summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Update Commit.trailer_list to return tuples.Twist2023-04-221-4/+4
|
* Deprecate Commit.trailers.Twist2023-04-221-6/+0
|
* Add trailers_list and trailers_list methods to fix the commit trailers ↵Twist2023-04-211-36/+47
| | | | functionality. Update trailers tests.
* Merge pull request #1555 from Codym48/fix/get_valuesSebastian Thiel2023-02-161-0/+11
|\ | | | | Fix get_values() so it correctly loads section names
| * Add test asserting that get_values works by itselfCody Martin2023-02-151-0/+11
| | | | | | | | | | | | | | | | | | | | | | As described in #1534, this test will fail in main with a KeyError about a missing section name even though the named sections do exist within the config file. This test will pass in the branch associated with #1535. This test should keep the improved behavior healthy as the code evolves by preventing future developers from removing the eager loading of sections within get_values().
* | Merge pull request #1550 from Sineaggi/remove-optional-from-two-variablesSebastian Thiel2023-02-021-2/+7
|\ \ | | | | | | Remove optional from two member variables
| * | Add additional assertions to test_base.pyClayton Walker2023-02-021-2/+6
| | |
| * | Add check to test bare repoClayton Walker2023-02-011-0/+1
| | |
* | | Updated diff test to use different similarity thresholdsCesar Velazquez2023-02-011-3/+26
| | |
* | | Added diff test to disable rename detectionCesar Velazquez2023-01-311-0/+47
|/ /
* | Fix timezone parsing functions for non-hour timezonesJames Cowgill2023-01-241-0/+21
| | | | | | | | | | | | | | | | The `utctz_to_altz` and `altz_to_utctz_str` functions fail to handle timezones with UTC offsets that are not a multiple of one hour. Rewrite them and add some unit tests. Fixes #630
* | Add test to verify GitCommandError is raised when check-ignore is run ↵Axel Aguado2023-01-211-1/+12
| | | | | | | | against a file behind a symlink
* | Add test_ignored_items_reportedAxel Aguado2023-01-211-0/+16
| |
* | fix files list on file renameMatteo Croce2023-01-131-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GitPython parses the output of `git diff --numstat` to get the files changed in a commit. This breaks when a commit contains a file rename, because the output of `git diff` is different than expected. This is the output of a normal commit: $ git diff --numstat 8f41a390bf9a^ 8f41a390bf9a 30 5 test/test_repo.py And this a commit containing a rename: $ git diff --numstat 185d847ec764^ 185d847ec764 3 1 .github/workflows/{test_pytest.yml => Future.yml} This can be triggered by this code: for commit in repo.iter_commits(): print(commit.hexsha) for file in commit.stats.files: print(file) Which will print for the normal commit: 8f41a390bf9a54db6f85032bc56b453307b95451 'test/test_repo.py' And when there is a rename: 185d847ec7647fd2642a82d9205fb3d07ea71715 '.github/workflows/{test_pytest.yml => Future.yml}' Additionally, when a path member is removed, the file list become a list of strings, breaking even more the caller. This is in the Linux kernel tree: $ git diff --numstat db401875f438^ db401875f438 1 1 tools/testing/selftests/drivers/net/mlxsw/{spectrum-2 => }/devlink_trap_tunnel_ipip6.sh and GitPython parses it as: db401875f438168c5804b295b93a28c7730bb57a ('tools/testing/selftests/drivers/net/mlxsw/{spectrum-2 => ' '}/devlink_trap_tunnel_ipip6.sh') Fix this by pasing the --no-renames option to `git diff` which ignores renames and print the same output as if the file was deleted from the old path and created in the new one: $ git diff --numstat --no-renames 185d847ec764^ 185d847ec764 57 0 .github/workflows/Future.yml 0 55 .github/workflows/test_pytest.yml
* | fix clone_from_unsafe_protocol testsFC Stegerman2023-01-081-5/+30
| |
* | replace tempfile.mkdtemp w/ tempfile.TemporaryDirectoryFC Stegerman2023-01-083-450/+488
|/
* tests: Use `command -v` instead of third-party `which` programMichał Górny2022-12-311-1/+1
| | | | | | | | Use `command -v` to locate the git executable instead of `which`. The former is guaranteed to always be available according to POSIX, while which(1) is a redundant third-party tool that is slowly being phased out from Linux distributions. In particular, Gentoo no longer installs it by default.
* Updates from reviewSantos Gallegos2022-12-283-17/+109
|
* Submodule testsSantos Gallegos2022-12-271-1/+115
|
* More testsSantos Gallegos2022-12-272-1/+213
|
* Update/add tests for Repo.clone*Santos Gallegos2022-12-271-27/+121
|
* Updates from reviewSantos Gallegos2022-12-271-2/+2
|
* Block unsafe options and protocols by defaultSantos Gallegos2022-12-231-2/+3
|
* Forbid unsafe protocol URLs in Repo.clone{,_from}()Steve Kowalik2022-12-231-0/+36
| | | | | | | | | Since the URL is passed directly to git clone, and the remote-ext helper will happily execute shell commands, so by default disallow URLs that contain a "::" unless a new unsafe_protocols kwarg is passed. (CVE-2022-24439) Fixes #1515
* Add testSantos Gallegos2022-12-211-0/+26
|
* Ignore empty info in diff lineDave Wapstra2022-09-271-0/+6
|
* Fix bug where colons in paths raise a `ValueError` on `diff()` calls.Malcolm Langfield2022-09-121-1/+0
| | | | | | | | | | | | | | | | | This commit introduces a potential fix for #1490 and #1483, in which an `invalid literal for int() with base 10: 'n'` exception was raised within a diff operation. Within `_handle_diff_line()`, we split the output of `git diff-tree` on colons (`:` characters), under the assumption that there are no colons within the paths of the files being diffed. On POSIX systems this is not a valid assumption. The fix is to split on `\x00:`, since a null character always precedes the colons we actually need to split on. A test already existed for this case (`test_diff_file_with_colon()`), but it was marked as skipped. * Split on `\x00:` instead of `:` in `_handle_diff_line()`. * Unskip `test_diff_file_with_colon()`.
* feat(blame): Support custom `rev_opts` for blameJoseph Hale2022-08-301-0/+7
| | | | | | | | | | | | | | | | The `git blame` CLI offers a repeated `-C` option that can be used to detect lines that move within/between files. While a slower operation, it yields more accurate authorship reports. https://git-scm.com/docs/git-blame#Documentation/git-blame.txt--Cltnumgt While GitPython does enable passing custom kwargs to the command line `git` invocation, the fact that kwargs is a dictionary (i.e. no duplicate keys) means that there was no way to request the `-C` option in `git blame` more than once. This commit adds an optional `rev_opts` parameter to the `blame` method which accepts a list of strings to propagate to the CLI invocation of `git blame`. By using a `List[str]` for `rev_opts`, users of GitPython can pass now the `-C` option multiple times to get more detailed authorship reports from `git blame`.
* Allow failure of that one test on cygwinSebastian Thiel2022-08-251-0/+7
|
* Use the same regex as the Actor class when determining co-authors.Twist2022-08-241-1/+1
|
* Add malformed co-authors to the test, to check they aren't detected with the ↵Twist2022-08-231-2/+6
| | | | regex.
* Add co_authors property to the Commit object, which parses the commit ↵Twist2022-08-221-0/+11
| | | | message for designated co-authors, include a simple test.
* Fix source comment typosluz paz2022-08-172-3/+3
|
* Merge pull request #1459 from AustinScola/ascola/fix-blob-filter-typesSebastian Thiel2022-07-021-0/+32
|\ | | | | Fix blob filter types
| * Remove stage type as parameter from blob filter testAustin Scola2022-07-011-6/+7
| |
| * Fix blob filter path shorter than filter pathAustin Scola2022-06-281-0/+31
| |
* | Add regression test for TagReference.createRuud van Asseldonk2022-06-251-0/+17
|/ | | | | | If you pass the "message" kwarg, it also translates it to an -m command line flag, and with both -m and --message, the message appears twice. I will fix this in the next commit.
* FIX: Mark the correct test_submodule test as xfail on CygwinDWesl2022-06-201-4/+4
| | | Got the wrong one the first time.
* FIX: Import pytest in tests.test_docsDWesl2022-06-201-0/+2
|
* TST: Mark test_submodule.TestSubmodule.test_root_module as xfail on CygwinDWesl2022-06-201-0/+8
|
* TST: Mark test_repo.TestRepo.test_submodules as xfail on CygwinDWesl2022-06-201-0/+8
|
* TST: Mark test_docs.Tutorials.test_submodules as xfail on CygwinDWesl2022-06-201-0/+6
|
* fix: Allow adding PathLike object to indexRuben DI BATTISTA2022-05-181-0/+11
| | | | Close #1382
* reformat according to 'black' configuration file.Sebastian Thiel2022-05-1825-716/+242
|
* Run everything through 'black'Sebastian Thiel2022-05-1829-1603/+2470
| | | | | That way people who use it won't be deterred, while it unifies style everywhere.
* Fix various typosluz paz2022-05-079-10/+10
| | | Found via `codespell -q 3 -S ./git/ext/gitdb,./test/fixtures/reflog_master,./test/fixtures/diff_mode_only,./test/fixtures/reflog_HEAD`
* Fix #1284: strip usernames from URLs as well as passwordsGlenn Matthews2022-05-042-10/+29
|
* chore: `s/strip_newline/&_in_stdout`Hiroki Tokunaga2022-04-071-2/+2
|
* feat(cmd): add the `strip_newline` flagHiroki Tokunaga2022-04-061-0/+10
| | | | | | | | This commit adds the `strip_newline` flag to the `Git.execute` method. When this flag is set to `True`, it will trim the trailing `\n`. The default value is `True` for backward compatibility. Setting it to `False` is helpful for, e.g., the `git show` output, especially with the binary file, as the missing `\n` may invalidate the file.
* Use bash to open extensionless hooks on windowsDavid Briscoe2022-01-141-3/+6
| | | | | | | | | | | | | | | Fix #971. Partly resolve #703. If the hook doesn't have a file extension, then Windows won't know how to run it and you'll get "[WinError 193] %1 is not a valid Win32 application". It's very likely that it's a shell script of some kind, so use bash.exe (commonly installed via Windows Subsystem for Linux). We don't want to run all hooks with bash because they could be .bat files. Update tests to get several hook ones working. More work necessary to get commit-msg hook working. The hook writes to the wrong file because it's not using forward slashes in the path: C:\Users\idbrii\AppData\Local\Temp\bare_test_commit_msg_hook_successy5fo00du\CUsersidbriiAppDataLocalTempbare_test_commit_msg_hook_successy5fo00duCOMMIT_EDITMSG