Skip to content

Commit 4a3ed63

Browse files
avargitster
authored andcommitted
tests: fix and add lint for non-portable grep --file
The --file option to grep isn't in POSIX[1], but -f is[1]. Let's check for that in the future, and fix the portability regression in f237c8b ("commit-graph: implement git-commit-graph write", 2018-04-02) that broke e.g. AIX. 1. http://pubs.opengroup.org/onlinepubs/009695399/utilities/grep.html Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8c97e38 commit 4a3ed63

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

t/check-non-portable-shell.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ sub err {
4343
/\bwc -l.*"\s*=/ and err '`"$(wc -l)"` is not portable (use test_line_count)';
4444
/\bhead\s+-c\b/ and err 'head -c is not portable (use test_copy_bytes BYTES <file >out)';
4545
/(?:\$\(seq|^\s*seq\b)/ and err 'seq is not portable (use test_seq)';
46+
/\bgrep\b.*--file\b/ and err 'grep --file FILE is not portable (use grep -f FILE)';
4647
/\bexport\s+[A-Za-z0-9_]*=/ and err '"export FOO=bar" is not portable (use FOO=bar && export FOO)';
4748
/^\s*([A-Z0-9_]+=(\w+|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and
4849
err '"FOO=bar shell_func" assignment extends beyond "shell_func"';

t/t5318-commit-graph.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ test_expect_success 'Add one more commit' '
134134
git branch commits/8 &&
135135
ls $objdir/pack | grep idx >existing-idx &&
136136
git repack &&
137-
ls $objdir/pack| grep idx | grep -v --file=existing-idx >new-idx
137+
ls $objdir/pack| grep idx | grep -v -f existing-idx >new-idx
138138
'
139139

140140
# Current graph structure:

0 commit comments

Comments
 (0)