All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
2 # set up git-annex aliases and functions
4 # Copyright © 2018 martin f. krafft <madduck@madduck.net>
5 # Released under the terms of the Artistic Licence 2.0
7 # Source repository: http://git.madduck.net/v/etc/zsh.git
11 alias gx\?='alias -rm gx gx[a-z]'
21 local cdup=$(git rev-parse --show-cdup 2>/dev/null || git init --quiet)
22 [[ -n $cdup ]] && builtin cd "$cdup"
27 setopt localoptions xtrace
28 [[ -z "$1" ]] && { echo >&2 E: missing file; return 1; }
31 if [[ -f "$f" ]]; then
33 files[$f]=$(md5sum "$f")
36 ${EDITOR:-editor} "$@"
38 [[ -f "$f" ]] || continue
39 [[ $files[$f] == "$(md5sum "$f")" ]] || gxa "$f"
45 function gxtestfile() {
46 local fname="${1:-$(tempfile -d ${PWD})}"
47 local fname="${fname##*/}"
48 echo "${(%):-"%D{%c}"}" >| "$fname"
50 gc -m"add test file $fname"
54 setopt localoptions xtrace
58 if [[ -z $rloc ]]; then
59 echo >&2 "E: missing remote location."
63 local host="${rloc%%:*}"
64 local rdest="${rloc#*:}"
65 local origin="${host%%.*}"
66 local localhost="${(%):-%m}"
67 git clone --origin "$origin" "$rloc" "$dest"
69 git annex --quiet init
70 ssh "$host" "builtin cd '$rdest' && git remote add $localhost $localhost:${PWD#${HOME}/} && git annex --quiet sync"
76 #setopt localoptions xtrace
78 [[ $1 =~ (start|stop|q) ]] && { mode=$1; shift; }
80 local dir="${${1:a}:-${PWD}}"
81 if [[ ! -d $dir ]]; then
82 echo >&2 "E: directory does not exist: $dir"
84 elif [[ ! -d $dir/.git ]]; then
85 echo >&2 "E: not a Git repository: $dir"
89 local escaped="$(systemd-escape "$dir")"
90 local service="git-annex-assistant@${escaped}.service"
91 local function sc() { systemctl --quiet --user "$@" "$service"; }
92 case "${mode:-start}" in
98 sc is-failed && sc reset-failed