mirror of
https://github.com/jj-vcs/jj.git
synced 2025-12-23 06:01:01 +00:00
config: deprecate git.auto-local-bookmark
This commit is contained in:
parent
e4d45dda34
commit
5ada0f7ff2
8 changed files with 28 additions and 42 deletions
|
|
@ -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.<name>.auto-track-bookmarks`. See
|
||||
<https://jj-vcs.github.io/jj/latest/config/#automatic-tracking-of-bookmarks>.
|
||||
|
||||
### 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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
|
|||
|
|
@ -765,6 +765,20 @@ pub fn default_config_migrations() -> Vec<ConfigMigrationRule> {
|
|||
"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.<name>.auto-track-bookmarks` instead."
|
||||
.into())
|
||||
},
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.<name>.auto-track-bookmarks` instead.
|
||||
Fetching into new repo in "$TEST_ENV/clone5"
|
||||
bookmark: feature1@origin [new] tracked
|
||||
bookmark: main@origin [new] tracked
|
||||
|
|
|
|||
|
|
@ -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 <bookmark name>`.
|
||||
|
||||
|
||||
### 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.<name>.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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <bookmark>@<remote>` 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.<name>.auto-track-bookmarks = "glob:*"` in the config file. Then you can specify a
|
||||
contributor's bookmark as `jj new <bookmark>` instead of `jj new <bookmark>@<remote>`.
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue