Skip to content

Commit ece0d80

Browse files
committed
cmd/git(fix[stash.push]): Handle str paths in GitStashCmd.push
why: Plain str paths were silently ignored when building required_flags. Only list and pathlib.Path were handled, so Git.stash.push(path="file.txt") would not limit the stash to that path. what: - Change elif isinstance(path, pathlib.Path) to elif path is not None - Remove unnecessary .absolute() conversion that broke relative paths - Now handles str, Path, and list consistently
1 parent 03b124c commit ece0d80

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libvcs/cmd/git.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4858,9 +4858,9 @@ def push(
48584858
required_flags: list[str] = []
48594859

48604860
if isinstance(path, list):
4861-
required_flags.extend(str(pathlib.Path(p).absolute()) for p in path)
4862-
elif isinstance(path, pathlib.Path):
4863-
required_flags.append(str(pathlib.Path(path).absolute()))
4861+
required_flags.extend(str(p) for p in path)
4862+
elif path is not None:
4863+
required_flags.append(str(path))
48644864

48654865
if patch is True:
48664866
local_flags.append("--patch")

0 commit comments

Comments
 (0)