Code

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