From 51979aef9a8a28253223140a8fbf92f3e5fa371a Mon Sep 17 00:00:00 2001 From: Harnoor Lal Date: Sat, 7 Mar 2026 15:45:00 -0800 Subject: [PATCH] fix(git): peel annotated tags to commit in diff When `chainsaw diff v1.0.0` is called and v1.0.0 is an annotated tag, `resolve_ref_to_sha` returned the tag object SHA instead of the commit SHA. `GitTreeVfs::new` then failed because it expects a commit object. Append `^{commit}` to the rev-parse argument so annotated tags are peeled to their underlying commit, matching the behaviour already present in `classify_diff_arg`. Closes #145 --- src/vfs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vfs.rs b/src/vfs.rs index 2a0fc8e..7dfd695 100644 --- a/src/vfs.rs +++ b/src/vfs.rs @@ -273,7 +273,7 @@ impl GitTreeVfs { fn resolve_ref_to_sha(repo_path: &Path, git_ref: &str) -> io::Result { let output = std::process::Command::new("git") - .args(["rev-parse", "--verify", git_ref]) + .args(["rev-parse", "--verify", &format!("{git_ref}^{{commit}}")]) .current_dir(repo_path) .output() .map_err(|e| io::Error::other(format!("git rev-parse: {e}")))?;