stash --patch splitting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



git stash --patch doesn't appear to play nice with splitting hunks:

	mkdir stash-p &&
	cd stash-p &&
	git init &&
	seq 1 3 > a &&
	git add a &&
	git commit -m "add a" &&
	sed -i 's/[13]/&&/' a &&
	(echo s; echo y; echo n) | git stash -p

That's a file with three lines, a modification to lines 1 and 3, then
an attempt to partially stash, splitting and stashing the modification
to line 1 but not line 3. It looks like the patch generated to roll
back the selected changes is faulty somehow:

	Saved working directory and index state WIP on master: 7cb76e1 add a
	error: patch failed: a:1
	error: a: patch does not apply
	Cannot remove worktree changes

The patch that git-stash attempts to reverse-apply looks sort of reasonable:

	diff --git a/a b/a
	index 01e79c3..88483cf 100644
	--- a/a
	+++ b/a
	@@ -1,3 +1,3 @@
	-1
	+11
	 2
	 3

but it doesn't apply, since the third line is now different in the
work tree. The patch I'd really expect to see would have "33" on the
third line. I've been staring at all the temporary index files
(git-stash.sh:105 and on) and the stash mode in
git-add--interactive.perl and trying to figure out where it goes
wrong, but I don't think I'm going to get it right now. Maybe one of
y'all will immediately see it?


Thanks,
Jeffrey
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]