]>
Commit | Line | Data |
---|---|---|
04e7ca1a JH |
1 | #!/bin/sh |
2 | ||
d20e2f16 FK |
3 | USAGE='' |
4 | SUBDIRECTORY_OK='Yes' | |
8f321a39 | 5 | OPTIONS_SPEC= |
d20e2f16 FK |
6 | . git-sh-setup |
7 | ||
fc8b5f03 JS |
8 | echo "WARNING: '$0' is deprecated in favor of 'git fsck --lost-found'" >&2 |
9 | ||
d20e2f16 FK |
10 | if [ "$#" != "0" ] |
11 | then | |
12 | usage | |
13 | fi | |
14 | ||
07203659 | 15 | laf="$GIT_DIR/lost-found" |
04e7ca1a JH |
16 | rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit |
17 | ||
566842f6 | 18 | git fsck --full --no-reflogs | |
04e7ca1a JH |
19 | while read dangling type sha1 |
20 | do | |
21 | case "$dangling" in | |
22 | dangling) | |
a86e8c1c | 23 | if git rev-parse -q --verify "$sha1^0" >/dev/null |
04e7ca1a JH |
24 | then |
25 | dir="$laf/commit" | |
5be60078 | 26 | git show-branch "$sha1" |
04e7ca1a JH |
27 | else |
28 | dir="$laf/other" | |
29 | fi | |
30 | echo "$sha1" >"$dir/$sha1" | |
31 | ;; | |
32 | esac | |
33 | done |