diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-01-17 23:49:26 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-01-17 23:49:26 +0100 |
commit | 7b0490f81c7c9ce5a93f92ddd3bf7cae78a073e8 (patch) | |
tree | 424eae02648adbfa1f82de83272c9eac27a77442 /builtin | |
parent | Merge branch 'js/mingw-isatty' into maint (diff) | |
parent | rev-parse: fix parent shorthands with --symbolic (diff) | |
download | git-7b0490f81c7c9ce5a93f92ddd3bf7cae78a073e8.tar.xz git-7b0490f81c7c9ce5a93f92ddd3bf7cae78a073e8.zip |
Merge branch 'jk/rev-parse-symbolic-parents-fix' into maint
"git rev-parse --symbolic" failed with a more recent notation like
"HEAD^-1" and "HEAD^!".
* jk/rev-parse-symbolic-parents-fix:
rev-parse: fix parent shorthands with --symbolic
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/rev-parse.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index cfb0f1510c..ff13e59e1d 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -342,11 +342,16 @@ static int try_parent_shorthands(const char *arg) for (parents = commit->parents, parent_number = 1; parents; parents = parents->next, parent_number++) { + char *name = NULL; + if (exclude_parent && parent_number != exclude_parent) continue; + if (symbolic) + name = xstrfmt("%s^%d", arg, parent_number); show_rev(include_parents ? NORMAL : REVERSED, - parents->item->object.oid.hash, arg); + parents->item->object.oid.hash, name); + free(name); } *dotdot = '^'; |