forked from oridb/git9
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd
executable file
·50 lines (45 loc) · 785 Bytes
/
add
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
#!/bin/rc -e
rfork ne
. /sys/lib/git/common.rc
usage='
git/add [-r] file ...
-r remove file
'
gitup
add='tracked'
del='removed'
while(~ $1 -* && ! ~ $1 --){
switch($1){
case -r
add='removed'
del='tracked'
case *
usage
}
shift
}
if(~ $1 --)
shift
if(~ $#* 0)
usage
if(~ $#rel 0)
rel=''
if(~ $add tracked)
files=`$nl{walk -f $gitrel/$*}
if not
files=`$nl{cd .git/index9/tracked/ && walk -f $gitrel/$*}
for(f in $files){
if(! ~ `{cleanname $f} .git/*){
addpath=.git/index9/$add/$f
delpath=.git/index9/$del/$f
mkdir -p `{basename -d $addpath}
mkdir -p `{basename -d $delpath}
# We don't want a matching qid, so that
# git/walk doesn't think this came from
# a checkout.
if(! test -e $addpath)
touch $addpath
rm -f $delpath
}
}
exit ''