From dd98f0564e89989c4bca8ce84f9e28224b91fb00 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sun, 7 Feb 2021 23:45:14 -0800 Subject: [PATCH] git: remove git note pointing to conflicts We store conflicts as blobs with JSON data and with a git note pointing to them to prevent GC. These are stored in the git tree as regular files. The only thing that distinguishes them is that their filename ends with `.jjconflict`. Since they are referenced from the tree, there's no need for the git note to prevent GC (which doesn't work anyway, as I just learned), and we don't store any additional data in the note either, so let's just remove it. --- lib/src/git_store.rs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/lib/src/git_store.rs b/lib/src/git_store.rs index 26d02f8f6..fe84fdc2e 100644 --- a/lib/src/git_store.rs +++ b/lib/src/git_store.rs @@ -31,7 +31,6 @@ use backoff::{ExponentialBackoff, Operation}; use std::ops::Deref; const COMMITS_NOTES_REF: &str = "refs/notes/jj/commits"; -const CONFLICTS_NOTES_REF: &str = "refs/notes/jj/conflicts"; const CONFLICT_SUFFIX: &str = ".jjconflict"; impl From for StoreError { @@ -388,22 +387,6 @@ impl Store for GitStore { let bytes = json_string.as_bytes(); let locked_repo = self.repo.lock().unwrap(); let oid = locked_repo.blob(bytes).unwrap(); - let signature = git2::Signature::now("Jujube", "jj@example.com").unwrap(); - let note_result = write_note( - locked_repo.deref(), - &signature, - CONFLICTS_NOTES_REF, - oid, - "Conflict object used by Jujube", - ); - match note_result { - // It's fine if the conflict already existed (no need to update the note), but - // any other error is unexpected. - Err(err) if err.code() != git2::ErrorCode::Exists => { - return Err(StoreError::from(err)); - } - _ => {} - } Ok(ConflictId(oid.as_bytes().to_vec())) } }