| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fb7e089 commit 8da6508
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,7 @@ Changelog | |||
| 8 | 8 | Security fixes for | |
| 9 | 9 | ||
| 10 | 10 | * https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-gq48-pqfc-9p58 | |
| 11 | + * https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-23mf-xhv8-69c2 | ||
| 11 | 12 | ||
| 12 | 13 | If you can, also try and provide feedback on the upcoming v4 branch | |
| 13 | 14 | https://github.com/gitpython-developers/GitPython/pull/2177 - patches welcome. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -283,7 +283,7 @@ def checkout( | |||
| 283 | 283 | """ | |
| 284 | 284 | if not allow_unsafe_options: | |
| 285 | 285 | Git.check_unsafe_options( | |
| 286 | - options=Git._option_candidates([], kwargs), | ||
| 286 | + options=Git._option_candidates([self], kwargs), | ||
| 287 | 287 | unsafe_options=Git.unsafe_git_pathspec_from_file_options, | |
| 288 | 288 | ) | |
| 289 | 289 | kwargs["f"] = force | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -289,6 +289,25 @@ def test_head_checkout_rejects_pathspec_from_file(self, rw_repo): | |||
| 289 | 289 | pathspec_file_nul=True, | |
| 290 | 290 | **{option_name: str(pathspecs)}, | |
| 291 | 291 | ) | |
| 292 | + for option_name in ("--pathspec-from-file", "--pathspec-from"): | ||
| 293 | + branch = Head(rw_repo, f"refs/heads/{option_name}={pathspecs}") | ||
| 294 | + with self.assertRaises(UnsafeOptionError): | ||
| 295 | + branch.checkout() | ||
| 296 | + | ||
| 297 | + def test_cloned_head_checkout_rejects_pathspec_from_file(self): | ||
| 298 | + with tempfile.TemporaryDirectory() as tdir: | ||
| 299 | + base_dir = Path(tdir) | ||
| 300 | + with self._repo_with_initial_commit(base_dir) as source: | ||
| 301 | + branch = source.create_head("--pathspec-from-file=pathspecs") | ||
| 302 | + source.head.reference = branch | ||
| 303 | + with Repo.clone_from(source.working_tree_dir, base_dir / "clone") as cloned: | ||
| 304 | + (base_dir / "clone" / "pathspecs").write_text("unmatched-private-content\n", encoding="utf-8") | ||
| 305 | + assert cloned.active_branch.name == branch.name | ||
| 306 | + with self.assertRaises(UnsafeOptionError): | ||
| 307 | + cloned.active_branch.checkout() | ||
| 308 | + with self.assertRaises(GitCommandError) as error: | ||
| 309 | + cloned.active_branch.checkout(allow_unsafe_options=True) | ||
| 310 | + assert "unmatched-private-content" in str(error.exception) | ||
| 292 | 311 | ||
| 293 | 312 | @with_rw_repo("HEAD") | |
| 294 | 313 | def test_head_reset_rejects_pathspec_from_file(self, rw_repo): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments