public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Samo Pogačnik" <samo_pogacnik@t-2•net>
To: "Patrick Steinhardt" <ps@pks•im>,
	"Samo Pogačnik via GitGitGadget" <gitgitgadget@gmail•com>
Cc: git@vger•kernel.org,
	Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail•com>
Subject: Re: [PATCH v4 2/2] shallow: handling fetch relative-deepen
Date: Sat, 14 Feb 2026 10:40:22 +0100	[thread overview]
Message-ID: <c55447544d68c3f98532b1d32183465c8f175ff8.camel@t-2.net> (raw)
In-Reply-To: <aYyGTmS6fEb2QfBU@pks.im>

[-- Attachment #1: Type: text/plain, Size: 2153 bytes --]

On Wed, 2026-02-11 at 14:38 +0100, Patrick Steinhardt wrote:
> On Fri, Jan 16, 2026 at 10:31:01PM +0000, Samo Pogačnik via GitGitGadget
> wrote:
> 
> > @@ -881,29 +838,14 @@ static void deepen(struct upload_pack_data *data, int
> > depth)
> >  			struct object *object = data-
> > >shallows.objects[i].item;
> >  			object->flags |= NOT_SHALLOW;
> >  		}
> > -	} else if (data->deepen_relative) {
> > -		struct object_array reachable_shallows = OBJECT_ARRAY_INIT;
> > -		struct commit_list *result;
> > -
> > -		/*
> > -		 * Checking for reachable shallows requires that our refs
> > be
> > -		 * marked with OUR_REF.
> > -		 */
> > -
> > 		refs_head_ref_namespaced(get_main_ref_store(the_repository),
> > -					 check_ref, data);
> > -		for_each_namespaced_ref_1(check_ref, data);
> > -
> > -		get_reachable_list(data, &reachable_shallows);
> > -		result = get_shallow_commits(&reachable_shallows,
> > -					     depth + 1,
> > -					     SHALLOW, NOT_SHALLOW);
> > -		send_shallow(data, result);
> > -		free_commit_list(result);
> > -		object_array_clear(&reachable_shallows);
> >  	} else {
> >  		struct commit_list *result;
> >  
> > -		result = get_shallow_commits(&data->want_obj, depth,
> > +		if (data->deepen_relative)
> > +			get_shallows_depth(data);
> 
> Okay, so here we now essentially call `get_shallow_commits()` twice. The
> first time we compute `data->deepen_relative`, only to then pass it back
> to `get_shallow_commits()` a second time. That feels quite strange to
> me. Can't we have `get_shallow_commits()` handle this for us directly in
> a single call?
> 
> > +		result = get_shallow_commits(&data->want_obj, NULL, NULL,
> > +					     data->deepen_relative + depth,
> >  					     SHALLOW, NOT_SHALLOW);
> >  		send_shallow(data, result);
> >  		free_commit_list(result);
> 

I have additional dilemma regarding handling this in a single call.
Wouldn't it be generally good/useful to have a separate function in shallow.c
just for measuring current absolute depth instead of blending the measurement
into get_shallow_commits()?

Thanks, Samo

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2026-02-14  9:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09 18:11 [PATCH 0/2] shallow: handling fetch relative-deepen Samo Pogačnik via GitGitGadget
2025-12-09 18:11 ` [PATCH 1/2] shallow: free local object_array allocations Samo Pogačnik via GitGitGadget
2026-01-06  7:44   ` Patrick Steinhardt
2026-01-09 16:21     ` Samo Pogačnik
2026-01-09 16:33       ` Patrick Steinhardt
2025-12-09 18:11 ` [PATCH 2/2] shallow: handling fetch relative-deepen Samo Pogačnik via GitGitGadget
2026-01-06  7:44   ` Patrick Steinhardt
2026-01-09 16:48     ` Samo Pogačnik
2026-01-09 22:23 ` [PATCH v2 0/2] " Samo Pogačnik via GitGitGadget
2026-01-09 22:23   ` [PATCH v2 1/2] shallow: free local object_array allocations Samo Pogačnik via GitGitGadget
2026-01-09 22:23   ` [PATCH v2 2/2] shallow: handling fetch relative-deepen Samo Pogačnik via GitGitGadget
2026-01-10  4:17     ` Junio C Hamano
2026-01-10  5:13   ` [PATCH v3 0/2] " Samo Pogačnik via GitGitGadget
2026-01-10  5:13     ` [PATCH v3 1/2] shallow: free local object_array allocations Samo Pogačnik via GitGitGadget
2026-01-10  5:13     ` [PATCH v3 2/2] shallow: handling fetch relative-deepen Samo Pogačnik via GitGitGadget
2026-01-15 15:50       ` Kristoffer Haugsbakk
2026-01-16 22:30     ` [PATCH v4 0/2] " Samo Pogačnik via GitGitGadget
2026-01-16 22:31       ` [PATCH v4 1/2] shallow: free local object_array allocations Samo Pogačnik via GitGitGadget
2026-01-16 22:31       ` [PATCH v4 2/2] shallow: handling fetch relative-deepen Samo Pogačnik via GitGitGadget
2026-02-11 13:38         ` Patrick Steinhardt
2026-02-13 20:48           ` Samo Pogačnik
2026-02-14  9:40           ` Samo Pogačnik [this message]
2026-02-15 11:19             ` Samo Pogačnik
2026-02-15 20:11       ` [PATCH v5 0/2] " Samo Pogačnik via GitGitGadget
2026-02-15 20:11         ` [PATCH v5 1/2] shallow: free local object_array allocations Samo Pogačnik via GitGitGadget
2026-02-15 20:11         ` [PATCH v5 2/2] shallow: handling fetch relative-deepen Samo Pogačnik via GitGitGadget
2026-02-20 22:34         ` [PATCH v5 0/2] " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c55447544d68c3f98532b1d32183465c8f175ff8.camel@t-2.net \
    --to=samo_pogacnik@t-2$(echo .)net \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitgitgadget@gmail$(echo .)com \
    --cc=kristofferhaugsbakk@fastmail$(echo .)com \
    --cc=ps@pks$(echo .)im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox