From b9317da0f88534b0efa33d98eba4c8a300d341e4 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Mon, 8 Dec 2025 18:15:03 +0900 Subject: [PATCH] cli: enable glob string matching globally The goal of this change is to unify defaults of string patterns in revsets and command arguments. Glob is a good default because it's largely the same as exact matching, and we can easily express substring patterns with globs. The hint for "jj git fetch -b" is deleted since exact: is now required in order to trigger the error. This patch also updates help of clone/fetch --branch patterns. Glob and operator support in refspecs is limited. --- CHANGELOG.md | 5 +- cli/src/cli_util.rs | 4 +- cli/src/command_error.rs | 11 +- cli/src/commands/bookmark/delete.rs | 6 +- cli/src/commands/bookmark/forget.rs | 6 +- cli/src/commands/bookmark/list.rs | 12 +- cli/src/commands/bookmark/move.rs | 6 +- cli/src/commands/bookmark/track.rs | 12 +- cli/src/commands/bookmark/untrack.rs | 12 +- cli/src/commands/git/clone.rs | 16 ++- cli/src/commands/git/fetch.rs | 23 ++-- cli/src/commands/git/push.rs | 8 +- cli/src/commands/tag/delete.rs | 6 +- cli/src/commands/tag/list.rs | 6 +- cli/src/config-schema.json | 2 +- cli/src/config.rs | 4 +- cli/tests/cli-reference@.md.snap | 64 +++++----- .../valid/experimental-advance-branches.toml | 2 +- cli/tests/test_abandon_command.rs | 2 +- cli/tests/test_advance_bookmarks.rs | 2 +- cli/tests/test_bookmark_command.rs | 85 +++++++------- cli/tests/test_builtin_aliases.rs | 2 +- cli/tests/test_commit_template.rs | 2 +- cli/tests/test_completion.rs | 2 +- cli/tests/test_git_clone.rs | 27 ++--- cli/tests/test_git_colocated.rs | 2 +- cli/tests/test_git_fetch.rs | 111 +++++++++--------- cli/tests/test_git_init.rs | 8 +- cli/tests/test_git_private_commits.rs | 6 +- cli/tests/test_git_push.rs | 34 +++--- cli/tests/test_tag_command.rs | 8 +- docs/bookmarks.md | 2 +- docs/config.md | 14 +-- docs/github.md | 5 +- docs/revsets.md | 2 +- lib/src/revset.rs | 4 +- 36 files changed, 263 insertions(+), 260 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f18715e48..7a4f63365 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Breaking changes -* [String patterns](docs/revsets.md#string-patterns) in revsets are now parsed - as globs by default. Use `substring:` prefix as needed. +* [String patterns](docs/revsets.md#string-patterns) in revsets, command + arguments, and configuration are now parsed as globs by default. Use + `substring:` or `exact:` prefix as needed. * `remotes..auto-track-bookmarks` is now parsed the same way they are in revsets and can be combined with logical operators. diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index 8c66edbc8..c9cebaa3e 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -749,7 +749,7 @@ pub struct AdvanceableBookmark { /// ```toml /// [experimental-advance-branches] /// # Enable the feature for all branches except "main". -/// enabled-branches = ["glob:*"] +/// enabled-branches = ["*"] /// disabled-branches = ["main"] /// ``` fn load_advance_bookmarks_matcher( @@ -3133,7 +3133,7 @@ impl FromStr for RemoteBookmarkNamePattern { if let Some(kind) = maybe_kind { StringPattern::from_str_kind(pat, kind).map_err(|err| err.to_string()) } else { - Ok(StringPattern::exact(pat)) + StringPattern::glob(pat).map_err(|err| err.to_string()) } }; // TODO: maybe reuse revset parser to handle bookmark/remote name containing @ diff --git a/cli/src/command_error.rs b/cli/src/command_error.rs index c560c7530..6c5dbc08d 100644 --- a/cli/src/command_error.rs +++ b/cli/src/command_error.rs @@ -598,16 +598,7 @@ jj currently does not support partial clones. To use jj with this repository, tr err, "Specify patterns in `(positive | ...) & ~(negative | ...)` form.", ), - GitRefExpansionError::InvalidBranchPattern(pattern) => { - if pattern.as_exact().is_some_and(|s| s.contains('*')) { - user_error_with_hint( - "Branch names may not include `*`.", - "Prefix the pattern with `glob:` to expand `*` as a glob", - ) - } else { - user_error(err) - } - } + GitRefExpansionError::InvalidBranchPattern(_) => user_error(err), } } } diff --git a/cli/src/commands/bookmark/delete.rs b/cli/src/commands/bookmark/delete.rs index 4a381d98f..05e56191d 100644 --- a/cli/src/commands/bookmark/delete.rs +++ b/cli/src/commands/bookmark/delete.rs @@ -37,10 +37,10 @@ use crate::ui::Ui; pub struct BookmarkDeleteArgs { /// The bookmarks to delete /// - /// By default, the specified name matches exactly. Use `glob:` prefix to - /// select bookmarks by [wildcard pattern]. + /// By default, the specified pattern matches bookmark names with glob + /// syntax. You can also use other [string pattern syntax]. /// - /// [wildcard pattern]: + /// [string pattern syntax]: /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns #[arg( required = true, diff --git a/cli/src/commands/bookmark/forget.rs b/cli/src/commands/bookmark/forget.rs index 7e4b57167..a0c11e600 100644 --- a/cli/src/commands/bookmark/forget.rs +++ b/cli/src/commands/bookmark/forget.rs @@ -47,10 +47,10 @@ pub struct BookmarkForgetArgs { include_remotes: bool, /// The bookmarks to forget /// - /// By default, the specified name matches exactly. Use `glob:` prefix to - /// select bookmarks by [wildcard pattern]. + /// By default, the specified pattern matches bookmark names with glob + /// syntax. You can also use other [string pattern syntax]. /// - /// [wildcard pattern]: + /// [string pattern syntax]: /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns #[arg( required = true, diff --git a/cli/src/commands/bookmark/list.rs b/cli/src/commands/bookmark/list.rs index 9aa90bea5..89cfdc106 100644 --- a/cli/src/commands/bookmark/list.rs +++ b/cli/src/commands/bookmark/list.rs @@ -64,10 +64,10 @@ pub struct BookmarkListArgs { /// Can be combined with `--tracked` or `--conflicted` to filter the /// bookmarks shown (can be repeated.) /// - /// By default, the specified remote name matches exactly. Use `glob:` - /// prefix to select remotes by [wildcard pattern]. + /// By default, the specified pattern matches remote names with glob syntax. + /// You can also use other [string pattern syntax]. /// - /// [wildcard pattern]: + /// [string pattern syntax]: /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns #[arg( long = "remote", @@ -88,10 +88,10 @@ pub struct BookmarkListArgs { /// Show bookmarks whose local name matches /// - /// By default, the specified name matches exactly. Use `glob:` prefix to - /// select bookmarks by [wildcard pattern]. + /// By default, the specified pattern matches bookmark names with glob + /// syntax. You can also use other [string pattern syntax]. /// - /// [wildcard pattern]: + /// [string pattern syntax]: /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns #[arg(add = ArgValueCandidates::new(complete::bookmarks))] names: Option>, diff --git a/cli/src/commands/bookmark/move.rs b/cli/src/commands/bookmark/move.rs index 3ce99ce99..e0d60eb7a 100644 --- a/cli/src/commands/bookmark/move.rs +++ b/cli/src/commands/bookmark/move.rs @@ -48,10 +48,10 @@ use crate::ui::Ui; pub struct BookmarkMoveArgs { /// Move bookmarks matching the given name patterns /// - /// By default, the specified name matches exactly. Use `glob:` prefix to - /// select bookmarks by [wildcard pattern]. + /// By default, the specified pattern matches bookmark names with glob + /// syntax. You can also use other [string pattern syntax]. /// - /// [wildcard pattern]: + /// [string pattern syntax]: /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns #[arg( group = "source", diff --git a/cli/src/commands/bookmark/track.rs b/cli/src/commands/bookmark/track.rs index 5ad71e830..be32302fa 100644 --- a/cli/src/commands/bookmark/track.rs +++ b/cli/src/commands/bookmark/track.rs @@ -44,10 +44,10 @@ use crate::ui::Ui; pub struct BookmarkTrackArgs { /// Bookmark names to track /// - /// By default, the specified name matches exactly. Use `glob:` prefix to - /// select bookmarks by [wildcard pattern]. + /// By default, the specified pattern matches bookmark names with glob + /// syntax. You can also use other [string pattern syntax]. /// - /// [wildcard pattern]: + /// [string pattern syntax]: /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns #[arg( required = true, @@ -58,13 +58,13 @@ pub struct BookmarkTrackArgs { /// Remote names to track /// - /// By default, the specified name matches exactly. Use `glob:` prefix to - /// select bookmarks by [wildcard pattern]. + /// By default, the specified pattern matches remote names with glob syntax. + /// You can also use other [string pattern syntax]. /// /// If no remote names are given, all remote bookmarks matching the bookmark /// names will be tracked. /// - /// [wildcard pattern]: + /// [string pattern syntax]: /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns #[arg(long = "remote", value_name = "REMOTE")] remotes: Option>, diff --git a/cli/src/commands/bookmark/untrack.rs b/cli/src/commands/bookmark/untrack.rs index 1b3c6e9e9..9172ae010 100644 --- a/cli/src/commands/bookmark/untrack.rs +++ b/cli/src/commands/bookmark/untrack.rs @@ -41,10 +41,10 @@ use crate::ui::Ui; pub struct BookmarkUntrackArgs { /// Bookmark names to untrack /// - /// By default, the specified name matches exactly. Use `glob:` prefix to - /// select bookmarks by [wildcard pattern]. + /// By default, the specified pattern matches bookmark names with glob + /// syntax. You can also use other [string pattern syntax]. /// - /// [wildcard pattern]: + /// [string pattern syntax]: /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns #[arg( required = true, @@ -55,13 +55,13 @@ pub struct BookmarkUntrackArgs { /// Remote names to untrack /// - /// By default, the specified name matches exactly. Use `glob:` prefix to - /// select bookmarks by [wildcard pattern]. + /// By default, the specified pattern matches remote names with glob syntax. + /// You can also use other [string pattern syntax]. /// /// If no remote names are given, all remote bookmarks matching the bookmark /// names will be untracked. /// - /// [wildcard pattern]: + /// [string pattern syntax]: /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns #[arg(long = "remote", value_name = "REMOTE")] remotes: Option>, diff --git a/cli/src/commands/git/clone.rs b/cli/src/commands/git/clone.rs index b695150fc..94ac3ec17 100644 --- a/cli/src/commands/git/clone.rs +++ b/cli/src/commands/git/clone.rs @@ -109,11 +109,17 @@ pub struct GitCloneArgs { /// If not present, all branches are fetched and the repository's default /// branch is used as parent of the working-copy change. /// - /// By default, the specified name matches exactly. Use `glob:` prefix to - /// expand `*` as a glob, e.g. `--branch 'glob:push-*'`. Other wildcard - /// characters such as `?` are *not* supported. Can be repeated to specify - /// multiple branches, in which case the first exact branch name is used as - /// the working-copy parent. + /// By default, the specified pattern matches branch names with glob syntax, + /// but only `*` is expanded. Other wildcard characters such as `?` are + /// *not* supported. Patterns can be repeated or combined with [logical + /// operators] to specify multiple branches, but only union and negative + /// intersection are supported. If there are multiple matching branches, the + /// first exact branch name is used as the working-copy parent. + /// + /// Examples: `push-*`, `(push-* | foo/*) ~ foo/unwanted` + /// + /// [logical operators]: + /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns #[arg(long, short, alias = "bookmark")] branch: Option>, } diff --git a/cli/src/commands/git/fetch.rs b/cli/src/commands/git/fetch.rs index 43cb1df58..a9ca6d121 100644 --- a/cli/src/commands/git/fetch.rs +++ b/cli/src/commands/git/fetch.rs @@ -51,10 +51,16 @@ use crate::ui::Ui; pub struct GitFetchArgs { /// Fetch only some of the branches /// - /// By default, the specified name matches exactly. Use `glob:` prefix to - /// expand `*` as a glob, e.g. `--branch 'glob:push-*'`. Other wildcard - /// characters such as `?` are *not* supported. Can be repeated to specify - /// multiple branches. + /// By default, the specified pattern matches branch names with glob syntax, + /// but only `*` is expanded. Other wildcard characters such as `?` are + /// *not* supported. Patterns can be repeated or combined with [logical + /// operators] to specify multiple branches, but only union and negative + /// intersection are supported. + /// + /// Examples: `push-*`, `(push-* | foo/*) ~ foo/unwanted` + /// + /// [logical operators]: + /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns #[arg( long, short, alias = "bookmark", @@ -73,12 +79,11 @@ pub struct GitFetchArgs { /// This defaults to the `git.fetch` setting. If that is not configured, and /// if there are multiple remotes, the remote named "origin" will be used. /// - /// By default, the specified remote names matches exactly. Use a [string - /// pattern], e.g. `--remote 'glob:*'`, to select remotes using - /// patterns. + /// By default, the specified pattern matches remote names with glob syntax, + /// e.g. `--remote '*'`. You can also use other [string pattern syntax]. /// - /// [string pattern]: - /// https://docs.jj-vcs.dev/latest/revsets#string-patterns + /// [string pattern syntax]: + /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns #[arg( long = "remote", value_name = "REMOTE", diff --git a/cli/src/commands/git/push.rs b/cli/src/commands/git/push.rs index 5139ee81e..6f77ad21e 100644 --- a/cli/src/commands/git/push.rs +++ b/cli/src/commands/git/push.rs @@ -107,11 +107,11 @@ pub struct GitPushArgs { /// Push only this bookmark, or bookmarks matching a pattern (can be /// repeated) /// - /// By default, the specified name matches exactly. Use `glob:` prefix to - /// select bookmarks by [wildcard pattern]. + /// By default, the specified pattern matches bookmark names with glob + /// syntax. You can also use other [string pattern syntax]. /// - /// [wildcard pattern]: - /// https://docs.jj-vcs.dev/latest/revsets#string-patterns + /// [string pattern syntax]: + /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns #[arg( long, short, alias = "branch", diff --git a/cli/src/commands/tag/delete.rs b/cli/src/commands/tag/delete.rs index be327293e..9cea75417 100644 --- a/cli/src/commands/tag/delete.rs +++ b/cli/src/commands/tag/delete.rs @@ -30,10 +30,10 @@ use crate::ui::Ui; pub struct TagDeleteArgs { /// Tag names to delete /// - /// By default, the specified name matches exactly. Use `glob:` prefix to - /// select tags by [wildcard pattern]. + /// By default, the specified pattern matches tag names with glob syntax. + /// You can also use other [string pattern syntax]. /// - /// [wildcard pattern]: + /// [string pattern syntax]: /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns #[arg( required = true, diff --git a/cli/src/commands/tag/list.rs b/cli/src/commands/tag/list.rs index 5471581cb..b75546075 100644 --- a/cli/src/commands/tag/list.rs +++ b/cli/src/commands/tag/list.rs @@ -31,10 +31,10 @@ use crate::ui::Ui; pub struct TagListArgs { /// Show tags whose local name matches /// - /// By default, the specified name matches exactly. Use `glob:` prefix to - /// select tags by [wildcard pattern]. + /// By default, the specified pattern matches tag names with glob syntax. + /// You can also use other [string pattern syntax]. /// - /// [wildcard pattern]: + /// [string pattern syntax]: /// https://docs.jj-vcs.dev/latest/revsets/#string-patterns pub names: Option>, /// Render each tag using the given template diff --git a/cli/src/config-schema.json b/cli/src/config-schema.json index 052fd0ab5..558466c3a 100644 --- a/cli/src/config-schema.json +++ b/cli/src/config-schema.json @@ -498,7 +498,7 @@ "auto-track-bookmarks": { "type": "string", "description": "A string pattern describing the bookmarks to automatically track with this remote. It will be applied to any new bookmark, created or fetched. See https://docs.jj-vcs.dev/latest/config/#automatic-tracking-of-bookmarks", - "default": "~glob:*" + "default": "~*" } } } diff --git a/cli/src/config.rs b/cli/src/config.rs index ac51432d1..e7bb3f8d0 100644 --- a/cli/src/config.rs +++ b/cli/src/config.rs @@ -741,7 +741,7 @@ pub fn default_config_migrations() -> Vec { |_| { Ok("`git.auto-local-bookmark` is deprecated; use \ `remotes..auto-track-bookmarks` instead. -Example: jj config set --user remotes.origin.auto-track-bookmarks 'glob:*' +Example: jj config set --user remotes.origin.auto-track-bookmarks '*' For details, see: https://docs.jj-vcs.dev/latest/config/#automatic-tracking-of-bookmarks" .into()) }, @@ -757,7 +757,7 @@ For details, see: https://docs.jj-vcs.dev/latest/config/#automatic-tracking-of-b |_| { Ok("`git.push-new-bookmarks` is deprecated; use \ `remotes..auto-track-bookmarks` instead. -Example: jj config set --user remotes.origin.auto-track-bookmarks 'glob:*' +Example: jj config set --user remotes.origin.auto-track-bookmarks '*' For details, see: https://docs.jj-vcs.dev/latest/config/#automatic-tracking-of-bookmarks" .into()) }, diff --git a/cli/tests/cli-reference@.md.snap b/cli/tests/cli-reference@.md.snap index d02ff709d..521caa141 100644 --- a/cli/tests/cli-reference@.md.snap +++ b/cli/tests/cli-reference@.md.snap @@ -392,9 +392,9 @@ If you don't want the deletion of the local bookmark to propagate to any tracked * `` — The bookmarks to delete - By default, the specified name matches exactly. Use `glob:` prefix to select bookmarks by [wildcard pattern]. + By default, the specified pattern matches bookmark names with glob syntax. You can also use other [string pattern syntax]. - [wildcard pattern]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns + [string pattern syntax]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns @@ -412,9 +412,9 @@ If a local bookmark is forgotten, any corresponding remote bookmarks will become * `` — The bookmarks to forget - By default, the specified name matches exactly. Use `glob:` prefix to select bookmarks by [wildcard pattern]. + By default, the specified pattern matches bookmark names with glob syntax. You can also use other [string pattern syntax]. - [wildcard pattern]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns + [string pattern syntax]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns ###### **Options:** @@ -442,9 +442,9 @@ See [`jj help -k bookmarks`] for more information. * `` — Show bookmarks whose local name matches - By default, the specified name matches exactly. Use `glob:` prefix to select bookmarks by [wildcard pattern]. + By default, the specified pattern matches bookmark names with glob syntax. You can also use other [string pattern syntax]. - [wildcard pattern]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns + [string pattern syntax]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns ###### **Options:** @@ -453,9 +453,9 @@ See [`jj help -k bookmarks`] for more information. Can be combined with `--tracked` or `--conflicted` to filter the bookmarks shown (can be repeated.) - By default, the specified remote name matches exactly. Use `glob:` prefix to select remotes by [wildcard pattern]. + By default, the specified pattern matches remote names with glob syntax. You can also use other [string pattern syntax]. - [wildcard pattern]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns + [string pattern syntax]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns * `-t`, `--tracked` — Show remote tracked bookmarks only. Omits local Git-tracking bookmarks by default * `-c`, `--conflicted` — Show conflicted bookmarks only * `-r`, `--revisions ` — Show bookmarks whose local targets are in the given revisions @@ -499,9 +499,9 @@ $ jj bookmark move --from 'heads(::@- & bookmarks())' --to @- * `` — Move bookmarks matching the given name patterns - By default, the specified name matches exactly. Use `glob:` prefix to select bookmarks by [wildcard pattern]. + By default, the specified pattern matches bookmark names with glob syntax. You can also use other [string pattern syntax]. - [wildcard pattern]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns + [string pattern syntax]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns ###### **Options:** @@ -565,19 +565,19 @@ A tracking remote bookmark will be imported as a local bookmark of the same name * `` — Bookmark names to track - By default, the specified name matches exactly. Use `glob:` prefix to select bookmarks by [wildcard pattern]. + By default, the specified pattern matches bookmark names with glob syntax. You can also use other [string pattern syntax]. - [wildcard pattern]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns + [string pattern syntax]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns ###### **Options:** * `--remote ` — Remote names to track - By default, the specified name matches exactly. Use `glob:` prefix to select bookmarks by [wildcard pattern]. + By default, the specified pattern matches remote names with glob syntax. You can also use other [string pattern syntax]. If no remote names are given, all remote bookmarks matching the bookmark names will be tracked. - [wildcard pattern]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns + [string pattern syntax]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns @@ -595,19 +595,19 @@ If you want to forget a local bookmark while also untracking the corresponding r * `` — Bookmark names to untrack - By default, the specified name matches exactly. Use `glob:` prefix to select bookmarks by [wildcard pattern]. + By default, the specified pattern matches bookmark names with glob syntax. You can also use other [string pattern syntax]. - [wildcard pattern]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns + [string pattern syntax]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns ###### **Options:** * `--remote ` — Remote names to untrack - By default, the specified name matches exactly. Use `glob:` prefix to select bookmarks by [wildcard pattern]. + By default, the specified pattern matches remote names with glob syntax. You can also use other [string pattern syntax]. If no remote names are given, all remote bookmarks matching the bookmark names will be untracked. - [wildcard pattern]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns + [string pattern syntax]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns @@ -1416,7 +1416,11 @@ Create a new repo backed by a clone of a Git repo If not present, all branches are fetched and the repository's default branch is used as parent of the working-copy change. - By default, the specified name matches exactly. Use `glob:` prefix to expand `*` as a glob, e.g. `--branch 'glob:push-*'`. Other wildcard characters such as `?` are *not* supported. Can be repeated to specify multiple branches, in which case the first exact branch name is used as the working-copy parent. + By default, the specified pattern matches branch names with glob syntax, but only `*` is expanded. Other wildcard characters such as `?` are *not* supported. Patterns can be repeated or combined with [logical operators] to specify multiple branches, but only union and negative intersection are supported. If there are multiple matching branches, the first exact branch name is used as the working-copy parent. + + Examples: `push-*`, `(push-* | foo/*) ~ foo/unwanted` + + [logical operators]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns @@ -1484,7 +1488,11 @@ If a working-copy commit gets abandoned, it will be given a new, empty commit. T * `-b`, `--branch ` — Fetch only some of the branches - By default, the specified name matches exactly. Use `glob:` prefix to expand `*` as a glob, e.g. `--branch 'glob:push-*'`. Other wildcard characters such as `?` are *not* supported. Can be repeated to specify multiple branches. + By default, the specified pattern matches branch names with glob syntax, but only `*` is expanded. Other wildcard characters such as `?` are *not* supported. Patterns can be repeated or combined with [logical operators] to specify multiple branches, but only union and negative intersection are supported. + + Examples: `push-*`, `(push-* | foo/*) ~ foo/unwanted` + + [logical operators]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns * `--tracked` — Fetch only tracked bookmarks This fetches only bookmarks that are already tracked from the specified remote(s). @@ -1492,9 +1500,9 @@ If a working-copy commit gets abandoned, it will be given a new, empty commit. T This defaults to the `git.fetch` setting. If that is not configured, and if there are multiple remotes, the remote named "origin" will be used. - By default, the specified remote names matches exactly. Use a [string pattern], e.g. `--remote 'glob:*'`, to select remotes using patterns. + By default, the specified pattern matches remote names with glob syntax, e.g. `--remote '*'`. You can also use other [string pattern syntax]. - [string pattern]: https://docs.jj-vcs.dev/latest/revsets#string-patterns + [string pattern syntax]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns * `--all-remotes` — Fetch from all remotes @@ -1576,9 +1584,9 @@ Before the command actually moves, creates, or deletes a remote bookmark, it mak This defaults to the `git.push` setting. If that is not configured, and if there are multiple remotes, the remote named "origin" will be used. * `-b`, `--bookmark ` — Push only this bookmark, or bookmarks matching a pattern (can be repeated) - By default, the specified name matches exactly. Use `glob:` prefix to select bookmarks by [wildcard pattern]. + By default, the specified pattern matches bookmark names with glob syntax. You can also use other [string pattern syntax]. - [wildcard pattern]: https://docs.jj-vcs.dev/latest/revsets#string-patterns + [string pattern syntax]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns * `--all` — Push all bookmarks (including new bookmarks) * `--tracked` — Push all tracked bookmarks @@ -2980,9 +2988,9 @@ Revisions referred to by the deleted tags are not abandoned. * `` — Tag names to delete - By default, the specified name matches exactly. Use `glob:` prefix to select tags by [wildcard pattern]. + By default, the specified pattern matches tag names with glob syntax. You can also use other [string pattern syntax]. - [wildcard pattern]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns + [string pattern syntax]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns @@ -2998,9 +3006,9 @@ List tags * `` — Show tags whose local name matches - By default, the specified name matches exactly. Use `glob:` prefix to select tags by [wildcard pattern]. + By default, the specified pattern matches tag names with glob syntax. You can also use other [string pattern syntax]. - [wildcard pattern]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns + [string pattern syntax]: https://docs.jj-vcs.dev/latest/revsets/#string-patterns ###### **Options:** diff --git a/cli/tests/sample-configs/valid/experimental-advance-branches.toml b/cli/tests/sample-configs/valid/experimental-advance-branches.toml index 3e666ebec..b14930f1e 100644 --- a/cli/tests/sample-configs/valid/experimental-advance-branches.toml +++ b/cli/tests/sample-configs/valid/experimental-advance-branches.toml @@ -1,4 +1,4 @@ #:schema ../../../src/config-schema.json [experimental-advance-branches] -enabled-branches = ["glob:push-*"] +enabled-branches = ["push-*"] disabled-branches = ["exact:main", "exact:master", "exact:trunk"] diff --git a/cli/tests/test_abandon_command.rs b/cli/tests/test_abandon_command.rs index 8ed1a8973..f5dfefb46 100644 --- a/cli/tests/test_abandon_command.rs +++ b/cli/tests/test_abandon_command.rs @@ -484,7 +484,7 @@ fn test_abandon_tracking_bookmarks() { "git", "clone", "--colocate", - "--config=remotes.origin.auto-track-bookmarks='glob:*'", + "--config=remotes.origin.auto-track-bookmarks='*'", "remote/.jj/repo/store/git", "local", ], diff --git a/cli/tests/test_advance_bookmarks.rs b/cli/tests/test_advance_bookmarks.rs index 5dff6fdbf..81310f4f6 100644 --- a/cli/tests/test_advance_bookmarks.rs +++ b/cli/tests/test_advance_bookmarks.rs @@ -30,7 +30,7 @@ fn set_advance_bookmarks(test_env: &TestEnvironment, enabled: bool) { if enabled { test_env.add_config( r#"[experimental-advance-branches] - enabled-branches = ["glob:*"] + enabled-branches = ["*"] "#, ); } else { diff --git a/cli/tests/test_bookmark_command.rs b/cli/tests/test_bookmark_command.rs index b421cf0bd..2c91e58fe 100644 --- a/cli/tests/test_bookmark_command.rs +++ b/cli/tests/test_bookmark_command.rs @@ -411,7 +411,7 @@ fn test_bookmark_move_matching() { "); let setup_opid = work_dir.current_operation_id(); - // The default could be considered "--from=all() glob:*", but is disabled + // The default could be considered "--from=all() *", but is disabled let output = work_dir.run_jj(["bookmark", "move"]); insta::assert_snapshot!(output, @r" ------- stderr ------- @@ -434,7 +434,7 @@ fn test_bookmark_move_matching() { "); // No matching bookmarks within the source revisions - let output = work_dir.run_jj(["bookmark", "move", "--from=::@", "glob:'a?'"]); + let output = work_dir.run_jj(["bookmark", "move", "--from=::@", "'a?'"]); insta::assert_snapshot!(output, @r" ------- stderr ------- No bookmarks to update. @@ -489,7 +489,7 @@ fn test_bookmark_move_matching() { work_dir.run_jj(["op", "restore", &setup_opid]).success(); // Try to move multiple bookmarks, but one of them isn't fast-forward - let output = work_dir.run_jj(["bookmark", "move", "glob:'?1'"]); + let output = work_dir.run_jj(["bookmark", "move", "'?1'"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Error: Refusing to move bookmark backwards or sideways: a1 @@ -509,7 +509,7 @@ fn test_bookmark_move_matching() { "); // Select by revision and name - let output = work_dir.run_jj(["bookmark", "move", "--from=::a1+", "--to=a1+", "glob:'?1'"]); + let output = work_dir.run_jj(["bookmark", "move", "--from=::a1+", "--to=a1+", "'?1'"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Moved 1 bookmarks to kkmpptxz 9328ecc5 a1 | (empty) head1 @@ -721,14 +721,14 @@ fn test_bookmark_forget_glob() { ◆ 000000000000 [EOF] "); - let output = work_dir.run_jj(["bookmark", "forget", "glob:'foo-[1-3]'"]); + let output = work_dir.run_jj(["bookmark", "forget", "'foo-[1-3]'"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Forgot 2 local bookmarks. [EOF] "); work_dir.run_jj(["op", "restore", &setup_opid]).success(); - let output = work_dir.run_jj(["bookmark", "forget", "glob:'foo-[1-3]'"]); + let output = work_dir.run_jj(["bookmark", "forget", "'foo-[1-3]'"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Forgot 2 local bookmarks. @@ -742,7 +742,7 @@ fn test_bookmark_forget_glob() { // Forgetting a bookmark via both explicit name and glob pattern, or with // multiple glob patterns, shouldn't produce an error. - let output = work_dir.run_jj(["bookmark", "forget", "foo-4", "glob:foo-*", "glob:foo-*"]); + let output = work_dir.run_jj(["bookmark", "forget", "foo-4", "foo-*", "foo-*"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Forgot 1 local bookmarks. @@ -772,7 +772,7 @@ fn test_bookmark_forget_glob() { "); // None of the globs match anything - let output = work_dir.run_jj(["bookmark", "forget", "glob:baz*", "glob:boom*"]); + let output = work_dir.run_jj(["bookmark", "forget", "baz*", "boom*"]); insta::assert_snapshot!(output, @r" ------- stderr ------- No bookmarks to forget. @@ -817,14 +817,14 @@ fn test_bookmark_delete_glob() { ◆ 000000000000 [EOF] "); - let output = work_dir.run_jj(["bookmark", "delete", "glob:'foo-[1-3]'"]); + let output = work_dir.run_jj(["bookmark", "delete", "'foo-[1-3]'"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Deleted 2 bookmarks. [EOF] "); work_dir.run_jj(["op", "restore", &setup_opid]).success(); - let output = work_dir.run_jj(["bookmark", "delete", "glob:'foo-[1-3]'"]); + let output = work_dir.run_jj(["bookmark", "delete", "'foo-[1-3]'"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Deleted 2 bookmarks. @@ -838,7 +838,7 @@ fn test_bookmark_delete_glob() { // We get an error if none of the globs match live bookmarks. Unlike `jj // bookmark forget`, it's not allowed to delete already deleted bookmarks. - let output = work_dir.run_jj(["bookmark", "delete", "glob:'foo-[1-3]'"]); + let output = work_dir.run_jj(["bookmark", "delete", "'foo-[1-3]'"]); insta::assert_snapshot!(output, @r" ------- stderr ------- No bookmarks to delete. @@ -847,7 +847,7 @@ fn test_bookmark_delete_glob() { // Deleting a bookmark via both explicit name and glob pattern, or with // multiple glob patterns, shouldn't produce an error. - let output = work_dir.run_jj(["bookmark", "delete", "foo-4", "glob:foo-*", "glob:foo-*"]); + let output = work_dir.run_jj(["bookmark", "delete", "foo-4", "foo-*", "foo-*"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Deleted 2 bookmarks. @@ -984,7 +984,7 @@ fn test_bookmark_forget_fetched_bookmark() { // Set up a git repo with a bookmark and a jj repo that has it as a remote. let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); let git_repo_path = test_env.env_root().join("git-repo"); @@ -1131,7 +1131,7 @@ fn test_bookmark_forget_deleted_or_nonexistent_bookmark() { // ======== Beginning of test setup ======== // Set up a git repo with a bookmark and a jj repo that has it as a remote. let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); let git_repo_path = test_env.env_root().join("git-repo"); @@ -1209,7 +1209,7 @@ fn test_bookmark_track_untrack() { "refs/heads/feature2", ], ); - test_env.add_config("remotes.origin.auto-track-bookmarks = '~glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '~*'"); let output = work_dir.run_jj(["git", "fetch"]); insta::assert_snapshot!(output, @r" ------- stderr ------- @@ -1353,7 +1353,7 @@ fn test_bookmark_track_untrack() { "refs/heads/feature3", ], ); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let output = work_dir.run_jj(["git", "fetch"]); insta::assert_snapshot!(output, @r" ------- stderr ------- @@ -1495,7 +1495,7 @@ fn test_bookmark_track_untrack_patterns() { ); // Fetch new commit without auto tracking - test_env.add_config("remotes.origin.auto-track-bookmarks = '~glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '~*'"); let output = work_dir.run_jj(["git", "fetch"]); insta::assert_snapshot!(output, @r" ------- stderr ------- @@ -1517,7 +1517,7 @@ fn test_bookmark_track_untrack_patterns() { [EOF] "); insta::assert_snapshot!( - work_dir.run_jj(["bookmark", "untrack", "main", "--remote=glob:o*"]), @r" + work_dir.run_jj(["bookmark", "untrack", "main", "--remote=o*"]), @r" ------- stderr ------- Warning: Remote bookmark not tracked yet: main@origin Nothing changed. @@ -1525,13 +1525,13 @@ fn test_bookmark_track_untrack_patterns() { "); // Track/untrack unknown bookmark - insta::assert_snapshot!(work_dir.run_jj(["bookmark", "track", "glob:maine*"]), @r" + insta::assert_snapshot!(work_dir.run_jj(["bookmark", "track", "maine*"]), @r" ------- stderr ------- Nothing changed. [EOF] "); insta::assert_snapshot!( - work_dir.run_jj(["bookmark", "untrack", "maine", "--remote=glob:o* | unknown"]), @r" + work_dir.run_jj(["bookmark", "untrack", "maine", "--remote=o* | unknown"]), @r" ------- stderr ------- Warning: No matching bookmarks for names: maine Warning: No matching remotes for names: unknown @@ -1593,7 +1593,7 @@ fn test_bookmark_track_untrack_patterns() { "); // Untrack by pattern - let output = work_dir.run_jj(["bookmark", "untrack", "~glob:main", "--remote=glob:*"]); + let output = work_dir.run_jj(["bookmark", "untrack", "~main", "--remote=*"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Warning: Git-tracking bookmark cannot be untracked: feature1@git @@ -1613,12 +1613,7 @@ fn test_bookmark_track_untrack_patterns() { "); // Track by pattern - let output = work_dir.run_jj([ - "bookmark", - "track", - "glob:'feature?' | main", - "--remote=~git", - ]); + let output = work_dir.run_jj(["bookmark", "track", "'feature?' | main", "--remote=~git"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Warning: Remote bookmark already tracked: main@origin @@ -1674,7 +1669,7 @@ fn test_bookmark_track_absent() { // Track feature1: remote2 isn't tracked because there's no local bookmark insta::assert_snapshot!( - work_dir.run_jj(["bookmark", "track", "feature1", "--remote=glob:*"]), @r" + work_dir.run_jj(["bookmark", "track", "feature1", "--remote=*"]), @r" ------- stderr ------- Started tracking 1 remote bookmarks. [EOF] @@ -1687,7 +1682,7 @@ fn test_bookmark_track_absent() { // Track feature1 again: remote2 is now tracked insta::assert_snapshot!( - work_dir.run_jj(["bookmark", "track", "feature1", "--remote=glob:*"]), @r" + work_dir.run_jj(["bookmark", "track", "feature1", "--remote=*"]), @r" ------- stderr ------- Warning: Remote bookmark already tracked: feature1@remote1 Started tracking 1 remote bookmarks. @@ -1705,7 +1700,7 @@ fn test_bookmark_track_absent() { .run_jj(["bookmark", "create", "new-feature"]) .success(); insta::assert_snapshot!( - work_dir.run_jj(["bookmark", "track", "new-feature", "--remote=glob:*"]), @r" + work_dir.run_jj(["bookmark", "track", "new-feature", "--remote=*"]), @r" ------- stderr ------- Started tracking 2 remote bookmarks. [EOF] @@ -1724,7 +1719,7 @@ fn test_bookmark_track_absent() { #[test] fn test_bookmark_list() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); // Initialize remote refs test_env.run_jj_in(".", ["git", "init", "remote"]).success(); @@ -1760,7 +1755,7 @@ fn test_bookmark_list() { .success(); local_dir .run_jj([ - "--config=remotes.origin.auto-track-bookmarks='~glob:*'", + "--config=remotes.origin.auto-track-bookmarks='~*'", "bookmark", "create", "local-only", @@ -1981,7 +1976,7 @@ fn test_bookmark_list() { #[test] fn test_bookmark_list_filtered() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); test_env.add_config(r#"revset-aliases."immutable_heads()" = "none()""#); // Initialize remote refs @@ -2013,7 +2008,7 @@ fn test_bookmark_list_filtered() { .success(); local_dir .run_jj([ - "--config=remotes.origin.auto-track-bookmarks='~glob:*'", + "--config=remotes.origin.auto-track-bookmarks='~*'", "bookmark", "create", "local-keep", @@ -2122,7 +2117,7 @@ fn test_bookmark_list_filtered() { Hint: Bookmarks marked as deleted can be *deleted permanently* on the remote by running `jj git push --deleted`. Use `jj bookmark forget` if you don't want that. [EOF] "); - insta::assert_snapshot!(query(&["--remote", "glob:'gi?'"]), @r" + insta::assert_snapshot!(query(&["--remote", "'gi?'"]), @r" local-keep: kpqxywon 4b2bc95c (empty) local-keep @git: kpqxywon 4b2bc95c (empty) local-keep remote-keep: rlvkpnrz c2f2ee40 (empty) remote-keep @@ -2167,7 +2162,7 @@ fn test_bookmark_list_filtered() { "); // Name patterns are OR-ed. - insta::assert_snapshot!(query(&["glob:*-keep", "glob:remote-* & glob:*-delete"]), @r" + insta::assert_snapshot!(query(&["*-keep", "remote-* & *-delete"]), @r" local-keep: kpqxywon 4b2bc95c (empty) local-keep remote-delete (deleted) @origin: zsuskuln 0e6b7968 (empty) remote-delete @@ -2181,7 +2176,7 @@ fn test_bookmark_list_filtered() { // Unmatched exact name pattern should be warned. "remote-delete" exists in // remote. "remote-rewrite" exists, but isn't included in the match. insta::assert_snapshot!( - query(&["local-keep", "glob:push-*", "unknown | remote-delete ~ remote-rewrite"]), @r" + query(&["local-keep", "push-*", "unknown | remote-delete ~ remote-rewrite"]), @r" local-keep: kpqxywon 4b2bc95c (empty) local-keep remote-delete (deleted) @origin: zsuskuln 0e6b7968 (empty) remote-delete @@ -2265,7 +2260,7 @@ fn test_bookmark_list_quoted_name() { #[test] fn test_bookmark_list_much_remote_divergence() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); // Initialize remote refs test_env.run_jj_in(".", ["git", "init", "remote"]).success(); @@ -2300,7 +2295,7 @@ fn test_bookmark_list_much_remote_divergence() { } local_dir .run_jj([ - "--config=remotes.origin.auto-track-bookmarks='~glob:*'", + "--config=remotes.origin.auto-track-bookmarks='~*'", "bookmark", "create", "local-only", @@ -2324,8 +2319,8 @@ fn test_bookmark_list_much_remote_divergence() { #[test] fn test_bookmark_list_tracked() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); - test_env.add_config("remotes.upstream.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); + test_env.add_config("remotes.upstream.auto-track-bookmarks = '*'"); // Initialize remote refs test_env.run_jj_in(".", ["git", "init", "remote"]).success(); @@ -2400,8 +2395,8 @@ fn test_bookmark_list_tracked() { .success(); local_dir .run_jj([ - "--config=remotes.origin.auto-track-bookmarks='~glob:*'", - "--config=remotes.upstream.auto-track-bookmarks='~glob:*'", + "--config=remotes.origin.auto-track-bookmarks='~*'", + "--config=remotes.upstream.auto-track-bookmarks='~*'", "bookmark", "create", "local-only", @@ -2667,9 +2662,9 @@ fn test_create_and_set_auto_track_bookmarks() { test_env.add_config( " [remotes.origin] - auto-track-bookmarks = 'glob:mine/*' + auto-track-bookmarks = 'mine/*' [remotes.fork] - auto-track-bookmarks = 'glob:mine/* | glob:not-mine/*' + auto-track-bookmarks = 'mine/* | not-mine/*' ", ); diff --git a/cli/tests/test_builtin_aliases.rs b/cli/tests/test_builtin_aliases.rs index 758f4755a..6fd2d1840 100644 --- a/cli/tests/test_builtin_aliases.rs +++ b/cli/tests/test_builtin_aliases.rs @@ -45,7 +45,7 @@ fn set_up(trunk_name: &str) -> TestEnvironment { [ "git", "clone", - "--config=remotes.origin.auto-track-bookmarks='glob:*'", + "--config=remotes.origin.auto-track-bookmarks='*'", origin_git_repo_path.to_str().unwrap(), "local", ], diff --git a/cli/tests/test_commit_template.rs b/cli/tests/test_commit_template.rs index 182231431..968b116e2 100644 --- a/cli/tests/test_commit_template.rs +++ b/cli/tests/test_commit_template.rs @@ -656,7 +656,7 @@ fn test_log_bookmarks() { // Track all remote bookmarks, rewrite bookmark1, move bookmark2 forward, // create conflict in bookmark3, add new-bookmark - work_dir.run_jj(["bookmark", "track", "glob:*"]).success(); + work_dir.run_jj(["bookmark", "track", "*"]).success(); work_dir .run_jj(["describe", "bookmark1", "-m", "modified bookmark1 commit"]) .success(); diff --git a/cli/tests/test_completion.rs b/cli/tests/test_completion.rs index 1e2b54238..74b156413 100644 --- a/cli/tests/test_completion.rs +++ b/cli/tests/test_completion.rs @@ -173,7 +173,7 @@ fn test_bookmark_names() { .success(); work_dir - .run_jj(["bookmark", "track", "--remote=origin", "glob:*-tracked"]) + .run_jj(["bookmark", "track", "--remote=origin", "*-tracked"]) .success(); work_dir .run_jj(["bookmark", "track", "--remote=upstream", "aaa-tracked"]) diff --git a/cli/tests/test_git_clone.rs b/cli/tests/test_git_clone.rs index 136f1f12b..3bd427b99 100644 --- a/cli/tests/test_git_clone.rs +++ b/cli/tests/test_git_clone.rs @@ -43,7 +43,7 @@ fn set_up_git_repo_with_file(git_repo: &gix::Repository, filename: &str) { fn test_git_clone() { let test_env = TestEnvironment::default(); let root_dir = test_env.work_dir(""); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let git_repo_path = test_env.env_root().join("source"); let git_repo = git::init(git_repo_path); @@ -208,7 +208,7 @@ fn test_git_clone_bad_source() { fn test_git_clone_colocate() { let test_env = TestEnvironment::default(); let root_dir = test_env.work_dir(""); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let git_repo_path = test_env.env_root().join("source"); let git_repo = git::init(git_repo_path); @@ -582,8 +582,8 @@ fn test_git_clone_remote_default_bookmark() { ) .unwrap(); - // All fetched bookmarks will be imported if auto-track-bookmarks = 'glob:*' - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + // All fetched bookmarks will be imported if auto-track-bookmarks = '*' + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let output = root_dir.run_jj(["git", "clone", "source", "clone1"]); insta::assert_snapshot!(output, @r#" ------- stderr ------- @@ -612,9 +612,8 @@ fn test_git_clone_remote_default_bookmark() { [EOF] "#); - // Only the default bookmark will be imported if auto-track-bookmarks = - // '~glob:*' - test_env.add_config("remotes.origin.auto-track-bookmarks = '~glob:*'"); + // Only the default bookmark will be imported if auto-track-bookmarks = '~*' + test_env.add_config("remotes.origin.auto-track-bookmarks = '~*'"); let output = root_dir.run_jj(["git", "clone", "source", "clone2"]); insta::assert_snapshot!(output, @r#" ------- stderr ------- @@ -703,7 +702,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. - Example: jj config set --user remotes.origin.auto-track-bookmarks 'glob:*' + Example: jj config set --user remotes.origin.auto-track-bookmarks '*' For details, see: https://docs.jj-vcs.dev/latest/config/#automatic-tracking-of-bookmarks Fetching into new repo in "$TEST_ENV/clone5" bookmark: feature1@origin [new] tracked @@ -827,7 +826,7 @@ fn test_git_clone_at_operation() { fn test_git_clone_with_remote_name() { let test_env = TestEnvironment::default(); let root_dir = test_env.work_dir(""); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let git_repo_path = test_env.env_root().join("source"); let git_repo = git::init(git_repo_path); set_up_non_empty_git_repo(&git_repo); @@ -1013,7 +1012,7 @@ fn test_git_clone_conditional_config() { fn test_git_clone_with_depth() { let test_env = TestEnvironment::default(); let root_dir = test_env.work_dir(""); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let clone_dir = test_env.work_dir("clone"); let git_repo_path = test_env.env_root().join("source"); let git_repo = git::init(git_repo_path); @@ -1198,7 +1197,7 @@ fn test_git_clone_no_git_executable_with_path() { fn test_git_clone_branch() { let test_env = TestEnvironment::default(); let root_dir = test_env.work_dir(""); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let git_repo_path = test_env.env_root().join("source"); let git_repo = git::init(&git_repo_path); set_up_non_empty_git_repo(&git_repo); @@ -1230,7 +1229,7 @@ fn test_git_clone_branch() { "clone", "source", "clone_no_such_branch", - "--branch=(nonexistent1 | glob:nonexistent*) & ~nonexistent2", + "--branch=(nonexistent1 | nonexistent*) & ~nonexistent2", ]); insta::assert_snapshot!(output, @r#" ------- stderr ------- @@ -1269,7 +1268,7 @@ fn test_git_clone_branch() { "); // Clone all branches explicitly, the default branch should be checked out - let output = root_dir.run_jj(["git", "clone", "source", "clone_all", "--branch=glob:*"]); + let output = root_dir.run_jj(["git", "clone", "source", "clone_all", "--branch=*"]); insta::assert_snapshot!(output, @r#" ------- stderr ------- Fetching into new repo in "$TEST_ENV/clone_all" @@ -1318,7 +1317,7 @@ fn test_git_clone_auto_track_bookmarks() { test_env.add_config( " [remotes.origin] - auto-track-bookmarks = 'glob:mine/*' + auto-track-bookmarks = 'mine/*' ", ); diff --git a/cli/tests/test_git_colocated.rs b/cli/tests/test_git_colocated.rs index 2cffc5bde..f7c2a52bd 100644 --- a/cli/tests/test_git_colocated.rs +++ b/cli/tests/test_git_colocated.rs @@ -684,7 +684,7 @@ fn test_git_colocated_checkout_non_empty_working_copy() { #[test] fn test_git_colocated_fetch_deleted_or_moved_bookmark() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let origin_dir = test_env.work_dir("origin"); git::init(origin_dir.root()); origin_dir.run_jj(["git", "init", "--git-repo=."]).success(); diff --git a/cli/tests/test_git_fetch.rs b/cli/tests/test_git_fetch.rs index 5714ea169..54be8259a 100644 --- a/cli/tests/test_git_fetch.rs +++ b/cli/tests/test_git_fetch.rs @@ -130,7 +130,7 @@ fn test_git_fetch_with_default_config() { #[test] fn test_git_fetch_default_remote() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); add_git_remote(&test_env, &work_dir, "origin"); @@ -146,7 +146,7 @@ fn test_git_fetch_default_remote() { #[test] fn test_git_fetch_single_remote() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.rem1.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.rem1.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); add_git_remote(&test_env, &work_dir, "rem1"); @@ -168,7 +168,7 @@ fn test_git_fetch_single_remote() { #[test] fn test_git_fetch_single_remote_all_remotes_flag() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.rem1.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.rem1.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); add_git_remote(&test_env, &work_dir, "rem1"); @@ -184,7 +184,7 @@ fn test_git_fetch_single_remote_all_remotes_flag() { #[test] fn test_git_fetch_single_remote_from_arg() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.rem1.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.rem1.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); add_git_remote(&test_env, &work_dir, "rem1"); @@ -202,7 +202,7 @@ fn test_git_fetch_single_remote_from_arg() { #[test] fn test_git_fetch_single_remote_from_config() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.rem1.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.rem1.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); add_git_remote(&test_env, &work_dir, "rem1"); @@ -219,8 +219,8 @@ fn test_git_fetch_single_remote_from_config() { #[test] fn test_git_fetch_multiple_remotes() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.rem1.auto-track-bookmarks = 'glob:*'"); - test_env.add_config("remotes.rem2.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.rem1.auto-track-bookmarks = '*'"); + test_env.add_config("remotes.rem2.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); add_git_remote(&test_env, &work_dir, "rem1"); @@ -335,7 +335,7 @@ fn test_git_fetch_with_glob() { add_git_remote(&test_env, &work_dir, "rem1"); add_git_remote(&test_env, &work_dir, "rem2"); - let output = work_dir.run_jj(["git", "fetch", "--remote", "glob:*"]); + let output = work_dir.run_jj(["git", "fetch", "--remote", "*"]); insta::assert_snapshot!(output, @r" ------- stderr ------- bookmark: rem1@rem1 [new] untracked @@ -355,7 +355,7 @@ fn test_git_fetch_with_glob_and_exact_match() { add_git_remote(&test_env, &work_dir, "upstream2"); add_git_remote(&test_env, &work_dir, "origin"); - let output = work_dir.run_jj(["git", "fetch", "--remote=glob:rem*", "--remote=origin"]); + let output = work_dir.run_jj(["git", "fetch", "--remote=rem*", "--remote=origin"]); insta::assert_snapshot!(output, @r" ------- stderr ------- bookmark: origin@origin [new] untracked @@ -368,7 +368,7 @@ fn test_git_fetch_with_glob_and_exact_match() { #[test] fn test_git_fetch_with_glob_from_config() { let test_env = TestEnvironment::default(); - test_env.add_config(r#"git.fetch = "glob:rem*""#); + test_env.add_config(r#"git.fetch = "rem*""#); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); add_git_remote(&test_env, &work_dir, "rem1"); @@ -391,7 +391,7 @@ fn test_git_fetch_with_glob_with_no_matching_remotes() { let work_dir = test_env.work_dir("repo"); add_git_remote(&test_env, &work_dir, "upstream"); - let output = work_dir.run_jj(["git", "fetch", "--remote=glob:rem*"]); + let output = work_dir.run_jj(["git", "fetch", "--remote=rem*"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Error: No git remotes to fetch from @@ -405,8 +405,8 @@ fn test_git_fetch_with_glob_with_no_matching_remotes() { #[test] fn test_git_fetch_all_remotes() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.rem1.auto-track-bookmarks = 'glob:*'"); - test_env.add_config("remotes.rem2.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.rem1.auto-track-bookmarks = '*'"); + test_env.add_config("remotes.rem2.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); add_git_remote(&test_env, &work_dir, "rem1"); @@ -433,8 +433,8 @@ fn test_git_fetch_all_remotes() { #[test] fn test_git_fetch_multiple_remotes_from_config() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.rem1.auto-track-bookmarks = 'glob:*'"); - test_env.add_config("remotes.rem2.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.rem1.auto-track-bookmarks = '*'"); + test_env.add_config("remotes.rem2.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); add_git_remote(&test_env, &work_dir, "rem1"); @@ -522,7 +522,7 @@ fn test_git_fetch_nonexistent_remote_from_config() { #[test] fn test_git_fetch_from_remote_named_git() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.bar.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.bar.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("repo"); init_git_remote(&test_env, "git"); @@ -592,7 +592,7 @@ fn test_git_fetch_from_remote_named_git() { #[test] fn test_git_fetch_from_remote_with_slashes() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("repo"); init_git_remote(&test_env, "source"); @@ -616,7 +616,7 @@ fn test_git_fetch_from_remote_with_slashes() { #[test] fn test_git_fetch_prune_before_updating_tips() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); let git_repo = add_git_remote(&test_env, &work_dir, "origin"); @@ -651,7 +651,7 @@ fn test_git_fetch_prune_before_updating_tips() { #[test] fn test_git_fetch_conflicting_bookmarks() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.rem1.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.rem1.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); add_git_remote(&test_env, &work_dir, "rem1"); @@ -668,7 +668,7 @@ fn test_git_fetch_conflicting_bookmarks() { "); work_dir - .run_jj(["git", "fetch", "--remote", "rem1", "--branch", "glob:*"]) + .run_jj(["git", "fetch", "--remote", "rem1", "--branch", "*"]) .success(); // This should result in a CONFLICTED bookmark insta::assert_snapshot!(get_bookmark_output(&work_dir), @r" @@ -683,7 +683,7 @@ fn test_git_fetch_conflicting_bookmarks() { #[test] fn test_git_fetch_conflicting_bookmarks_colocated() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.rem1.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.rem1.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("repo"); git::init(work_dir.root()); // create_colocated_repo_and_bookmarks_from_trunk1(&test_env, &repo_path); @@ -753,7 +753,7 @@ fn create_trunk2_and_rebase_bookmarks(work_dir: &TestWorkDir) -> String { #[test] fn test_git_fetch_all() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); test_env.add_config(r#"revset-aliases."immutable_heads()" = "none()""#); let source_dir = test_env.work_dir("source"); git::init(source_dir.root()); @@ -911,7 +911,7 @@ fn test_git_fetch_all() { #[test] fn test_git_fetch_some_of_many_bookmarks() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); test_env.add_config(r#"revset-aliases."immutable_heads()" = "none()""#); let source_dir = test_env.work_dir("source"); git::init(source_dir.root()); @@ -940,18 +940,17 @@ fn test_git_fetch_some_of_many_bookmarks() { "#); // Test an error message - let output = target_dir.run_jj(["git", "fetch", "--branch", "glob:'^:a*'"]); + let output = target_dir.run_jj(["git", "fetch", "--branch", "'^:a*'"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Error: Invalid branch pattern provided. When fetching, branch names and globs may not contain the characters `:`, `^`, `?`, `[`, `]` [EOF] [exit status: 1] "); - let output = target_dir.run_jj(["git", "fetch", "--branch", "a*"]); + let output = target_dir.run_jj(["git", "fetch", "--branch", "exact:a*"]); insta::assert_snapshot!(output, @r" ------- stderr ------- - Error: Branch names may not include `*`. - Hint: Prefix the pattern with `glob:` to expand `*` as a glob + Error: Invalid branch pattern provided. When fetching, branch names and globs may not contain the characters `:`, `^`, `?`, `[`, `]` [EOF] [exit status: 1] "); @@ -984,7 +983,7 @@ fn test_git_fetch_some_of_many_bookmarks() { [EOF] "); // ...then fetch two others with a glob. - let output = target_dir.run_jj(["git", "fetch", "--branch", "glob:a*"]); + let output = target_dir.run_jj(["git", "fetch", "--branch", "a*"]); insta::assert_snapshot!(output, @r" ------- stderr ------- bookmark: a1@origin [new] tracked @@ -1056,7 +1055,7 @@ fn test_git_fetch_some_of_many_bookmarks() { ◆ 000000000000 "" [EOF] "#); - let output = target_dir.run_jj(["git", "fetch", "--branch=~(a2 | glob:trunk*)"]); + let output = target_dir.run_jj(["git", "fetch", "--branch=~(a2 | trunk*)"]); insta::assert_snapshot!(output, @r" ------- stderr ------- bookmark: a1@origin [updated] tracked @@ -1095,7 +1094,7 @@ fn test_git_fetch_some_of_many_bookmarks() { "); // Now, let's fetch a2 and double-check that fetching a1 and b again doesn't do // anything. - let output = target_dir.run_jj(["git", "fetch", "--branch", "b", "--branch", "glob:a*"]); + let output = target_dir.run_jj(["git", "fetch", "--branch", "b", "--branch", "a*"]); insta::assert_snapshot!(output, @r" ------- stderr ------- bookmark: a2@origin [updated] tracked @@ -1134,10 +1133,10 @@ fn test_git_fetch_some_of_many_bookmarks() { #[test] fn test_git_fetch_bookmarks_some_missing() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); - test_env.add_config("remotes.rem1.auto-track-bookmarks = 'glob:*'"); - test_env.add_config("remotes.rem2.auto-track-bookmarks = 'glob:*'"); - test_env.add_config("remotes.rem3.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); + test_env.add_config("remotes.rem1.auto-track-bookmarks = '*'"); + test_env.add_config("remotes.rem2.auto-track-bookmarks = '*'"); + test_env.add_config("remotes.rem3.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); add_git_remote(&test_env, &work_dir, "origin"); @@ -1272,7 +1271,7 @@ fn test_git_fetch_unsupported_branch_patterns() { "); // Unsupported glob pattern in negative refspecs - let output = work_dir.run_jj(["git", "fetch", "--branch=~glob:'[xy]'"]); + let output = work_dir.run_jj(["git", "fetch", "--branch=~'[xy]'"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Error: Invalid branch pattern provided. When fetching, branch names and globs may not contain the characters `:`, `^`, `?`, `[`, `]` @@ -1286,7 +1285,7 @@ fn test_git_fetch_unsupported_branch_patterns() { #[test] fn test_git_fetch_undo() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let source_dir = test_env.work_dir("source"); git::init(source_dir.root()); @@ -1369,7 +1368,7 @@ fn test_git_fetch_undo() { #[test] fn test_fetch_undo_what() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let source_dir = test_env.work_dir("source"); git::init(source_dir.root()); @@ -1471,7 +1470,7 @@ fn test_fetch_undo_what() { #[test] fn test_git_fetch_remove_fetch() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); add_git_remote(&test_env, &work_dir, "origin"); @@ -1527,7 +1526,7 @@ fn test_git_fetch_remove_fetch() { #[test] fn test_git_fetch_rename_fetch() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); add_git_remote(&test_env, &work_dir, "origin"); @@ -1573,7 +1572,7 @@ fn test_git_fetch_rename_fetch() { #[test] fn test_git_fetch_removed_bookmark() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let source_dir = test_env.work_dir("source"); git::init(source_dir.root()); @@ -1671,7 +1670,7 @@ fn test_git_fetch_removed_bookmark() { #[test] fn test_git_fetch_removed_parent_bookmark() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let source_dir = test_env.work_dir("source"); git::init(source_dir.root()); @@ -1723,7 +1722,7 @@ fn test_git_fetch_removed_parent_bookmark() { // Remove all bookmarks in origin. source_dir - .run_jj(["bookmark", "forget", "--include-remotes", "glob:*"]) + .run_jj(["bookmark", "forget", "--include-remotes", "*"]) .success(); // Fetch bookmarks master, trunk1 and a1 from origin and check that only those @@ -1775,8 +1774,8 @@ fn test_git_fetch_remote_only_bookmark() { &[], ); - // Fetch using remotes.origin.auto-track-bookmarks = 'glob:*' - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + // Fetch using remotes.origin.auto-track-bookmarks = '*' + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); work_dir .run_jj(["git", "fetch", "--remote=origin"]) .success(); @@ -1794,8 +1793,8 @@ fn test_git_fetch_remote_only_bookmark() { &[], ); - // Fetch using remotes.origin.auto-track-bookmarks = '~glob:*' - test_env.add_config("remotes.origin.auto-track-bookmarks = '~glob:*'"); + // Fetch using remotes.origin.auto-track-bookmarks = '~*' + test_env.add_config("remotes.origin.auto-track-bookmarks = '~*'"); work_dir .run_jj(["git", "fetch", "--remote=origin"]) .success(); @@ -1817,8 +1816,8 @@ fn test_git_fetch_remote_only_bookmark() { #[test] fn test_git_fetch_preserve_commits_across_repos() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.upstream.auto-track-bookmarks = 'glob:*'"); - test_env.add_config("remotes.fork.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.upstream.auto-track-bookmarks = '*'"); + test_env.add_config("remotes.fork.auto-track-bookmarks = '*'"); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let work_dir = test_env.work_dir("repo"); @@ -1916,7 +1915,7 @@ fn test_git_fetch_preserve_commits_across_repos() { #[test] fn test_git_fetch_tracked() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); // Set up a remote with multiple bookmarks let remote_path = test_env.env_root().join("remote"); @@ -1981,9 +1980,7 @@ fn test_git_fetch_tracked() { "); // Now fetch all branches - work_dir - .run_jj(["git", "fetch", "--branch", "glob:*"]) - .success(); + work_dir.run_jj(["git", "fetch", "--branch", "*"]).success(); // Now feature1@origin gets updated but feature1 stays at old commit // (untracked), feature2 appears for the first time, and main stays at its @@ -2002,7 +1999,7 @@ fn test_git_fetch_tracked() { #[test] fn test_git_fetch_tracked_no_tracked_bookmarks() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); // Set up a remote with bookmarks let remote_path = test_env.env_root().join("remote"); @@ -2023,7 +2020,7 @@ fn test_git_fetch_tracked_no_tracked_bookmarks() { work_dir.run_jj(["git", "fetch"]).success(); // Untrack all bookmarks - work_dir.run_jj(["bookmark", "untrack", "glob:*"]).success(); + work_dir.run_jj(["bookmark", "untrack", "*"]).success(); // Fetch with --tracked should indicate nothing changed let output = work_dir.run_jj(["git", "fetch", "--tracked"]); @@ -2037,8 +2034,8 @@ fn test_git_fetch_tracked_no_tracked_bookmarks() { #[test] fn test_git_fetch_tracked_multiple_remotes() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); - test_env.add_config("remotes.upstream.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); + test_env.add_config("remotes.upstream.auto-track-bookmarks = '*'"); // Set up two remotes with different branches let origin_path = test_env.env_root().join("origin"); @@ -2141,7 +2138,7 @@ fn test_git_fetch_auto_track_bookmarks() { test_env.add_config( " [remotes.origin] - auto-track-bookmarks = 'glob:mine/*' + auto-track-bookmarks = 'mine/*' ", ); diff --git a/cli/tests/test_git_init.rs b/cli/tests/test_git_init.rs index b7cc76aa9..7091c08e9 100644 --- a/cli/tests/test_git_init.rs +++ b/cli/tests/test_git_init.rs @@ -668,7 +668,7 @@ fn test_git_init_colocated_via_git_repo_path_symlink_gitlink() { #[test] fn test_git_init_colocated_via_git_repo_path_imported_refs() { let test_env = TestEnvironment::default(); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); // Set up remote refs test_env.run_jj_in(".", ["git", "init", "remote"]).success(); @@ -697,7 +697,7 @@ fn test_git_init_colocated_via_git_repo_path_imported_refs() { .unwrap(); }; - // With remotes.origin.auto-track-bookmarks = 'glob:*' + // With remotes.origin.auto-track-bookmarks = '*' let local_dir = test_env.work_dir("local1"); set_up_local_repo(local_dir.root()); let output = local_dir.run_jj(["git", "init", "--git-repo=."]); @@ -717,8 +717,8 @@ fn test_git_init_colocated_via_git_repo_path_imported_refs() { [EOF] "); - // With remotes.origin.auto-track-bookmarks = '~glob:*' - test_env.add_config("remotes.origin.auto-track-bookmarks = '~glob:*'"); + // With remotes.origin.auto-track-bookmarks = '~*' + test_env.add_config("remotes.origin.auto-track-bookmarks = '~*'"); let local_dir = test_env.work_dir("local2"); set_up_local_repo(local_dir.root()); let output = local_dir.run_jj(["git", "init", "--git-repo=."]); diff --git a/cli/tests/test_git_private_commits.rs b/cli/tests/test_git_private_commits.rs index 81768f748..589cd0665 100644 --- a/cli/tests/test_git_private_commits.rs +++ b/cli/tests/test_git_private_commits.rs @@ -38,7 +38,7 @@ fn set_up(test_env: &TestEnvironment) { [ "git", "clone", - "--config=remotes.origin.auto-track-bookmarks='glob:*'", + "--config=remotes.origin.auto-track-bookmarks='*'", origin_git_repo_path.to_str().unwrap(), "local", ], @@ -179,7 +179,7 @@ fn test_git_private_commits_are_not_checked_if_immutable() { fn test_git_private_commits_not_directly_in_line_block_pushing() { let test_env = TestEnvironment::default(); set_up(&test_env); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("local"); // New private commit descended from root() @@ -230,7 +230,7 @@ fn test_git_private_commits_descending_from_commits_pushed_do_not_block_pushing( fn test_git_private_commits_already_on_the_remote_do_not_block_push() { let test_env = TestEnvironment::default(); set_up(&test_env); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("local"); // Start a bookmark before a "private" commit lands in main diff --git a/cli/tests/test_git_push.rs b/cli/tests/test_git_push.rs index 4473d2843..701b304d6 100644 --- a/cli/tests/test_git_push.rs +++ b/cli/tests/test_git_push.rs @@ -53,7 +53,7 @@ fn set_up(test_env: &TestEnvironment) { [ "git", "clone", - "--config=remotes.origin.auto-track-bookmarks='glob:*'", + "--config=remotes.origin.auto-track-bookmarks='*'", origin_git_repo_path.to_str().unwrap(), "local", ], @@ -87,7 +87,7 @@ fn test_git_push_nothing() { fn test_git_push_current_bookmark() { let test_env = TestEnvironment::default(); set_up(&test_env); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("local"); test_env.add_config(r#"revset-aliases."immutable_heads()" = "none()""#); // Update some bookmarks. `bookmark1` is not a current bookmark, but @@ -537,7 +537,7 @@ fn test_git_push_unexpectedly_deleted() { fn test_git_push_creation_unexpectedly_already_exists() { let test_env = TestEnvironment::default(); set_up(&test_env); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("local"); // Forget bookmark1 locally @@ -581,7 +581,7 @@ fn test_git_push_locally_created_and_rewritten() { set_up(&test_env); let work_dir = test_env.work_dir("local"); // Ensure that remote bookmarks aren't tracked automatically - test_env.add_config("remotes.origin.auto-track-bookmarks = '~glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '~*'"); // Push locally-created bookmark work_dir.run_jj(["new", "root()", "-mlocal 1"]).success(); @@ -615,7 +615,7 @@ fn test_git_push_locally_created_and_rewritten() { insta::assert_snapshot!(output, @r" ------- stderr ------- Warning: Deprecated CLI-provided config: `git.push-new-bookmarks` is deprecated; use `remotes..auto-track-bookmarks` instead. - Example: jj config set --user remotes.origin.auto-track-bookmarks 'glob:*' + Example: jj config set --user remotes.origin.auto-track-bookmarks '*' For details, see: https://docs.jj-vcs.dev/latest/config/#automatic-tracking-of-bookmarks Changes to push to origin: Add bookmark my to e0cba5e497ee @@ -659,7 +659,7 @@ fn test_git_push_locally_created_and_rewritten() { fn test_git_push_multiple() { let test_env = TestEnvironment::default(); set_up(&test_env); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("local"); work_dir .run_jj(["bookmark", "delete", "bookmark1"]) @@ -709,7 +709,7 @@ fn test_git_push_multiple() { "-b=bookmark1", "-b=my-bookmark", "-b=bookmark1", - "-b=glob:my-*", + "-b=my-*", "--dry-run", ]); insta::assert_snapshot!(output, @r" @@ -721,7 +721,7 @@ fn test_git_push_multiple() { [EOF] "); // Dry run with glob pattern - let output = work_dir.run_jj(["git", "push", "-b=glob:'bookmark?'", "--dry-run"]); + let output = work_dir.run_jj(["git", "push", "-b='bookmark?'", "--dry-run"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Changes to push to origin: @@ -739,7 +739,7 @@ fn test_git_push_multiple() { Nothing changed. [EOF] "); - let output = work_dir.run_jj(["git", "push", "-b=foo", "-b=glob:'?bookmark'"]); + let output = work_dir.run_jj(["git", "push", "-b=foo", "-b='?bookmark'"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Warning: No matching bookmarks for names: foo @@ -1257,7 +1257,7 @@ fn test_git_push_changes_with_name_untracked_or_forgotten() { fn test_git_push_revisions() { let test_env = TestEnvironment::default(); set_up(&test_env); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("local"); work_dir.run_jj(["describe", "-m", "foo"]).success(); work_dir.write_file("file", "contents"); @@ -1433,7 +1433,7 @@ fn test_git_push_conflict() { fn test_git_push_no_description() { let test_env = TestEnvironment::default(); set_up(&test_env); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("local"); work_dir .run_jj(["bookmark", "create", "-r@", "my-bookmark"]) @@ -1462,7 +1462,7 @@ fn test_git_push_no_description() { fn test_git_push_no_description_in_immutable() { let test_env = TestEnvironment::default(); set_up(&test_env); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("local"); work_dir .run_jj(["bookmark", "create", "-r@", "imm"]) @@ -1498,7 +1498,7 @@ fn test_git_push_no_description_in_immutable() { fn test_git_push_missing_author() { let test_env = TestEnvironment::default(); set_up(&test_env); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("local"); let run_without_var = |var: &str, args: &[&str]| { work_dir @@ -1531,7 +1531,7 @@ fn test_git_push_missing_author() { fn test_git_push_missing_author_in_immutable() { let test_env = TestEnvironment::default(); set_up(&test_env); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("local"); let run_without_var = |var: &str, args: &[&str]| { work_dir @@ -1573,7 +1573,7 @@ fn test_git_push_missing_author_in_immutable() { fn test_git_push_missing_committer() { let test_env = TestEnvironment::default(); set_up(&test_env); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("local"); let run_without_var = |var: &str, args: &[&str]| { work_dir @@ -1623,7 +1623,7 @@ fn test_git_push_missing_committer() { fn test_git_push_missing_committer_in_immutable() { let test_env = TestEnvironment::default(); set_up(&test_env); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let work_dir = test_env.work_dir("local"); let run_without_var = |var: &str, args: &[&str]| { work_dir @@ -1702,7 +1702,7 @@ fn test_git_push_conflicting_bookmarks() { let test_env = TestEnvironment::default(); set_up(&test_env); let work_dir = test_env.work_dir("local"); - test_env.add_config("remotes.origin.auto-track-bookmarks = 'glob:*'"); + test_env.add_config("remotes.origin.auto-track-bookmarks = '*'"); let git_repo = { let mut git_repo_path = work_dir.root().to_owned(); git_repo_path.extend([".jj", "repo", "store", "git"]); diff --git a/cli/tests/test_tag_command.rs b/cli/tests/test_tag_command.rs index efa715289..c5fe2a80d 100644 --- a/cli/tests/test_tag_command.rs +++ b/cli/tests/test_tag_command.rs @@ -99,7 +99,7 @@ fn test_tag_set_delete() { [EOF] "); - let output = work_dir.run_jj(["tag", "delete", "glob:b*"]); + let output = work_dir.run_jj(["tag", "delete", "b*"]); insta::assert_snapshot!(output, @r" ------- stderr ------- Deleted 2 tags. @@ -219,7 +219,7 @@ fn test_tag_unknown() { [EOF] "); - let output = work_dir.run_jj(["tag", "delete", "glob:unknown*"]); + let output = work_dir.run_jj(["tag", "delete", "unknown*"]); insta::assert_snapshot!(output, @r" ------- stderr ------- No tags to delete. @@ -292,7 +292,7 @@ fn test_tag_list() { [EOF] "); - insta::assert_snapshot!(work_dir.run_jj(["tag", "list", "glob:'test_tag?'"]), @r" + insta::assert_snapshot!(work_dir.run_jj(["tag", "list", "'test_tag?'"]), @r" test_tag2: zsuskuln 76abdd20 (empty) commit2 [EOF] "); @@ -300,7 +300,7 @@ fn test_tag_list() { // Unmatched exact name pattern should be warned. "test_tag2" exists, but // isn't included in the match. insta::assert_snapshot!( - work_dir.run_jj(["tag", "list", "glob:test* & ~glob:*2", "unknown ~ test_tag2"]), @r" + work_dir.run_jj(["tag", "list", "test* & ~*2", "unknown ~ test_tag2"]), @r" test_tag: rlvkpnrz 893e67dc (empty) commit1 [EOF] ------- stderr ------- diff --git a/docs/bookmarks.md b/docs/bookmarks.md index dcb2c6580..7c7b998c3 100644 --- a/docs/bookmarks.md +++ b/docs/bookmarks.md @@ -141,7 +141,7 @@ 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 `remotes..auto-track-bookmarks = "glob:*"`. +The default can be changed by setting the config `remotes..auto-track-bookmarks = "*"`. 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 diff --git a/docs/config.md b/docs/config.md index ccf13441e..90c821eb2 100644 --- a/docs/config.md +++ b/docs/config.md @@ -1521,12 +1521,12 @@ jj config set --repo git.fetch "upstream" jj config set --repo git.fetch '["origin", "upstream"]' ``` -By default, the specified remote names matches exactly. You can also use a -[string pattern](revsets.md#string-patterns) to select remotes using patterns: +By default, the specified pattern matches remote names with glob syntax. You can +also use other [string pattern syntax](revsets.md#string-patterns): ```sh -jj config set --repo git.fetch "glob:*" -jj config set --repo git.fetch '["glob:remote*", "glob:upstream*"]' +jj config set --repo git.fetch "regex:'^(remote|upstream)'" +jj config set --repo git.fetch '["remote*", "upstream*"]' ``` Similarly, you can also set the variable `git.push` to cause `jj git push` to @@ -1550,7 +1550,7 @@ created locally and ones fetched from the remote. For example: ```toml [remotes.origin] -auto-track-bookmarks = "glob:*" +auto-track-bookmarks = "*" ``` This will simply track all bookmarks for the remote "origin". There are various @@ -1566,7 +1566,7 @@ reasons to restrict which bookmarks to track: ```toml [remotes.origin] - auto-track-bookmarks = "glob:alice/*" + auto-track-bookmarks = "alice/*" ``` That way, bookmarks pushed by other people (who probably use a different @@ -1585,7 +1585,7 @@ reasons to restrict which bookmarks to track: ```toml [remotes.origin] - auto-track-bookmarks = "glob:*" + auto-track-bookmarks = "*" [remotes.upstream] auto-track-bookmarks = "main" ``` diff --git a/docs/github.md b/docs/github.md index 528d974cb..7584d339e 100644 --- a/docs/github.md +++ b/docs/github.md @@ -169,8 +169,9 @@ 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 -`remotes..auto-track-bookmarks = "glob:*"` in the config file. Then you can specify a -contributor's bookmark as `jj new ` instead of `jj new @`. +`remotes..auto-track-bookmarks = "*"` 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]. diff --git a/docs/revsets.md b/docs/revsets.md index b59ea5a73..d6e03df99 100644 --- a/docs/revsets.md +++ b/docs/revsets.md @@ -473,7 +473,7 @@ revsets (expressions) as arguments. Functions that perform string matching support the following pattern syntax (the quotes are optional). -By default, `"string"` is parsed as a `glob:` pattern in revsets. +By default, `"string"` is parsed as a `glob:` pattern. * `exact:"string"`: Matches strings exactly equal to `string`. * `glob:"pattern"`: Matches strings with Unix-style shell [wildcard diff --git a/lib/src/revset.rs b/lib/src/revset.rs index 6da313dd7..5d87aa7e6 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -1168,7 +1168,7 @@ pub fn expect_string_expression( fn expect_string_expression_inner( diagnostics: &mut RevsetDiagnostics, node: &ExpressionNode, - // TODO: enable glob matching by default and remove this parameter + // TODO: remove this parameter with ui.revsets-use-glob-by-default default_kind: &str, ) -> Result { revset_parser::catch_aliases(diagnostics, node, |diagnostics, node| { @@ -1426,7 +1426,7 @@ pub fn parse_string_expression( text: &str, ) -> Result { let node = parse_program(text)?; - let default_kind = "exact"; // TODO: use "glob" by default + let default_kind = "glob"; expect_string_expression_inner(diagnostics, &node, default_kind) }