@@ -1190,6 +1190,57 @@ def test_stash_push_and_list(git_repo: GitSync) -> None:
11901190 assert stashes [0 ].index == 0
11911191
11921192
1193+ def test_stash_cmd_push_path_types (git_repo : GitSync ) -> None :
1194+ """Test GitStashCmd.push() handles all path types.
1195+
1196+ Verifies commit ece0d80: str paths were silently ignored.
1197+ Tests str, pathlib.Path, and list path argument types.
1198+ """
1199+ # Use unique filenames with timestamp to avoid rerun conflicts
1200+ import time
1201+
1202+ ts = str (int (time .time () * 1000000 ))[- 6 :]
1203+ test_filename = f"stash_path_{ ts } .txt"
1204+ other_filename = f"stash_other_{ ts } .txt"
1205+ test_file = git_repo .path / test_filename
1206+ other_file = git_repo .path / other_filename
1207+
1208+ test_file .write_text ("initial content" )
1209+ other_file .write_text ("other initial" )
1210+ git_repo .cmd .run (["add" , test_filename , other_filename ])
1211+ git_repo .cmd .run (["commit" , "-m" , f"Add stash path test files { ts } " ])
1212+
1213+ stash_cmd = git .GitStashCmd (path = git_repo .path )
1214+
1215+ # Test 1: str path - should only stash the specified file
1216+ test_file .write_text ("modified for str test" )
1217+ other_file .write_text ("other modified 1" )
1218+ result = stash_cmd .push (path = test_filename )
1219+ assert "fatal" not in result .lower ()
1220+ # other_file should still be modified (not stashed)
1221+ assert "other modified 1" in other_file .read_text ()
1222+ stash = git_repo .cmd .stashes .get (index = 0 )
1223+ assert stash is not None
1224+ stash .pop ()
1225+
1226+ # Test 2: pathlib.Path - should only stash the specified file
1227+ test_file .write_text ("modified for pathlib test" )
1228+ other_file .write_text ("other modified 2" )
1229+ result = stash_cmd .push (path = pathlib .Path (test_filename ))
1230+ assert "fatal" not in result .lower ()
1231+ assert "other modified 2" in other_file .read_text ()
1232+ stash = git_repo .cmd .stashes .get (index = 0 )
1233+ assert stash is not None
1234+ stash .pop ()
1235+
1236+ # Test 3: list path - should only stash the specified file
1237+ test_file .write_text ("modified for list test" )
1238+ other_file .write_text ("other modified 3" )
1239+ result = stash_cmd .push (path = [test_filename ])
1240+ assert "fatal" not in result .lower ()
1241+ assert "other modified 3" in other_file .read_text ()
1242+
1243+
11931244def test_stash_entry_show (git_repo : GitSync ) -> None :
11941245 """Test GitStashEntryCmd.show()."""
11951246 # Create a stash first
0 commit comments