Skip to content

Commit

Permalink
Fix Git checkout in container
Browse files Browse the repository at this point in the history
This lets packages resolve Git refs in their source tree. GEANT4 needs this.
  • Loading branch information
TimoWilken committed Mar 14, 2024
1 parent 3666880 commit 0f62890
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion alibuild_helpers/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ def cloneReferenceCmd(self, source, referenceRepo, usePartialClone):
def cloneSourceCmd(self, source, destination, referenceRepo, usePartialClone):
cmd = ["clone", "-n", source, destination]
if referenceRepo:
cmd.extend(["--reference", referenceRepo])
# If we're building inside a Docker container, we can't refer to the
# mirror repo directly, since Git uses an absolute path. With
# "--dissociate", we still copy the objects locally, but we don't refer
# to them by path.
cmd.extend(["--dissociate", "--reference", referenceRepo])
if usePartialClone:
cmd.extend(clone_speedup_options())
return cmd
Expand Down
4 changes: 2 additions & 2 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"/sw/MIRROR/zlib", "--filter=blob:none"), ".", False
GIT_CLONE_SRC_ZLIB_ARGS = ("clone", "-n", "https://github.com/star-externals/zlib",
"/sw/SOURCES/zlib/v1.2.3/8822efa61f",
"--reference", "/sw/MIRROR/zlib", "--filter=blob:none"), ".", False
"--dissociate", "--reference", "/sw/MIRROR/zlib", "--filter=blob:none"), ".", False
GIT_SET_URL_ZLIB_ARGS = ("remote", "set-url", "--push", "origin", "https://github.com/star-externals/zlib"), \
"/sw/SOURCES/zlib/v1.2.3/8822efa61f", False
GIT_CHECKOUT_ZLIB_ARGS = ("checkout", "-f", "master"), \
Expand All @@ -115,7 +115,7 @@
"+refs/heads/*:refs/heads/*"), "/sw/MIRROR/root", False
GIT_CLONE_SRC_ROOT_ARGS = ("clone", "-n", "https://github.com/root-mirror/root",
"/sw/SOURCES/ROOT/v6-08-30/f7b3366117",
"--reference", "/sw/MIRROR/root", "--filter=blob:none"), ".", False
"--dissociate", "--reference", "/sw/MIRROR/root", "--filter=blob:none"), ".", False
GIT_SET_URL_ROOT_ARGS = ("remote", "set-url", "--push", "origin", "https://github.com/root-mirror/root"), \
"/sw/SOURCES/ROOT/v6-08-30/f7b3366117", False
GIT_CHECKOUT_ROOT_ARGS = ("checkout", "-f", "v6-08-00-patches"), \
Expand Down

0 comments on commit 0f62890

Please sign in to comment.