ae2b0f1518
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>
24 lines
392 B
Bash
Executable File
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
|