-
-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A basic implementation of rev-list without anything fancy
- Loading branch information
Showing
6 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use anyhow::{bail, Context}; | ||
use git_repository as git; | ||
use std::ffi::OsString; | ||
|
||
use crate::OutputFormat; | ||
|
||
pub fn list( | ||
mut repo: git::Repository, | ||
spec: OsString, | ||
mut out: impl std::io::Write, | ||
format: OutputFormat, | ||
) -> anyhow::Result<()> { | ||
if format != OutputFormat::Human { | ||
bail!("Only human output is currently supported"); | ||
} | ||
repo.object_cache_size_if_unset(4 * 1024 * 1024); | ||
|
||
let spec = git::path::os_str_into_bstr(&spec)?; | ||
let id = repo | ||
.rev_parse(spec)? | ||
.single() | ||
.context("Only single revisions are currently supported")?; | ||
for commit in id.ancestors().all()? { | ||
writeln!(out, "{}", commit?.to_hex())?; | ||
} | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
mod list; | ||
pub use list::list; | ||
mod explain; | ||
pub use explain::explain; | ||
|
||
pub mod resolve; | ||
pub use resolve::function::resolve; | ||
|
||
mod previous_branches; | ||
pub use previous_branches::function as previous_branches; | ||
pub use previous_branches::previous_branches; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters