Thread (1 message) 1 message, 1 author, 2018-03-16

Re: [PATCH v3 1/2] stash push: avoid printing errors

From: Junio C Hamano <hidden>
Date: 2018-03-16 21:31:18

Thomas Gummerer [off-list ref] writes:
quoted hunk
@@ -322,9 +322,12 @@ push_stash () {
 
 		if test $# != 0
 		then
-			git add -u -- "$@" |
-			git checkout-index -z --force --stdin
This obviously is not something this patch breaks, but I am finding
this pipeline that was already here quite puzzling.

The "add -u" is about adding the changes in paths that match the
pathspec to the index; the output from it is meant for human
consumption and certainly is not something "--stdin" should expect
to be understandable, let alone with "-z".

	... goes and digs ...

I think you mis-copied the suggestion in

    https://public-inbox.org/git/xmqqpo7byjwb.fsf@gitster.mtv.corp.google.com/

when you made bba067d2 ("stash: don't delete untracked files that
match pathspec", 2018-01-06), and nobody caught that breakage during
the review.
-			git diff-index -p --cached --binary HEAD -- "$@" | git apply --index -R
+			if git ls-files --error-unmatch -- "$@" >/dev/null 2>/dev/null
+			then
+				git add -u -- "$@" |
+				git checkout-index -z --force --stdin
And the same breakage is inherited here; just drop "|" and
downstream "checkout-index" and you should be OK.
+				git diff-index -p --cached --binary HEAD -- "$@" | git apply --index -R
And while at it, let's split this to two lines after "|".
+			fi
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help