~sircmpwn/shit

ref: 308ffecc89bce90960bdbbdd2f4cfd4fce8a7367 shit/write-tree -rwxr-xr-x 368 bytes
308ffeccDrew DeVault Initial commit 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh -eu
SHIT_PATH=$(dirname "$0")
. $SHIT_PATH/common.sh

"$SHIT_PATH"/ls-files | while read -r type mode sha path
do
	case $type in
		file)
			mode=100$mode
			;;
		link)
			mode=012$mode
			;;
		gitlink)
			printf "submodules are unimplemented\n" >&2
			exit 1
			;;
	esac
	# TODO: subtrees
	objtype=blob
	printf "%s %s\0" $mode "$path"
	write_hex "$sha"
done