aboutsummaryrefslogtreecommitdiff
path: root/git-lost-found.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-11-13 02:07:02 -0800
committerJunio C Hamano <junkio@cox.net>2005-11-13 02:07:02 -0800
commit0086e2c854e3af3209915e4ec2f933bcef400050 (patch)
tree57701ab66d75e8f02c9db9b2e6e1bdfc11fccf11 /git-lost-found.sh
parentabacbe4166bcf9d62f430a4a75de2e82df3799b1 (diff)
downloadgit-0086e2c854e3af3209915e4ec2f933bcef400050.tar.gz
git-0086e2c854e3af3209915e4ec2f933bcef400050.tar.xz
Rename lost+found to lost-found.
Because we use "lost-found" as the directory name to hold dangling object names, it is confusing to call the command git-lost+found, although it makes sense and is even cute ;-). Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-lost-found.sh')
-rwxr-xr-xgit-lost-found.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/git-lost-found.sh b/git-lost-found.sh
new file mode 100755
index 000000000..3892f5200
--- /dev/null
+++ b/git-lost-found.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+. git-sh-setup || die "Not a git archive."
+
+laf="$GIT_DIR/lost-found"
+rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
+
+git fsck-objects |
+while read dangling type sha1
+do
+ case "$dangling" in
+ dangling)
+ if git-rev-parse --verify "$sha1^0" >/dev/null 2>/dev/null
+ then
+ dir="$laf/commit"
+ git-show-branch "$sha1"
+ else
+ dir="$laf/other"
+ fi
+ echo "$sha1" >"$dir/$sha1"
+ ;;
+ esac
+done