]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'dl/push-missing-object-error' into maint-2.51
authorJunio C Hamano <gitster@pobox.com>
Wed, 15 Oct 2025 17:29:28 +0000 (10:29 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Oct 2025 17:29:28 +0000 (10:29 -0700)
"git push" had a code path that led to BUG() but it should have
been a die(), as it is a response to a usual but invalid end-user
action to attempt pushing an object that does not exist.
cf. <xmqqo6spiyqp.fsf@gitster.g>

* dl/push-missing-object-error:
  remote.c: convert if-else ladder to switch
  remote.c: remove BUG in show_push_unqualified_ref_name_error()
  t5516: remove surrounding empty lines in test bodies

1  2 
remote.c
t/t5516-fetch-push.sh

diff --cc remote.c
index 88f991795b2683cd5267c7bd24d374fc473b0184,398bfa6a958e777ed7fd355a9dabd8107910146c..df8891471656309b759ec011ff101a91782d7776
+++ b/remote.c
@@@ -1196,8 -1181,9 +1195,9 @@@ static void show_push_unqualified_ref_n
                BUG("'%s' is not a valid object, "
                    "match_explicit_lhs() should catch this!",
                    matched_src_name);
-       type = odb_read_object_info(the_repository->objects, &oid, NULL);
-       if (type == OBJ_COMMIT) {
 -      switch (oid_object_info(the_repository, &oid, NULL)) {
++      switch (odb_read_object_info(the_repository->objects, &oid, NULL)) {
+       case OBJ_COMMIT:
                advise(_("The <src> part of the refspec is a commit object.\n"
                         "Did you mean to create a new branch by pushing to\n"
                         "'%s:refs/heads/%s'?"),
Simple merge