summaryrefslogtreecommitdiff
path: root/scripts/hash.rc
blob: 5f894a6b0e651facdf0a6f1b0c7c0c288454684c (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
25
26
#!/bin/rc

flag e +

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

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 >$out.tmp
mv $out.tmp $out