chiark
/
gitweb
/
~ian
/
topgit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tg.sh: simplify cat_file
[topgit.git]
/
tg.sh
diff --git
a/tg.sh
b/tg.sh
index 3718702e5cd20eb0aefcfbb36a77801411c88978..8264a3b074f1d6bbded09e8110f1c07be475ffdd 100644
(file)
--- a/
tg.sh
+++ b/
tg.sh
@@
-25,17
+25,15
@@
cat_file()
arg="$1"
case "$arg" in
'(w):'*)
arg="$1"
case "$arg" in
'(w):'*)
- arg=$(echo "$arg" | tail --bytes=+5)
- cat "$arg"
- return
+ cat "${arg#(w):}"
;;
'(i):'*)
# ':file' means cat from index
;;
'(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"
;;
*)
git cat-file blob "$arg"
+ ;;
esac
}
esac
}