repo: Support SHA-256 ref updates

5d0eb3896951f15c5835c55b5d2de7596ef2b52a
Use the repository object identifier width for the absent-ref sentinel
so atomic ref creation succeeds in SHA-256 repositories.

Assisted-by: Codex:gpt-5
Alexis Sellier committed ago 1 parent fdf87fb1
crates/repo/src/git.rs +2 -1
1003 1003
        reference: &Qualified<'_>,
1004 1004
        commit: Oid,
1005 1005
        expected: Option<Oid>,
1006 1006
    ) -> Result<bool, RepoError> {
1007 1007
        let commit = commit.to_string();
1008 -
        let expected_arg = expected.map_or_else(|| "0".repeat(40), |oid| oid.to_string());
1008 +
        let expected_arg =
1009 +
            expected.map_or_else(|| "0".repeat(self.object_id_width), |oid| oid.to_string());
1009 1010
        let output = self.run(
1010 1011
            "update-ref",
1011 1012
            &[reference.as_str(), &commit, &expected_arg],
1012 1013
            Opts::default(),
1013 1014
        )?;
root\nnew file mode")); +0 -0
file\n")); +0 -0
file\n"), +0 -0
file\n"), +0 -0
a\n--- a/a\n+++ b/a\n@@ -1 +1 @@\n-old\n+new\n".to_owned(), +0 -0
b\n--- a/b\n+++ b/b\n@@ -0,0 +1 @@\n+line\n".to_owned(), +0 -0
f{index}\n--- a/f{index}\n+++ b/f{index}\n\ +0 -0