summaryrefslogtreecommitdiff
path: root/git-filter-branch.sh
diff options
context:
space:
mode:
authorJosh Triplett <josh@freedesktop.org>2007-07-14 08:05:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-07-14 08:07:44 (GMT)
commit9d6f220cc8ffbd71b4c68765b52c3a7c41dd729b (patch)
tree618f04c4e0ebf509fc817a1e5c767c7f1d38ea9b /git-filter-branch.sh
parentbdecd9d41b3528e17aea2290344c584412e2424e (diff)
downloadgit-9d6f220cc8ffbd71b4c68765b52c3a7c41dd729b.zip
git-9d6f220cc8ffbd71b4c68765b52c3a7c41dd729b.tar.gz
git-9d6f220cc8ffbd71b4c68765b52c3a7c41dd729b.tar.bz2
Remove useless uses of cat, and replace with filename arguments
Replace uses of cat that do nothing but writing the contents of a single file to another command via pipe. [jc: Original patch from Josh was somewhat buggy and rewrote "cat $file | wc -l" to "wc -l $file", but this one should be Ok.] Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-filter-branch.sh')
-rwxr-xr-xgit-filter-branch.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index d77902d..5401970 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -171,7 +171,7 @@ case "$filter_subdir" in
git rev-list --reverse --topo-order --default HEAD \
--parents --full-history "$@" -- "$filter_subdir"
esac > ../revs
-commits=$(cat ../revs | wc -l | tr -d " ")
+commits=$(wc -l <../revs | tr -d " ")
test $commits -eq 0 && die "Found nothing to rewrite"
@@ -241,7 +241,7 @@ case "$target_head" in
;;
*)
git update-ref refs/heads/"$dstbranch" $target_head
- if [ $(cat ../map/$src_head | wc -l) -gt 1 ]; then
+ if [ $(wc -l <../map/$src_head) -gt 1 ]; then
echo "WARNING: Your commit filter caused the head commit to expand to several rewritten commits. Only the first such commit was recorded as the current $dstbranch head but you will need to resolve the situation now (probably by manually merging the other commits). These are all the commits:" >&2
sed 's/^/ /' ../map/$src_head >&2
ret=1