Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2177a67

Browse files
Xiao75896453Lee-W
authored andcommitted
fix(commitizen): Modify the function of the arg a of commit from git add all to git add update
1 parent f0382a6 commit 2177a67

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

commitizen/cli.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@
7676
"help": "sign off the commit",
7777
},
7878
{
79-
"name": ["-a", "--add"],
79+
"name": ["-a", "--all"],
8080
"action": "store_true",
81-
"help": "automatically stage every tracked and un-staged file",
81+
"help": "Tell the command to automatically stage files that have been modified and deleted, but new files you have not told Git about are not affected.",
8282
},
8383
],
8484
},

commitizen/commands/commit.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ def __call__(self):
6767
dry_run: bool = self.arguments.get("dry_run")
6868
write_message_to_file = self.arguments.get("write_message_to_file")
6969

70-
is_git_add: bool = self.arguments.get("add")
71-
if is_git_add:
72-
c = git.add()
70+
is_all: bool = self.arguments.get("all")
71+
if is_all:
72+
c = git.add("-u")
7373

7474
if git.is_staging_clean() and not dry_run:
7575
raise NothingToCommitError("No files added to staging!")

commitizen/git.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ def tag(tag: str, annotated: bool = False, signed: bool = False) -> cmd.Command:
9292
return c
9393

9494

95-
def add() -> cmd.Command:
96-
c = cmd.run("git add .")
95+
def add(args: str = "") -> cmd.Command:
96+
c = cmd.run(f"git add {args}")
9797
return c
9898

9999

tests/commands/test_commit_command.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def test_commit_in_non_git_project(tmpdir, config):
258258

259259

260260
@pytest.mark.usefixtures("staging_is_clean")
261-
def test_commit_command_with_add_option(config, mocker: MockFixture):
261+
def test_commit_command_with_all_option(config, mocker: MockFixture):
262262
prompt_mock = mocker.patch("questionary.prompt")
263263
prompt_mock.return_value = {
264264
"prefix": "feat",

0 commit comments

Comments
 (0)