From: Jeffrey Middleton <jefromi@gmail.com>
To: git@vger.kernel.org
Subject: stash --patch splitting
Date: Fri, 18 Feb 2011 18:49:20 -0600 [thread overview]
Message-ID: <AANLkTimcUi0jKK2AWsw7MHNdHFWbKFSjBixeM0pU74+a@mail.gmail.com> (raw)
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
reply other threads:[~2011-02-19 0:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTimcUi0jKK2AWsw7MHNdHFWbKFSjBixeM0pU74+a@mail.gmail.com \
--to=jefromi@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).