@@ -343,7 +343,7 @@ def checkout(self):
343
343
fork (['git' , 'init' ])
344
344
fork (['git' , 'remote' , 'add' , 'origin' , self .url .geturl ()])
345
345
fork (['git' , 'fetch' , '--depth' , '1' , 'origin' , self .noremote_ref ()])
346
- fork (['git' , 'checkout' , self .ref , '--' ])
346
+ fork (['git' , '-c' , 'advice.detachedHead=false' , ' checkout' , self .ref , '--' ])
347
347
else :
348
348
# Regular case
349
349
extra_opts = []
@@ -361,7 +361,7 @@ def checkout(self):
361
361
# Find out a sensible local branch name (needed for origin/HEAD)
362
362
local_branch = self .symbolic_full_name (self .ref ).split ('/origin/' , 1 )[1 ]
363
363
opts = [ local_branch ]
364
- fork (['git' , 'checkout' ] + opts + ['--' ])
364
+ fork (['git' , '-c' , 'advice.detachedHead=false' , ' checkout' ] + opts + ['--' ])
365
365
366
366
def update (self , clean = False , fix_remotes = False ):
367
367
def actualUpdate ():
@@ -405,12 +405,12 @@ def actualUpdate():
405
405
try :
406
406
# Try to check it out; in the common case (nothing
407
407
# changed) this should be a no-op
408
- fork (['git' , 'checkout' , remote_commit , '--' ])
408
+ fork (['git' , '-c' , 'advice.detachedHead=false' , ' checkout' , remote_commit , '--' ])
409
409
except CalledProcessError :
410
410
# Probably we don't have the commit; fetch it
411
411
fork (['git' , 'fetch' , '--depth' , '1' , 'origin' , remote_commit ])
412
412
# Try again
413
- fork (['git' , 'checkout' , remote_commit , '--' ])
413
+ fork (['git' , '-c' , 'advice.detachedHead=false' , ' checkout' , remote_commit , '--' ])
414
414
else :
415
415
fork (['git' , 'fetch' ])
416
416
# If we want to go on a branch, try to find a local branch that tracks it
@@ -431,7 +431,7 @@ def actualUpdate():
431
431
if remote_fullref == local_fulltrackref :
432
432
try :
433
433
# Checkout and fast-forward
434
- fork (['git' , 'checkout' , local_ref , '--' ])
434
+ fork (['git' , '-c' , 'advice.detachedHead=false' , ' checkout' , local_ref , '--' ])
435
435
fork (['git' , 'merge' , '--ff-only' , self .ref , '--' ])
436
436
# Final sanity check
437
437
if log_check_output (['git' , 'rev-parse' , self .ref , '--' ]) != log_check_output (['git' , 'rev-parse' , local_ref , '--' ]):
@@ -440,7 +440,7 @@ def actualUpdate():
440
440
except CalledProcessError :
441
441
logger .warning ("Couldn't fast-forward local branch, fallback to detached head mode..." )
442
442
# General case: plain checkout of the origin ref (going in detached HEAD)
443
- fork (['git' , 'checkout' , self .ref , '--' ])
443
+ fork (['git' , '-c' , 'advice.detachedHead=false' , ' checkout' , self .ref , '--' ])
444
444
445
445
if not exists (self .directory ):
446
446
self .checkout ()
0 commit comments