diff --git a/cli/src/commands/fix.rs b/cli/src/commands/fix.rs index 0954b091fad..4c68cb2380e 100644 --- a/cli/src/commands/fix.rs +++ b/cli/src/commands/fix.rs @@ -462,6 +462,7 @@ fn get_tools_config(ui: &mut Ui, settings: &UserSettings) -> Result = HashSet::new(); // Process --change bookmarks first because matching bookmarks can be moved. - let bookmark_prefix = get_change_bookmark_prefix(ui, tx.settings())?; + let bookmark_prefix = tx.settings().get_string("git.push-bookmark-prefix")?; let change_bookmark_names = update_change_bookmarks(ui, &mut tx, &args.change, &bookmark_prefix)?; let change_bookmarks = change_bookmark_names.iter().map(|bookmark_name| { @@ -505,23 +505,6 @@ fn get_default_push_remote( } } -fn get_change_bookmark_prefix(ui: &Ui, settings: &UserSettings) -> Result { - // TODO: Drop support support for git.push-branch-prefix in 0.28.0+ and move - // the default value to config/*.toml - if let Some(prefix) = settings.get_string("git.push-branch-prefix").optional()? { - writeln!( - ui.warning_default(), - "Config git.push-branch-prefix is deprecated. Please switch to \ - git.push-bookmark-prefix", - )?; - Ok(prefix) - } else if let Some(prefix) = settings.get_string("git.push-bookmark-prefix").optional()? { - Ok(prefix) - } else { - Ok("push-".to_owned()) - } -} - #[derive(Clone, Debug)] struct RejectedBookmarkUpdateReason { message: String, diff --git a/cli/src/config.rs b/cli/src/config.rs index f66462250cb..0f8dd3b9d70 100644 --- a/cli/src/config.rs +++ b/cli/src/config.rs @@ -593,7 +593,12 @@ fn parse_config_arg_item(item_str: &str) -> Result<(ConfigNamePathBuf, ConfigVal /// List of rules to migrate deprecated config variables. pub fn default_config_migrations() -> Vec { - vec![] // TODO + vec![ + // TODO: Delete in jj 0.32+ + ConfigMigrationRule::rename_value("git.auto-local-branch", "git.auto-local-bookmark"), + // TODO: Delete in jj 0.28+ + ConfigMigrationRule::rename_value("git.push-branch-prefix", "git.push-bookmark-prefix"), + ] } /// Command name and arguments specified by config. diff --git a/cli/src/config/misc.toml b/cli/src/config/misc.toml index ed6252547f0..ae107387392 100644 --- a/cli/src/config/misc.toml +++ b/cli/src/config/misc.toml @@ -13,6 +13,9 @@ context = 3 [diff.git] context = 3 +[git] +push-bookmark-prefix = "push-" + [ui] # TODO: delete ui.allow-filesets in jj 0.26+ allow-filesets = true diff --git a/cli/tests/test_git_push.rs b/cli/tests/test_git_push.rs index 3a868329d96..a7ab1b94789 100644 --- a/cli/tests/test_git_push.rs +++ b/cli/tests/test_git_push.rs @@ -710,12 +710,12 @@ fn test_git_push_changes() { ], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" - Warning: Config git.push-branch-prefix is deprecated. Please switch to git.push-bookmark-prefix + insta::assert_snapshot!(stderr, @r" + Warning: Deprecated config: git.push-branch-prefix is renamed to git.push-bookmark-prefix Creating bookmark branch-yostqsxwqrlt for revision yostqsxwqrlt Changes to push to origin: Add bookmark branch-yostqsxwqrlt to 38cb417ce3a6 - "#); + "); } #[test] diff --git a/lib/src/config/misc.toml b/lib/src/config/misc.toml index 2a61500b33a..b9801bdb8ae 100644 --- a/lib/src/config/misc.toml +++ b/lib/src/config/misc.toml @@ -11,7 +11,7 @@ register_snapshot_trigger = false [git] abandon-unreachable-commits = true -# auto-local-bookmark = false +auto-local-bookmark = false [operation] hostname = "" diff --git a/lib/src/settings.rs b/lib/src/settings.rs index c0349c745cc..a6060a59829 100644 --- a/lib/src/settings.rs +++ b/lib/src/settings.rs @@ -62,17 +62,9 @@ pub struct GitSettings { impl GitSettings { pub fn from_settings(settings: &UserSettings) -> Result { - let auto_local_bookmark = { - // TODO: Drop support for git.auto-local-branch and move the default - // value to config/*.toml - let opt1 = settings.get_bool("git.auto-local-bookmark").optional()?; - let opt2 = settings.get_bool("git.auto-local-branch").optional()?; - opt1.or(opt2).unwrap_or(false) - }; - let abandon_unreachable_commits = settings.get_bool("git.abandon-unreachable-commits")?; Ok(GitSettings { - auto_local_bookmark, - abandon_unreachable_commits, + auto_local_bookmark: settings.get_bool("git.auto-local-bookmark")?, + abandon_unreachable_commits: settings.get_bool("git.abandon-unreachable-commits")?, }) } }