Documentation: fix git-clone manpage not to refer to itself
[git] / git-lost-found.sh
1 #!/bin/sh
2
3 USAGE=''
4 SUBDIRECTORY_OK='Yes'
5 . git-sh-setup
6
7 echo "WARNING: '$0' is deprecated in favor of 'git fsck --lost-found'" >&2
8
9 if [ "$#" != "0" ]
10 then
11     usage
12 fi
13
14 laf="$GIT_DIR/lost-found"
15 rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
16
17 git fsck --full --no-reflogs |
18 while read dangling type sha1
19 do
20         case "$dangling" in
21         dangling)
22                 if git rev-parse --verify "$sha1^0" >/dev/null 2>/dev/null
23                 then
24                         dir="$laf/commit"
25                         git show-branch "$sha1"
26                 else
27                         dir="$laf/other"
28                 fi
29                 echo "$sha1" >"$dir/$sha1"
30                 ;;
31         esac
32 done