* [PATCH] cg-commit --review may permanently delete changes
@ 2006-07-28 17:11 Dennis Stosberg
2006-09-24 15:50 ` Petr Baudis
0 siblings, 1 reply; 2+ messages in thread
From: Dennis Stosberg @ 2006-07-28 17:11 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
If the patch is changed in the editor in such a way that cg-patch
can not apply it, all changes made since the last commit are
irrecoverably lost, which is _really_ bad.
This patch lets cg-commit reapply the old patch and keep the edited
patch for manual fix-up.
Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---
cg-commit | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/cg-commit b/cg-commit
index 0cec58f..9604ad7 100755
--- a/cg-commit
+++ b/cg-commit
@@ -524,8 +524,11 @@ if [ "$review" ]; then
fi
echo "Applying the edited patch..."
if ! cg-patch < "$PATCH2"; then
- rm "$PATCH" "$PATCH2" "$LOGMSG"
- die "unable to apply the edited patch"
+ echo "The edited patch does not apply. Reapplying old patch."
+ cg-patch <"$PATCH" >/dev/null
+ edited_patch="$(mktemp -t edited-patch.XXXXXX)"
+ mv "$PATCH2" "$edited_patch"
+ die "You can find the edited patch in \"$edited_patch\" for manual review."
fi
fi
fi
--
1.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cg-commit --review may permanently delete changes
2006-07-28 17:11 [PATCH] cg-commit --review may permanently delete changes Dennis Stosberg
@ 2006-09-24 15:50 ` Petr Baudis
0 siblings, 0 replies; 2+ messages in thread
From: Petr Baudis @ 2006-09-24 15:50 UTC (permalink / raw)
To: Dennis Stosberg; +Cc: git
Dear diary, on Fri, Jul 28, 2006 at 07:11:52PM CEST, I got a letter
where Dennis Stosberg <dennis@stosberg.net> said that...
> If the patch is changed in the editor in such a way that cg-patch
> can not apply it, all changes made since the last commit are
> irrecoverably lost, which is _really_ bad.
>
> This patch lets cg-commit reapply the old patch and keep the edited
> patch for manual fix-up.
>
> Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Hmm, good catch. Unfortunately, we can't safely patch the original patch
over that either, since bits of the edited patch _might_ got applied.
As the first step, I've prevented Cogito from deleting any of the
temporary files and now it instead reports their name to the user and
lets him fix up the situation.
As the second stage, we should restore the original state of the tree. I
will do it when I get to it, patches welcome. :-)
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-09-24 15:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-28 17:11 [PATCH] cg-commit --review may permanently delete changes Dennis Stosberg
2006-09-24 15:50 ` Petr Baudis
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).