branch: mention start_name in set-upstream error messages
If we refuse a branch operation because the tracking start_name the user gave us is bogus, we just print something like: fatal: Cannot setup tracking information; start point is not a branch If we mention the actual name we tried to use, that may help the user figure out why it didn't work (e.g., if they gave us the arguments in the wrong order). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Apr 2, 2013 at 15:04 UTC
1a15d00bb910de0a86981f0d75836feac71d1fe0
1 file changed
+5
-5
branch.c
+5
-5
@@ -198,9 +198,9 @@ int validate_new_branchname(const char *name, struct strbuf *ref,
198
}
199
200
static const char upstream_not_branch[] =
201
-N_("Cannot setup tracking information; starting point is not a branch.");
201
+N_("Cannot setup tracking information; starting point '%s' is not a branch.");
202
static const char upstream_missing[] =
203
-N_("Cannot setup tracking information; starting point does not exist");
203
+N_("Cannot setup tracking information; starting point '%s' does not exist");
204
205
void create_branch(const char *head,
206
const char *name, const char *start_name,
@@ -231,7 +231,7 @@ void create_branch(const char *head,
231
real_ref = NULL;
232
if (get_sha1(start_name, sha1)) {
233
if (explicit_tracking)
234
- die(_(upstream_missing));
234
+ die(_(upstream_missing), start_name);
235
die("Not a valid object name: '%s'.", start_name);
236
}
237
@@ -239,14 +239,14 @@ void create_branch(const char *head,
239
case 0:
240
/* Not branching from any existing branch */
241
if (explicit_tracking)
242
- die(_(upstream_not_branch));
242
+ die(_(upstream_not_branch), start_name);
243
break;
244
case 1:
245
/* Unique completion -- good, only if it is a real branch */
246
if (prefixcmp(real_ref, "refs/heads/") &&
247
prefixcmp(real_ref, "refs/remotes/")) {
248
if (explicit_tracking)
249
- die(_(upstream_not_branch));
249
+ die(_(upstream_not_branch), start_name);
250
else
251
real_ref = NULL;
252
}