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

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

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Jun 7, 2012, 12:05 UTC
Message-ID
<1339070715-31417-1-git-send-email-pclouds@gmail.com>
In-Reply-To
<0001-Remove-i18n-legos-in-notifying-new-branch-tracking-s.patch>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 More compact code compared to the lasst version while maintaining
 -Wformat's effectiveness.
 branch.c |   38 +++++++++++++++++++++++---------------
 1 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/branch.c b/branch.c
index eccdaf9..2bef1e7 100644
--- a/branch.c
+++ b/branch.c
@@ -74,25 +74,33 @@ void install_branch_config(int flag, const char *local, const char *origin, cons
 		strbuf_addf(&key, "branch.%s.rebase", local);
 		git_config_set(key.buf, "true");
 	}
+	strbuf_release(&key);
 
 	if (flag & BRANCH_CONFIG_VERBOSE) {
-		strbuf_reset(&key);
-
-		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 (remote_is_branch && origin)
+			printf(rebasing ?
+			       "Branch %s set up to track remote branch %s from %s by rebasing.\n" :
+			       "Branch %s set up to track remote branch %s from %s.\n",
+			       local, shortname, origin);
+		else if (remote_is_branch && !origin)
+			printf(rebasing ?
+			       "Branch %s set up to track local branch %s by rebasing.\n" :
+			       "Branch %s set up to track local branch %s.\n",
+			       local, shortname);
+		else if (!remote_is_branch && origin)
+			printf(rebasing ?
+			       "Branch %s set up to track remote ref %s by rebasing.\n" :
+			       "Branch %s set up to track remote ref %s.\n",
+			       local, remote);
+		else if (!remote_is_branch && !origin)
+			printf(rebasing ?
+			       "Branch %s set up to track local ref %s by rebasing.\n" :
+			       "Branch %s set up to track local ref %s.\n",
+			       local, remote);
 		else
-			strbuf_addf(&key, " ref %s", remote);
-		printf("Branch %s set up to track %s%s.\n",
-		       local, key.buf,
-		       rebasing ? " by rebasing" : "");
+			die("BUG: impossible combination of %d and %p",
+			    remote_is_branch, origin);
 	}
-	strbuf_release(&key);
 }
 
 /*
-- 
1.7.8
Next: Nguyễn Thái Ngọc Duy
Message 1 of 7 in “Remove i18n legos in notifying new branch tracking setup”
  1. 1/6 Remove i18n legos in notifying new branch tracking setupNguyễn Thái Ngọc Duy, Jun 7, 2012
  2. 2/6 reflog: remove i18n legos in pruning messageNguyễn Thái Ngọc Duy, Jun 7, 2012
  3. 3/6 merge-recursive: remove i18n legos in conflict messagesNguyễn Thái Ngọc Duy, Jun 7, 2012
  4. 4/6 notes-merge: remove i18n legos in merge result messageNguyễn Thái Ngọc Duy, Jun 7, 2012
  5. 5/6 rerere: remove i18n legos in result messageNguyễn Thái Ngọc Duy, Jun 7, 2012
  6. 6/6 unpack-trees: remove i18n legos in unpack's porcelain error messagesNguyễn Thái Ngọc Duy, Jun 7, 2012
  7. Junio C HamanoJun 7, 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.