mirror of
https://github.com/martinvonz/jj.git
synced 2024-11-11 02:30:57 +03:00
git_store: avoid confusing delegation from write_conflict() to write_file()
Very little code was saved by reusing `write_file()` and it made it confusing (needed to provide an unused filename). Also, I'll soon want access to the `locked_repo` variable in `write_conflict()`.
This commit is contained in:
parent
8cca56ee77
commit
3613fe3f59
@ -371,10 +371,11 @@ impl Store for GitStore {
|
||||
"adds": conflict_part_list_to_json(&conflict.adds),
|
||||
});
|
||||
let json_string = json.to_string();
|
||||
let mut bytes = json_string.as_bytes();
|
||||
let bytes = json_string.as_bytes();
|
||||
let locked_repo = self.repo.lock().unwrap();
|
||||
// TODO: add a ref pointing to it so it won't get GC'd
|
||||
let file_id = self.write_file(&FileRepoPath::from("unused"), &mut bytes)?;
|
||||
Ok(ConflictId(file_id.0))
|
||||
let oid = locked_repo.blob(bytes).unwrap();
|
||||
Ok(ConflictId(oid.as_bytes().to_vec()))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user