Thread (34 messages) 34 messages, 3 authors, 2016-06-15

[PATCH 14/14] pull --rebase: error on no merge candidate cases

flat view
STALE3773d SUPERSEDED

From: Paul Tan <hidden>
Date: 2016-06-15 23:04:48
Subsystem: the rest · Maintainer: Linus Torvalds

Revision v1 of 4 in this series.

Revisions (4)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]
Tweak the error messages printed by die_no_merge_candidates() to take
into account that we may be "rebasing against" rather than "merging
with".

Signed-off-by: Paul Tan <redacted>
---
 builtin/pull.c | 42 +++++++++++++++++++++++++-----------------
 1 file changed, 25 insertions(+), 17 deletions(-)
diff --git a/builtin/pull.c b/builtin/pull.c
index c8d673d..15b65a0 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -474,10 +474,12 @@ static void NORETURN die_no_merge_candidates(const char *repo, const char **refs
 	const char *remote = curr_branch ? curr_branch->remote_name : NULL;
 
 	if (*refspecs) {
-		fprintf(stderr,
-			_("There are no candidates for merging among the refs that you just fetched.\n"
-			"Generally this means that you provided a wildcard refspec which had no\n"
-			"matches on the remote end.\n"));
+		if (opt_rebase)
+			fputs(_("There is no candidate for rebasing against among the refs that you just fetched."), stderr);
+		else
+			fputs(_("There are no candidates for merging among the refs that you just fetched."), stderr);
+		fputs(_("Generally this means that you provided a wildcard refspec which had no\n"
+			"matches on the remote end."), stderr);
 	} else if (repo && curr_branch && (!remote || strcmp(repo, remote))) {
 		fprintf(stderr,
 			_("You asked to pull from the remote '%s', but did not specify\n"
@@ -485,12 +487,15 @@ static void NORETURN die_no_merge_candidates(const char *repo, const char **refs
 			"for your current branch, you must specify a branch on the command line.\n"),
 			repo);
 	} else if (!curr_branch) {
-		fprintf(stderr,
-			_("You are not currently on a branch. Please specify which\n"
-			"branch you want to merge with. See git-pull(1) for details.\n"
-			"\n"
-			"    git pull <remote> <branch>\n"
-			"\n"));
+		fputs(_("You are not currently on a branch."), stderr);
+		if (opt_rebase)
+			fputs(_("Please specify which branch you want to rebase against."), stderr);
+		else
+			fputs(_("Please specify which branch you want to merge with."), stderr);
+		fputs(_("See git-pull(1) for details."), stderr);
+		fputs("", stderr);
+		fputs("    git pull <remote> <branch>", stderr);
+		fputs("", stderr);
 	} else if (!curr_branch->merge_nr) {
 		struct known_remote *remotes = NULL;
 		const char *remote_name = "<remote>";
@@ -499,14 +504,17 @@ static void NORETURN die_no_merge_candidates(const char *repo, const char **refs
 		if (remotes && !remotes->next)
 			remote_name = remotes->remote->name;
 
+		fputs(_("There is no tracking information for the current branch."), stderr);
+		if (opt_rebase)
+			fputs(_("Please specify which branch you want to rebase against."), stderr);
+		else
+			fputs(_("Please specify which branch you want to merge with."), stderr);
+		fputs(_("See git-pull(1) for details."), stderr);
+		fputs("", stderr);
+		fputs("    git pull <remote> <branch>", stderr);
+		fputs("", stderr);
 		fprintf(stderr,
-			_("There is no tracking information for the current branch.\n"
-			"Please specify which branch you want to merge with.\n"
-			"See git-pull(1) for details.\n"
-			"\n"
-			"    git pull <remote> <branch>\n"
-			"\n"
-			"If you wish to set tracking information for this branch you can do so with:\n"
+			_("If you wish to set tracking information for this branch you can do so with:\n"
 			"\n"
 			"    git branch --set-upstream-to=%s/<branch> %s\n"
 			"\n"),
-- 
2.1.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help