Skip to content

Commit 4d04658

Browse files
dschogitster
authored andcommitted
send-pack/transport-helper: avoid mentioning a particular branch
When trying to push all matching branches, but none match, we offer a message suggesting to push the `master` branch. However, we want to step away from making that branch any more special than any other branch, so let's reword that message to mention no branch in particular. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 489947c commit 4d04658

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

send-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ int send_pack(struct send_pack_args *args,
406406

407407
if (!remote_refs) {
408408
fprintf(stderr, "No refs in common and none specified; doing nothing.\n"
409-
"Perhaps you should specify a branch such as 'master'.\n");
409+
"Perhaps you should specify a branch.\n");
410410
return 0;
411411
}
412412
if (args->atomic && !atomic_supported)

t/t5528-push-default.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ test_expect_success 'push from/to new branch with upstream, matching and simple'
9898
test_push_failure upstream
9999
'
100100

101+
test_expect_success '"matching" fails if none match' '
102+
git init --bare empty &&
103+
test_must_fail git push empty : 2>actual &&
104+
test_i18ngrep "Perhaps you should specify a branch" actual
105+
'
106+
101107
test_expect_success 'push ambiguously named branch with upstream, matching and simple' '
102108
git checkout -b ambiguous &&
103109
test_config branch.ambiguous.remote parent1 &&

transport-helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ static int push_refs(struct transport *transport,
10461046
if (!remote_refs) {
10471047
fprintf(stderr,
10481048
_("No refs in common and none specified; doing nothing.\n"
1049-
"Perhaps you should specify a branch such as 'master'.\n"));
1049+
"Perhaps you should specify a branch.\n"));
10501050
return 0;
10511051
}
10521052

0 commit comments

Comments
 (0)