summaryrefslogtreecommitdiff
path: root/branch.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2013-04-02 15:03:55 -0400
committerJunio C Hamano <gitster@pobox.com>2013-04-02 16:14:08 -0700
commite2b6aa5f1b85d5f49f0cf280162cf216e55e1eba (patch)
treec911be1938db0942763e02b0ecac082cdc113c9f /branch.c
parent8a3e5ecdaa9fc45d7af58eb95bba0f39ca625a8d (diff)
downloadgit-e2b6aa5f1b85d5f49f0cf280162cf216e55e1eba.tar.gz
branch: factor out "upstream is not a branch" error messages
This message is duplicated, and is quite long. Let's factor it out, which avoids the repetition and the long lines. It will also make future patches easier as we tweak the message. While we're at it, let's also mark it for translation. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'branch.c')
-rw-r--r--branch.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/branch.c b/branch.c
index 2bef1e7e71..1acbd4e6d3 100644
--- a/branch.c
+++ b/branch.c
@@ -197,6 +197,9 @@ int validate_new_branchname(const char *name, struct strbuf *ref,
return 1;
}
+static const char upstream_not_branch[] =
+N_("Cannot setup tracking information; starting point is not a branch.");
+
void create_branch(const char *head,
const char *name, const char *start_name,
int force, int reflog, int clobber_head,
@@ -231,14 +234,14 @@ void create_branch(const char *head,
case 0:
/* Not branching from any existing branch */
if (explicit_tracking)
- die("Cannot setup tracking information; starting point is not a branch.");
+ die(_(upstream_not_branch));
break;
case 1:
/* Unique completion -- good, only if it is a real branch */
if (prefixcmp(real_ref, "refs/heads/") &&
prefixcmp(real_ref, "refs/remotes/")) {
if (explicit_tracking)
- die("Cannot setup tracking information; starting point is not a branch.");
+ die(_(upstream_not_branch));
else
real_ref = NULL;
}