* [PATCH] revert: only suggest to commit if not passing -n
@ 2010-07-22 13:51 Carlo Marcelo Arenas Belon
2010-07-23 16:42 ` Jared Hance
0 siblings, 1 reply; 4+ messages in thread
From: Carlo Marcelo Arenas Belon @ 2010-07-22 13:51 UTC (permalink / raw)
To: git
while doing revert or cherry-pick, if the automatic merge fails
and the user specifically suggested he didn't want to commit,
then don't suggest to do that as part of the conflict resolution.
Signed-off-by: Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe>
---
builtin/revert.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/builtin/revert.c b/builtin/revert.c
index 8b9d829..72d0753 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -250,14 +250,18 @@ static char *help_msg(void)
return msg;
strbuf_addstr(&helpbuf, " After resolving the conflicts,\n"
- "mark the corrected paths with 'git add <paths>' or 'git rm <paths>'\n"
- "and commit the result");
+ "mark the corrected paths with 'git add <paths>' or 'git rm <paths>'");
+ if (!no_commit) {
+ strbuf_addf(&helpbuf, "\nand commit the result");
- if (action == CHERRY_PICK) {
- strbuf_addf(&helpbuf, " with: \n"
- "\n"
- " git commit -c %s\n",
- sha1_to_hex(commit->object.sha1));
+ if (action == CHERRY_PICK) {
+ strbuf_addf(&helpbuf, " with: \n"
+ "\n"
+ " git commit -c %s\n",
+ sha1_to_hex(commit->object.sha1));
+ }
+ else
+ strbuf_addch(&helpbuf, '.');
}
else
strbuf_addch(&helpbuf, '.');
--
1.7.1.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] revert: only suggest to commit if not passing -n
2010-07-22 13:51 [PATCH] revert: only suggest to commit if not passing -n Carlo Marcelo Arenas Belon
@ 2010-07-23 16:42 ` Jared Hance
2010-07-25 12:54 ` [PATCH v2] " Carlo Marcelo Arenas Belon
0 siblings, 1 reply; 4+ messages in thread
From: Jared Hance @ 2010-07-23 16:42 UTC (permalink / raw)
To: git
On Thu, Jul 22, 2010 at 06:51:32AM -0700, Carlo Marcelo Arenas Belon wrote:
> strbuf_addstr(&helpbuf, " After resolving the conflicts,\n"
> - "mark the corrected paths with 'git add <paths>' or 'git rm <paths>'\n"
> - "and commit the result");
> + "mark the corrected paths with 'git add <paths>' or 'git rm <paths>'");
> + if (!no_commit) {
> + strbuf_addf(&helpbuf, "\nand commit the result");
Shouldn't we use strbuf_addstr here? We aren't using the formatting
part of strbuf_addf.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] revert: only suggest to commit if not passing -n
2010-07-23 16:42 ` Jared Hance
@ 2010-07-25 12:54 ` Carlo Marcelo Arenas Belon
2010-08-13 4:54 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Carlo Marcelo Arenas Belon @ 2010-07-25 12:54 UTC (permalink / raw)
To: git
while doing revert or cherry-pick, if the automatic merge fails
and the user specifically suggested he didn't want to commit,
then don't suggest to do that as part of the conflict resolution.
Signed-off-by: Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe>
---
builtin/revert.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/builtin/revert.c b/builtin/revert.c
index 8b9d829..b7cb69b 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -250,14 +250,18 @@ static char *help_msg(void)
return msg;
strbuf_addstr(&helpbuf, " After resolving the conflicts,\n"
- "mark the corrected paths with 'git add <paths>' or 'git rm <paths>'\n"
- "and commit the result");
+ "mark the corrected paths with 'git add <paths>' or 'git rm <paths>'");
+ if (!no_commit) {
+ strbuf_addstr(&helpbuf, "\nand commit the result");
- if (action == CHERRY_PICK) {
- strbuf_addf(&helpbuf, " with: \n"
- "\n"
- " git commit -c %s\n",
- sha1_to_hex(commit->object.sha1));
+ if (action == CHERRY_PICK) {
+ strbuf_addf(&helpbuf, " with: \n"
+ "\n"
+ " git commit -c %s\n",
+ sha1_to_hex(commit->object.sha1));
+ }
+ else
+ strbuf_addch(&helpbuf, '.');
}
else
strbuf_addch(&helpbuf, '.');
--
1.7.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] revert: only suggest to commit if not passing -n
2010-07-25 12:54 ` [PATCH v2] " Carlo Marcelo Arenas Belon
@ 2010-08-13 4:54 ` Junio C Hamano
0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2010-08-13 4:54 UTC (permalink / raw)
To: Carlo Marcelo Arenas Belon; +Cc: git
Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe> writes:
> while doing revert or cherry-pick, if the automatic merge fails
> and the user specifically suggested he didn't want to commit,
> then don't suggest to do that as part of the conflict resolution.
I agree that the suggestion does not make sense, but realistically, when
the user said
git cherry-pick --no-commit $something
we have no idea if the user wants to add or remove once the conflict has
been resolved. More often than not, "cherry-pick --no-commit" is followed
by further edit, at least in the use cases I've seen, so "git add/rm" is
not the first command the user will run after resolving the conflicts.
So it _might_ make sense not to even suggest "add/rm" in that case.
After all, this is a help/advice message, and "cherry-pick --no-commit"
is sort of an advanced feature anyway, so...
> Signed-off-by: Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe>
> ---
> builtin/revert.c | 20 ++++++++++++--------
> 1 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/builtin/revert.c b/builtin/revert.c
> index 8b9d829..b7cb69b 100644
> --- a/builtin/revert.c
> +++ b/builtin/revert.c
> @@ -250,14 +250,18 @@ static char *help_msg(void)
> return msg;
>
> strbuf_addstr(&helpbuf, " After resolving the conflicts,\n"
> - "mark the corrected paths with 'git add <paths>' or 'git rm <paths>'\n"
> - "and commit the result");
> + "mark the corrected paths with 'git add <paths>' or 'git rm <paths>'");
> + if (!no_commit) {
> + strbuf_addstr(&helpbuf, "\nand commit the result");
>
> - if (action == CHERRY_PICK) {
> - strbuf_addf(&helpbuf, " with: \n"
> - "\n"
> - " git commit -c %s\n",
> - sha1_to_hex(commit->object.sha1));
> + if (action == CHERRY_PICK) {
> + strbuf_addf(&helpbuf, " with: \n"
> + "\n"
> + " git commit -c %s\n",
> + sha1_to_hex(commit->object.sha1));
> + }
> + else
> + strbuf_addch(&helpbuf, '.');
> }
> else
> strbuf_addch(&helpbuf, '.');
> --
> 1.7.2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-13 4:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-22 13:51 [PATCH] revert: only suggest to commit if not passing -n Carlo Marcelo Arenas Belon
2010-07-23 16:42 ` Jared Hance
2010-07-25 12:54 ` [PATCH v2] " Carlo Marcelo Arenas Belon
2010-08-13 4:54 ` Junio C Hamano
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).