git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/6] Remove i18n legos in notifying new branch tracking setup

From
Jonathan Nieder <jrnieder@gmail.com>
Date
May 31, 2012, 14:00 UTC
Message-ID
<20120531140024.GC10523@burratino>
In-Reply-To
<1338469482-30936-2-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy wrote:
> Not sure if it's the right way to fix these though. For example, while
> 1/1 looks very good from i18n perspective, code-wise it's quite ugly.
> Grouping format strings in array also prevents gcc from checking
> correct parameters, I think.
[...]
> --- a/branch.c
> +++ b/branch.c
> @@ -74,25 +74,43 @@ void install_branch_config(int flag, const char *local, const char *origin, cons
[...]
Show 13 quoted lines
> -		strbuf_addstr(&key, origin ? "remote" : "local");
> -
> -		/* Are we tracking a proper "branch"? */
> -		if (remote_is_branch) {
> -			strbuf_addf(&key, " branch %s", shortname);
> -			if (origin)
> -				strbuf_addf(&key, " from %s", origin);
> +		if (rebasing) {
> +			if (remote_is_branch) {
> +				if (origin)
> +					printf("Branch %s set up to track remote branch %s from %s by rebasing.\n",
> +					       local, shortname, origin);
> +				else
[...]
> +			} else {
> +				if (origin)
[...]
> +			}
> +		} else {
> +			if (remote_is_branch) {
[...]

I think a table-driven version of this switchboard would be much easier to read, even if it would hurt gcc's -Wformat checking. If the -Wformat safety is too precious to lose, would something like the following work?

	switch (tracking_msg_flags) {
	case REBASING | REMOTE_IS_BRANCH | ORIGIN:
		printf(_("Branch %s set up to track remote branch %s ..."),
			...
		break;
	case REBASING | REMOTE_IS_BRANCH:
		printf(_(...
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 4 of 17 in “i18n: apply: split to fix a partial i18n message”
  1. i18n: apply: split to fix a partial i18n messageJiang Xin, May 31, 2012
  2. Nguyễn Thái Ngọc DuyMay 31, 2012
  3. 1/6 Remove i18n legos in notifying new branch tracking setupNguyễn Thái Ngọc Duy, May 31, 2012
  4. Jonathan NiederMay 31, 2012
  5. 2/6 reflog: remove i18n legos in pruning messageNguyễn Thái Ngọc Duy, May 31, 2012
  6. Jonathan NiederMay 31, 2012
  7. Nguyen Thai Ngoc DuyMay 31, 2012
  8. Jonathan NiederMay 31, 2012
  9. Nguyen Thai Ngoc DuyMay 31, 2012
  10. Junio C HamanoMay 31, 2012
  11. Jonathan NiederMay 31, 2012
  12. 3/6 merge-recursive: remove i18n legos in conflict messagesNguyễn Thái Ngọc Duy, May 31, 2012
  13. Jonathan NiederMay 31, 2012
  14. Nguyen Thai Ngoc DuyMay 31, 2012
  15. 4/6 notes-merge: remove i18n legos in merge result messageNguyễn Thái Ngọc Duy, May 31, 2012
  16. 5/6 rerere: remove i18n legos in result messageNguyễn Thái Ngọc Duy, May 31, 2012
  17. 6/6 unpack-trees: remove i18n legos in unpack's porcelain error messagesNguyễn Thái Ngọc Duy, May 31, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.