diff --git a/README.md b/README.md index ba0067e61b4..dac06fc5c7a 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Please see _'Development Status'_ for a listing of all crates and their capabili * **pack-index** * [x] [index from data](https://asciinema.org/a/352941) - create an index file by streaming a pack file as done during clone * [ ] support for thin packs (as needed for fetch/pull) - * **remote-ref-ls** + * **remote-ref-list** * [x] list all (or given) references from a remote at the given URL ### git-object diff --git a/src/plumbing/lean/options.rs b/src/plumbing/lean/options.rs index e1c9628ca51..33847034e91 100644 --- a/src/plumbing/lean/options.rs +++ b/src/plumbing/lean/options.rs @@ -68,10 +68,10 @@ pub struct IndexFromPack { /// This is the plumbing equivalent of `git ls-remote`. /// Supported URLs are documented here: https://www.git-scm.com/docs/git-clone#_git_urls #[derive(FromArgs, PartialEq, Debug)] -#[argh(subcommand, name = "remote-ref-ls")] +#[argh(subcommand, name = "remote-ref-list")] pub struct RemoteRefList { /// the protocol version to use. Valid values are 1 and 2 - #[argh(option)] + #[argh(option, short = 'p')] pub protocol: Option, /// the URLs or path from which to receive references diff --git a/src/plumbing/pretty/main.rs b/src/plumbing/pretty/main.rs index 35089ea009d..ed973c66e35 100644 --- a/src/plumbing/pretty/main.rs +++ b/src/plumbing/pretty/main.rs @@ -125,6 +125,25 @@ pub fn main() -> Result<()> { git_features::interrupt::init_handler(std::io::stderr()); match cmd { + Subcommands::RemoteRefList { protocol, url } => prepare_and_run( + "remote-ref-list", + verbose, + progress, + progress_keep_open, + core::remote::refs::PROGRESS_RANGE, + move |progress, out, _err| { + core::remote::refs::list( + protocol, + &url, + git_features::progress::DoOrDiscard::from(progress), + core::remote::refs::Context { + thread_limit, + format, + out, + }, + ) + }, + ), Subcommands::PackIndexFromData { iteration_mode, pack_path, diff --git a/src/plumbing/pretty/options.rs b/src/plumbing/pretty/options.rs index f42b207905b..84f57d82a03 100644 --- a/src/plumbing/pretty/options.rs +++ b/src/plumbing/pretty/options.rs @@ -42,9 +42,22 @@ pub struct Args { #[derive(Debug, Clap)] pub enum Subcommands { - /// Create an index from a packfile. + /// List remote references from a remote identified by a url. /// - /// This command can also be used to stream packs to standard input or to repair partial packs. + /// This is the plumbing equivalent of `git ls-remote`. + /// Supported URLs are documented here: https://www.git-scm.com/docs/git-clone#_git_urls + #[clap(setting = AppSettings::ColoredHelp)] + #[clap(setting = AppSettings::DisableVersion)] + RemoteRefList { + /// The protocol version to use. Valid values are 1 and 2 + #[clap(long, short = "p")] + protocol: Option, + + /// the URLs or path from which to receive references + /// + /// See here for a list of supported URLs: https://www.git-scm.com/docs/git-clone#_git_urls + url: String, + }, #[clap(setting = AppSettings::ColoredHelp)] #[clap(setting = AppSettings::DisableVersion)] PackIndexFromData { diff --git a/tasks.md b/tasks.md index db833257be4..f756fd53cb1 100644 --- a/tasks.md +++ b/tasks.md @@ -3,6 +3,8 @@ * [x] allow automatic downgrade (request V2, deal with that not supported and fallback to V1) * [x] basic progress * **gixp-ls-remote** + * [x] pretty version with json support + * [ ] usable JSON * [ ] A V1/V2 version of a delegate to list remotes of a given remote, attempting to use as many features as possible * [ ] journey tests for each connection method * [x] file @@ -12,11 +14,12 @@ * [ ] git JT * [x] ssh * [x] expand user support - * [ ] ssh JT + * [ ] ~~ssh JT~~ * [x] https (unauthenticated) + * [ ] https (unauthenticated) JIT * [x] https (authenticated) * **git-protocol** - * [ ] delegate to support clone + * [ ] delegate interaction to support clone * [ ] parse server negotiation response * [ ] negotiation via delegate * [ ] pack file receive passed to delegate