mirror of
https://github.com/martinvonz/jj.git
synced 2024-10-23 23:10:01 +00:00
Add configuration option to override branch name prefix.
This commit is contained in:
parent
044bc93aeb
commit
9831b82a98
3 changed files with 14 additions and 2 deletions
|
@ -78,7 +78,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
* `jj git push` gained a `--change <revision>` argument. When that's used, it
|
* `jj git push` gained a `--change <revision>` argument. When that's used, it
|
||||||
will create a branch named after the revision's change ID, so you don't have
|
will create a branch named after the revision's change ID, so you don't have
|
||||||
to create a branch yourself.
|
to create a branch yourself. By default, the branch name will start with
|
||||||
|
`push-`, but this can be overridden by the `push.branch-prefix` config
|
||||||
|
setting.
|
||||||
|
|
||||||
* Diff editor command arguments can now be specified by config file.
|
* Diff editor command arguments can now be specified by config file.
|
||||||
Example:
|
Example:
|
||||||
|
|
|
@ -65,6 +65,12 @@ impl UserSettings {
|
||||||
.unwrap_or_else(|_| "(no email configured)".to_string())
|
.unwrap_or_else(|_| "(no email configured)".to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn push_branch_prefix(&self) -> String {
|
||||||
|
self.config
|
||||||
|
.get_string("push.branch-prefix")
|
||||||
|
.unwrap_or("push-".to_string())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn signature(&self) -> Signature {
|
pub fn signature(&self) -> Signature {
|
||||||
let timestamp = self.timestamp.clone().unwrap_or_else(Timestamp::now);
|
let timestamp = self.timestamp.clone().unwrap_or_else(Timestamp::now);
|
||||||
Signature {
|
Signature {
|
||||||
|
|
|
@ -4857,7 +4857,11 @@ fn cmd_git_push(
|
||||||
}
|
}
|
||||||
} else if let Some(change_str) = &args.change {
|
} else if let Some(change_str) = &args.change {
|
||||||
let commit = workspace_command.resolve_single_rev(ui, change_str)?;
|
let commit = workspace_command.resolve_single_rev(ui, change_str)?;
|
||||||
let branch_name = format!("push-{}", commit.change_id().hex());
|
let branch_name = format!(
|
||||||
|
"{}{}",
|
||||||
|
ui.settings().push_branch_prefix(),
|
||||||
|
commit.change_id().hex()
|
||||||
|
);
|
||||||
tx.mut_repo()
|
tx.mut_repo()
|
||||||
.set_local_branch(branch_name.clone(), RefTarget::Normal(commit.id().clone()));
|
.set_local_branch(branch_name.clone(), RefTarget::Normal(commit.id().clone()));
|
||||||
if let Some(update) =
|
if let Some(update) =
|
||||||
|
|
Loading…
Reference in a new issue