Skip to content

Commit

Permalink
[ref-ls] add pretty version for ls-refs
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Sep 5, 2020
1 parent d88e9da commit 487d06d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/plumbing/lean/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<core::Protocol>,

/// the URLs or path from which to receive references
Expand Down
19 changes: 19 additions & 0 deletions src/plumbing/pretty/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 15 additions & 2 deletions src/plumbing/pretty/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<core::Protocol>,

/// 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 {
Expand Down
7 changes: 5 additions & 2 deletions tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 487d06d

Please sign in to comment.