fixed link in documentation of diff-options
[git/mingw/4msysgit/wingit-dll.git] / git-lost-found.sh
blobc0b00e0fd143ab9d96933f2d39baa94e7e50e0ef
1 #!/bin/sh
3 USAGE=''
4 SUBDIRECTORY_OK='Yes'
5 . git-sh-setup
7 if [ "$#" != "0" ]
8 then
9 usage
12 laf="$GIT_DIR/lost-found"
13 rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
15 git fsck --full --no-reflogs |
16 while read dangling type sha1
18 case "$dangling" in
19 dangling)
20 if git rev-parse --verify "$sha1^0" >/dev/null 2>/dev/null
21 then
22 dir="$laf/commit"
23 git show-branch "$sha1"
24 else
25 dir="$laf/other"
27 echo "$sha1" >"$dir/$sha1"
29 esac
30 done