@matheusbsbs / matheus-bagliano / commits / 89d750bf6f
Fork 0

Avoid invoking diff drivers during git-stash

git-stash needs to restrict itself to plumbing when running automated diffs as part of its operation as the user may have configured a custom diff driver that opens an interactive UI for certain/all files. Doing that during scripted actions is very unfriendly to the end-user and may cause git-stash to fail to work. Reported by Johannes Sixt Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Oct 18, 2007 at 21:28 UTC 89d750bf6fa025edeb31ad258cdd09a27a5c02fa
1 file changed +3 -3
git-stash.sh
+3 -3
@@ -110,7 +110,7 @@ show_stash () {
110
111 w_commit=$(git rev-parse --verify "$s") &&
112 b_commit=$(git rev-parse --verify "$s^") &&
113 - git diff $flags $b_commit $w_commit
113 + git diff-tree $flags $b_commit $w_commit
114 }
115
116 apply_stash () {
@@ -139,7 +139,7 @@ apply_stash () {
139 unstashed_index_tree=
140 if test -n "$unstash_index" && test "$b_tree" != "$i_tree"
141 then
142 - git diff --binary $s^2^..$s^2 | git apply --cached
142 + git diff-tree --binary $s^2^..$s^2 | git apply --cached
143 test $? -ne 0 &&
144 die 'Conflicts in index. Try without --index.'
145 unstashed_index_tree=$(git-write-tree) ||
@@ -162,7 +162,7 @@ apply_stash () {
162 git read-tree "$unstashed_index_tree"
163 else
164 a="$TMP-added" &&
165 - git diff --cached --name-only --diff-filter=A $c_tree >"$a" &&
165 + git diff-index --cached --name-only --diff-filter=A $c_tree >"$a" &&
166 git read-tree --reset $c_tree &&
167 git update-index --add --stdin <"$a" ||
168 die "Cannot unstage modified files"