summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2018-07-13 00:03:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-16 19:56:14 (GMT)
commit8c4cc326896de1a1501135c529b0596fa6327969 (patch)
tree1a46a40eedfcc18270e328259b3f3fff211a5c01 /t
parentdc0a13f6813f35bae5fd2de6af4d5524a20d5b82 (diff)
downloadgit-8c4cc326896de1a1501135c529b0596fa6327969.zip
git-8c4cc326896de1a1501135c529b0596fa6327969.tar.gz
git-8c4cc326896de1a1501135c529b0596fa6327969.tar.bz2
tag: don't warn if target is missing but promised
deref_tag() prints a warning if the object that a tag refers to does not exist. However, when a partial clone has an annotated tag from its promisor remote, but not the object that it refers to, printing a warning on such a tag is incorrect. This occurs, for example, when the checkout that happens after a partial clone causes some objects to be fetched - and as part of the fetch, all local refs are read. The test included in this patch demonstrates this situation. Therefore, do not print a warning in this case. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t5616-partial-clone.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
index e8dfeaf..bbbe753 100755
--- a/t/t5616-partial-clone.sh
+++ b/t/t5616-partial-clone.sh
@@ -229,9 +229,13 @@ test_expect_success 'when partial cloning, tolerate server not sending target of
git -C "$SERVER" tag -m message -a myblob "$BLOB" &&
# Craft a packfile including the tag, but not the blob it points to.
- printf "%s\n%s\n--not\n%s\n" \
+ # Also, omit objects referenced from HEAD in order to force a second
+ # fetch (to fetch missing objects) upon the automatic checkout that
+ # happens after a clone.
+ printf "%s\n%s\n--not\n%s\n%s\n" \
$(git -C "$SERVER" rev-parse HEAD) \
$(git -C "$SERVER" rev-parse myblob) \
+ $(git -C "$SERVER" rev-parse HEAD^{tree}) \
$(git -C "$SERVER" rev-parse myblob^{blob}) |
git -C "$SERVER" pack-objects --thin --stdout >incomplete.pack &&
@@ -249,7 +253,8 @@ test_expect_success 'when partial cloning, tolerate server not sending target of
# Exercise to make sure it works.
git -c protocol.version=2 clone \
- --filter=blob:none $HTTPD_URL/one_time_sed/server repo &&
+ --filter=blob:none $HTTPD_URL/one_time_sed/server repo 2> err &&
+ ! grep "missing object referenced by" err &&
# Ensure that the one-time-sed script was used.
! test -e "$HTTPD_ROOT_PATH/one-time-sed"