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

flag e +

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

hash=`{
	switch($mode) {
	case 120???
		printf %s $1 | git -C $repo hash-object -w --stdin
	case 100???
		git -C $repo hash-object -w --stdin <$1
	}
}

printf '%s %s\t%s\n' $mode $hash $name >$out.tmp
mv $out.tmp $out