Skip to content

Commit 2df6020

Browse files
committed
Add branch status to CLI
It calls `list_virtual_branches()` which kind of has the effect of a status call.
1 parent 8951aba commit 2df6020

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

crates/gitbutler-branch-actions/src/actions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl VirtualBranchActions {
6868
branch::is_remote_branch_mergeable(&ctx, branch_name).map_err(Into::into)
6969
}
7070

71-
#[instrument(skip(self, project))]
71+
#[instrument(level = tracing::Level::DEBUG,skip(self, project))]
7272
pub fn list_virtual_branches(
7373
&self,
7474
project: &Project,

crates/gitbutler-cli/src/args.rs

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ pub mod vbranch {
3838

3939
#[derive(Debug, clap::Subcommand)]
4040
pub enum SubCommands {
41+
/// Provide the current state of all applied virtual branches.
42+
Status,
4143
/// Make the named branch the default so all worktree or index changes are associated with it automatically.
4244
SetDefault {
4345
/// The name of the new default virtual branch.

crates/gitbutler-cli/src/command/vbranch.rs

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ pub fn list(project: Project) -> Result<()> {
4040
Ok(())
4141
}
4242

43+
pub fn status(project: Project) -> Result<()> {
44+
debug_print(VirtualBranchActions.list_virtual_branches(&project)?)
45+
}
46+
4347
pub fn unapply(project: Project, branch_name: String) -> Result<()> {
4448
let branch = branch_by_name(&project, &branch_name)?;
4549
debug_print(VirtualBranchActions.convert_to_real_branch(&project, branch.id)?)

crates/gitbutler-cli/src/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fn main() -> Result<()> {
2020
args::Subcommands::Branch(vbranch::Platform { cmd }) => {
2121
let project = command::prepare::project_from_path(args.current_dir)?;
2222
match cmd {
23+
Some(vbranch::SubCommands::Status) => command::vbranch::status(project),
2324
Some(vbranch::SubCommands::Unapply { name }) => {
2425
command::vbranch::unapply(project, name)
2526
}

0 commit comments

Comments
 (0)