blob: 0dc986c69c2db066c3f8f33a5b78324272af7c76 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/bin/sh
# Print if repo is out of sync or not
# path to repo
repo="$1"
# remote for repo
remote="$2"
[ "$#" -lt 2 ] && exit 1
repo_pretty="$(printf '%s' "$repo" | sed "s@$HOME@~@")"
ref="$(git -C "$repo" symbolic-ref HEAD)"
local_hash="$(git -C "$repo" rev-parse "$ref")"
remote_hash="$(git ls-remote "$remote" "$ref" | cut -f 1)"
if [ "$remote_hash" != "$local_hash" ]; then
printf '%s: x\n' "$repo_pretty"
else
printf '%s: o\n' "$repo_pretty"
fi
|