summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--remote.c5
-rwxr-xr-xt/t5516-fetch-push.sh5
2 files changed, 8 insertions, 2 deletions
diff --git a/remote.c b/remote.c
index 4099183cac..eebee4fe04 100644
--- a/remote.c
+++ b/remote.c
@@ -1204,8 +1204,9 @@ static void show_push_unqualified_ref_name_error(const char *dst_value,
"'%s:refs/tags/%s'?"),
matched_src_name, dst_value);
} else {
- BUG("'%s' should be commit/tag/tree/blob, is '%d'",
- matched_src_name, type);
+ advise(_("The <src> part of the refspec ('%s') "
+ "is an object ID that doesn't exist.\n"),
+ matched_src_name);
}
}
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 2b685b05a9..f493a3b42a 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -471,6 +471,11 @@ test_expect_success 'push ref expression with non-existent, incomplete dest' '
test_must_fail git push testrepo main^:branch
'
+test_expect_success 'push ref expression with non-existent oid src' '
+ mk_test testrepo &&
+ test_must_fail git push testrepo $(test_oid 001):branch
+'
+
for head in HEAD @
do