summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 53b3c47)
raw | patch | inline | side by side (parent: 53b3c47)
author | Charles Bailey <charles@hashpling.org> | |
Sun, 18 Apr 2010 18:28:05 +0000 (19:28 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 18 Apr 2010 22:00:03 +0000 (15:00 -0700) |
The use of git add -u in create_stash isn't always complete. In
particular, if a file has been removed from the index but changed in the
work tree it will not be added to the stash's saved work tree tree
object. When stash then resets the work tree to match HEAD, any changes
will be lost.
To be complete, any work tree file which differs from HEAD needs to be
saved, regardless of whether it still appears in the index or not.
This is achieved with a combination of a diff against HEAD and a call to
update-index with an explicit list of paths that have changed.
Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
particular, if a file has been removed from the index but changed in the
work tree it will not be added to the stash's saved work tree tree
object. When stash then resets the work tree to match HEAD, any changes
will be lost.
To be complete, any work tree file which differs from HEAD needs to be
saved, regardless of whether it still appears in the index or not.
This is achieved with a combination of a diff against HEAD and a call to
update-index with an explicit list of paths that have changed.
Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-stash.sh | patch | blob | history |
diff --git a/git-stash.sh b/git-stash.sh
index 59db3dc38e72fda88d521171a174c08b919677a9..0f858d334c756f9cd4028b4950a3912d0f6182dd 100755 (executable)
--- a/git-stash.sh
+++ b/git-stash.sh
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"
) ) ||