git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
	Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Derrick Stolee <derrickstolee@github.com>,
	Derrick Stolee <dstolee@microsoft.com>
Subject: Re: [PATCH] maintenance: core.commitGraph=false prevents writes
Date: Mon, 12 Oct 2020 14:40:12 -0400	[thread overview]
Message-ID: <5e2b2da5-526e-efa6-a127-7aa7a8c07c88@gmail.com> (raw)
In-Reply-To: <xmqqwnzvpd1i.fsf@gitster.c.googlers.com>

On 10/12/2020 1:30 PM, Junio C Hamano wrote:
> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
>> From: Derrick Stolee <dstolee@microsoft.com>
>>
>> Recently, a user had an issue due to combining
>> fetch.writeCommitGraph=true with core.commitGraph=false. The root bug
>> has been resolved by preventing commit-graph writes when
>> core.commitGraph is disabled. This happens inside the 'git commit-graph
>> write' command, but we can be more aware of this situation and prevent
>> that process from ever starting in the 'commit-graph' maintenance task.
>>
>> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
>> ---
>>     maintenance: core.commitGraph=false prevents writes
>>     
>>     As requested [1], this prevents the extra process when core.commitGraph
>>     is disabled.
> 
> That's not a request.  I was just wondering aloud.
> 
> If you took inspiration from my thinking aloud, that is wonderful,
> but the actual work to ensure it is not an idea that horribly breaks
> some underlying assumption I didn't know about in the code and
> deciding it is a good idea to do so is all done by you, so please
> take the credit due.

Ok, I saw your comment and I thought "no harm in dropping an extra
process." The patch to no-op the write does more work than this one,
and the commit-graph maintenance task would automatically stop
writing the file but will output a warning.

> There is a call to prepare_repo_settings() in cmd_gc().
>
> I have to wonder if it should be done much earlier and in a more
> central place, perhaps in cmd_maintenance() before anything else
> happens.  Even though commit-graph may feel somewhat special only
> because it is relatively new, it is not hard to imagine that other
> maintenance tasks (both older ones and future ones) would eventually
> want to have similar access to the feature settings.

This "prepare_" pattern is like using "prepare_packed_git()" before
iterating on the packed_git list. We use prepare_repo_settings() to
ensure they are loaded before we use the settings. If the settings are
already loaded, then prepare_repo_settings() exits quickly.

Perhaps it is worth claiming a region of code requiring that the
settings are initialized before calling, but that may lead to issues
in the future that I'd like to avoid. Having a few extra calls to
prepare_repo_settings() is the right trade-off in my opinion.

> It is OK to keep "the maintenance command works only in the single
> repository", and not passing a "repo" that cmd_maintenance() would
> prepare by calling prepare_repo_settings() down in the callchain, at
> least right now, but we might want to consider doing so in the
> future.

Removing the use of the_repository is a worthwhile discussion to
save for another day.

Thanks,
-Stolee

      reply	other threads:[~2020-10-12 18:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-12 13:28 Derrick Stolee via GitGitGadget
2020-10-12 17:30 ` Junio C Hamano
2020-10-12 18:40   ` Derrick Stolee [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=5e2b2da5-526e-efa6-a127-7aa7a8c07c88@gmail.com \
    --to=stolee@gmail.com \
    --cc=derrickstolee@github.com \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --subject='Re: [PATCH] maintenance: core.commitGraph=false prevents writes' \
    /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

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git