Skip to content

Commit e2b6aa5

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8a3e5ec commit e2b6aa5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

branch.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ int validate_new_branchname(const char *name, struct strbuf *ref,
197197
return 1;
198198
}
199199

200+
static const char upstream_not_branch[] =
201+
N_("Cannot setup tracking information; starting point is not a branch.");
202+
200203
void create_branch(const char *head,
201204
const char *name, const char *start_name,
202205
int force, int reflog, int clobber_head,
@@ -231,14 +234,14 @@ void create_branch(const char *head,
231234
case 0:
232235
/* Not branching from any existing branch */
233236
if (explicit_tracking)
234-
die("Cannot setup tracking information; starting point is not a branch.");
237+
die(_(upstream_not_branch));
235238
break;
236239
case 1:
237240
/* Unique completion -- good, only if it is a real branch */
238241
if (prefixcmp(real_ref, "refs/heads/") &&
239242
prefixcmp(real_ref, "refs/remotes/")) {
240243
if (explicit_tracking)
241-
die("Cannot setup tracking information; starting point is not a branch.");
244+
die(_(upstream_not_branch));
242245
else
243246
real_ref = NULL;
244247
}

0 commit comments

Comments
 (0)