Documentation: clarify diff --cc
[git/jnareb-git/bp-gitweb.git] / git-lost-found.sh
blob9cedaf80ceac1d4100adf3cfb152c76c7f945e4d
1 #!/bin/sh
3 USAGE=''
4 SUBDIRECTORY_OK='Yes'
5 OPTIONS_SPEC=
6 . git-sh-setup
8 echo "WARNING: '$0' is deprecated in favor of 'git fsck --lost-found'" >&2
10 if [ "$#" != "0" ]
11 then
12 usage
15 laf="$GIT_DIR/lost-found"
16 rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
18 git fsck --full --no-reflogs |
19 while read dangling type sha1
21 case "$dangling" in
22 dangling)
23 if git rev-parse --verify "$sha1^0" >/dev/null 2>/dev/null
24 then
25 dir="$laf/commit"
26 git show-branch "$sha1"
27 else
28 dir="$laf/other"
30 echo "$sha1" >"$dir/$sha1"
32 esac
33 done