Introduce git_etc_gitconfig() that encapsulates access of ETC_GITCONFIG.
[git/mingw.git] / git-lost-found.sh
blobf2ec5d147a56136b8c3aff8b693912a7c792da63
1 #!/bin/sh
3 USAGE=''
4 SUBDIRECTORY_OK='Yes'
5 . git-sh-setup
7 echo "WARNING: '$0' is deprecated in favor of 'git fsck --lost-found'" >&2
9 if [ "$#" != "0" ]
10 then
11 usage
14 laf="$GIT_DIR/lost-found"
15 rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
17 git fsck --full --no-reflogs |
18 while read dangling type sha1
20 case "$dangling" in
21 dangling)
22 if git rev-parse --verify "$sha1^0" >/dev/null 2>/dev/null
23 then
24 dir="$laf/commit"
25 git show-branch "$sha1"
26 else
27 dir="$laf/other"
29 echo "$sha1" >"$dir/$sha1"
31 esac
32 done