On Mon, May 10, 2010 at 04:55, Jeff King wrote: > This patch fixes it by explicitly selecting the 0th parent > for the single parent case. > [...] > This is an old bug, but I finally got a chance to track it down. Thanks for fixing it. > There is a related buglet elsewhere in select_commit_parent. Now that we > ask git to print only the parents, we will get no output at all for a > parent-less commit. This will cause iobuf_read to return an error, and > we will print "Failed to get parent information" instead of "The > selected commit has no parents" (or "Path '%s' does not exist" if we are > blaming the parent of a commit that introduced a file). > > AFAICT, fixing it would mean improving iobuf_read to differentiate "no > output" from "there were errors". I'll leave that sort of infrastructure > refactoring to you if you want to do it. The resulting bug is quite > minor. The spaced damaged patch below fixes the first error. --- >8 --- >8 --- >8 --- diff --git a/tig.c b/tig.c index 35b0cfa..f5bb1b9 100644 --- a/tig.c +++ b/tig.c @@ -1028,7 +1028,7 @@ io_read_buf(struct io *io, char buf[], size_t bufsize) string_ncopy_do(buf, bufsize, result, strlen(result)); } - return io_done(io) && result; + return io_done(io) && !io_error(io); } static bool --- 8< --- 8< --- 8< --- However, it seems that the output of the command that was previously used for fetching parents and the current one pretty printing using the %P flag is also the cause of the breakage. In the tig repository, trying to "blame" the parent of b801d8b2b shows reproduces the problem. Commit b801d8b2b replaced cgit.c with tig.c, which means there is no parent blame to show. Before: > git rev-list -1 --parents b801d8b2b -- tig.c b801d8b2bc1a6aac6b9744f21f7a10a51e16c53e .. i.e no parents as expected. Now: > git log --no-color -1 --pretty=format:%P b801d8b2b -- tig.c a7bc4b1447f974fbbe400c3657d9ec3d0fda133e .. i.e. the parent of b801d8b2b, but where tig.c does not exist. The attached patch addresses this problem by reverting back to the command used before. A related question is why the hell I chose to switch to using %P in commit 0a4694191613f887151a52f0c70e6b6181ea5fb6 ... -- Jonas Fonseca