From 5ada0f7ff2ae21e7ea40322cd0b48baad889c8df Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Wed, 15 Oct 2025 22:24:40 +0200 Subject: [PATCH] config: deprecate git.auto-local-bookmark --- CHANGELOG.md | 7 ++++--- cli/src/config-schema.json | 5 ----- cli/src/config.rs | 14 ++++++++++++++ cli/tests/test_git_clone.rs | 1 + docs/bookmarks.md | 9 ++++++--- docs/config.md | 29 ----------------------------- docs/github.md | 4 ++-- lib/src/settings.rs | 1 + 8 files changed, 28 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c9c3f027..ae02724b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). * `jj describe --edit` is deprecated in favor of `--editor`. +* The config option `git.auto-local-bookmark` is deprecated + in favor of `remotes..auto-track-bookmarks`. See + . + ### New features * `jj commit`, `jj describe`, `jj squash`, and `jj split` now accept @@ -3112,9 +3116,6 @@ Thanks to the people who made this release happen! If the deduced tracking flags are wrong, use `jj branch track`/`untrack` commands to fix them up. - See [automatic local branch creation](docs/config.md#automatic-local-bookmark-creation) - for details. - * Non-tracking remote branches aren't listed by default. Use `jj branch list --all` to show all local and remote branches. diff --git a/cli/src/config-schema.json b/cli/src/config-schema.json index ba98e6e4e..16203e461 100644 --- a/cli/src/config-schema.json +++ b/cli/src/config-schema.json @@ -424,11 +424,6 @@ "type": "object", "description": "Settings for git behavior (when using git backend)", "properties": { - "auto-local-bookmark": { - "type": "boolean", - "description": "Whether jj creates a local bookmark with the same name when it imports a remote-tracking branch from git. See https://jj-vcs.github.io/jj/latest/config/#automatic-local-bookmark-creation", - "default": false - }, "abandon-unreachable-commits": { "type": "boolean", "description": "Whether jj should abandon commits that became unreachable in Git.", diff --git a/cli/src/config.rs b/cli/src/config.rs index 972795b55..78235470f 100644 --- a/cli/src/config.rs +++ b/cli/src/config.rs @@ -765,6 +765,20 @@ pub fn default_config_migrations() -> Vec { "core.watchman.register-snapshot-trigger", "fsmonitor.watchman.register-snapshot-trigger", ), + // TODO: Delete in jj 0.42.0+ + ConfigMigrationRule::custom( + |layer| { + let Ok(Some(val)) = layer.look_up_item("git.auto-local-bookmark") else { + return false; + }; + val.as_bool().is_some_and(|b| b) + }, + |_| { + Ok("`git.auto-local-bookmark` is deprecated; use \ + `remotes..auto-track-bookmarks` instead." + .into()) + }, + ), ] } diff --git a/cli/tests/test_git_clone.rs b/cli/tests/test_git_clone.rs index 2bde9d5bb..df36b92af 100644 --- a/cli/tests/test_git_clone.rs +++ b/cli/tests/test_git_clone.rs @@ -680,6 +680,7 @@ fn test_git_clone_remote_default_bookmark() { ]); insta::assert_snapshot!(output, @r#" ------- stderr ------- + Warning: Deprecated CLI-provided config: `git.auto-local-bookmark` is deprecated; use `remotes..auto-track-bookmarks` instead. Fetching into new repo in "$TEST_ENV/clone5" bookmark: feature1@origin [new] tracked bookmark: main@origin [new] tracked diff --git a/docs/bookmarks.md b/docs/bookmarks.md index 691f0f45b..b5a549c8c 100644 --- a/docs/bookmarks.md +++ b/docs/bookmarks.md @@ -132,7 +132,7 @@ This command omits local Git-tracking bookmarks by default. You can see if a specific bookmark is tracked with `jj bookmark list --tracked `. -### Automatic tracking of bookmarks & `git.auto-local-bookmark` option +### Automatic tracking of bookmarks & `auto-track-bookmarks` option There are two situations where `jj` tracks bookmarks automatically. `jj git clone` automatically sets up the default remote bookmark (e.g. `main@origin`) as @@ -143,11 +143,14 @@ By default, every other remote bookmark is marked as "not tracked" when it's fetched. If desired, you need to manually `jj bookmark track` them. This works well for repositories where multiple people work on a large number of bookmarks. -The default can be changed by setting the config `git.auto-local-bookmark = true`. +The default can be changed by setting the config `remotes..auto-track-bookmarks = "glob:*"`. Then, `jj git fetch` tracks every *newly fetched* bookmark with a local bookmark. Branches that already existed before the `jj git fetch` are not affected. This is similar to Mercurial, which fetches all its bookmarks (equivalent to Git's -branches) by default. +branches) by default. Similarly, all newly created local bookmarks +will be marked as "tracked", preparing them to be pushed with +the next `jj git push` command. See ["Automatic tracking of +bookmarks"](config.md#automatic-tracking-of-bookmarks) for details. ## Bookmark updates diff --git a/docs/config.md b/docs/config.md index c51a85217..badee0bf0 100644 --- a/docs/config.md +++ b/docs/config.md @@ -1499,35 +1499,6 @@ Note that unlike `git.fetch`, `git.push` can currently only be a single remote. This is not a hard limitation, and could be changed in the future if there is demand. -### Automatic local bookmark creation - -When `jj` imports a new remote-tracking bookmark from Git, it can also create a -local bookmark with the same name. This feature is disabled by default because it -may be undesirable in some repositories, e.g.: - -- There is a remote with a lot of historical bookmarks that you don't - want to be exported to the colocated Git workspace. -- There are multiple remotes with conflicting views of that bookmark, - resulting in an unhelpful conflicted state. - -You can enable this behavior by setting `git.auto-local-bookmark` like so, - -```toml -[git] -auto-local-bookmark = true -``` - -This setting is applied only to new remote bookmarks. Existing remote bookmarks -can be tracked individually by using `jj bookmark track`/`untrack` commands. - -```shell -# import feature1 bookmark and start tracking it -jj bookmark track feature1@origin -# delete local gh-pages bookmark and stop tracking it -jj bookmark delete gh-pages -jj bookmark untrack gh-pages@upstream -``` - ### Automatic tracking of bookmarks You can configure which bookmarks to track automatically per remote, using the diff --git a/docs/github.md b/docs/github.md index f6d6b5ece..9821b1fea 100644 --- a/docs/github.md +++ b/docs/github.md @@ -166,7 +166,7 @@ local bookmarks. This means that if you want to iterate or test another contributor's bookmark, you'll need to do `jj new @` onto it. If you want to import all remote bookmarks including inactive ones, set -`git.auto-local-bookmark = true` in the config file. Then you can specify a +`remotes..auto-track-bookmarks = "glob:*"` in the config file. Then you can specify a contributor's bookmark as `jj new ` instead of `jj new @`. You can find more information on that setting [here][auto-bookmark]. @@ -237,7 +237,7 @@ the [tutorial][tut]. If you're wondering why we prefer clean commits in this project, see e.g. [this blog post][stacked] -[auto-bookmark]: config.md#automatic-local-bookmark-creation +[auto-bookmark]: config.md#automatic-tracking-of-bookmarks [detached]: https://git-scm.com/docs/git-checkout#_detached_head [gh]: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent [tut]: tutorial.md#conflicts diff --git a/lib/src/settings.rs b/lib/src/settings.rs index 667102a45..366fe4471 100644 --- a/lib/src/settings.rs +++ b/lib/src/settings.rs @@ -62,6 +62,7 @@ struct UserSettingsData { #[derive(Debug, Clone)] pub struct GitSettings { + // TODO: Delete in jj 0.42.0+ pub auto_local_bookmark: bool, pub abandon_unreachable_commits: bool, pub executable_path: PathBuf,