Use shell parameter expansion to strip the leading (w): and (i)
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
arg="$1"
case "$arg" in
'(w):'*)
- arg=$(echo "$arg" | tail --bytes=+5)
- cat "$arg"
- return
+ cat "${arg#(w):}"
;;
'(i):'*)
# ':file' means cat from index
- arg=$(echo "$arg" | tail --bytes=+5)
- git cat-file blob ":$arg"
+ git cat-file blob "${arg#(i)}"
;;
*)
git cat-file blob "$arg"
+ ;;
esac
}