Skip to contentSkip to conversation

push: improve consistency of output when "up to date"

PATCH In review Benji Kay via GitGitGadget 8 participants 11 messages Jan 11, 2024 – Jan 17, 2024 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 push: improve consistency of output when "up to date"

From: okaybenji <[email protected]>

When one issues the pull command, one may see "Already up to date." When issuing the push command, one may have seen "Everything up-to-date". To improve consistency, "Everything up to date." is printed instead. (The hyphens have been removed, and a period has been added.)

---
push: improve consistency of output when "up to date"

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1638%2Fokaybenji%2Fup-to-date-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1638/okaybenji/up-to-date-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1638

 transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
transport.c +1 -1
index bd7899e9bf5..c42cb4e58b4 100644
@@ -1467,7 +1467,7 @@ int transport_push(struct repository *r,
 	if (porcelain && !push_ret)
 		puts("Done");
 	else if (!quiet && !ret && !transport_refs_pushed(remote_refs))
-		fprintf(stderr, "Everything up-to-date\n");
+		fprintf(stderr, "Everything up to date.\n");
 
 done:
 	free_refs(local_refs);

base-commit: a54a84b333adbecf7bc4483c0e36ed5878cac17b

Signature · 1 line
gitgitgadget
#1 lore raw
Quoted 6 lines · Benji Kay via GitGitGadget

When one issues the pull command, one may see "Already up to date." When issuing the push command, one may have seen "Everything up-to-date". To improve consistency, "Everything up to date." is printed instead. (The hyphens have been removed, and a period has been added.)

Thanks. This particular change is proposed periodically...

transport.c int transport_push(struct repository *r, · line 1468

Quoted 5 lines
transport.c +1 -1
@@ -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/[email protected]/T/

#2 lore raw
Quoted 10 lines · Eric Sunshine

Thanks. This particular change is proposed periodically...

transport.c int transport_push(struct repository *r, · line 1468

Quoted 5 lines
transport.c +1 -1
@@ -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.

Quoted 3 lines

See, for instance, this email thread explaining the rationale for avoiding such a change:
https://lore.kernel.org/git/[email protected]/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"?

In any case, a safe first step is to add a short comment to each of these that should not be translated. Perhaps something along this line.

------- >8 ------------- >8 ------------- >8 -------
Subject: [PATCH] messages: mark some strings with "up-to-date" not to touch

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, to make it possible for those who are motivated enough to find out why we decided to tell them "do not modify".

---

 builtin/send-pack.c | 1 +
 http-push.c         | 2 ++
 transport.c         | 1 +
 3 files changed, 4 insertions(+)
builtin/send-pack.c +1 -0
index b7183be970..ac7ec1e643 100644
@@ -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");
 
 	return ret;
http-push.c +2 -0
index b4d0b2a6aa..e4c6645cc2 100644
@@ -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)
+				/* do not modify this string */
 				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.
 				 */
+				/* do not modify this string */
 				error("remote '%s' is not an ancestor of\n"
 				      "local '%s'.\n"
 				      "Maybe you are not up-to-date and "
transport.c +1 -0
index bd7899e9bf..c9f39d45f1 100644
@@ -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))
+		/* do not modify this string */
 		fprintf(stderr, "Everything up-to-date\n");
 
 done:
Signature · 1 line
2.43.0-283-ga54a84b333

A message that is not in the archive (sent off-list or not yet received): CADavbxcFXpP5EQZ=UEMZt+6KKVtCsTMbgQDHEo0uinm0YfRbZA@mail.gmail.com

#4 lore raw

If it's important these messages are not changed (under the presumption some programs may make decisions based on the output), perhaps a test should be written to ensure the output is as expected.

#5 lore raw
In reply to Junio C Hamano
Quoted 14 lines · Junio C Hamano
Quoted 6 lines · Eric Sunshine

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/[email protected]/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".
---

builtin/send-pack.c int cmd_send_pack(int argc, const char **argv, const char *prefix) · line 335

Quoted 3 lines
builtin/send-pack.c +1 -0
@@ -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 */
#6 lore raw

PATCH 1/1 messages: mark some strings with "up-to-date" not to touch

In reply to Junio C Hamano

From: Junio C Hamano <[email protected]>

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]

---

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/[email protected]/

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: Eric Sunshine <[email protected]>

## 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(+)
builtin/send-pack.c +1 -0
index b7183be970..3df9eaad09 100644
@@ -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;
http-push.c +2 -0
index b4d0b2a6aa..12d1113741 100644
@@ -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 "
transport.c +1 -0
index bd7899e9bf..df518ead70 100644
@@ -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:
Signature · 1 line
2.43.0
#7 lore raw

