This commit refreshes a pushed patch even if there was a conflict (in
which case only the correctly merged files are merged). The refresh
after fixing the conflict would log the conflict files in the patch
history.
The patch also updates the index in the case of the interactive merge.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
__conflict(path)
return 1
# successful interactive merge
+ os.system('git-update-index -- %s' % path)
__remove_files(orig_hash, file1_hash, file2_hash)
return 0
else:
log = 'push'
self.refresh_patch(cache_update = False, log = log)
else:
+ # we store the correctly merged files only for
+ # tracking the conflict history. Note that the
+ # git.merge() operations shouls always leave the index
+ # in a valid state (i.e. only stage 0 files)
+ self.refresh_patch(cache_update = False, log = 'push(c)')
raise StackException, str(ex)
return modified
'
test_expect_success \
+ 'Check the "push(c)" log' \
+ '
+ echo bar > test && stg refresh &&
+ stg pop &&
+ echo foo > test && stg refresh &&
+ ! stg push &&
+ stg log | grep -q -e "^push(c) "
+ '
+
+test_expect_success \
'Check the push "undo" log' \
'
+ stg status --reset &&
stg push --undo &&
stg log bar | grep -q -e "^undo "
'