git-quiltimport.sh fix --patches handling
[git.git] / git-lost-found.sh
bloba5a32e7c70f33369a016dd18ebb072c90b3a40f7
1 #!/bin/sh
3 USAGE=''
4 SUBDIRECTORY_OK='Yes'
5 OPTIONS_SPEC=
6 . git-sh-setup
8 if [ "$#" != "0" ]
9 then
10 usage
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
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"
28 echo "$sha1" >"$dir/$sha1"
30 esac
31 done