1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-08 00:46:11 +02:00
git/git-lost-found.sh
Junio C Hamano ae2b0f1518 git-sh-setup: die if outside git repository.
Now all the users of this script detect its exit status and die,
complaining that it is outside git repository.  So move the code
that dies from all callers to git-sh-setup script.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 13:49:17 -08:00

24 lines
392 B
Bash
Executable File

#!/bin/sh
. git-sh-setup
laf="$GIT_DIR/lost-found"
rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
git fsck-objects |
while read dangling type sha1
do
case "$dangling" in
dangling)
if git-rev-parse --verify "$sha1^0" >/dev/null 2>/dev/null
then
dir="$laf/commit"
git-show-branch "$sha1"
else
dir="$laf/other"
fi
echo "$sha1" >"$dir/$sha1"
;;
esac
done