Re: [PATCH v3 2/4] fetch-pack: prepare updated shallow file before fetching the pack
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- May 26, 2013, 01:01 UTC
- Message-ID
- <CACsJy8BFbDA1MitnktL6tNy59sWMw4vnsZ0wN6UfDfY_oAKh+w@mail.gmail.com>
- In-Reply-To
- <7va9o6lr0h.fsf@alter.siamese.dyndns.org>
On Tue, May 7, 2013 at 10:59 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
>> if (args->depth > 0) {
>> + struct stat st;
>> + if (!fstat(shallow_lock.fd, &st) &&
>> + st.st_size == 0) {
>> + unlink_or_warn(git_path("shallow"));
>
> Are we unlinking the right file here?Yes we are. when st.st_size is 0, the new shallow file is empty (i.e. --unshallow), so we want to remove the old file. I should check "!*alternate_shallow_file" here instead of based on st.st_size. -- Duy