Merge branch 'cb/maint-stash-orphaned-file'
authorJunio C Hamano <gitster@pobox.com>
Fri, 21 May 2010 11:02:23 +0000 (04:02 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 May 2010 11:02:23 +0000 (04:02 -0700)
* cb/maint-stash-orphaned-file:
stash tests: stash can lose data in a file removed from the index
stash: Don't overwrite files that have gone from the index

1  2 
git-stash.sh
diff --combined git-stash.sh
index 908aab2659ca5d66d8091e474c484dd8d9b88c0c,0f858d334c756f9cd4028b4950a3912d0f6182dd..1d95447d03f342811dd77386f2e83d0814beabf2
@@@ -57,7 -57,7 +57,7 @@@ create_stash () 
        # state of the base commit
        if b_commit=$(git rev-parse --verify HEAD)
        then
 -              head=$(git log --no-color --abbrev-commit --pretty=oneline -n 1 HEAD --)
 +              head=$(git rev-list --oneline -n 1 HEAD --)
        else
                die "You do not have the initial commit yet"
        fi
@@@ -86,7 -86,7 +86,7 @@@
                        GIT_INDEX_FILE="$TMP-index" &&
                        export GIT_INDEX_FILE &&
                        git read-tree -m $i_tree &&
-                       git add -u &&
+                       git diff --name-only -z HEAD | git update-index -z --add --remove --stdin &&
                        git write-tree &&
                        rm -f "$TMP-index"
                ) ) ||