git-diff-scripton commit [PATCH] git-branch: avoid getting confused by empty or nonexisting branches. (a38e727)
   1#!/bin/sh
   2. git-sh-setup-script || die "Not a git archive"
   3
   4rev=($(git-rev-parse --revs-only "$@"))
   5flags=($(git-rev-parse --no-revs --flags "$@"))
   6files=($(git-rev-parse --no-revs --no-flags "$@"))
   7case "${#rev[*]}" in
   80)
   9        git-diff-files -M -p "$@";;
  101)
  11        git-diff-cache -M -p "$@";;
  122)
  13        begin=$(echo "${rev[1]}" | tr -d '^')
  14        end="${rev[0]}"
  15        git-diff-tree -M -p $flags $begin $end $files;;
  16*)
  17        echo "I don't understand"
  18        exit 1;;
  19esac