]> arthur.barton.de Git - bup.git/blob - cmd-join.sh
Add 'bup init' command.
[bup.git] / cmd-join.sh
1 #!/bin/sh
2 set -e
3
4 get_one()
5 {
6     local typ="$1"
7     local sha="$2"
8     if [ "$typ" = "tree" -o "$typ" = "commit" ]; then
9         git cat-file -p "$x:" | while read nmode ntyp nsha njunk; do
10             get_one $ntyp $nsha
11         done
12     else
13         git cat-file blob "$sha"
14     fi
15 }
16
17
18 get_from_stdin()
19 {
20     while read x junk; do
21         [ -z "$x" ] && continue
22         typ="$(git cat-file -t "$x")"
23         get_one "$typ" "$x"
24     done
25 }
26
27
28 if [ -z "$*" ]; then
29     get_from_stdin
30 else
31     for d in "$@"; do
32         echo "$d"
33     done | get_from_stdin
34 fi