Skip to content

Commit

Permalink
a first sketch of the gix repo describe plumbing command (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Apr 4, 2022
1 parent 8e0fb0a commit 2d6ccef
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/plumbing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,22 @@ pub fn main() -> Result<()> {
),
},
Subcommands::Repository(repo::Platform { repository, cmd }) => match cmd {
repo::Subcommands::Describe { cmd } => match cmd {
repo::commit::Subcommands::Describe {
all_tags,
all_refs,
first_parent,
always,
rev_spec,
} => prepare_and_run(
"repository-commit-describe",
verbose,
progress,
progress_keep_open,
None,
move |_progress, out, err| todo!(),
),
},
repo::Subcommands::Mailmap { cmd } => match cmd {
repo::mailmap::Subcommands::Entries => prepare_and_run(
"repository-mailmap-entries",
Expand Down
32 changes: 32 additions & 0 deletions src/plumbing/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ pub mod repo {
#[clap(flatten)]
args: super::pack::VerifyOptions,
},
/// Describe the current commit or the given one using the name of the closest annotated tag in its ancestry.
Describe {
#[clap(subcommand)]
cmd: commit::Subcommands,
},
/// Interact with tree objects.
Tree {
#[clap(subcommand)]
Expand Down Expand Up @@ -385,6 +390,33 @@ pub mod repo {
}
}

pub mod commit {
#[derive(Debug, clap::Subcommand)]
pub enum Subcommands {
/// Describe the current commit or the given one using the name of the closest annotated tag in its ancestry.
Describe {
/// Use all tag references for naming, not only annotated tags.
#[clap(short = 't', conflicts_with("all-refs"))]
all_tags: bool,

/// Use all references under the `ref/` namespaces, which includes tag references, local and remote branches.
#[clap(short = 'a', conflicts_with("all-tags"))]
all_refs: bool,

/// Only follow the first parent when traversing the commit graph.
#[clap(short = 'f')]
first_parent: bool,

#[clap(short = 'a')]
/// If there was no way to describe the commit, fallback to using the abbreviated input revision.
always: bool,

/// A specification of the revision to use, or the current `HEAD` if unset.
rev_spec: Option<String>,
},
}
}

pub mod tree {
#[derive(Debug, clap::Subcommand)]
pub enum Subcommands {
Expand Down

0 comments on commit 2d6ccef

Please sign in to comment.