Re: [PATCH] partial-clone: add a partial-clone test case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/15/2022 7:30 AM, Abhradeep Chakraborty wrote:
> Junio C Hamano <gitster@xxxxxxxxx> wrote:
> 
>> I found it quite a roundabout way to look into trace to see if
>> a "fetch" was run to determine if we are doing the right thing.
>>
>> Regardless of whatever mechanism is used to lazily fetch objects
>> that have become necessary from the promisor remotes, what we want
>> to ensure is that the blob object HEAD:new-file.txt is still missing
>> in our object store after running "log --follow", isn't it?  In a
>> future version of "git", our on-demand lazy fetch mechanism may not
>> even invoke "git fetch" under the hood, after all.
>>
>> Don't we have a more direct way to ask "does this object exist in
>> our object store, or is it merely left as a promise?" without
>> triggering a lazy fetching that we can use in this test?  I think
>> such a direct approach is what we want to use in this test.
> 
> I did think of other ways to detect the downloading before. Initially I
> thought of using grep functionality to see if any download related
> messages are printed or not. But I found that `git log` doesn't print
> any download related messages (e.g. like "enumerating ...."). So, I
> dropped that idea.
> 
> The next idea that came into my mind was to detect if the previous file
> (the file from where the new file is renamed) is still missing ( you're
> suggesting the same approach). But the problem I faced with this apprach
> is I didn't find a way to detect if the file is missing.
> 
> I tried to use `git rev-list --objects --missing=print` with `HEAD` and
> first commit hash. But in both cases, I didn't found a missing `[?]` sign
> before ` <blob-hash-ID> file.txt`. That means, both blob objects ( or I
> think the same blob object) exists in the local repo.

Ah! This method really should have worked. And the test as written
is not testing the right thing, because we also skip downloading the
blobs if we already have them.

I think the key issue is that your clone says this:

+	git clone --filter=blob:none "file://$(pwd)/repo" partial.git &&

which will do a checkout and download the blobs at tip.

If you add a "--bare" to this clone command, then no blobs should be
downloaded, and your rev-list command should show the missing objects.

> Most probably, this is because the content of these two files are same.
> Blob object is never modified. So, as far as I think, both base trees ( one
> which is pointed by the initial commit and other which is pointed by the latest
> commit) is pointing to the same blob object. As a result, the file is not
> missing. ( I am not sure if git really does it as I said; sorry if I am
> wrong here)
> 
> That's why I asked Derrick to help me detecting the download and he
> suggested me this. It is true that this is not ideal (use of `fetch` may
> change later). But this was the only option that I can go with.
> 
> If you find another/better way or if you think I tried to use `git rev-list
> ...` in the wrong way -  please tell me. I would be very happy.

Hopefully my suggestion to use --bare will help.

Thanks,
-Stolee




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux