Skip to content

Commit 77484fe

Browse files
committed
Merge branch 'dl/push-missing-object-error' into jch
"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. * dl/push-missing-object-error: remote.c: remove BUG in show_push_unqualified_ref_name_error() t5516: introduce 'push ref expression with non-existent oid src'
2 parents c7eba84 + 4dac530 commit 77484fe

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

remote.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,8 +1218,7 @@ static void show_push_unqualified_ref_name_error(const char *dst_value,
12181218
"'%s:refs/tags/%s'?"),
12191219
matched_src_name, dst_value);
12201220
} else {
1221-
BUG("'%s' should be commit/tag/tree/blob, is '%d'",
1222-
matched_src_name, type);
1221+
advise(_("The <src> part of the refspec is an oid that doesn't exist.\n"));
12231222
}
12241223
}
12251224

t/t5516-fetch-push.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,13 @@ test_expect_success 'push ref expression with non-existent, incomplete dest' '
509509
510510
'
511511

512+
test_expect_success 'push ref expression with non-existent oid src' '
513+
514+
mk_test testrepo &&
515+
test_must_fail git push testrepo $(test_oid 001):branch
516+
517+
'
518+
512519
for head in HEAD @
513520
do
514521

0 commit comments

Comments
 (0)