diff options
| -rw-r--r-- | ymir.nix | 14 |
1 files changed, 7 insertions, 7 deletions
| @@ -894,23 +894,23 @@ in rec { | |||
| 894 | hook=${pkgs.writeScript "git-sync.sh" '' | 894 | hook=${pkgs.writeScript "git-sync.sh" '' |
| 895 | #!${pkgs.zsh}/bin/zsh | 895 | #!${pkgs.zsh}/bin/zsh |
| 896 | 896 | ||
| 897 | repository=$(git -C ${2:h} rev-parse --show-toplevel) | 897 | repository=$(git -C ''${2:h} rev-parse --show-toplevel) |
| 898 | [[ $? -eq 0 ]] || exit 0 | 898 | [[ $? -eq 0 ]] || exit 0 |
| 899 | 899 | ||
| 900 | git() { | 900 | git() { |
| 901 | $(whence -cp git) -C ${repository} ${@} | 901 | $(whence -cp git) -C ''${repository} ${@} |
| 902 | } | 902 | } |
| 903 | 903 | ||
| 904 | typeset -a changeSet | 904 | typeset -a changeSet |
| 905 | changeSet=() | 905 | changeSet=() |
| 906 | git diff -z --name-only | \ | 906 | git diff -z --name-only | \ |
| 907 | while IFS= read -r -d $'\0' change; do changeSet=(${changeSet} ${change}); done | 907 | while IFS= read -r -d $'\0' change; do changeSet=(''${changeSet} ''${change}); done |
| 908 | 908 | ||
| 909 | [[ ${changeSet[(i)$(realpath ${2} --relative-to=${repository})]} -le ${#changeSet} ]] || exit 0 | 909 | [[ ''${changeSet[(i)$(realpath ${2} --relative-to=''${repository})]} -le ''${#changeSet} ]] || exit 0 |
| 910 | 910 | ||
| 911 | commitMessage=$(printf "%s modified via infinoted" $(realpath ${2} --relative-to=${repository})) | 911 | commitMessage=$(printf "%s modified via infinoted" $(realpath ''${2} --relative-to=''${repository})) |
| 912 | git add ${2} | 912 | git add ''${2} |
| 913 | git commit -m ${commitMessage} --no-edit ${2} | 913 | git commit -m ''${commitMessage} --no-edit ''${2} |
| 914 | git push | 914 | git push |
| 915 | ''} | 915 | ''} |
| 916 | ''; | 916 | ''; |
