summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <Johannes.Schindelin@gmx.de>2007-02-09 01:28:23 +0100
committerLibravatar Junio C Hamano <junkio@cox.net>2007-02-08 17:48:22 -0800
commiteb3a48221fd4a0b38c31976028dbab7df51be6d4 (patch)
tree054ee03e6d638c4fdd9f2d5ac9ed5f29bbcf2e54
parentformat-patch -n: make sorting easier by padding number (diff)
downloadtgif-eb3a48221fd4a0b38c31976028dbab7df51be6d4.tar.xz
log --reflog: use dwim_log
Since "git log origin/master" uses dwim_log() to match "refs/remotes/origin/master", it makes sense to do that for "git log --reflog", too. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--cache.h1
-rw-r--r--reflog-walk.c13
-rw-r--r--sha1_name.c2
3 files changed, 15 insertions, 1 deletions
diff --git a/cache.h b/cache.h
index 87142571b3..c62b0b090d 100644
--- a/cache.h
+++ b/cache.h
@@ -302,6 +302,7 @@ extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */
extern int read_ref(const char *filename, unsigned char *sha1);
extern const char *resolve_ref(const char *path, unsigned char *sha1, int, int *);
extern int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref);
+extern int dwim_log(const char *str, int len, unsigned char *sha1, char **ref);
extern int create_symref(const char *ref, const char *refs_heads_master, const char *logmsg);
extern int validate_headref(const char *ref);
diff --git a/reflog-walk.c b/reflog-walk.c
index afe1577d76..c983858259 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -174,6 +174,19 @@ void add_reflog_for_walk(struct reflog_walk_info *info,
branch = xstrdup(head);
}
reflogs = read_complete_reflog(branch);
+ if (!reflogs || reflogs->nr == 0) {
+ unsigned char sha1[20];
+ char *b;
+ if (dwim_log(branch, strlen(branch), sha1, &b) == 1) {
+ if (reflogs) {
+ free(reflogs->ref);
+ free(reflogs);
+ }
+ free(branch);
+ branch = b;
+ reflogs = read_complete_reflog(branch);
+ }
+ }
if (!reflogs || reflogs->nr == 0)
die("No reflogs found for '%s'", branch);
path_list_insert(branch, &info->complete_reflogs)->util
diff --git a/sha1_name.c b/sha1_name.c
index d77f77097f..f79a7c9fb8 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -267,7 +267,7 @@ int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref)
return refs_found;
}
-static int dwim_log(const char *str, int len, unsigned char *sha1, char **log)
+int dwim_log(const char *str, int len, unsigned char *sha1, char **log)
{
const char **p;
int logs_found = 0;