Use the current branch by default for send
This commit is contained in:
parent
980f8fcc0a
commit
61bf3d4542
1 changed files with 10 additions and 4 deletions
14
src/main.rs
14
src/main.rs
|
|
@ -66,8 +66,8 @@ struct Send {
|
||||||
help = "Version of the patchset to set. Defaults to the latest version"
|
help = "Version of the patchset to set. Defaults to the latest version"
|
||||||
)]
|
)]
|
||||||
version: Option<u64>,
|
version: Option<u64>,
|
||||||
#[arg(help = "Patch series to send")]
|
#[arg(help = "Patch series to send. Defaults to the current branch")]
|
||||||
series: String,
|
series: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Args, Debug)]
|
#[derive(Args, Debug)]
|
||||||
|
|
@ -522,11 +522,17 @@ fn main() -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
Command::Send(send) => {
|
Command::Send(send) => {
|
||||||
let branch_dir = patch_dir.join(&send.series);
|
let current_branch = git_cd(&["branch", "--show-current"])?;
|
||||||
|
let branch = send
|
||||||
|
.series
|
||||||
|
.as_ref()
|
||||||
|
.try_m_unwrap_or_else(|| Ok(¤t_branch))?;
|
||||||
|
|
||||||
|
let branch_dir = patch_dir.join(&branch);
|
||||||
let version = match send.version {
|
let version = match send.version {
|
||||||
Some(v) => v,
|
Some(v) => v,
|
||||||
None => match latest_version(&branch_dir)? {
|
None => match latest_version(&branch_dir)? {
|
||||||
None => return Err(miette!("No patch set for the branch {}", send.series)),
|
None => return Err(miette!("No patch set for the branch {branch}")),
|
||||||
Some(v) => v,
|
Some(v) => v,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue