You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This probably won't be helpful, but FWIW I hacked around a little bit last night was able to get this working w/ the following changes in dag.rs:
+use gitrevset::SetExt;
pub fn resolve_commits<'repo>(
effects: &Effects,
repo: &'repo Repo,
dag: &mut Dag,
hashes: Vec<String>,
) -> eyre::Result<ResolveCommitsResult<'repo>> {
let mut commits = Vec::new();
++ // FIXME can we share the already opened git2::Repository from repo.inner?+ let git_repo = git2::Repository::open(repo.get_path())?;+ let revset_repo = gitrevset::Repo::open_from_repo(Box::new(git_repo))?;+
for hash in hashes {
- let commit = match repo.revparse_single_commit(&hash)? {+ let set = revset_repo.anyrevs(hash.as_str())?;++ for oid in set.to_oids()? {+ // FIXME yuck: oid -> to_string -> as_str ???+ let commit = match repo.revparse_single_commit(oid?.to_string().as_str())? {
let commit = match repo.revparse_single_commit(&hash)? {
Some(commit) => commit,
None => return Ok(ResolveCommitsResult::CommitNotFound { commit: hash }),
};
commits.push(commit)
}
+ }
let commit_oids = commits.iter().map(|commit| commit.get_oid()).collect_vec();
dag.sync_from_oids(
effects,
repo,
CommitSet::empty(),
CommitSet::from_iter(commit_oids.into_iter().map(CommitVertex::from).map(Ok)),
)?;
Ok(ResolveCommitsResult::Ok { commits })
}
Not pretty and theres room for much improvement, but it was fun to play with and this was enough to get something like git hide 'desc("foo")' to actually work.
See discussion at #157.
The text was updated successfully, but these errors were encountered: