-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-getall
More file actions
executable file
·35 lines (27 loc) · 775 Bytes
/
git-getall
File metadata and controls
executable file
·35 lines (27 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
USAGE="$0 [PATH]
Searches for git repositories in PATH, and does a 'git get' on them.
That is: a git fetch --all --prune
Designed to run as an automated update script.
Does not touch bare repositories.
If not specified, PATH defaults to ~/src
"
die() { echo "$@"; exit 1; }
interrupt() { kill "$current"; }
SRCDIR="$1"
shift 1
[ "$SRCDIR" ] || SRCDIR=~/src
[ -e "$SRCDIR" ] || die "$SRCDIR not found"
[ -d "$SRCDIR" ] || die "$SRCDIR not a directory"
trap interrupt SIGINT
echo "Scanning directory $SRCDIR"
for d in "$SRCDIR"/*; do
[ -d "$d" ] || continue
[ -d "$d/.git" ] && (
cd "$d"
echo "Fetching for repository ${d}..."
git get
) &
current=$!
wait "$current" # if we get a ^C, interrupt() will kill the $current proc and we continue.
done