From 052d04512e6172a2b8a87aef94c909882c083e28 Mon Sep 17 00:00:00 2001 From: benaryorg Date: Mon, 23 Feb 2026 19:31:49 +0000 Subject: [PATCH] libfetchers: Provide gitDir for rev-list operation Without the `--git-dir` git will attempt to figure out which the git directory is on its own. This causes issues when the `GIT_DIR` envvar is set in the environment for other reasons (such as being part of a `git rebase`). Providing this parameter overrides the environment and thus makes sure the revs are always coming from the intended repository. Fixes: #1135 Change-Id: Ibd43cfd8e0278463c0e1ccf86779982947a6038a Signed-off-by: benaryorg --- lix/libfetchers/git.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lix/libfetchers/git.cc b/lix/libfetchers/git.cc index d4f8dc285..97a134af6 100644 --- a/lix/libfetchers/git.cc +++ b/lix/libfetchers/git.cc @@ -833,7 +833,7 @@ struct GitInputScheme : InputScheme auto rev = chomp(TRY_AWAIT(runProgram( "git", true, - {"-C", repoDir, "rev-list", "--max-count=1", *input.getRef()} + {"-C", repoDir, "--git-dir", gitDir, "rev-list", "--max-count=1", *input.getRef()} ))); input.attrs.insert_or_assign("rev", rev); }