Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-09-09 22:26:38 +0300
committerJunio C Hamano <gitster@pobox.com>2019-09-09 22:26:38 +0300
commitd8b1ce79729b1744727c29ec818c34ec43ee9599 (patch)
treea21bcc0d9437bad6fd5f37361a11381fd8e05ee9
parent8ce8a63b46298501c9afebfea28ed3339a9104b7 (diff)
parenta63694f52355b412b65515961401cd2359fed544 (diff)
Merge branch 'jt/diff-lazy-fetch-submodule-fix'
On-demand object fetching in lazy clone incorrectly tried to fetch commits from submodule projects, while still working in the superproject, which has been corrected. * jt/diff-lazy-fetch-submodule-fix: diff: skip GITLINK when lazy fetching missing objs
-rw-r--r--diff.c1
-rwxr-xr-xt/t4067-diff-partial-clone.sh31
2 files changed, 32 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index efe42b341a..e28b463f57 100644
--- a/diff.c
+++ b/diff.c
@@ -6512,6 +6512,7 @@ static void add_if_missing(struct repository *r,
const struct diff_filespec *filespec)
{
if (filespec && filespec->oid_valid &&
+ !S_ISGITLINK(filespec->mode) &&
oid_object_info_extended(r, &filespec->oid, NULL,
OBJECT_INFO_FOR_PREFETCH))
oid_array_append(to_fetch, &filespec->oid);
diff --git a/t/t4067-diff-partial-clone.sh b/t/t4067-diff-partial-clone.sh
index 90c8fb2901..4831ad35e6 100755
--- a/t/t4067-diff-partial-clone.sh
+++ b/t/t4067-diff-partial-clone.sh
@@ -75,6 +75,37 @@ test_expect_success 'diff skips same-OID blobs' '
! grep "want $(cat hash-b)" trace
'
+test_expect_success 'when fetching missing objects, diff skips GITLINKs' '
+ test_when_finished "rm -rf sub server client trace" &&
+
+ test_create_repo sub &&
+ test_commit -C sub first &&
+
+ test_create_repo server &&
+ echo a >server/a &&
+ git -C server add a &&
+ git -C server submodule add "file://$(pwd)/sub" &&
+ git -C server commit -m x &&
+
+ test_commit -C server/sub second &&
+ echo another-a >server/a &&
+ git -C server add a sub &&
+ git -C server commit -m x &&
+
+ test_config -C server uploadpack.allowfilter 1 &&
+ test_config -C server uploadpack.allowanysha1inwant 1 &&
+ git clone --bare --filter=blob:limit=0 "file://$(pwd)/server" client &&
+
+ echo a | git hash-object --stdin >hash-old-a &&
+ echo another-a | git hash-object --stdin >hash-new-a &&
+
+ # Ensure that a and another-a are fetched, and check (by successful
+ # execution of the diff) that no invalid OIDs are sent.
+ GIT_TRACE_PACKET="$(pwd)/trace" git -C client diff HEAD^ HEAD &&
+ grep "want $(cat hash-old-a)" trace &&
+ grep "want $(cat hash-new-a)" trace
+'
+
test_expect_success 'diff with rename detection batches blobs' '
test_when_finished "rm -rf server client trace" &&