git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* sequencer "edit" command always issues a warning
@ 2017-03-16 13:15 Jeff King
  2017-03-16 22:29 ` Junio C Hamano
  2017-03-16 22:59 ` Johannes Schindelin
  0 siblings, 2 replies; 4+ messages in thread
From: Jeff King @ 2017-03-16 13:15 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

I was rebasing with the new built-in sequencer code today, and I was
surprised to see the use of warning() here:

  $ git rebase -i
  [set one commit to 'edit']
  warning: stopped at 6ce6b914a... odb_pack_keep(): stop generating keepfile name
  You can amend the commit now, with
    [...more instructions...]

It alarmed me for a minute until I realized that no, this is nothing to
be alarmed about, but just git doing exactly what I told it to do.

The original just wrote:

  Stopped at 6ce6b914a... odb_pack_keep(): stop generating keepfile name

It would be easy to switch back:

diff --git a/sequencer.c b/sequencer.c
index 1f729b053..8183a83c1 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1997,7 +1997,8 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
 			if (item->command == TODO_EDIT) {
 				struct commit *commit = item->commit;
 				if (!res)
-					warning(_("stopped at %s... %.*s"),
+					fprintf(stderr,
+						_("Stopped at %s...  %.*s"),
 						short_commit_name(commit),
 						item->arg_len, item->arg);
 				return error_with_patch(commit,

and that would match most of the other messages that the command issues,
which use a bare fprintf() and start with a capital letter. But I'm not
sure if there was some reason to treat this one differently.

-Peff

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: sequencer "edit" command always issues a warning
  2017-03-16 13:15 sequencer "edit" command always issues a warning Jeff King
@ 2017-03-16 22:29 ` Junio C Hamano
  2017-03-16 22:59 ` Johannes Schindelin
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2017-03-16 22:29 UTC (permalink / raw)
  To: Jeff King; +Cc: Johannes Schindelin, git

Jeff King <peff@peff.net> writes:

> I was rebasing with the new built-in sequencer code today, and I was
> surprised to see the use of warning() here:
>
>   $ git rebase -i
>   [set one commit to 'edit']
>   warning: stopped at 6ce6b914a... odb_pack_keep(): stop generating keepfile name
>   You can amend the commit now, with
>     [...more instructions...]
>
> It alarmed me for a minute until I realized that no, this is nothing to
> be alarmed about, but just git doing exactly what I told it to do.
>
> The original just wrote:
>
>   Stopped at 6ce6b914a... odb_pack_keep(): stop generating keepfile name
>
> It would be easy to switch back:
>
> diff --git a/sequencer.c b/sequencer.c
> index 1f729b053..8183a83c1 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -1997,7 +1997,8 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
>  			if (item->command == TODO_EDIT) {
>  				struct commit *commit = item->commit;
>  				if (!res)
> -					warning(_("stopped at %s... %.*s"),
> +					fprintf(stderr,
> +						_("Stopped at %s...  %.*s"),
>  						short_commit_name(commit),
>  						item->arg_len, item->arg);
>  				return error_with_patch(commit,
>
> and that would match most of the other messages that the command issues,
> which use a bare fprintf() and start with a capital letter. But I'm not
> sure if there was some reason to treat this one differently.

I doubt there was.  At least, I didn't think I read any rationale
for switching in logs or in-code comments.

If we stop due to conflicting changes during a "rebase -i" or a
range "cherry-pick/revert" session, warning() might make sense, but
I agree with you that stopping at "edit" is an expected thing.  If
we had info("stopped at...") that may be appropriate, but writing it
out to stderr is just fine, I would think.

Thanks for spotting.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sequencer "edit" command always issues a warning
  2017-03-16 13:15 sequencer "edit" command always issues a warning Jeff King
  2017-03-16 22:29 ` Junio C Hamano
@ 2017-03-16 22:59 ` Johannes Schindelin
  2017-03-17  0:19   ` Jeff King
  1 sibling, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2017-03-16 22:59 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Hi Peff,

On Thu, 16 Mar 2017, Jeff King wrote:

> I was rebasing with the new built-in sequencer code today, and I was
> surprised to see the use of warning() here:
> 
>   $ git rebase -i
>   [set one commit to 'edit']
>   warning: stopped at 6ce6b914a... odb_pack_keep(): stop generating keepfile name
>   You can amend the commit now, with
>     [...more instructions...]
> 
> It alarmed me for a minute until I realized that no, this is nothing to
> be alarmed about, but just git doing exactly what I told it to do.
> 
> The original just wrote:
> 
>   Stopped at 6ce6b914a... odb_pack_keep(): stop generating keepfile name
> 
> It would be easy to switch back:
> 
> diff --git a/sequencer.c b/sequencer.c
> index 1f729b053..8183a83c1 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -1997,7 +1997,8 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
>  			if (item->command == TODO_EDIT) {
>  				struct commit *commit = item->commit;
>  				if (!res)
> -					warning(_("stopped at %s... %.*s"),
> +					fprintf(stderr,
> +						_("Stopped at %s...  %.*s"),
>  						short_commit_name(commit),
>  						item->arg_len, item->arg);
>  				return error_with_patch(commit,
> 
> and that would match most of the other messages that the command issues,
> which use a bare fprintf() and start with a capital letter. But I'm not
> sure if there was some reason to treat this one differently.

I do not recall why I chose warning(); probably just an oversight on my
part. Your patch looks good.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sequencer "edit" command always issues a warning
  2017-03-16 22:59 ` Johannes Schindelin
@ 2017-03-17  0:19   ` Jeff King
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2017-03-17  0:19 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, git

On Thu, Mar 16, 2017 at 11:59:35PM +0100, Johannes Schindelin wrote:

> I do not recall why I chose warning(); probably just an oversight on my
> part. Your patch looks good.

Thanks. Here it is with a commit message.

I agree with Junio that if we had "info()" it would perhaps be the right
thing to use. We can go down that road later if we choose to.

-- >8 --
Subject: [PATCH] sequencer: drop "warning:" when stopping for edit

Since the conversion from shell to C in 56dc3ab04 (sequencer
(rebase -i): implement the 'edit' command, 2017-01-02),
stopping at an "edit" instruction went from:

  $ git rebase -i
  Stopped at 6ce6b914a... odb_pack_keep(): stop generating keepfile name
  You can amend the commit now, with
    [...more instructions...]

to:

  $ git rebase -i
  warning: stopped at 6ce6b914a... odb_pack_keep(): stop generating keepfile name
  You can amend the commit now, with
    [...more instructions...]

The "warning" implies that it's something unexpected, but
it's not. Let's switch back to the original message.

Signed-off-by: Jeff King <peff@peff.net>
---
 sequencer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sequencer.c b/sequencer.c
index 1f729b053..8183a83c1 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1997,7 +1997,8 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
 			if (item->command == TODO_EDIT) {
 				struct commit *commit = item->commit;
 				if (!res)
-					warning(_("stopped at %s... %.*s"),
+					fprintf(stderr,
+						_("Stopped at %s...  %.*s"),
 						short_commit_name(commit),
 						item->arg_len, item->arg);
 				return error_with_patch(commit,
-- 
2.12.0.623.g86ec6c963


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-17  0:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-16 13:15 sequencer "edit" command always issues a warning Jeff King
2017-03-16 22:29 ` Junio C Hamano
2017-03-16 22:59 ` Johannes Schindelin
2017-03-17  0:19   ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).