Skip to content

Commit a45808b

Browse files
committed
refactor(git.cmd): Fix param entry
1 parent 223dbec commit a45808b

File tree

1 file changed

+38
-35
lines changed

1 file changed

+38
-35
lines changed

libvcs/cmd/git.py

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,15 @@ def run(
157157
C = [str(c) for c in C]
158158
cli_args.extend(["-C", C])
159159
if git_dir is not None:
160-
cli_args.append(f"--git-dir {git_dir}")
160+
cli_args.extend(["--git-dir", str(git_dir)])
161161
if work_tree is not None:
162-
cli_args.append(f"--work-tree {work_tree}")
162+
cli_args.extend(["--work-tree", str(work_tree)])
163163
if namespace is not None:
164-
cli_args.append(f"--namespace {namespace}")
164+
cli_args.extend(["--namespace", namespace])
165165
if super_prefix is not None:
166-
cli_args.append(f"--super-prefix {super_prefix}")
166+
cli_args.extend(["--super-prefix", super_prefix])
167167
if exec_path is not None:
168-
cli_args.append(f"--exec-path {exec_path}")
168+
cli_args.extend(["--exec-path", exec_path])
169169
if bare is True:
170170
cli_args.append("--bare")
171171
if no_replace_objects is True:
@@ -253,25 +253,25 @@ def clone(
253253
if (filter := kwargs.pop("filter", None)) is not None:
254254
local_flags.append(f"--filter={filter}")
255255
if depth is not None:
256-
local_flags.append(f"--depth {depth}")
256+
local_flags.extend(["--depth", depth])
257257
if branch is not None:
258-
local_flags.append(f"--branch {branch}")
258+
local_flags.extend(["--branch", branch])
259259
if origin is not None:
260-
local_flags.append(f"--origin {origin}")
260+
local_flags.extend(["--origin", origin])
261261
if upload_pack is not None:
262-
local_flags.append(f"--upload-pack {upload_pack}")
262+
local_flags.extend(["--upload-pack", upload_pack])
263263
if shallow_since is not None:
264264
local_flags.append(f"--shallow-since={shallow_since}")
265265
if shallow_exclude is not None:
266266
local_flags.append(f"--shallow-exclude={shallow_exclude}")
267267
if reference is not None:
268-
local_flags.append(f"--reference {reference}")
268+
local_flags.extend(["--reference", reference])
269269
if reference_if_able is not None:
270-
local_flags.append(f"--reference {reference_if_able}")
270+
local_flags.extend(["--reference", reference_if_able])
271271
if server_option is not None:
272272
local_flags.append(f"--server-option={server_option}")
273273
if jobs is not None:
274-
local_flags.append(f"--jobs {jobs}")
274+
local_flags.extend(["--jobs", jobs])
275275
if local is True:
276276
local_flags.append("--local")
277277
if hardlinks is True:
@@ -390,21 +390,21 @@ def fetch(
390390
if (filter := kwargs.pop("filter", None)) is not None:
391391
local_flags.append(f"--filter={filter}")
392392
if depth is not None:
393-
local_flags.append(f"--depth {depth}")
393+
local_flags.extend(["--depth", depth])
394394
if branch is not None:
395-
local_flags.append(f"--branch {branch}")
395+
local_flags.extend(["--branch", branch])
396396
if origin is not None:
397-
local_flags.append(f"--origin {origin}")
397+
local_flags.extend(["--origin", origin])
398398
if upload_pack is not None:
399-
local_flags.append(f"--upload-pack {upload_pack}")
399+
local_flags.extend(["--upload-pack", upload_pack])
400400
if shallow_since is not None:
401401
local_flags.append(f"--shallow-since={shallow_since}")
402402
if shallow_exclude is not None:
403403
local_flags.append(f"--shallow-exclude={shallow_exclude}")
404404
if server_option is not None:
405405
local_flags.append(f"--server-option={server_option}")
406406
if jobs is not None:
407-
local_flags.append(f"--jobs {jobs}")
407+
local_flags.extend(["--jobs", jobs])
408408
if keep:
409409
local_flags.append("--keep")
410410
if force:
@@ -556,12 +556,12 @@ def rebase(
556556
if branch:
557557
required_flags.insert(0, branch)
558558
if onto:
559-
local_flags.append(f"--onto {onto}")
559+
local_flags.extend(["--onto", onto])
560560
if context:
561-
local_flags.append(f"--C{context}")
561+
local_flags.extend(["--C", context])
562562

563563
if exec:
564-
local_flags.append(f"--exec {shlex.quote(exec)}")
564+
local_flags.extend(["--exec", shlex.quote(exec)])
565565
if reschedule_failed_exec:
566566
local_flags.append("--reschedule-failed-exec")
567567
if no_reschedule_failed_exec:
@@ -864,21 +864,21 @@ def pull(
864864
if (filter := kwargs.pop("filter", None)) is not None:
865865
local_flags.append(f"--filter={filter}")
866866
if depth is not None:
867-
local_flags.append(f"--depth {depth}")
867+
local_flags.extend(["--depth", depth])
868868
if branch is not None:
869-
local_flags.append(f"--branch {branch}")
869+
local_flags.extend(["--branch", branch])
870870
if origin is not None:
871-
local_flags.append(f"--origin {origin}")
871+
local_flags.extend(["--origin", origin])
872872
if upload_pack is not None:
873-
local_flags.append(f"--upload-pack {upload_pack}")
873+
local_flags.extend(["--upload-pack", upload_pack])
874874
if shallow_since is not None:
875875
local_flags.append(f"--shallow-since={shallow_since}")
876876
if shallow_exclude is not None:
877877
local_flags.append(f"--shallow-exclude={shallow_exclude}")
878878
if server_option is not None:
879879
local_flags.append(f"--server-option={server_option}")
880880
if jobs is not None:
881-
local_flags.append(f"--jobs {jobs}")
881+
local_flags.extend(["--jobs", jobs])
882882
if keep:
883883
local_flags.append("--keep")
884884
if force:
@@ -1006,9 +1006,9 @@ def init(
10061006
if object_format is not None:
10071007
local_flags.append(f"--object-format={object_format}")
10081008
if branch is not None:
1009-
local_flags.append(f"--branch {branch}")
1009+
local_flags.extend(["--branch", branch])
10101010
if initial_branch is not None:
1011-
local_flags.append(f"--initial-branch {initial_branch}")
1011+
local_flags.extend(["--initial-branch", initial_branch])
10121012
if shared is True:
10131013
local_flags.append("--shared")
10141014
if quiet is True:
@@ -1156,7 +1156,7 @@ def reset(
11561156
local_flags.append("--no-refresh")
11571157
if refresh is True:
11581158
local_flags.append("--refresh")
1159-
if pathspec_from_file is True:
1159+
if pathspec_from_file is not None:
11601160
local_flags.append(f"--pathspec_from_file {pathspec_from_file}")
11611161

11621162
# HEAD to commit form
@@ -1176,7 +1176,7 @@ def reset(
11761176
local_flags.append("--keep")
11771177

11781178
if commit is True:
1179-
local_flags.append(f"{commit}")
1179+
local_flags.append(commit)
11801180

11811181
if recurse_submodules:
11821182
local_flags.append("--recurse-submodules")
@@ -1297,19 +1297,19 @@ def checkout(
12971297
local_flags.append(f"--conflict={conflict}")
12981298

12991299
if commit is True:
1300-
local_flags.append(f"{commit}")
1300+
local_flags.append(commit)
13011301

13021302
if branch is True:
1303-
local_flags.append(f"{branch}")
1303+
local_flags.append(branch)
13041304

13051305
if new_branch is True:
1306-
local_flags.append(f"{new_branch}")
1306+
local_flags.append(new_branch)
13071307

13081308
if start_point is True:
1309-
local_flags.append(f"{start_point}")
1309+
local_flags.append(start_point)
13101310

13111311
if treeish is True:
1312-
local_flags.append(f"{treeish}")
1312+
local_flags.append(treeish)
13131313

13141314
if recurse_submodules:
13151315
local_flags.append("--recurse-submodules")
@@ -1438,7 +1438,10 @@ def status(
14381438
local_flags.append("--porcelain")
14391439

14401440
if find_renames is True:
1441-
local_flags.append(f"--find-renames={find_renames}")
1441+
if isinstance(find_renames, str):
1442+
local_flags.append(f"--find-renames={find_renames}")
1443+
else:
1444+
local_flags.append("--find-renames")
14421445

14431446
if pathspec is not None:
14441447
if not isinstance(pathspec, list):

0 commit comments

Comments
 (0)