Problem
Ledger::create assigns a ref ID via IdStrategy, but none of the current
variants allow the ref to be named after the OID of its own initial commit.
The desired layout is refs/forge/issue/<initial-commit-oid> — where the ref
suffix is the OID of the commit that create writes. This OID is the permanent,
stable identity of the entity; it never changes even as the ref tip advances
with edits.
Current workaround
In git-forge we bypass Ledger::create entirely and write the commit + ref
manually:
let commit_oid = repo.commit(None, &sig, &sig, message, &tree, &[])?;
let ref_name = format!("refs/forge/issue/{commit_oid}");
repo.reference(&ref_name, commit_oid, false, "create issue")?;
This duplicates internal Ledger logic and bypasses the abstraction.
Proposed fix
Add a new variant to IdStrategy:
/// Name the record's ref after the OID of the commit that `create` writes.
CommitOid,
Inside Ledger::create, build the tree and commit first (with no ref), then
use the resulting commit OID as the record ID and create the ref in a second
step.
Problem
Ledger::createassigns a ref ID viaIdStrategy, but none of the currentvariants allow the ref to be named after the OID of its own initial commit.
The desired layout is
refs/forge/issue/<initial-commit-oid>— where the refsuffix is the OID of the commit that
createwrites. This OID is the permanent,stable identity of the entity; it never changes even as the ref tip advances
with edits.
Current workaround
In
git-forgewe bypassLedger::createentirely and write the commit + refmanually:
This duplicates internal Ledger logic and bypasses the abstraction.
Proposed fix
Add a new variant to
IdStrategy:Inside
Ledger::create, build the tree and commit first (with no ref), thenuse the resulting commit OID as the record ID and create the ref in a second
step.