aboutsummaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2008-03-12 17:32:17 -0400
committerJunio C Hamano <gitster@pobox.com>2008-03-13 00:57:52 -0700
commitaadbe44f883859536c5320e0ac1d6ed122c45671 (patch)
tree5552c7d0999106d0198ed59403b21dcc1c5111e6 /git-rebase--interactive.sh
parente85fe4d85bc7654af20ccf8054ab6922665405e5 (diff)
downloadgit-aadbe44f883859536c5320e0ac1d6ed122c45671.tar.gz
git-aadbe44f883859536c5320e0ac1d6ed122c45671.tar.xz
grep portability fix: don't use "-e" or "-q"
System V versions of grep (such as Solaris /usr/bin/grep) don't understand either of these options. git's usage of "grep -e pattern" fell into one of two categories: 1. equivalent to "grep pattern". -e is only useful here if the pattern begins with a "-", but all of the patterns are hardcoded and do not begin with a dash. 2. stripping comments and blank lines with grep -v -e "^$" -e "^#" We can fortunately do this in the affirmative as grep '^[^#]' Uses of "-q" can be replaced with redirection to /dev/null. In many tests, however, "grep -q" is used as "if this string is in the expected output, we are OK". In this case, it is fine to just remove the "-q" entirely; it simply makes the "verbose" mode of the test slightly more verbose. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase--interactive.sh')
-rwxr-xr-xgit-rebase--interactive.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index c2bedd622..4c3280a76 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -78,8 +78,8 @@ mark_action_done () {
sed -e 1q < "$TODO" >> "$DONE"
sed -e 1d < "$TODO" >> "$TODO".new
mv -f "$TODO".new "$TODO"
- count=$(($(grep -ve '^$' -e '^#' < "$DONE" | wc -l)))
- total=$(($count+$(grep -ve '^$' -e '^#' < "$TODO" | wc -l)))
+ count=$(grep -c '^[^#]' < "$DONE")
+ total=$(($count+$(grep -c '^[^#]' < "$TODO")))
if test "$last_count" != "$count"
then
last_count=$count
@@ -110,7 +110,7 @@ die_abort () {
}
has_action () {
- grep -vqe '^$' -e '^#' "$1"
+ grep '^[^#]' "$1" >/dev/null
}
pick_one () {