on iko/ghcjs-patch-master help sign in
Add error message for empty src (#320)
cb8e388David Cao
lib/call-cabal-project-to-nix.nix+7
@@ -170,6 +170,13 @@ let
170 ) (''
170 ) (''
171 tmp=$(mktemp -d)
171 tmp=$(mktemp -d)
172 cd $tmp
172 cd $tmp
173+ # if maybeCleanedSource is empty, this means it's a new
174+ # project where the files haven't been added to the git
175+ # repo yet. We fail early and provide a useful error
176+ # message to prevent headaches (#290).
177+ if [ -z "$(ls -A ${maybeCleanedSource})" ];
178+ echo "cleaned source is empty. Did you forget to 'git add -A'?"; exit 1;
179+ fi
173 cp -r ${maybeCleanedSource}/* .
180 cp -r ${maybeCleanedSource}/* .
174 chmod +w -R .
181 chmod +w -R .
175 ${fixedProject.makeFixedProjectFile}
182 ${fixedProject.makeFixedProjectFile}