git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] upload-pack: Remove a piece of dead code

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 11, 2013, 15:49 UTC
Message-ID
<7vy59drta7.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CACsJy8CazcJau0yTYSndbam_bUhZLS5f02p9WD0jjutHh1J6+A@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 13 quoted lines
> On Thu, Jul 11, 2013 at 6:25 PM, Matthijs Kooijman <matthijs@stdin.nl> wrote:
>> Commit 682c7d2 (upload-pack: fix off-by-one depth calculation in shallow
>> clone) introduced a new check in get_shallow_commits to decide when to
>> stop traversing the history and mark the current commit as a shallow
>> root.
>>
>> With this new check in place, the old check can no longer be true, since
>> the first check always fires first. This commit removes that check,
>> making the code a bit more simple again.
>
> True. Ack-by: me.
>
>> Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>

Yeah, thanks both. I tend to agree that 2 and 3 are the right change that came too late after the ship sailed X-(.

Show 37 quoted lines
>> ---
>>  shallow.c | 17 ++++++-----------
>>  1 file changed, 6 insertions(+), 11 deletions(-)
>>
>> diff --git a/shallow.c b/shallow.c
>> index cbe2526..8a9c96d 100644
>> --- a/shallow.c
>> +++ b/shallow.c
>> @@ -110,17 +110,12 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
>>                                         continue;
>>                                 *pointer = cur_depth;
>>                         }
>> -                       if (cur_depth < depth) {
>> -                               if (p->next)
>> -                                       add_object_array(&p->item->object,
>> -                                                       NULL, &stack);
>> -                               else {
>> -                                       commit = p->item;
>> -                                       cur_depth = *(int *)commit->util;
>> -                               }
>> -                       } else {
>> -                               commit_list_insert(p->item, &result);
>> -                               p->item->object.flags |= shallow_flag;
>> +                       if (p->next)
>> +                               add_object_array(&p->item->object,
>> +                                               NULL, &stack);
>> +                       else {
>> +                               commit = p->item;
>> +                               cur_depth = *(int *)commit->util;
>>                         }
>>                 }
>>         }
>> --
>> 1.8.3.rc1
>>
> --
> Duy
Previous: Duy NguyenNext: Duy Nguyen
Message 27 of 29 in “git clone depth of 0 not possible.”
  1. git clone depth of 0 not possible.Stefan Beller, Jan 7, 2013
  2. Documentation on depth option in git clone.Stefan Beller, Jan 7, 2013
  3. Jonathan NiederJan 8, 2013
  4. Junio C HamanoJan 8, 2013
  5. Junio C HamanoJan 8, 2013
  6. Junio C HamanoJan 8, 2013
  7. Duy NguyenJan 8, 2013
  8. Stefan BellerJan 8, 2013
  9. Duy NguyenJan 8, 2013
  10. Junio C HamanoJan 8, 2013
  11. Duy NguyenJan 8, 2013
  12. Junio C HamanoJan 8, 2013
  13. Matthijs KooijmanMay 28, 2013
  14. Jonathan NiederMay 28, 2013
  15. Jonathan NiederMay 28, 2013
  16. Matthijs KooijmanMay 28, 2013
  17. Jonathan NiederMay 28, 2013
  18. Junio C HamanoMay 28, 2013
  19. Matthijs KooijmanMay 30, 2013
  20. Junio C HamanoJun 2, 2013
  21. Matthijs KooijmanJul 9, 2013
  22. Matthijs KooijmanJul 11, 2013
  23. 1/3 upload-pack: Remove a piece of dead codeMatthijs Kooijman, Jul 11, 2013
  24. 2/3 upload-pack: Introduce new "fixed-off-by-one-depth" server featureMatthijs Kooijman, Jul 11, 2013
  25. 3/3 fetch-pack: Request fixed-off-by-one-depth when availableMatthijs Kooijman, Jul 11, 2013
  26. Duy NguyenJul 11, 2013
  27. Junio C HamanoJul 11, 2013
  28. Duy NguyenJan 8, 2013
  29. Junio C HamanoJan 8, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.