diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-07-03 14:21:59 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-07-09 16:42:23 -0700 |
commit | 957d74062c1f0e92368aeda335e27d2d61f584f6 (patch) | |
tree | 7b5c5c54cfe2d06d741ec8fcd103f1a8eeddcb38 /builtin/rev-parse.c | |
parent | rev-parse: A and B in "rev-parse A..B" refer to committish (diff) | |
download | tgif-957d74062c1f0e92368aeda335e27d2d61f584f6.tar.xz |
rev-parse --disambiguate=<prefix>
The new option allows you to feed an ambiguous prefix and enumerate
all the objects that share it as a prefix of their object names.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/rev-parse.c')
-rw-r--r-- | builtin/rev-parse.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 16b98b5b90..d85b8a6a6d 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -195,6 +195,12 @@ static int anti_reference(const char *refname, const unsigned char *sha1, int fl return 0; } +static int show_abbrev(const unsigned char *sha1, void *cb_data) +{ + show_rev(NORMAL, sha1, NULL); + return 0; +} + static void show_datestring(const char *flag, const char *datestr) { static char buffer[100]; @@ -589,6 +595,10 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) for_each_ref(show_reference, NULL); continue; } + if (!prefixcmp(arg, "--disambiguate=")) { + for_each_abbrev(arg + 15, show_abbrev, NULL); + continue; + } if (!strcmp(arg, "--bisect")) { for_each_ref_in("refs/bisect/bad", show_reference, NULL); for_each_ref_in("refs/bisect/good", anti_reference, NULL); |