@@ -155,11 +155,13 @@ def query_remote(self, remote, refs=None):
155
155
for ref in refs :
156
156
yield None , ref , ref
157
157
return
158
- for sha , fullref in (l .split () for l in out .splitlines ()):
158
+ for sha , fullref in (line .split () for line in out .splitlines ()):
159
159
if fullref .startswith ('refs/heads/' ):
160
- yield 'branch' , fullref , sha
160
+ ref = fullref .split ("/" )[- 1 ]
161
+ yield 'branch' , ref , sha
161
162
elif fullref .startswith ('refs/tags/' ):
162
- yield 'tag' , fullref , sha
163
+ ref = fullref .split ("/" )[- 1 ]
164
+ yield 'tag' , ref , sha
163
165
elif fullref == 'HEAD' :
164
166
yield 'HEAD' , fullref , sha
165
167
else :
@@ -255,7 +257,7 @@ def init_repository(self, target_dir):
255
257
# repository
256
258
cmd += ('--filter=blob:none' ,)
257
259
# Try to clone target branch, if it exists
258
- rtype , _sha = self .query_remote_ref (repository , branch )
260
+ rtype , _ref , _sha = list ( self .query_remote (repository , branch ))[ 0 ]
259
261
if rtype in {'branch' , 'tag' }:
260
262
cmd += ('-b' , branch )
261
263
# Emtpy fetch options to use global default for 1st clone
@@ -342,7 +344,10 @@ def push(self):
342
344
"Cannot push %s, no target remote configured" % branch
343
345
)
344
346
logger .info ("Push %s to %s" , branch , remote )
345
- self .log_call (['git' , 'push' , '-f' , remote , "HEAD:%s" % branch ], cwd = self .cwd )
347
+ self .log_call (
348
+ ['git' , 'push' , '-f' , remote , "HEAD:%s" % branch ],
349
+ cwd = self .cwd
350
+ )
346
351
347
352
def _check_status (self ):
348
353
"""Check repo status and except if dirty."""
@@ -392,8 +397,7 @@ def _execute_shell_command_after(self):
392
397
self .log_call (cmd , shell = True , cwd = self .cwd )
393
398
394
399
def _merge (self , merge ):
395
- logger .info ("Merge %s, %s" , merge ["remote" ], merge ["ref" ])
396
- cmd = ("git" , "merge" )
400
+ cmd = ("git" , "merge" , "--ff" )
397
401
if self .git_version >= (1 , 7 , 10 ):
398
402
# --edit and --no-edit appear with Git 1.7.10
399
403
# see Documentation/RelNotes/1.7.10.txt of Git
0 commit comments