]> git.ipfire.org Git - thirdparty/git.git/blame - git-lost-found.sh
git-fetch: Usage string clean-up, emit usage string at unrecognized option
[thirdparty/git.git] / git-lost-found.sh
CommitLineData
04e7ca1a
JH
1#!/bin/sh
2
eefaa4fc 3GIT_DIR=`git-rev-parse --git-dir` || exit $?
07203659 4laf="$GIT_DIR/lost-found"
04e7ca1a
JH
5rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
6
7git fsck-objects |
8while read dangling type sha1
9do
10 case "$dangling" in
11 dangling)
12 if git-rev-parse --verify "$sha1^0" >/dev/null 2>/dev/null
13 then
14 dir="$laf/commit"
15 git-show-branch "$sha1"
16 else
17 dir="$laf/other"
18 fi
19 echo "$sha1" >"$dir/$sha1"
20 ;;
21 esac
22done