Skip to content

Commit 3c4bea4

Browse files
author
Evan Phoenix
committed
Fix bug in checking the status of 'git checkout'
1 parent d3e79eb commit 3c4bea4

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

git-update.rb

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ def sh(cmd)
261261
Grit.log cmd if Grit.debug
262262
out = `#{cmd}`
263263
Grit.log out if Grit.debug
264+
return out
264265
end
265266

266267
def port_changes
@@ -283,7 +284,8 @@ def port_changes
283284
@to_replay = @repo.revs_between(@common, @current)
284285

285286
# Ok, try again.
286-
error = @repo.git.checkout({:q => true}, @origin)
287+
# Use sh, since the git proxy seems to fuck up $?
288+
error = sh "git checkout -q #{@origin} 2>&1"
287289
if $?.exitstatus != 0
288290
# Ok, give up.
289291
recover
@@ -292,11 +294,27 @@ def port_changes
292294
puts "ERROR: Sorry, 'git checkout' can't figure out how to properly switch"
293295
puts "the working copy. Please fix this and run 'git update' again."
294296
puts "Here is the error that 'git checkout' reported:"
297+
puts
295298
puts error
299+
puts
296300
exit 1
297301
end
298302
else
299-
@repo.git.checkout({:q => true}, @origin)
303+
error = sh "git checkout -q #{@origin} 2>&1"
304+
305+
if $?.exitstatus != 0
306+
# Ok, give up.
307+
recover
308+
309+
# Now tell the user what happened.
310+
puts "ERROR: Sorry, 'git checkout' can't figure out how to properly switch"
311+
puts "the working copy. Please fix this and run 'git update' again."
312+
puts "Here is the error that 'git checkout' reported:"
313+
puts
314+
puts error
315+
puts
316+
exit 1
317+
end
300318
end
301319

302320
sh "git format-patch --full-index --stdout #{@common}..#{@current} > .git/update-patch"

0 commit comments

Comments
 (0)