1
0
mirror of https://github.com/git/git.git synced 2024-10-06 14:33:28 +02:00
git/git-lost+found.sh
Junio C Hamano 07203659d0 Rename .git/lost+found to .git/lost-found.
Just to avoid confusion that scripts poorly written by somebody
else ;-) might mistake this as a mount point, or backup tools
ignoring the directory.  The latter is probably not a big loss,
however, considering that this directory's contents are to be
used while fresh anyway.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-11 21:52:21 -08:00

24 lines
420 B
Bash
Executable File

#!/bin/sh
. git-sh-setup || die "Not a git archive."
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