mirror of
https://github.com/danog/gift.git
synced 2024-11-26 20:04:47 +01:00
Repo#sync restructured to make sure a 'stash pop' is never attempted if there was nothing to stash in the first place
This commit is contained in:
parent
334417ea34
commit
f9abf4b277
@ -270,12 +270,17 @@ module.exports = class Repo
|
||||
sync: (remote_name, branch, callback) ->
|
||||
[remote_name, callback, branch] = ['origin', branch, remote_name] if !callback
|
||||
[remote_name, callback, branch] = ['origin', remote_name, []] if !branch
|
||||
@git "stash", {}, ["save"], (err) =>
|
||||
@status (err, status) =>
|
||||
return callback err if err
|
||||
@git "pull", {}, [remote_name, branch], (err) =>
|
||||
@git "stash", {}, ["save"], (err) =>
|
||||
return callback err if err
|
||||
@git "push", {}, [remote_name, branch], (err) =>
|
||||
@git "pull", {}, [remote_name, branch], (err) =>
|
||||
return callback err if err
|
||||
@git "stash", {}, "pop", (err) =>
|
||||
@git "push", {}, [remote_name, branch], (err) =>
|
||||
return callback err if err
|
||||
return callback null
|
||||
if not status?.clean
|
||||
@git "stash", {}, ["pop"], (err) =>
|
||||
return callback err if err
|
||||
return callback null
|
||||
else
|
||||
return callback null
|
||||
|
Loading…
Reference in New Issue
Block a user