From: Junio C Hamano <gitster@pobox.com>
To: Wincent Colaiuta <win@wincent.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Johannes Sixt <j.sixt@viscovery.net>,
Benoit Sigoure <tsuna@lrde.epita.fr>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: Rebase/cherry-picking idea
Date: Wed, 28 Nov 2007 00:06:41 -0800 [thread overview]
Message-ID: <7vir3m94ku.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <97F6E8DE-4022-4458-B6A9-C644A6EDC1E3@wincent.com> (Wincent Colaiuta's message of "Mon, 26 Nov 2007 14:55:56 +0100")
> Once I get a clear idea of what kind of change is likely to actually
> get accepted I'll submit a proper patch.
Too often, people disappear with a patch that is basically good but has
room for improvements this way. I really do not have time nor bandwidth
to keep bugging them for updates, and often end up cleaning up on my own
instead.
This is such a patch, and without acks or comments, it is also very
likely to be lost.
-- >8 --
revert/cherry-pick: Allow overriding the help text by the calling Porcelain
A Porcelain command that uses cherry-pick or revert may make a commit
out of resolved index itself, in which case telling the user to commit
the result is not appropriate at all. This allows GIT_CHERRY_PICK_HELP
environment variable to be set by the calling Porcelain in order to
override the built-in help text.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* I suspect that "git rebase --continue" can do "git add -u" itself,
just like recent "git rebase --skip" would do "git reset --hard".
The overriding help text in this patch can lose its second line that
tells the user to use "git add <paths>" if we decide to do so.
builtin-revert.c | 33 +++++++++++++++++++++++----------
git-rebase--interactive.sh | 5 +++++
2 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/builtin-revert.c b/builtin-revert.c
index a0586f9..4f86178 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -224,6 +224,27 @@ static int merge_recursive(const char *base_sha1,
return run_command_v_opt(argv, RUN_COMMAND_NO_STDIN | RUN_GIT_CMD);
}
+static char *help_msg(const unsigned char *sha1)
+{
+ static char helpbuf[1024];
+ char *msg = getenv("GIT_CHERRY_PICK_HELP");
+
+ if (msg)
+ return msg;
+
+ strcpy(helpbuf, " After resolving the conflicts,\n"
+ "mark the corrected paths with 'git add <paths>' "
+ "and commit the result.");
+
+ if (action == CHERRY_PICK) {
+ sprintf(helpbuf + strlen(helpbuf),
+ "\nWhen commiting, use the option "
+ "'-c %s' to retain authorship and message.",
+ find_unique_abbrev(sha1, DEFAULT_ABBREV));
+ }
+ return helpbuf;
+}
+
static int revert_or_cherry_pick(int argc, const char **argv)
{
unsigned char head[20];
@@ -352,16 +373,8 @@ static int revert_or_cherry_pick(int argc, const char **argv)
}
if (close(msg_fd) || commit_lock_file(&msg_file) < 0)
die ("Error wrapping up %s", defmsg);
- fprintf(stderr, "Automatic %s failed. "
- "After resolving the conflicts,\n"
- "mark the corrected paths with 'git add <paths>' "
- "and commit the result.\n", me);
- if (action == CHERRY_PICK) {
- fprintf(stderr, "When commiting, use the option "
- "'-c %s' to retain authorship and message.\n",
- find_unique_abbrev(commit->object.sha1,
- DEFAULT_ABBREV));
- }
+ fprintf(stderr, "Automatic %s failed.%s\n",
+ me, help_msg(commit->object.sha1));
exit(1);
}
if (close(msg_fd) || commit_lock_file(&msg_file) < 0)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index bf44b6a..33a5d4b 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -30,6 +30,11 @@ test -d "$REWRITTEN" && PRESERVE_MERGES=t
test -f "$DOTEST"/strategy && STRATEGY="$(cat "$DOTEST"/strategy)"
test -f "$DOTEST"/verbose && VERBOSE=t
+GIT_CHERRY_PICK_HELP=" After resolving the conflicts,
+mark the corrected paths with 'git add <paths>', and
+run 'git rebase --continue'"
+export GIT_CHERRY_PICK_HELP
+
warn () {
echo "$*" >&2
}
next prev parent reply other threads:[~2007-11-28 11:17 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-26 9:02 Rebase/cherry-picking idea Wincent Colaiuta
2007-11-26 9:32 ` Benoit Sigoure
2007-11-26 11:27 ` Wincent Colaiuta
2007-11-26 12:34 ` Wincent Colaiuta
2007-11-26 12:39 ` Benoit Sigoure
2007-11-26 12:51 ` Johannes Sixt
2007-11-26 13:15 ` Wincent Colaiuta
2007-11-26 13:41 ` Johannes Schindelin
2007-11-26 13:55 ` Wincent Colaiuta
2007-11-28 8:06 ` Junio C Hamano [this message]
2007-11-28 8:52 ` Wincent Colaiuta
2007-11-28 9:47 ` Junio C Hamano
2007-11-28 10:04 ` Wincent Colaiuta
2007-11-28 13:57 ` [PATCH] Replace instances of export VAR=VAL with VAR=VAL; export VAR Johannes Schindelin
2007-11-28 14:09 ` David Kastrup
2007-11-28 14:19 ` Nguyen Thai Ngoc Duy
2007-11-28 14:24 ` David Kastrup
2007-11-28 14:27 ` Nguyen Thai Ngoc Duy
2007-11-28 14:36 ` Johannes Schindelin
2007-11-28 14:27 ` Johannes Schindelin
2007-11-28 14:21 ` Johannes Sixt
2007-11-28 14:29 ` Johannes Schindelin
2007-11-28 14:39 ` Johannes Sixt
2007-11-28 15:56 ` [PATCH v2] " Johannes Schindelin
2007-11-28 16:03 ` David Kastrup
2007-11-28 22:46 ` Junio C Hamano
2007-11-28 22:53 ` David Kastrup
2007-11-28 23:02 ` Jeff King
2007-11-28 23:10 ` David Kastrup
2007-11-29 7:39 ` Johannes Sixt
2007-11-29 10:17 ` David Kastrup
2007-11-28 23:05 ` Johannes Schindelin
2007-11-28 18:49 ` [PATCH] " Junio C Hamano
2007-11-28 19:03 ` Johannes Schindelin
2007-11-28 22:48 ` Junio C Hamano
2007-11-28 23:08 ` Johannes Schindelin
2007-11-28 14:41 ` David Kastrup
2007-11-28 18:44 ` Rebase/cherry-picking idea Junio C Hamano
2007-11-26 17:26 ` Junio C Hamano
2007-11-26 19:12 ` Marco Costalba
2007-11-27 1:08 ` Shawn O. Pearce
2007-11-27 1:25 ` Junio C Hamano
2007-11-26 13:26 ` Johannes Schindelin
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=7vir3m94ku.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=j.sixt@viscovery.net \
--cc=tsuna@lrde.epita.fr \
--cc=win@wincent.com \
/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).