]> git.ipfire.org Git - thirdparty/git.git/blame - git-lost-found.sh
Use symbolic name SHORT_NAME_AMBIGUOUS as error return value
[thirdparty/git.git] / git-lost-found.sh
CommitLineData
04e7ca1a
JH
1#!/bin/sh
2
d20e2f16
FK
3USAGE=''
4SUBDIRECTORY_OK='Yes'
5. git-sh-setup
6
7if [ "$#" != "0" ]
8then
9 usage
10fi
11
07203659 12laf="$GIT_DIR/lost-found"
04e7ca1a
JH
13rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
14
15git fsck-objects |
16while read dangling type sha1
17do
18 case "$dangling" in
19 dangling)
20 if git-rev-parse --verify "$sha1^0" >/dev/null 2>/dev/null
21 then
22 dir="$laf/commit"
23 git-show-branch "$sha1"
24 else
25 dir="$laf/other"
26 fi
27 echo "$sha1" >"$dir/$sha1"
28 ;;
29 esac
30done