git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <ericsunshine@charter.net>
Cc: git@vger.kernel.org,  Benji Kay <okaybenji@gmail.com>,
	 Eric Sunshine <sunshine@sunshineco.com>
Subject: Re: [PATCH] messages: mark some strings with "up-to-date" not to touch
Date: Fri, 12 Jan 2024 10:19:49 -0800	[thread overview]
Message-ID: <xmqqa5pabeii.fsf@gitster.g> (raw)
In-Reply-To: <20240112171910.11131-1-ericsunshine@charter.net> (Eric Sunshine's message of "Fri, 12 Jan 2024 12:19:10 -0500")

Eric Sunshine <ericsunshine@charter.net> writes:

> Let's do the second best thing, leave a short comment near them
> explaining why those strings should not be modified or localized.

I simply could not come up with a short and concise in-code comment
;-) What you picked looks good to me.

Thanks.  


>
> [es: make in-code comment more developer-friendly]
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
> ---
>
> This is a reroll of Junio's[1] v1 which adds an in-code comment
> explaining that "up-to-date" messages in plumbing commands should not be
> changed, but doesn't explain _why_, which forces readers to dig through
> project history or the mailing list to understand the motivation. v2
> changes the comment to be more developer-friendly by adding the
> explanation directly to the comment.
>
> [1]: https://lore.kernel.org/git/xmqqjzofec0e.fsf@gitster.g/
>
> Range-diff:
> 1:  36596051c9 ! 1:  782169e0b1 messages: mark some strings with "up-to-date" not to touch
>     @@ Commit message
>          the commit is impossible to ask "git blame" to link back to the
>          commit that did not touch them.
>      
>     -    Let's do the second best thing, leave a short comment near them, to
>     -    make it possible for those who are motivated enough to find out why
>     -    we decided to tell them "do not modify".
>     +    Let's do the second best thing, leave a short comment near them
>     +    explaining why those strings should not be modified or localized.
>     +
>     +    [es: make in-code comment more developer-friendly]
>      
>          Signed-off-by: Junio C Hamano <gitster@pobox.com>
>     +    Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
>      
>       ## builtin/send-pack.c ##
>      @@ builtin/send-pack.c: int cmd_send_pack(int argc, const char **argv, const char *prefix)
>       	}
>       
>       	if (!ret && !transport_refs_pushed(remote_refs))
>     -+		/* do not modify this string */
>     ++		/* stable plumbing output; do not modify or localize */
>       		fprintf(stderr, "Everything up-to-date\n");
>       
>       	return ret;
>     @@ http-push.c: int cmd_main(int argc, const char **argv)
>       
>       		if (oideq(&ref->old_oid, &ref->peer_ref->new_oid)) {
>       			if (push_verbosely)
>     -+				/* do not modify this string */
>     ++				/* stable plumbing output; do not modify or localize */
>       				fprintf(stderr, "'%s': up-to-date\n", ref->name);
>       			if (helper_status)
>       				printf("ok %s up to date\n", ref->name);
>     @@ http-push.c: int cmd_main(int argc, const char **argv)
>       				 * commits at the remote end and likely
>       				 * we were not up to date to begin with.
>       				 */
>     -+				/* do not modify this string */
>     ++				/* stable plumbing output; do not modify or localize */
>       				error("remote '%s' is not an ancestor of\n"
>       				      "local '%s'.\n"
>       				      "Maybe you are not up-to-date and "
>     @@ transport.c: int transport_push(struct repository *r,
>       	if (porcelain && !push_ret)
>       		puts("Done");
>       	else if (!quiet && !ret && !transport_refs_pushed(remote_refs))
>     -+		/* do not modify this string */
>     ++		/* stable plumbing output; do not modify or localize */
>       		fprintf(stderr, "Everything up-to-date\n");
>       
>       done:
>
>  builtin/send-pack.c | 1 +
>  http-push.c         | 2 ++
>  transport.c         | 1 +
>  3 files changed, 4 insertions(+)
>
> diff --git a/builtin/send-pack.c b/builtin/send-pack.c
> index b7183be970..3df9eaad09 100644
> --- a/builtin/send-pack.c
> +++ b/builtin/send-pack.c
> @@ -333,6 +333,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
>  	}
>  
>  	if (!ret && !transport_refs_pushed(remote_refs))
> +		/* stable plumbing output; do not modify or localize */
>  		fprintf(stderr, "Everything up-to-date\n");
>  
>  	return ret;
> diff --git a/http-push.c b/http-push.c
> index b4d0b2a6aa..12d1113741 100644
> --- a/http-push.c
> +++ b/http-push.c
> @@ -1851,6 +1851,7 @@ int cmd_main(int argc, const char **argv)
>  
>  		if (oideq(&ref->old_oid, &ref->peer_ref->new_oid)) {
>  			if (push_verbosely)
> +				/* stable plumbing output; do not modify or localize */
>  				fprintf(stderr, "'%s': up-to-date\n", ref->name);
>  			if (helper_status)
>  				printf("ok %s up to date\n", ref->name);
> @@ -1871,6 +1872,7 @@ int cmd_main(int argc, const char **argv)
>  				 * commits at the remote end and likely
>  				 * we were not up to date to begin with.
>  				 */
> +				/* stable plumbing output; do not modify or localize */
>  				error("remote '%s' is not an ancestor of\n"
>  				      "local '%s'.\n"
>  				      "Maybe you are not up-to-date and "
> diff --git a/transport.c b/transport.c
> index bd7899e9bf..df518ead70 100644
> --- a/transport.c
> +++ b/transport.c
> @@ -1467,6 +1467,7 @@ int transport_push(struct repository *r,
>  	if (porcelain && !push_ret)
>  		puts("Done");
>  	else if (!quiet && !ret && !transport_refs_pushed(remote_refs))
> +		/* stable plumbing output; do not modify or localize */
>  		fprintf(stderr, "Everything up-to-date\n");
>  
>  done:

  reply	other threads:[~2024-01-12 18:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11 21:27 [PATCH] push: improve consistency of output when "up to date" Benji Kay via GitGitGadget
2024-01-11 21:43 ` Eric Sunshine
2024-01-11 22:33   ` Junio C Hamano
     [not found]     ` <CADavbxcFXpP5EQZ=UEMZt+6KKVtCsTMbgQDHEo0uinm0YfRbZA@mail.gmail.com>
2024-01-12  0:55       ` Benji Kay
2024-01-12  3:14     ` Eric Sunshine
2024-01-12 17:19     ` [PATCH] messages: mark some strings with "up-to-date" not to touch Eric Sunshine
2024-01-12 18:19       ` Junio C Hamano [this message]
2024-01-15  8:43     ` [PATCH] push: improve consistency of output when "up to date" Patrick Steinhardt
2024-01-11 21:43 ` Taylor Blau
2024-01-11 21:45   ` Eric Sunshine
2024-01-17 22:02   ` Dragan Simic

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=xmqqa5pabeii.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=ericsunshine@charter.net \
    --cc=git@vger.kernel.org \
    --cc=okaybenji@gmail.com \
    --cc=sunshine@sunshineco.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).