summaryrefslogtreecommitdiff
path: root/builtin/rev-parse.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-12-16 23:27:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-12-16 23:27:47 (GMT)
commit598119d3cdd59b750bd33da639cf2cc6a6675199 (patch)
tree523125041b4927bb1ddc2be11d9c997fbeff5bac /builtin/rev-parse.c
parentde2efebf7ce2b308ea77d8b06f971e935238cd2f (diff)
parenta2e7b04c443e63696d3c61bac0734486132eedbf (diff)
downloadgit-598119d3cdd59b750bd33da639cf2cc6a6675199.zip
git-598119d3cdd59b750bd33da639cf2cc6a6675199.tar.gz
git-598119d3cdd59b750bd33da639cf2cc6a6675199.tar.bz2
Merge branch 'jk/rev-parse-symbolic-parents-fix'
"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/rev-parse.c')
-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 = '^';