git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dennis Stosberg <dennis@stosberg.net>
To: Petr Baudis <pasky@suse.cz>
Cc: git@vger.kernel.org
Subject: [PATCH] cg-commit --review may permanently delete changes
Date: Fri, 28 Jul 2006 19:11:52 +0200	[thread overview]
Message-ID: <20060728171152.G3a9ef049@leonov.stosberg.net> (raw)

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

             reply	other threads:[~2006-07-28 17:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-28 17:11 Dennis Stosberg [this message]
2006-09-24 15:50 ` [PATCH] cg-commit --review may permanently delete changes Petr Baudis

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=20060728171152.G3a9ef049@leonov.stosberg.net \
    --to=dennis@stosberg.net \
    --cc=git@vger.kernel.org \
    --cc=pasky@suse.cz \
    /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).