-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitadd.sh
70 lines (59 loc) · 915 Bytes
/
gitadd.sh
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
while test $# != 0; do
case "$1" in
-v)
_debug=1
_level=1
shift
;;
-d)
shift
description=$1
shift
;;
-o)
shift
owner=$1
shift
;;
*)
break
;;
esac
done
. bdbg.sh
p=$1
if [ -z $1 ]; then
dbg 4 "missing remote repo"
exit 1
fi
. common.sh
if [ ! -z $description ]; then
dbg 2 "using git repo description: $description"
fi
if [ ! -z $owner ]; then
dbg 2 "using git repo owner: $owner"
fi
b=${GIT_BASE:-.}
set +e
t=$(mktemp)
chomp_git_path $p $t
read -r pc < $t
dbg 2 "using git repo path: $b/$pc for $p"
pushd $b
git clone --bare $p $pc
popd
if [ ! -z $description ]; then
echo -n $description > $pc/description
fi
if [ ! -z $owner ]; then
grep -e "^[owner]" $pc/config
if [ $? -eq "0" ]; then
>&2 echo "owner already set in config, skip, edit manually if you really want"
else
cat <<EOF >> $pc/config
[gitweb]
owner = $owner
EOF
fi
fi
set -e