git-lost-found.shon commit git am: Display some help text when patch is empty (dc267b1)
   1#!/bin/sh
   2
   3USAGE=''
   4SUBDIRECTORY_OK='Yes'
   5OPTIONS_SPEC=
   6. git-sh-setup
   7
   8echo "WARNING: '$0' is deprecated in favor of 'git fsck --lost-found'" >&2
   9
  10if [ "$#" != "0" ]
  11then
  12    usage
  13fi
  14
  15laf="$GIT_DIR/lost-found"
  16rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
  17
  18git fsck --full --no-reflogs |
  19while read dangling type sha1
  20do
  21        case "$dangling" in
  22        dangling)
  23                if git rev-parse -q --verify "$sha1^0" >/dev/null
  24                then
  25                        dir="$laf/commit"
  26                        git show-branch "$sha1"
  27                else
  28                        dir="$laf/other"
  29                fi
  30                echo "$sha1" >"$dir/$sha1"
  31                ;;
  32        esac
  33done