Skip to content

Commit e45f18c

Browse files
committed
cmd/git(fix[branch.run]): Remove broken command parameter
why: GitBranchCommandLiteral defined values like "delete", "move" that would produce invalid git invocations. These should be flags (-d, -m) not subcommands. The parameter was unused - dedicated methods (delete, rename, copy) already implement correct flag handling. what: - Remove GitBranchCommandLiteral type - Remove command parameter from GitBranchCmd.run() and GitBranchManager.run()
1 parent 4b8a0f7 commit e45f18c

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

src/libvcs/cmd/git.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5257,21 +5257,6 @@ def filter(self, *args: t.Any, **kwargs: t.Any) -> list[GitStashEntryCmd]:
52575257
return self.ls().filter(*args, **kwargs)
52585258

52595259

5260-
GitBranchCommandLiteral = t.Literal[
5261-
# "create", # checkout -b
5262-
# "checkout", # checkout
5263-
"--list",
5264-
"move", # branch -m, or branch -M with force
5265-
"copy", # branch -c, or branch -C with force
5266-
"delete", # branch -d, or branch -D /ith force
5267-
"set_upstream",
5268-
"unset_upstream",
5269-
"track",
5270-
"no_track",
5271-
"edit_description",
5272-
]
5273-
5274-
52755260
class GitBranchCmd:
52765261
"""Run commands directly against a git branch for a git repo."""
52775262

@@ -5330,11 +5315,10 @@ def __repr__(self) -> str:
53305315

53315316
def run(
53325317
self,
5333-
command: GitBranchCommandLiteral | None = None,
53345318
local_flags: list[str] | None = None,
53355319
*,
53365320
quiet: bool | None = None,
5337-
cached: bool | None = None, # Only when no command entered and status
5321+
cached: bool | None = None,
53385322
# Pass-through to run()
53395323
log_in_real_time: bool = False,
53405324
check_returncode: bool | None = None,
@@ -5353,8 +5337,6 @@ def run(
53535337
'* master'
53545338
"""
53555339
local_flags = local_flags if isinstance(local_flags, list) else []
5356-
if command is not None:
5357-
local_flags.insert(0, command)
53585340

53595341
if quiet is True:
53605342
local_flags.append("--quiet")
@@ -5642,11 +5624,10 @@ def __repr__(self) -> str:
56425624

56435625
def run(
56445626
self,
5645-
command: GitBranchCommandLiteral | None = None,
56465627
local_flags: list[str] | None = None,
56475628
*,
56485629
quiet: bool | None = None,
5649-
cached: bool | None = None, # Only when no command entered and status
5630+
cached: bool | None = None,
56505631
# Pass-through to run()
56515632
log_in_real_time: bool = False,
56525633
check_returncode: bool | None = None,
@@ -5662,8 +5643,6 @@ def run(
56625643
'* master'
56635644
"""
56645645
local_flags = local_flags if isinstance(local_flags, list) else []
5665-
if command is not None:
5666-
local_flags.insert(0, command)
56675646

56685647
if quiet is True:
56695648
local_flags.append("--quiet")

0 commit comments

Comments
 (0)