Re: git bug(?) for commit baf18fc261ca475343fe3cb9cd2c0dded4bc1bb7
From: Tony Wang <hidden>
Date: 2016-06-15 22:52:24
On Monday, November 7, 2011 at 17:30, Nguyen Thai Ngoc Duy wrote:
Hi, On Mon, Nov 7, 2011 at 3:59 PM, Tony Wang <wwwjfy@gmail.com (mailto:wwwjfy@gmail.com)> wrote:quoted
Hi, I don't know if a better way to report this, so I write to the author of the commit. Please let me know if I do wrong. :)It's good that you bisect to the broken commit and send me. However you should always send to git@vger just in case I'm unavailable.
Roger.
quoted
The thing is the commit baf18fc261ca475343fe3cb9cd2c0dded4bc1bb7 made an option broken sometimes (it's weird, but it's true that it didn't happen every time) I set "branch.master.mergeoptions=--squash" in config, but when I do "git merge b", the squash didn't work, however, "git merge b --squash" works as expected.What was the expection? --squash was not effective or something else?
Yes, it just merged like without "--squash"
quoted
I tried to debug, and found after this merge.c:1104 head_commit = lookup_commit_or_die(head_sha1, "HEAD"); the variable branch becomes "s/origin/b", which is previously "b". I used git bisect and found the commit baf18fc261ca475343fe3cb9cd2c0dded4bc1bb7 caused this.Variable "head_sha1"? Strange because lookup_commit_or_die() takes "const char *" and the compiler should catch any attempts to change the variable.
No, variable "branch". It's declared as "static const char *branch;" in builtin/merge.c
If you can reproduce it, can you make a small test case to demonstrate it? I'm not sure what "b" is and how you set up configuration for branch master. BTW what git version did you use?
I'll try it. Sorry, "b" is a random branch name, I should use a meaningful one. I set by "git config branch.master.mergeoptions --squash" I tried 1.7.7.2 and master of github.com/gitster/git.git (http://github.com/gitster/git.git).
quoted
I browsed the diff, and found the function lookup_commit_or_die uses lookup_commit_reference, but not lookup_commit which was used before lookup_commit_or_die replaced it. Was it on purpose or typo?It was on purpose. HEAD may contain a tag, in which case lookup_commit() would to return a commit fail while lookup_commit_reference() can peel the tag to the commit.
However, I tried to make it lookup_commit and it worked as expected. I'll try to read some detail.
quoted
If possible, it'll be good that I can know some details. Thanks!-- Duy
-- BR, Tony Wang