* stash --patch splitting
@ 2011-02-19 0:49 Jeffrey Middleton
0 siblings, 0 replies; only message in thread
From: Jeffrey Middleton @ 2011-02-19 0:49 UTC (permalink / raw)
To: git
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-02-19 0:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-19 0:49 stash --patch splitting Jeffrey Middleton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).