Re: [PATCH v4 3/6] clone: refactor wanted_peer_refs()
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Feb 3, 2025, 07:51 UTC
- Message-ID
- <Z6B1c1lrmK3RYzKi@pks.im>
- In-Reply-To
- <20250131-toon-clone-refs-v4-3-2a4ff851498f@iotcl.com>
On Fri, Jan 31, 2025 at 04:30:31PM +0100, Toon Claes wrote:
> The function wanted_peer_refs() is used to map the refs returned by the > server to refs we will save in our clone. > > Over time this function grown to be very complex. Refactor it.
The diff of this commit is a bit on the harder side to read, so it would be nice if the message guided the reader a bit.
Show 10 quoted lines
> Signed-off-by: Toon Claes <toon@iotcl.com> > --- > builtin/clone.c | 39 +++++++++++++++------------------------ > 1 file changed, 15 insertions(+), 24 deletions(-) > > diff --git a/builtin/clone.c b/builtin/clone.c > index 69d1ad029dfa84a2f7136fa4a3c4c8a594b179c4..d652682494d0d27dd73cd0585e28b23f2883786d 100644 > --- a/builtin/clone.c > +++ b/builtin/clone.c > @@ -434,46 +434,37 @@ static struct ref *wanted_peer_refs(const struct ref *refs,
[snip]
> - if (!option_mirror && !option_single_branch && option_tags) > + for (int i = 0; i < refspec->nr; i++)
While at it: this should be `size_t i` to match the type of `refspec->nr`.
Patrick