Skip to content

Commit c0e385d

Browse files
cruesslerByron
authored andcommitted
Fail gix tag list when JSON is requested
1 parent af460d2 commit c0e385d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

gitoxide-core/src/repository/tag.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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 {
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

src/plumbing/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ pub fn main() -> Result<()> {
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 {

0 commit comments

Comments
 (0)