Commit 1361d5cf authored by David Fifield's avatar David Fifield
Browse files

Update the index in preparation for applying patches.

Using "git am" to apply a patch was failing randomly using git version
1.7.0.4 on the lucid i386 and amd64 images. The error message was:

ubuntu@ubuntu:~/build/tor$ git am ~/build/0001-Set-CREATE_NO_WINDOW-in-tor_spawn_background.patch
Applying: Set CREATE_NO_WINDOW in tor_spawn_background.
error: src/common/util.c: does not match index
Patch failed at 0001 Set CREATE_NO_WINDOW in tor_spawn_background.
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".

I could log in and run the command manually; it would fail perhaps 10%
of the time. The rest of the time it would work as expected. What I mean
is that I could set the working tree to the tag tor-0.2.4.18-rc using
either of
	git checkout tor-0.2.4.18-rc
	git reset --hard tor-0.2.4.18-rc
try running the "git am" command, and sometimes it would work, sometimes
not. I would reset the state of the tree and again, sometimes it would
work, and sometimes not. I checked many times using "git status" and
"git ls-files -s" to see that there were no changes and nothing staged
in the working tree.

I believe the cause of the error is the bug fixed by this commit:
"am: refresh the index at start and --resolved"
https://github.com/git/git/commit/2a6f08ac1f6949ed0072aed3240bc04d80051851
It doesn't seem to have made it into the release notes, but according to
the history it first appeared in 1.7.6.1.

See also the email thread leading to the commit:
http://git.661346.n2.nabble.com/quot-git-apply-check-quot-successes-but-git-am-says-quot-does-not-match-index-quot-td6684646.html

I never got this error with "git am" for the windows build on the
precise i386 VM, which has git version 1.7.9.5, which fits with the
problem being a git bug that has since been fixed.
parent faa70d80
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ script: |
  chmod 700 $INSTDIR/Tor/*so*
  #
  cd tor
  git update-index --refresh -q
  mkdir -p $OUTDIR/src
  #git archive HEAD | tar -x -C $OUTDIR/src
  ./autogen.sh
+1 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ script: |
  cd ..
  #
  cd tor
  git update-index --refresh -q
  mkdir -p $OUTDIR/src
  git archive HEAD | tar -x -C $OUTDIR/src
  ./autogen.sh
+1 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ script: |
  cd ..
  #
  cd tor
  git update-index --refresh -q
  mkdir -p $OUTDIR/src
  git archive HEAD | tar -x -C $OUTDIR/src
  ./autogen.sh