t: remove \{m,n\} from BRE grep usage
The CodingGuidelines says we should avoid \{m,n\} in BRE usage. And their usages in our code base is limited, and subjectively hard to read. Replace them with ERE. Except for "0\{40\}" which would be changed to "$ZERO_OID", which is a better value for testing with: GIT_TEST_DEFAULT_HASH=sha256 Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
2e092725e6
commit
a764c37bad
|
@ -201,8 +201,8 @@ test_expect_success 'git branch -M baz bam should succeed when baz is checked ou
|
|||
|
||||
test_expect_success 'git branch -M baz bam should add entries to .git/logs/HEAD' '
|
||||
msg="Branch: renamed refs/heads/baz to refs/heads/bam" &&
|
||||
grep " 0\{40\}.*$msg$" .git/logs/HEAD &&
|
||||
grep "^0\{40\}.*$msg$" .git/logs/HEAD
|
||||
grep " $ZERO_OID.*$msg$" .git/logs/HEAD &&
|
||||
grep "^$ZERO_OID.*$msg$" .git/logs/HEAD
|
||||
'
|
||||
|
||||
test_expect_success 'git branch -M should leave orphaned HEAD alone' '
|
||||
|
|
|
@ -9,7 +9,7 @@ path_has_fanout() {
|
|||
path=$1 &&
|
||||
fanout=$2 &&
|
||||
after_last_slash=$(($(test_oid hexsz) - $fanout * 2)) &&
|
||||
echo $path | grep -q "^\([0-9a-f]\{2\}/\)\{$fanout\}[0-9a-f]\{$after_last_slash\}$"
|
||||
echo $path | grep -q -E "^([0-9a-f]{2}/){$fanout}[0-9a-f]{$after_last_slash}$"
|
||||
}
|
||||
|
||||
touched_one_note_with_fanout() {
|
||||
|
|
|
@ -1244,9 +1244,9 @@ test_expect_success 'short commit ID collide' '
|
|||
test $colliding_id = "$(git rev-parse HEAD | cut -c 1-4)" &&
|
||||
grep "^pick $colliding_id " \
|
||||
.git/rebase-merge/git-rebase-todo.tmp &&
|
||||
grep "^pick [0-9a-f]\{$hexsz\}" \
|
||||
grep -E "^pick [0-9a-f]{$hexsz}" \
|
||||
.git/rebase-merge/git-rebase-todo &&
|
||||
grep "^pick [0-9a-f]\{$hexsz\}" \
|
||||
grep -E "^pick [0-9a-f]{$hexsz}" \
|
||||
.git/rebase-merge/git-rebase-todo.backup &&
|
||||
git rebase --continue
|
||||
) &&
|
||||
|
@ -1261,7 +1261,7 @@ test_expect_success 'respect core.abbrev' '
|
|||
set_cat_todo_editor &&
|
||||
test_must_fail git rebase -i HEAD~4 >todo-list
|
||||
) &&
|
||||
test 4 = $(grep -c "pick [0-9a-f]\{12,\}" todo-list)
|
||||
test 4 = $(grep -c -E "pick [0-9a-f]{12,}" todo-list)
|
||||
'
|
||||
|
||||
test_expect_success 'todo count' '
|
||||
|
|
|
@ -234,7 +234,7 @@ test_expect_success 'http-fetch --packfile' '
|
|||
--index-pack-arg=--keep \
|
||||
"$HTTPD_URL"/dumb/repo_pack.git/$p >out &&
|
||||
|
||||
grep "^keep.[0-9a-f]\{16,\}$" out &&
|
||||
grep -E "^keep.[0-9a-f]{16,}$" out &&
|
||||
cut -c6- out >packhash &&
|
||||
|
||||
# Ensure that the expected files are generated
|
||||
|
|
|
@ -1001,7 +1001,7 @@ test_expect_success 'part of packfile response provided as URI' '
|
|||
do
|
||||
git verify-pack --object-format=$(test_oid algo) --verbose $idx >out &&
|
||||
{
|
||||
grep "^[0-9a-f]\{16,\} " out || :
|
||||
grep -E "^[0-9a-f]{16,} " out || :
|
||||
} >out.objectlist &&
|
||||
if test_line_count = 1 out.objectlist
|
||||
then
|
||||
|
|
Loading…
Reference in New Issue