2

I am trying to git bisect some bad behavior in a public repo.

The repo has:

  • some commits with CRLF (I am on MacOS, so expecting LF)
  • a .gitattributes file in its root, normalizing .c, .h, and .java files

As I understand it, none of the present .git/config or ~/.gitconfig should matter, as .gitattributes has precedence.

My problem relates to this: when I do a checkout of a commit with CRLF, the local files are modified with LF. These files show up as modified upon git status. Then if I try to check out another commit, git refuses in order to protect my local changes. Fine.

In the checkout case, I can force it with -f, and go on.

The problem is that I cannot seem to force git bisect skip. If I try, git tells me to stash changes. I cannot get clean working files (stashing leaves me with modified newlines anyway), and I cannot skip.

I've tried copying over a temporary .gitattributes in order to make bisect leave the newlines unchanged, but then it complains about the changes in .gitattributes being unsaved.

Is there a way to force bisect?

Gauthier
  • 40,309
  • 11
  • 63
  • 97
  • Ugh. I'd try the temporary `.gitattributes` file plus setting `git update-index --skip-worktree` on it, and hope there are no changes to `.gitattributes` in any of the bisect-range commits. Failing that, keep a temporary `.gitattributes` you can swap in and out, swap it out to go to the next bisect, swap it back in and `git checkout -f` to update, etc. – torek Apr 05 '17 at 09:12

1 Answers1

0

none of the present .git/config or ~/.gitconfig should matter, as .gitattributes has precedence

not really, the local file for gitattributes is .git/info/attributes, and it has precedence over whatever .gitattributes file in repository

max630
  • 8,762
  • 3
  • 30
  • 55