Re: [PATCH] messages: mark some strings with "up-to-date" not to touch

Quoted 2 lines · Eric Sunshine

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.

Quoted 120 lines

[es: make in-code comment more developer-friendly]

---

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/[email protected]/

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: Eric Sunshine <[email protected]>

## 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(+)
builtin/send-pack.c +1 -0
index b7183be970..3df9eaad09 100644
@@ -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;
http-push.c +2 -0
index b4d0b2a6aa..12d1113741 100644
@@ -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 "
transport.c +1 -0
index bd7899e9bf..df518ead70 100644
@@ -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:
#8 lore raw
In reply to Junio C Hamano
Quoted 25 lines · Junio C Hamano
Quoted 10 lines · Eric Sunshine

Thanks. This particular change is proposed periodically...

transport.c int transport_push(struct repository *r, · line 1468

Quoted 5 lines
transport.c +1 -1
@@ -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.

Quoted 3 lines

See, for instance, this email thread explaining the rationale for avoiding such a change:
https://lore.kernel.org/git/[email protected]/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");
Quoted 5 lines

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

#9 lore raw
In reply to Benji Kay via GitGitGadget
Quoted 23 lines · Benji Kay via GitGitGadget

From: okaybenji <[email protected]>

When one issues the pull command, one may see "Already up to date." When issuing the push command, one may have seen "Everything up-to-date". To improve consistency, "Everything up to date." is printed instead. (The hyphens have been removed, and a period has been added.)

---
push: improve consistency of output when "up to date"

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1638%2Fokaybenji%2Fup-to-date-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1638/okaybenji/up-to-date-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1638

 transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
transport.c +0 -0
index bd7899e9bf5..c42cb4e58b4 100644

transport.c int transport_push(struct repository *r, · line 1470

Quoted 5 lines
transport.c +1 -1
@@ -1467,7 +1467,7 @@ int transport_push(struct repository *r,
 	if (porcelain && !push_ret)
 		puts("Done");
 	else if (!quiet && !ret && !transport_refs_pushed(remote_refs))
-		fprintf(stderr, "Everything up-to-date\n");
+		fprintf(stderr, "Everything up to date.\n");

Between the two, I have a vague preference towards "up-to-date", which would suggest changing the pull command's output to read "Already up-to-date". Personally I think that neither of them should include a period in their output, but whichever we decide should be done so consistently between the two.

Also, should this string be marked for translation?

Thanks,
Taylor

#10 lore raw
Quoted 11 lines · Taylor Blau

transport.c int transport_push(struct repository *r, · line 1470

Quoted 2 lines · Benji Kay via GitGitGadget
transport.c +1 -1
-             fprintf(stderr, "Everything up-to-date\n");
+             fprintf(stderr, "Everything up to date.\n");

Between the two, I have a vague preference towards "up-to-date", which would suggest changing the pull command's output to read "Already up-to-date". Personally I think that neither of them should include a period in their output, but whichever we decide should be done so consistently between the two.

Also, should this string be marked for translation?

See: https://lore.kernel.org/git/[email protected]/

#11 lore raw
In reply to Taylor Blau
Quoted 19 lines · Taylor Blau
Quoted 18 lines · Benji Kay via GitGitGadget

From: okaybenji <[email protected]>

When one issues the pull command, one may see "Already up to date." When issuing the push command, one may have seen "Everything up-to-date". To improve consistency, "Everything up to date." is printed instead. (The hyphens have been removed, and a period has been added.)

---
push: improve consistency of output when "up to date"

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1638%2Fokaybenji%2Fup-to-date-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1638/okaybenji/up-to-date-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1638

 transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

transport.c int transport_push(struct repository *r, · line 1470

Quoted 10 lines
transport.c +1 -1
index bd7899e9bf5..c42cb4e58b4 100644
@@ -1467,7 +1467,7 @@ int transport_push(struct repository *r,
 	if (porcelain && !push_ret)
 		puts("Done");
 	else if (!quiet && !ret && !transport_refs_pushed(remote_refs))
-		fprintf(stderr, "Everything up-to-date\n");
+		fprintf(stderr, "Everything up to date.\n");

Between the two, I have a vague preference towards "up-to-date", which would suggest changing the pull command's output to read "Already up-to-date". Personally I think that neither of them should include a period in their output, but whichever we decide should be done so consistently between the two.

I'm not a native English speaker, but I spent years contributing to English Wikipedia. According to the manual of style employed by Wikipedia, which is based mainly on The Chicago Manual of Style, hyphenated forms should not be used at the ends of sentences, or at the ends of sentence-like forms. In this case, we don't have complete sentences.

[1] https://www.chicagomanualofstyle.org/home.html