Staging
v0.5.1
https://github.com/git/git
Revision 16cee38ae2bff93a4e4c512550fb4ccac035a3a1 authored by Junio C Hamano on 06 June 2006, 05:36:21 UTC, committed by Junio C Hamano on 06 June 2006, 05:36:21 UTC
Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 1d84a60
Raw File
Tip revision: 16cee38ae2bff93a4e4c512550fb4ccac035a3a1 authored by Junio C Hamano on 06 June 2006, 05:36:21 UTC
rev-parse: tighten constness properly.
Tip revision: 16cee38
git-lost-found.sh
#!/bin/sh

USAGE=''
SUBDIRECTORY_OK='Yes'
. git-sh-setup

if [ "$#" != "0" ]
then
    usage
fi

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
back to top