Skip to content

Commit 846fe0b

Browse files
committed
fix: Run git read-tree and write-tree in work root
These commands seem to operate better w.r.t. how temporary indexes are handled when run from the root of the work tree. This change is low-risk since no work tree paths are passed into these commands.
1 parent 2887fa9 commit 846fe0b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/stupid/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ impl<'repo, 'index> StupidContext<'repo, 'index> {
965965

966966
/// Read content of a tree into specified index using `git read-tree`.
967967
pub(crate) fn read_tree(&self, tree_id: gix::ObjectId) -> Result<()> {
968-
self.git()
968+
self.git_in_work_root()?
969969
.arg("read-tree")
970970
.arg(tree_id.to_string())
971971
.stdout(Stdio::null())
@@ -1430,7 +1430,7 @@ impl<'repo, 'index> StupidContext<'repo, 'index> {
14301430
/// Write tree object from content of specified index using `git write-tree`.
14311431
pub(crate) fn write_tree(&self) -> Result<gix::ObjectId> {
14321432
let output = self
1433-
.git()
1433+
.git_in_work_root()?
14341434
.arg("write-tree")
14351435
.output_git()?
14361436
.require_success("write-tree")?;

0 commit comments

Comments
 (0)