summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5568f99)
raw | patch | inline | side by side (parent: 5568f99)
author | Jeff King <peff@peff.net> | |
Mon, 10 May 2010 08:55:04 +0000 (04:55 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Mon, 10 May 2010 10:57:06 +0000 (06:57 -0400) |
Originally, we use "git rev-list -1 --parents" to get the
list of parents, and therefore the 0th slot was the commit
in question, the 1st slot was the 1st parent, and so forth.
Commit 0a46941 switched this to use --pretty=format:%P, so
that the menu-selection code could be easily used (which
counts items starting from 0). However, we only use the menu
code in the case of multiple parents. For a single parent,
this introduced an off-by-one where we look just past the
parent we want.
This patch fixes it by explicitly selecting the 0th parent
for the single parent case.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
list of parents, and therefore the 0th slot was the commit
in question, the 1st slot was the 1st parent, and so forth.
Commit 0a46941 switched this to use --pretty=format:%P, so
that the menu-selection code could be easily used (which
counts items starting from 0). However, we only use the menu
code in the case of multiple parents. For a single parent,
this introduced an off-by-one where we look just past the
parent we want.
This patch fixes it by explicitly selecting the 0th parent
for the single parent case.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
tig.c | patch | blob | history |
index 074e4143184929aa1db735c009bb6554b8ecd812..60932d46482f8aca0468609f96f2fe47f2efa6ee 100644 (file)
--- a/tig.c
+++ b/tig.c
return FALSE;
}
- if (parents > 1 && !open_commit_parent_menu(buf, &parents))
+ if (parents == 1)
+ parents = 0;
+ else if (!open_commit_parent_menu(buf, &parents))
return FALSE;
string_copy_rev(rev, &buf[41 * parents]);