mirror of
https://github.com/NixOS/nix
synced 2025-07-02 09:21:47 +02:00
Merge pull request #4638 from orbekk/read_head
Resolve reference for remote git repositories (makes fetchGit work with non-'master' branch)
This commit is contained in:
commit
a26be9f3b8
7 changed files with 326 additions and 130 deletions
|
@ -161,6 +161,14 @@ path4=$(nix eval --impure --raw --expr "(builtins.fetchGit $repo).outPath")
|
|||
[[ $(cat $path4/hello) = dev ]]
|
||||
[[ $path3 = $path4 ]]
|
||||
|
||||
# Using remote path with branch other than 'master' should fetch the HEAD revision.
|
||||
# (--tarball-ttl 0 to prevent using the cached repo above)
|
||||
export _NIX_FORCE_HTTP=1
|
||||
path4=$(nix eval --tarball-ttl 0 --impure --raw --expr "(builtins.fetchGit $repo).outPath")
|
||||
[[ $(cat $path4/hello) = dev ]]
|
||||
[[ $path3 = $path4 ]]
|
||||
unset _NIX_FORCE_HTTP
|
||||
|
||||
# Confirm same as 'dev' branch
|
||||
path5=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = $repo; ref = \"dev\"; }).outPath")
|
||||
[[ $path3 = $path5 ]]
|
||||
|
|
|
@ -31,7 +31,14 @@ flakeFollowsE=$TEST_ROOT/follows/flakeA/flakeE
|
|||
for repo in $flake1Dir $flake2Dir $flake3Dir $flake7Dir $templatesDir $nonFlakeDir $flakeA $flakeB $flakeFollowsA; do
|
||||
rm -rf $repo $repo.tmp
|
||||
mkdir -p $repo
|
||||
git -C $repo init
|
||||
|
||||
# Give one repo a non-master initial branch.
|
||||
extraArgs=
|
||||
if [[ $repo == $flake2Dir ]]; then
|
||||
extraArgs="--initial-branch=main"
|
||||
fi
|
||||
|
||||
git -C $repo init $extraArgs
|
||||
git -C $repo config user.email "foobar@example.com"
|
||||
git -C $repo config user.name "Foobar"
|
||||
done
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue