Skip to content

Commit cc4955a

Browse files
committed
Fixes a reformatting bug
1 parent 8adb8fd commit cc4955a

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
77

88
## [Unreleased]
99

10+
## [v5.8.4] - 2026-05-08
11+
12+
### Added
13+
- Fixed a bug where preceding slashes are not properly removed when reformatting.
14+
1015
## [v5.8.3] - 2026-05-08
1116

1217
### Added

src/Commands/ReformatCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,12 @@ private function getPresentGitattributesContentWithAlignedExportIgnores(bool $so
170170
$exportIgnorePatterns = [];
171171

172172
foreach ($gitattributesLines as $line) {
173-
if ($this->isAlignableExportIgnoreLine($line) === false) {
173+
if ($this->isAlignableExportIgnoreLine($line) === false || $line === '') {
174174
continue;
175175
}
176176

177177
[$pattern] = \explode('export-ignore', $line, 2);
178+
178179
$exportIgnorePatterns[] = \rtrim($pattern);
179180
}
180181

@@ -192,7 +193,7 @@ private function getPresentGitattributesContentWithAlignedExportIgnores(bool $so
192193
[$pattern, $suffix] = \explode('export-ignore', $line, 2);
193194
$pattern = \trim($pattern);
194195

195-
if (\str_starts_with($pattern, '/') && \str_ends_with($pattern, '/') === false) {
196+
if (\str_starts_with($pattern, '/')) {
196197
$pattern = \ltrim($pattern, '/');
197198
}
198199

0 commit comments

Comments
 (0)