git-prune-scripton commit [PATCH] Fix math thinko in similarity estimator. (a00d7d1)
   1#!/bin/sh
   2dryrun=
   3while case "$#" in 0) break ;; esac
   4do
   5    case "$1" in
   6    -n) dryrun=echo ;;
   7    --) break ;;
   8    -*) echo >&2 "usage: git-prune-script [ -n ] [ heads... ]"; exit 1 ;;
   9    *)  break ;;
  10    esac
  11    shift;
  12done
  13
  14: ${GIT_DIR=.git}
  15: ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"}
  16
  17git-fsck-cache --cache --unreachable "$@" |
  18sed -ne '/unreachable /{
  19    s/unreachable [^ ][^ ]* //
  20    s|\(..\)|\1/|p
  21}' | {
  22        cd "$GIT_OBJECT_DIRECTORY" || exit
  23        xargs -r $dryrun rm -f
  24}
  25