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

Re: [PATCH 1/2] scalar register: add --no-maintenance option

From
Patrick Steinhardt <ps@pks.im>
Date
May 2, 2025, 09:15 UTC
Message-ID
<aBSNN6Z3Vve6c6Bm@pks.im>
In-Reply-To
<4910bacd0524a29186e673a174a47cd46ac95b5e.1746008680.git.gitgitgadget@gmail.com>
On Wed, Apr 30, 2025 at 10:24:39AM +0000, Derrick Stolee via GitGitGadget wrote:
Show 48 quoted lines
> diff --git a/Documentation/scalar.adoc b/Documentation/scalar.adoc
> index 7e4259c6743f..b2b244a86499 100644
> --- a/Documentation/scalar.adoc
> +++ b/Documentation/scalar.adoc
> @@ -11,7 +11,7 @@ SYNOPSIS
>  scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]
>  	[--[no-]src] <url> [<enlistment>]
>  scalar list
> -scalar register [<enlistment>]
> +scalar register [--[no-]maintenance] [<enlistment>]
>  scalar unregister [<enlistment>]
>  scalar run ( all | config | commit-graph | fetch | loose-objects | pack-files ) [<enlistment>]
>  scalar reconfigure [ --all | <enlistment> ]
> @@ -117,6 +117,12 @@ Note: when this subcommand is called in a worktree that is called `src/`, its
>  parent directory is considered to be the Scalar enlistment. If the worktree is
>  _not_ called `src/`, it itself will be considered to be the Scalar enlistment.
>  
> +--[no-]maintenance::
> +	By default, `scalar register` configures the enlistment to use Git's
> +	background maintenance feature. Use the `--no-maintenance` to skip
> +	this configuration. This does not disable any maintenance that may
> +	already be enabled in other ways.
> +
>  Unregister
>  ~~~~~~~~~~
>  
> diff --git a/scalar.c b/scalar.c
> index d359f08bb8e2..2a21fd55f39b 100644
> --- a/scalar.c
> +++ b/scalar.c
> @@ -259,7 +259,7 @@ static int stop_fsmonitor_daemon(void)
>  	return 0;
>  }
>  
> -static int register_dir(void)
> +static int register_dir(int maintenance)
>  {
>  	if (add_or_remove_enlistment(1))
>  		return error(_("could not add enlistment"));
> @@ -267,7 +267,7 @@ static int register_dir(void)
>  	if (set_recommended_config(0))
>  		return error(_("could not set recommended config"));
>  
> -	if (toggle_maintenance(1))
> +	if (toggle_maintenance(maintenance))
>  		warning(_("could not turn on maintenance"));
>  
>  	if (have_fsmonitor_support() && start_fsmonitor_daemon()) {

Isn't this change contrary to what the docs say? `toggle_maintenance(0)` would cause us to execute `git maintenance unregister --force`, which deregisters maintenance for us.

Show 8 quoted lines
> @@ -597,11 +597,14 @@ static int cmd_list(int argc, const char **argv UNUSED)
>  
>  static int cmd_register(int argc, const char **argv)
>  {
> +	int maintenance = 1;
>  	struct option options[] = {
> +		OPT_BOOL(0, "maintenance", &maintenance,
> +			 N_("specify if background maintenance should be enabled")),

Maybe s/if/whether/? Might just be me not being a native speaker, though.

Show 15 quoted lines
> diff --git a/t/t9210-scalar.sh b/t/t9210-scalar.sh
> index a81662713eb8..a488f72de9fe 100755
> --- a/t/t9210-scalar.sh
> +++ b/t/t9210-scalar.sh
> @@ -129,6 +129,13 @@ test_expect_success 'scalar unregister' '
>  	scalar unregister vanish
>  '
>  
> +test_expect_success 'scalar register --no-maintenance' '
> +	git init register-no-maint &&
> +	GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \
> +		scalar register --no-maintenance register-no-maint 2>err &&
> +	test_must_be_empty err
> +'
> +

We should probably have a test that verifies that we don't deregister maintenance.

Patrick
Previous: Derrick Stolee via GitGitGadgetNext: Derrick Stolee
Message 3 of 30 in “scalar: add --no-maintenance option”
  1. 0/2 scalar: add --no-maintenance optionDerrick Stolee via GitGitGadget, Apr 30, 2025
  2. 1/2 scalar register: add --no-maintenance optionDerrick Stolee via GitGitGadget, Apr 30, 2025
  3. Patrick SteinhardtMay 2, 2025
  4. Derrick StoleeMay 2, 2025
  5. 2/2 scalar clone: add --no-maintenance optionDerrick Stolee via GitGitGadget, Apr 30, 2025
  6. Junio C HamanoApr 30, 2025
  7. Derrick StoleeMay 1, 2025
  8. Junio C HamanoMay 1, 2025
  9. Junio C HamanoMay 1, 2025
  10. 0/4 scalar: add --no-maintenance optionDerrick Stolee via GitGitGadget, May 5, 2025
  11. 1/4 scalar: customize register_dir()'s behaviorDerrick Stolee via GitGitGadget, May 5, 2025
  12. 2/4 scalar register: add --no-maintenance optionDerrick Stolee via GitGitGadget, May 5, 2025
  13. 3/4 scalar clone: add --no-maintenance optionDerrick Stolee via GitGitGadget, May 5, 2025
  14. 4/4 scalar reconfigure: add --no-maintenance optionDerrick Stolee via GitGitGadget, May 5, 2025
  15. Junio C HamanoMay 5, 2025
  16. Derrick StoleeMay 6, 2025
  17. Junio C HamanoMay 6, 2025
  18. 0/4 scalar: add --no-maintenance optionDerrick Stolee via GitGitGadget, May 7, 2025
  19. 1/4 scalar: customize register_dir()'s behaviorDerrick Stolee via GitGitGadget, May 7, 2025
  20. 2/4 scalar register: add --no-maintenance optionDerrick Stolee via GitGitGadget, May 7, 2025
  21. 3/4 scalar clone: add --no-maintenance optionDerrick Stolee via GitGitGadget, May 7, 2025
  22. 4/4 scalar reconfigure: add --maintenance=<mode> optionDerrick Stolee via GitGitGadget, May 7, 2025
  23. Junio C HamanoMay 7, 2025
  24. Derrick StoleeMay 12, 2025
  25. Junio C HamanoMay 12, 2025
  26. Derrick StoleeMay 12, 2025
  27. Junio C HamanoMay 14, 2025
  28. 5/4 scalar reconfigure: improve --maintenance docsDerrick Stolee, May 14, 2025
  29. Junio C HamanoMay 14, 2025
  30. Derrick StoleeMay 16, 2025

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.