Skip to content

Commit

Permalink
Fixed git update index supporting whitespaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Feb 26, 2019
1 parent 24651ad commit 508878a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ArtefactTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ protected function gitUpdateIndex($location)
foreach ($files as $file) {
$this->gitCommandRun(
$this->src,
'update-index --add '.$file
sprintf('update-index --add "%s"', $file)
);
}
}
Expand Down
7 changes: 4 additions & 3 deletions tests/ForcePushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public function testGitignoreCustomWhitelisting()

$this->gitCreateFixtureFile($this->src, 'vendor/ve_ignored_ignored.txt');
$this->gitCreateFixtureFile($this->src, 'vendor_com_com.txt');
$this->gitCreateFixtureFile($this->src, 'vendor_com with space com.txt');
$this->gitCreateFixtureFile($this->src, 'dir_other/vendor/ve_com_com.txt');

$this->gitCreateFixtureCommits(2);
Expand All @@ -177,7 +178,7 @@ public function testGitignoreCustomWhitelisting()
$this->gitAssertFilesCommitted($this->src, [
'1.txt', '2.txt', 'com_com.txt', 'com_ignored.txt',
'dir_com_com/sub_com_com.txt', 'dir_com_ignored/sub_com_ignored.txt',
'vendor_com_com.txt', 'dir_other/vendor/ve_com_com.txt',
'vendor_com_com.txt', 'dir_other/vendor/ve_com_com.txt', 'vendor_com with space com.txt',
]);
$this->gitAssertNoFilesCommitted($this->src, [
'ignored_ignored.txt', 'ignored_com.txt', 'uncom_ignored.txt', 'uncom_com.txt', 'uncom_del.txt',
Expand Down Expand Up @@ -206,7 +207,7 @@ public function testGitignoreCustomWhitelisting()
$this->gitAssertNoFilesCommitted($this->dst, [
'1.txt', 'ignored_ignored.txt', 'com_ignored.txt', 'uncom_ignored.txt', 'uncom_del.txt',
'dir_com_ignored/sub_com_ignored.txt', 'dir_ignored_ignored/sub_ignored_ignored.txt', 'dir_uncom_ignored/sub_uncom_ignored.txt', 'dir_uncom_del/sub_uncom_del.txt',
'vendor_com_com.txt', 'dir_other/vendor/ve_com_com.txt',
'vendor_com_com.txt', 'dir_other/vendor/ve_com_com.txt', 'vendor_com with space com.txt',
], 'testbranch');

$this->gitAssertFilesExist($this->dst, [
Expand All @@ -218,7 +219,7 @@ public function testGitignoreCustomWhitelisting()
'1.txt', 'ignored_ignored.txt', 'com_ignored.txt', 'uncom_ignored.txt', 'uncom_del.txt',
'dir_com_ignored/sub_com_ignored.txt',
'dir_ignored_ignored/sub_ignored_ignored.txt', 'dir_uncom_ignored/sub_uncom_ignored.txt', 'dir_uncom_del/sub_uncom_del.txt',
'vendor_com_com.txt', 'dir_other/vendor/ve_com_com.txt',
'vendor_com_com.txt', 'dir_other/vendor/ve_com_com.txt', 'vendor_com with space com.txt'
], 'testbranch');
}

Expand Down

0 comments on commit 508878a

Please sign in to comment.