repo.or.cz
/
git
/
trast.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
rebase: one safety net, one bugfix and one optimization.
[git/trast.git]
/
git-lost-found.sh
blob
9dd7430018f4bfb76c29e77e7fb9365acaa3bd9b
1
#!/bin/sh
2
3
. git-sh-setup
4
5
laf
=
"
$GIT_DIR
/lost-found"
6
rm
-fr
"
$laf
"
&&
mkdir
-p
"
$laf
/commit"
"
$laf
/other"
||
exit
7
8
git fsck-objects |
9
while
read
dangling
type
sha1
10
do
11
case
"
$dangling
"
in
12
dangling
)
13
if
git-rev-parse
--verify
"
$sha1
^0"
>/
dev
/
null
2
>/
dev
/
null
14
then
15
dir
=
"
$laf
/commit"
16
git-show-branch
"
$sha1
"
17
else
18
dir
=
"
$laf
/other"
19
fi
20
echo
"
$sha1
"
>
"
$dir
/
$sha1
"
21
;;
22
esac
23
done