t/t6022: a new test for renaming merge.
[git.git] / git-lost-found.sh
1 #!/bin/sh
2
3 GIT_DIR=`git-rev-parse --git-dir` || exit $?
4 laf="$GIT_DIR/lost-found"
5 rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
6
7 git fsck-objects |
8 while read dangling type sha1
9 do
10         case "$dangling" in
11         dangling)
12                 if git-rev-parse --verify "$sha1^0" >/dev/null 2>/dev/null
13                 then
14                         dir="$laf/commit"
15                         git-show-branch "$sha1"
16                 else
17                         dir="$laf/other"
18                 fi
19                 echo "$sha1" >"$dir/$sha1"
20                 ;;
21         esac
22 done