1#!/bin/sh
23
GIT_DIR=`git-rev-parse --git-dir` || exit $?
4laf="$GIT_DIR/lost-found"
5rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
67
git fsck-objects |
8while read dangling type sha1
9do
10case "$dangling" in
11dangling)
12if git-rev-parse --verify "$sha1^0" >/dev/null 2>/dev/null
13then
14dir="$laf/commit"
15git-show-branch "$sha1"
16else
17dir="$laf/other"
18fi
19echo "$sha1" >"$dir/$sha1"
20;;
21esac
22done