Staging
v0.5.1
https://github.com/git/git
Revision d5e86da89155b462c30a59bc724037fb111d3894 authored by Junio C Hamano on 26 December 2006, 02:14:12 UTC, committed by Junio C Hamano on 26 December 2006, 02:39:54 UTC
This is not yet -rc1 where all new topics closes, but I think it
is getting pretty closer.  I'd still want to merge updates to
fsck/prune to honor reflog entries before -rc1.

Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent d2bafe5
Raw File
Tip revision: d5e86da89155b462c30a59bc724037fb111d3894 authored by Junio C Hamano on 26 December 2006, 02:14:12 UTC
GIT v1.5.0 preview
Tip revision: d5e86da
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 --full |
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