fetchgitLocal: make it work in submodules

This commit is contained in:
Eric Seidel 2016-01-04 15:08:45 -08:00
parent 2027caa875
commit a8217711ce

View File

@ -10,9 +10,9 @@ let
preferLocalBuild = true;
} ''
cd ${srcStr}
ROOT=$(git rev-parse --show-toplevel) # path to repo
DOT_GIT=$(git rev-parse --resolve-git-dir .git) # path to repo
cp $ROOT/.git/index $ROOT/.git/index-user # backup index
cp $DOT_GIT/index $DOT_GIT/index-user # backup index
git reset # reset index
git add . # add current directory
@ -21,7 +21,7 @@ let
git rev-parse $(git write-tree) \
| tr -d '\n' > $out
mv $ROOT/.git/index-user $ROOT/.git/index # restore index
mv $DOT_GIT/index-user $DOT_GIT/index # restore index
'';
gitHash = builtins.readFile gitHashFile; # cache against git hash