git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: <git@vger.kernel.org>, Jacob Keller <jacob.keller@gmail.com>,
	Lidong Yan <yldhome2d2@gmail.com>, Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH v2 1/6] remote: fix tear down of struct branch and struct remote
Date: Wed, 18 Jun 2025 10:41:52 -0700	[thread overview]
Message-ID: <119590ce-c994-4875-addc-6f395990d708@intel.com> (raw)
In-Reply-To: <xmqq1prhguu3.fsf@gitster.g>



On 6/18/2025 4:20 AM, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
> 
>> Jacob Keller <jacob.e.keller@intel.com> writes:
>>
>>> We initialize branch->merge with set_merge() which is called by
>>> branch_get() and which is the only way for callers external to remote.c
>>> of getting a branch structure.
>>>
>>> The issue is that merge_nr can be non-zero because if no caller has done
>>> a branch_get() on the given branch, we still have merge_nr is non-zero
>>> and merge is NULL.
>>
>> Meaning merge_nr and merge are both uninitialized and unlikely to be
>> 0 and NULL?  What values do they have, and if they are left
>> uninitialized, shouldn't we be initializing them to predictable
>> values?
> 
> Ah, no, I was just being stupid.
> 
> We read configuration files and accumulate things in .merge_name[]
> while incrementing .merge_nr but until set_merge() is called, .merge
> is NULL.  We need to clear .merge[] only when it is not NULL, of
> course.  And for that, it may be more readable if we had two loops.
> 
> Thanks.
> 
> 
> 

Right. I think I like my solution of just eliminating merge_names
entirely. Unfortunately it looks like my mailer marked that content as
quoted when I pasted it in as an inline diff.

  reply	other threads:[~2025-06-18 17:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-17 21:30 [PATCH v2 0/6] submodule: improve remote lookup logic Jacob Keller
2025-06-17 21:30 ` [PATCH v2 1/6] remote: fix tear down of struct branch and struct remote Jacob Keller
2025-06-17 22:25   ` Junio C Hamano
2025-06-17 23:25     ` Jacob Keller
2025-06-18  1:30       ` Junio C Hamano
2025-06-18 11:20         ` Junio C Hamano
2025-06-18 17:41           ` Jacob Keller [this message]
2025-06-18  2:44       ` Lidong Yan
2025-06-17 23:45     ` Jacob Keller
2025-06-17 21:30 ` [PATCH v2 2/6] dir: move starts_with_dot(_dot)_slash to dir.h Jacob Keller
2025-06-17 21:30 ` [PATCH v2 3/6] remote: remove the_repository from some functions Jacob Keller
2025-06-17 22:46   ` Junio C Hamano
2025-06-17 23:19     ` Jacob Keller
2025-06-17 21:30 ` [PATCH v2 4/6] submodule--helper: improve logic for fallback remote name Jacob Keller
2025-06-17 23:12   ` Junio C Hamano
2025-06-17 23:21     ` Jacob Keller
2025-06-17 21:30 ` [PATCH v2 5/6] submodule: move get_default_remote_submodule() Jacob Keller
2025-06-17 21:30 ` [PATCH v2 6/6] submodule: look up remotes by URL first Jacob Keller

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=119590ce-c994-4875-addc-6f395990d708@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jacob.keller@gmail.com \
    --cc=ps@pks.im \
    --cc=yldhome2d2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).