summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-01-17 22:49:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-01-17 22:49:26 (GMT)
commit7b0490f81c7c9ce5a93f92ddd3bf7cae78a073e8 (patch)
tree424eae02648adbfa1f82de83272c9eac27a77442 /builtin
parent0ab8606ebb2dc89f23a6e844ce1d284f693912f9 (diff)
parenta2e7b04c443e63696d3c61bac0734486132eedbf (diff)
downloadgit-7b0490f81c7c9ce5a93f92ddd3bf7cae78a073e8.zip
git-7b0490f81c7c9ce5a93f92ddd3bf7cae78a073e8.tar.gz
git-7b0490f81c7c9ce5a93f92ddd3bf7cae78a073e8.tar.bz2
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.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index cfb0f15..ff13e59 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 = '^';