From 02ede67ad45973f9f8d07db7896a537de97d21b6 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 5 Jun 2005 20:02:31 -0700 Subject: git-read-tree: be a lot more careful about merging dirty trees We don't want to overwrite state that we haven't committed yet when merging, so it's better to make git-read-tree fail than end up with a merge tree that ends up not having the dirty changes. Update git-resolve-script to fail cleanly when git-read-tree fails. --- git-resolve-script | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'git-resolve-script') diff --git a/git-resolve-script b/git-resolve-script index b7ccc20114..4fc7a6dce3 100644 --- a/git-resolve-script +++ b/git-resolve-script @@ -39,13 +39,14 @@ if [ "$common" == "$head" ]; then echo "Destroying all noncommitted data!" echo "Kill me within 3 seconds.." sleep 3 - git-read-tree -m $merge && git-checkout-cache -f -u -a + git-read-tree -m $merge || exit 1 + git-checkout-cache -f -u -a echo $merge > "$GIT_DIR"/HEAD git-diff-tree -p ORIG_HEAD HEAD | git-apply --stat exit 0 fi echo "Trying to merge $merge into $head" -git-read-tree -m $common $head $merge +git-read-tree -m $common $head $merge || exit 1 merge_msg="Merge of $merge_repo" result_tree=$(git-write-tree 2> /dev/null) if [ $? -ne 0 ]; then -- cgit v1.2.3