]> git.ipfire.org Git - thirdparty/git.git/commitdiff
transport: not report a non-head push as a branch
authorJiang Xin <zhiyou.jx@alibaba-inc.com>
Thu, 27 Aug 2020 15:45:42 +0000 (11:45 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Aug 2020 19:47:47 +0000 (12:47 -0700)
When pushing a new reference (not a head or tag), report it as a new
reference instead of a new branch.

Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5516-fetch-push.sh
transport.c

index 9c6218f568ea3bc4c61a1377fc4b2be150b4be1d..77938db77f85f7c7736b97cb134536a77cb8d28e 100755 (executable)
@@ -1039,7 +1039,7 @@ test_force_fetch_tag "annotated tag" "-f -a -m'tag message'"
 test_expect_success 'push --porcelain' '
        mk_empty testrepo &&
        echo >.git/foo  "To testrepo" &&
-       echo >>.git/foo "*      refs/heads/master:refs/remotes/origin/master    [new branch]"  &&
+       echo >>.git/foo "*      refs/heads/master:refs/remotes/origin/master    [new reference]"  &&
        echo >>.git/foo "Done" &&
        git push >.git/bar --porcelain  testrepo refs/heads/master:refs/remotes/origin/master &&
        (
index 15f5ba4e8f22c69959357bc8a7fe073678fe8862..26fefd13c17220f9f69d87cbbc0553db418e56a2 100644 (file)
@@ -500,9 +500,12 @@ static void print_ok_ref_status(struct ref *ref, int porcelain, int summary_widt
                                 porcelain, summary_width);
        else if (is_null_oid(&ref->old_oid))
                print_ref_status('*',
-                       (starts_with(ref->name, "refs/tags/") ? "[new tag]" :
-                       "[new branch]"),
-                       ref, ref->peer_ref, NULL, porcelain, summary_width);
+                                (starts_with(ref->name, "refs/tags/")
+                                 ? "[new tag]"
+                                 : (starts_with(ref->name, "refs/heads/")
+                                    ? "[new branch]"
+                                    : "[new reference]")),
+                                ref, ref->peer_ref, NULL, porcelain, summary_width);
        else {
                struct strbuf quickref = STRBUF_INIT;
                char type;