Skip to content

Commit 9ce0b6f

Browse files
committed
feat: gix index entries also prints attributes.
1 parent affa2a5 commit 9ce0b6f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

gitoxide-core/src/repository/index/entries.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::io::BufWriter;
2+
13
pub fn entries(repo: gix::Repository, mut out: impl std::io::Write, format: crate::OutputFormat) -> anyhow::Result<()> {
24
use crate::OutputFormat::*;
35
let index = repo.index()?;
@@ -7,6 +9,7 @@ pub fn entries(repo: gix::Repository, mut out: impl std::io::Write, format: crat
79
out.write_all(b"[\n")?;
810
}
911

12+
let mut out = BufWriter::new(out);
1013
let mut entries = index.entries().iter().peekable();
1114
while let Some(entry) = entries.next() {
1215
match format {
@@ -18,6 +21,7 @@ pub fn entries(repo: gix::Repository, mut out: impl std::io::Write, format: crat
1821

1922
#[cfg(feature = "serde")]
2023
if let Json = format {
24+
use std::io::Write;
2125
out.write_all(b"]\n")?;
2226
}
2327
Ok(())

0 commit comments

Comments
 (0)