2011/8/19 Junio C Hamano <gitster@xxxxxxxxx>: >> static unsigned char head_sha1[20]; >> +static struct commit *head_commit; > > I was not happy with the file-scope global head_sha1[] already, and this > makes me even less happy. Was it too much trouble to keep them local to > cmd_commit() and pass them around as arguments where necessary? If you > pass around head_commit, is_null_sha1(head_sha1) can be replaced with a > check !head_commit so we may even be able to lose the head_sha1[] global. > > And actually removing head_sha1[] is a necessary step from the correctness > point of view. The repository may have given an object name for a tag in > head_sha1[] and lookup_expect_commit() may have peeled it to a commit. > The code may want to add the "HEAD" as one of the parents of a new commit, > and head_sha1[] is no longer the place to pick that information up after > your fix. The code needs to look at head_commit->object.sha1[] instead. > Losing the use of head_sha1[] variable and forcing the code to go to > head_commit->object.sha1[] reduces the risk of such confusion. I actually wanted to get rid of head_sha1 but it made changes bigger. But the patch's become big already. Let me remove head_sha1[] (and head[] in merge.c) globally, then put this fix on top. -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html