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 @@
11 use gix::bstr::{BStr, BString, ByteSlice};
22
3+use crate::OutputFormat;
4+
35 #[derive(Eq, PartialEq, PartialOrd, Ord)]
46 enum VersionPart {
57 String(BString),
@@ -41,7 +43,11 @@ impl Version { · 35 unmodified lines
4143 }
4244 }
4345
44−pub fn list(repo: gix::Repository, out: &mut dyn std::io::Write) -> anyhow::Result<()> {
46+pub 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+
4551 let platform = repo.references()?;
4652
4753 let mut tags: Vec<_> = platform
gix/src/discover.rs+1−1
@@ -3,7 +3,7 @@ use std::path::Path; · 2 unmodified lines
33
44 pub use gix_discover::*;
55
6−use crate::{bstr::BString, Repository, ThreadSafeRepository};
6+use crate::{bstr::BString, ThreadSafeRepository};
77
88 /// The error returned by [`crate::discover()`].
99 #[derive(Debug, thiserror::Error)]
src/plumbing/main.rs+1−1
@@ -1312,7 +1312,7 @@ pub fn main() -> Result<()> { · 1311 unmodified lines
13121312 progress,
13131313 progress_keep_open,
13141314 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),
13161316 ),
13171317 },
13181318 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