summaryrefslogtreecommitdiff
path: root/scripts/hash.rc
blob: 901511834c6bc18d8d75a48640a0408d3821c2e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/rc

flag e +

repo=$1
mode=$2
name=$3
shift 3

fn checkstatus {}

hash=`{
	switch($mode) {
	case 12????
		printf %s $1 | git -C $repo hash-object -w --stdin
	case 10????
		git -C $repo hash-object -w --stdin <$1
	case *
		status=1
	}
}
checkstatus

printf '%s %s\t%s\n' $mode $hash $name