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) | ||
commit | a02d423ea80b29b368ee452585b49e5e15a38a4a | |
tree | f23602e90f4e459d1d7a710e9170b9115a7e0c49 | tree | snapshot |
parent | 5568f99e97b0f79c1c4367fa14f6319f8dde6826 | commit | diff |
fix off-by-one on parent selection
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>
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>
tig.c | diff | blob | history |