diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix index b5b8a7b..939ffb3 100644 --- a/pkgs/populate/default.nix +++ b/pkgs/populate/default.nix @@ -60,6 +60,17 @@ let in /* sh */ '' umask 0077 + if test -e ${quote source.dir}/.git; then + local_pass_info=${quote source.name}\ $(${git}/bin/git -C ${quote source.dir} rev-parse HEAD) + remote_pass_info=$(${shell' target /* sh */ '' + cat ${quote target.path}/.pass_info || : + ''}) + + if test "$local_pass_info" = "$remote_pass_info"; then + exit 0 + fi + fi + tmp_dir=$(${coreutils}/bin/mktemp -dt populate-pass.XXXXXXXX) trap cleanup EXIT cleanup() { @@ -83,6 +94,10 @@ let ${coreutils}/bin/touch -d "$pass_date" "$tmp_path" done + if test -n "''${local_pass_info-}"; then + echo "$local_pass_info" > "$tmp_dir"/.pass_info + fi + ${rsync' target {} /* sh */ "$tmp_dir"} '';