[parent not found: <CADavbxcFXpP5EQZ=UEMZt+6KKVtCsTMbgQDHEo0uinm0YfRbZA@mail.gmail.com>]
* Re: [PATCH] push: improve consistency of output when "up to date"
2024-01-11 22:33 ` Junio C Hamano
[not found] ` <CADavbxcFXpP5EQZ=UEMZt+6KKVtCsTMbgQDHEo0uinm0YfRbZA@mail.gmail.com>
@ 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-15 8:43 ` [PATCH] push: improve consistency of output when "up to date" Patrick Steinhardt
3 siblings, 0 replies; 11+ messages in thread
From: Eric Sunshine @ 2024-01-12 3:14 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Benji Kay via GitGitGadget, git, Benji Kay
On Thu, Jan 11, 2024 at 5:33 PM Junio C Hamano <gitster@pobox.com> wrote:
> Eric Sunshine <sunshine@sunshineco.com> writes:
> > Thanks. This particular change is proposed periodically...
> > ... but has not been considered desirable.
> >
> > See, for instance, this email thread explaining the rationale for
> > avoiding such a change:
> > https://lore.kernel.org/git/pull.1298.git.1658908927714.gitgitgadget@gmail.com/T/
>
> 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".
> ---
> diff --git 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))
> + /* do not modify this string */
> fprintf(stderr, "Everything up-to-date\n");
Yes, that helps, though, we can probably be a bit more friendly to
future developers. Rather than insisting that they dig through
history, we could use a slightly less terse comment, such as:
/* stable plumbing output; do not modify or localize */
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] messages: mark some strings with "up-to-date" not to touch
2024-01-11 22:33 ` Junio C Hamano
[not found] ` <CADavbxcFXpP5EQZ=UEMZt+6KKVtCsTMbgQDHEo0uinm0YfRbZA@mail.gmail.com>
2024-01-12 3:14 ` Eric Sunshine
@ 2024-01-12 17:19 ` Eric Sunshine
2024-01-12 18:19 ` Junio C Hamano
2024-01-15 8:43 ` [PATCH] push: improve consistency of output when "up to date" Patrick Steinhardt
3 siblings, 1 reply; 11+ messages in thread
From: Eric Sunshine @ 2024-01-12 17:19 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Benji Kay, Eric Sunshine
From: Junio C Hamano <gitster@pobox.com>
The treewide clean-up of "up-to-date" strings done in 7560f547
(treewide: correct several "up-to-date" to "up to date", 2017-08-23)
deliberately left some out, but unlike the lines that were changed
by the commit, the lines that were deliberately left untouched by
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
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>
---
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:
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] messages: mark some strings with "up-to-date" not to touch
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
0 siblings, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2024-01-12 18:19 UTC (permalink / raw)
To: Eric Sunshine; +Cc: git, Benji Kay, Eric Sunshine
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:
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] push: improve consistency of output when "up to date"
2024-01-11 22:33 ` Junio C Hamano
` (2 preceding siblings ...)
2024-01-12 17:19 ` [PATCH] messages: mark some strings with "up-to-date" not to touch Eric Sunshine
@ 2024-01-15 8:43 ` Patrick Steinhardt
3 siblings, 0 replies; 11+ messages in thread
From: Patrick Steinhardt @ 2024-01-15 8:43 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Eric Sunshine, Benji Kay via GitGitGadget, git, Benji Kay
[-- Attachment #1: Type: text/plain, Size: 2334 bytes --]
On Thu, Jan 11, 2024 at 02:33:21PM -0800, Junio C Hamano wrote:
> Eric Sunshine <sunshine@sunshineco.com> writes:
>
> > Thanks. This particular change is proposed periodically...
> >
> >> diff --git a/transport.c b/transport.c
> >> @@ -1467,7 +1467,7 @@ int transport_push(struct repository *r,
> >> else if (!quiet && !ret && !transport_refs_pushed(remote_refs))
> >> - fprintf(stderr, "Everything up-to-date\n");
> >> + fprintf(stderr, "Everything up to date.\n");
> >
> > ... but has not been considered desirable.
> >
> > See, for instance, this email thread explaining the rationale for
> > avoiding such a change:
> > https://lore.kernel.org/git/pull.1298.git.1658908927714.gitgitgadget@gmail.com/T/
>
> Looking at the "grep" hits:
>
> $ git grep -e 'up-to-date.*"' \*.c
> builtin/rm.c: OPT__FORCE(&force, N_("override the up-to-date check"), PARSE_OPT_NOCOMPLETE),
> builtin/send-pack.c: fprintf(stderr, "Everything up-to-date\n");
> http-push.c: fprintf(stderr, "'%s': up-to-date\n", ref->name);
> http-push.c: "Maybe you are not up-to-date and "
> transport.c: fprintf(stderr, "Everything up-to-date\n");
>
> it is true that these are not marked for translation, which should
> be a clue enough that we want them to be exactly the way they are
> spelled. However, they are going to the standard error stream. Is
> it reasonable to expect third-party tools scraping it to find the
> string "up-to-date"?
I would say it's not entirely reasonable:
- These are strings that users see frequently, and if they are not
proficient in the English language I think it actually regresses
their user experience.
- The way this string is written would never lead me, as a script
developer, to think that this is a message that should be parsed by
my script. It's simply too user-focussed to make me think so.
- Last but not least, I think it's not entirely unreasonable to ask
script developers to use e.g. LANG=C when they expect strings to be
stable.
Also, with the introduction of `git push --porcelain`, I think there is
even less reason to keep such user-visible strings intact. Any machine
that wants to parse output of git-push(1) should use `--porcelain`
instead in my opinion.
Patrick
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread