mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 00:08:07 +02:00
Fetch specific Git revisions
This is more efficient, and necessary when using shallow=1 with a rev.
This commit is contained in:
parent
f450c8773c
commit
e4066c0444
2 changed files with 5 additions and 4 deletions
|
@ -518,8 +518,11 @@ struct GitInputScheme : InputScheme
|
|||
|
||||
if (doFetch) {
|
||||
try {
|
||||
auto fetchRef = getAllRefsAttr(input)
|
||||
auto fetchRef =
|
||||
getAllRefsAttr(input)
|
||||
? "refs/*"
|
||||
: input.getRev()
|
||||
? input.getRev()->gitRev()
|
||||
: ref.compare(0, 5, "refs/") == 0
|
||||
? ref
|
||||
: ref == "HEAD"
|
||||
|
|
|
@ -51,9 +51,7 @@ git -C $repo add differentbranch
|
|||
git -C $repo commit -m 'Test2'
|
||||
git -C $repo checkout master
|
||||
devrev=$(git -C $repo rev-parse devtest)
|
||||
out=$(nix eval --impure --raw --expr "builtins.fetchGit { url = file://$repo; rev = \"$devrev\"; }" 2>&1) || status=$?
|
||||
[[ $status == 1 ]]
|
||||
[[ $out =~ 'Cannot find Git revision' ]]
|
||||
nix eval --impure --raw --expr "builtins.fetchGit { url = file://$repo; rev = \"$devrev\"; }"
|
||||
|
||||
[[ $(nix eval --raw --expr "builtins.readFile (builtins.fetchGit { url = file://$repo; rev = \"$devrev\"; allRefs = true; } + \"/differentbranch\")") = 'different file' ]]
|
||||
|
||||
|
|
Loading…
Reference in a new issue