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