diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-01-17 14:49:26 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-01-17 14:49:26 -0800 |
commit | 7b0490f81c7c9ce5a93f92ddd3bf7cae78a073e8 (patch) | |
tree | 424eae02648adbfa1f82de83272c9eac27a77442 /builtin | |
parent | 0ab8606ebb2dc89f23a6e844ce1d284f693912f9 (diff) | |
parent | a2e7b04c443e63696d3c61bac0734486132eedbf (diff) | |
download | git-7b0490f81c7c9ce5a93f92ddd3bf7cae78a073e8.tar.gz |
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 = '^'; |