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 <binary@benary.org>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user