Skip to content

grep: don't emit the -T alignment tab on empty lines#12

Open
sylvestre wants to merge 1 commit into
mainfrom
grep-initial-tab-empty-line
Open

grep: don't emit the -T alignment tab on empty lines#12
sylvestre wants to merge 1 commit into
mainfrom
grep-initial-tab-empty-line

Conversation

@sylvestre
Copy link
Copy Markdown
Contributor

With -T, grep pads the prefix with a tab so line content lands on a tab stop. GNU omits that tab when the line has no content: an empty line prints just its prefix (a whitespace-only line still gets the tab). uu_grep always wrote the tab, so empty matched lines gained a spurious trailing tab. Gate the tab on non-empty content. Fixes the GNU testsuite 'initial-tab' test.

@github-actions
Copy link
Copy Markdown

GNU grep testsuite comparison:

Test results comparison:
  Current:   TOTAL: 128 / PASSED: 71 / FAILED: 36 / SKIPPED: 21
  Reference: TOTAL: 128 / PASSED: 70 / FAILED: 37 / SKIPPED: 21

Changes from main branch:
  TOTAL: +0
  PASSED: +1
  FAILED: -1

Test improvements (1):
  + initial-tab

@codecov
Copy link
Copy Markdown

codecov Bot commented May 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.90%. Comparing base (98e6bb6) to head (a7b1532).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #12      +/-   ##
==========================================
+ Coverage   95.82%   95.90%   +0.07%     
==========================================
  Files           6        6              
  Lines        1414     1417       +3     
  Branches      140      141       +1     
==========================================
+ Hits         1355     1359       +4     
  Misses         58       58              
+ Partials        1        0       -1     
Flag Coverage Δ
macOS_latest 96.72% <100.00%> (+0.07%) ⬆️
ubuntu_latest 96.72% <100.00%> (+0.07%) ⬆️
windows_latest 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

With -T, grep pads the prefix with a tab so line content lands on a tab
stop. GNU omits that tab when the line has no content: an empty line
prints just its prefix (a whitespace-only line still gets the tab).
uu_grep always wrote the tab, so empty matched lines gained a spurious
trailing tab. Gate the tab on non-empty content. Fixes the GNU testsuite
'initial-tab' test.
@sylvestre sylvestre force-pushed the grep-initial-tab-empty-line branch from f1388c3 to a7b1532 Compare May 30, 2026 17:14
@github-actions
Copy link
Copy Markdown

GNU grep testsuite comparison:

Test results comparison:
  Current:   TOTAL: 128 / PASSED: 71 / FAILED: 36 / SKIPPED: 21
  Reference: TOTAL: 128 / PASSED: 70 / FAILED: 37 / SKIPPED: 21

Changes from main branch:
  TOTAL: +0
  PASSED: +1
  FAILED: -1

Test improvements (1):
  + initial-tab

@sylvestre sylvestre requested a review from lhecker May 30, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant