History

Fail `gix tag list` when JSON is requested

Christoph Rüßler committed 1 year ago

Commit fb2766b1 parent fa1287f3 files · +9 −3Browse files

Unified · Split

3 files
  1. gitoxide-core/src/repository/tag.rs +7 −1
  2. gix/src/discover.rs +1 −1
  3. src/plumbing/main.rs +1 −1
gitoxide-core/src/repository/tag.rs+7−1
@@ -1,5 +1,7 @@
1use gix::bstr::{BStr, BString, ByteSlice};1use gix::bstr::{BStr, BString, ByteSlice};
2 2
3use crate::OutputFormat;
4
3#[derive(Eq, PartialEq, PartialOrd, Ord)]5#[derive(Eq, PartialEq, PartialOrd, Ord)]
4enum VersionPart {6enum VersionPart {
5 String(BString),7 String(BString),
@@ -41,7 +43,11 @@ impl Version { · 35 unmodified lines
41 }43 }
42}44}
43 45
44pub fn list(repo: gix::Repository, out: &mut dyn std::io::Write) -> anyhow::Result<()> {46pub fn list(repo: gix::Repository, out: &mut dyn std::io::Write, format: OutputFormat) -> anyhow::Result<()> {
47 if format != OutputFormat::Human {
48 anyhow::bail!("JSON output isn't supported");
49 }
50
45 let platform = repo.references()?;51 let platform = repo.references()?;
46 52
47 let mut tags: Vec<_> = platform53 let mut tags: Vec<_> = platform
gix/src/discover.rs+1−1
@@ -3,7 +3,7 @@ use std::path::Path; · 2 unmodified lines
3 3
4pub use gix_discover::*;4pub use gix_discover::*;
5 5
6use crate::{bstr::BString, Repository, ThreadSafeRepository};6use crate::{bstr::BString, ThreadSafeRepository};
7 7
8/// The error returned by [`crate::discover()`].8/// The error returned by [`crate::discover()`].
9#[derive(Debug, thiserror::Error)]9#[derive(Debug, thiserror::Error)]
src/plumbing/main.rs+1−1
@@ -1312,7 +1312,7 @@ pub fn main() -> Result<()> { · 1311 unmodified lines
1312 progress,1312 progress,
1313 progress_keep_open,1313 progress_keep_open,
1314 None,1314 None,
1315 move |_progress, out, _err| core::repository::tag::list(repository(Mode::Lenient)?, out),1315 move |_progress, out, _err| core::repository::tag::list(repository(Mode::Lenient)?, out, format),
1316 ),1316 ),
1317 },1317 },
1318 Subcommands::Tree(cmd) => match cmd {1318 Subcommands::Tree(cmd) => match cmd {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t