From ed34231ae32408dd5d1071b2979ada40983bac48 Mon Sep 17 00:00:00 2001 From: Adrian Garay Date: Mon, 12 Oct 2020 12:01:45 -0500 Subject: [PATCH] fix(add all): Change dot for dash A on git add This change must prevent that someone create a new commit inside a directory, the git add . only adds the current directory, git add -A adds all the files in the repository --- src/CreateConventionalCommit.php | 2 +- tests/Unit/CreateConventionalCommitTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CreateConventionalCommit.php b/src/CreateConventionalCommit.php index 32e0933..514ca1b 100644 --- a/src/CreateConventionalCommit.php +++ b/src/CreateConventionalCommit.php @@ -15,7 +15,7 @@ class CreateConventionalCommit public function __invoke(Subject $subject, Body $body, Footer $footer, bool $addAllToStage): void { if ($addAllToStage) { - $this->exec('git add .'); + $this->exec('git add -A'); } $safeSubject = escapeshellarg((string)$subject); diff --git a/tests/Unit/CreateConventionalCommitTest.php b/tests/Unit/CreateConventionalCommitTest.php index f8470db..796e95a 100644 --- a/tests/Unit/CreateConventionalCommitTest.php +++ b/tests/Unit/CreateConventionalCommitTest.php @@ -41,7 +41,7 @@ public function testCreateConventionalCommitWithAddAllFlag(): void ->expects($this->exactly(2)) ->method('exec') ->withConsecutive( - [$this->equalTo('git add .')], + [$this->equalTo('git add -A')], [$this->equalTo("git commit -m 'subject' -m 'body' -m 'footer'")] );