]> git.ipfire.org Git - thirdparty/git.git/blame - git-lost-found.sh
Git 1.7.8-rc2
[thirdparty/git.git] / git-lost-found.sh
CommitLineData
04e7ca1a
JH
1#!/bin/sh
2
d20e2f16
FK
3USAGE=''
4SUBDIRECTORY_OK='Yes'
8f321a39 5OPTIONS_SPEC=
d20e2f16
FK
6. git-sh-setup
7
fc8b5f03
JS
8echo "WARNING: '$0' is deprecated in favor of 'git fsck --lost-found'" >&2
9
d20e2f16
FK
10if [ "$#" != "0" ]
11then
12 usage
13fi
14
07203659 15laf="$GIT_DIR/lost-found"
04e7ca1a
JH
16rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
17
566842f6 18git fsck --full --no-reflogs |
04e7ca1a
JH
19while read dangling type sha1
20do
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
33done