Skip to content

Commit

Permalink
feat: gix clone --no-tags support.
Browse files Browse the repository at this point in the history
This is the same as `git clone --no-tags`.
  • Loading branch information
Byron committed Dec 15, 2022
1 parent 35f7d59 commit e2b8c5d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions gitoxide-core/src/repository/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub struct Options {
pub format: OutputFormat,
pub bare: bool,
pub handshake_info: bool,
pub no_tags: bool,
}

pub const PROGRESS_RANGE: std::ops::RangeInclusive<u8> = 1..=3;
Expand All @@ -29,6 +30,7 @@ pub(crate) mod function {
format,
handshake_info,
bare,
no_tags,
}: Options,
) -> anyhow::Result<()>
where
Expand All @@ -51,6 +53,9 @@ pub(crate) mod function {
opts
},
)?;
if no_tags {
prepare = prepare.configure_remote(|r| Ok(r.with_fetch_tags(git::remote::fetch::Tags::None)));
}
let (mut checkout, fetch_outcome) =
prepare.fetch_then_checkout(&mut progress, &git::interrupt::IS_INTERRUPTED)?;

Expand Down
2 changes: 2 additions & 0 deletions src/plumbing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,15 @@ pub fn main() -> Result<()> {
Subcommands::Clone(crate::plumbing::options::clone::Platform {
handshake_info,
bare,
no_tags,
remote,
directory,
}) => {
let opts = core::repository::clone::Options {
format,
bare,
handshake_info,
no_tags,
};
prepare_and_run(
"clone",
Expand Down
6 changes: 5 additions & 1 deletion src/plumbing/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,14 @@ pub mod clone {
#[clap(long, short = 'H')]
pub handshake_info: bool,

/// If set, the clone will be bare and a working tree checkout won't be available.
/// The clone will be bare and a working tree checkout won't be available.
#[clap(long)]
pub bare: bool,

/// Do not clone any tags. Useful to reduce the size of the clone if only branches are needed.
#[clap(long)]
pub no_tags: bool,

/// The url of the remote to connect to, like `https://github.com/byron/gitoxide`.
pub remote: OsString,

Expand Down

0 comments on commit e2b8c5d

Please sign in to comment.