git-prune-scripton commit [PATCH] git bugfixes and cleanups, mainly Debian things (c68e10b)
   1#!/bin/sh
   2
   3. git-sh-setup-script || die "Not a git archive"
   4
   5dryrun=
   6echo=
   7while case "$#" in 0) break ;; esac
   8do
   9    case "$1" in
  10    -n) dryrun=-n echo=echo ;;
  11    --) break ;;
  12    -*) echo >&2 "usage: git-prune-script [ -n ] [ heads... ]"; exit 1 ;;
  13    *)  break ;;
  14    esac
  15    shift;
  16done
  17
  18git-fsck-cache --full --cache --unreachable "$@" |
  19sed -ne '/unreachable /{
  20    s/unreachable [^ ][^ ]* //
  21    s|\(..\)|\1/|p
  22}' | {
  23        cd "$GIT_OBJECT_DIRECTORY" || exit
  24        xargs $echo rm -f
  25}
  26
  27git-prune-packed $dryrun