summaryrefslogtreecommitdiff
path: root/git/test/fixtures
Commit message (Collapse)AuthorAgeFilesLines
* Fix diff patch parser for paths with unsafe charsVincent Driessen2016-04-191-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This specifically covers the cases where unsafe chars occur in path names, and git-diff -p will escape those. From the git-diff-tree manpage: > 3. TAB, LF, double quote and backslash characters in pathnames are > represented as \t, \n, \" and \\, respectively. If there is need > for such substitution then the whole pathname is put in double > quotes. This patch checks whether or not this has happened and will unescape those paths accordingly. One thing to note here is that, depending on the position in the patch format, those paths may be prefixed with an a/ or b/. I've specifically made sure to never interpret a path that actually starts with a/ or b/ incorrectly. Example of that subtlety below. Here, the actual file path is "b/normal". On the diff file that gets encoded as "b/b/normal". diff --git a/b/normal b/b/normal new file mode 100644 index 0000000000000000000000000000000000000000..eaf5f7510320b6a327fb308379de2f94d8859a54 --- /dev/null +++ b/b/normal @@ -0,0 +1 @@ +dummy content Here, we prefer the "---" and "+++" lines' values. Note that these paths start with a/ or b/. The only exception is the value "/dev/null", which is handled as a special case. Suppose now the file gets moved "b/moved", the output of that diff would then be this: diff --git a/b/normal b/b/moved similarity index 100% rename from b/normal rename to b/moved We prefer the "rename" lines' values in this case (the "diff" line is always a last resort). Take note that those lines are not prefixed with a/ or b/, but the ones in the "diff" line are (just like the ones in "---" or "+++" lines).
* Make diff patch parsing more reliableVincent Driessen2016-04-192-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | The a_path and b_path cannot reliably be read from the first diff line as it's ambiguous. From the git-diff manpage: > The a/ and b/ filenames are the same unless rename/copy is involved. > Especially, **even for a creation or a deletion**, /dev/null is not > used in place of the a/ or b/ filenames. This patch changes the a_path and b_path detection to read it from the more reliable locations further down the diff headers. Two use cases are fixed by this: - As the man page snippet above states, for new/deleted files the a or b path will now be properly None. - File names with spaces in it are now properly parsed. Working on this patch, I realized the --- and +++ lines really belong to the diff header, not the diff contents. This means that when parsing the patch format, the --- and +++ will now be swallowed, and not end up anymore as part of the diff contents. The diff contents now always start with an @@ line. This may be a breaking change for some users that rely on this behaviour. However, those users could now access that information more reliably via the normal Diff properties a_path and b_path now.
* Support "root" as a special value in .diff() callsVincent Driessen2016-04-141-0/+10
| | | | This enabled getting diff patches for root commits.
* Add incremental blame supportVincent Driessen2016-04-131-0/+30
| | | | | | | | | | | | | | | This adds a sibling method to Repo's blame method: Repo.blame_incremental(rev, path, **kwargs) This can alternatively be called using: Repo.blame(rev, path, incremental=True) The main difference is that blame incremental is a bit more efficient and does not return the full file's contents, just the commits and the line number ranges. The parser is a bit more straight-forward and faster since the incremental output format is defined a little stricter.
* Add test and fixture for diff index from raw formatJonathan Chu2016-03-161-0/+1
| | | | | | This tests the edge case of doing a diff against a single whitespace filename and returns the proper change type. All other normal usage of this diff classmethod should remain unchanged.
* fix(config): ignore empty values in config fileSebastian Thiel2015-09-061-0/+4
| | | | | | | | | | | Similar to git, we now ignore options which have no value. Previously it would not handle it consistently, and throw a parsing error the first time the cache was built. Afterwards, it was fully usable though. Now we specifically check for the case of no-value options instead. Closes #349
* fix(cmd): don't open stdout when fetchingSebastian Thiel2015-07-031-0/+5
| | | | | | | This allows us to use the main thread to parse stderr to get progress, and resolve assertion failures hopefully once and for all. Relates to #301
* test(git): remove unnecessary fixtureSebastian Thiel2015-07-031-5001/+0
| | | | | Test was adjusted as well to parse only a single file which simulates stderr output.
* fix(cmd): line parsingSebastian Thiel2015-07-032-0/+10003
| | | | | | * Previously we could fail to parse the last line within a read buffer, which is now fixed. * Added a test to verify our *slow* line parsing works as expected.
* fix(config): selective cfg write;fix cfg parserSebastian Thiel2015-04-221-0/+3
| | | | | | | | | | | * config parser now handles quoted values correctly. This doesn't hamper multi-line support. * added regression test to travis to assure we will be warned if we rewrite and break the user's .gitconfig file * only rewrite configuration files if we actually called a mutating method on the writer. Previously it would always rewrite it. Fixes #285
* Fetch now deals with custom refspecs much better.Sebastian Thiel2015-01-222-0/+12
| | | | | | | | | Even though the test-csae only verifies this spec: +refs/pull/*:refs/heads/pull/* I could locally verify that it indeed handles other ones just as well: +refs/pull/*:refs/pull/* Fixes #243
* Added advance usage examples to tutorial and made minor fixes.Sebastian Thiel2015-01-211-2/+2
| | | | | | GIT_PYTHON_TRACE would actually fail (now) if we debugged archive operations. Related to #239
* GitConfigParser now respects and merges 'include' sectionsSebastian Thiel2015-01-141-0/+3
| | | | | | | | | | | | | We implement it as described in this article: http://stackoverflow.com/questions/1557183/is-it-possible-to-include-a-file-in-your-gitconfig Thus we handle * cycles * relative and absolute include paths * write-backs in case of writable GitConfigParser instances Fixes #201
* Implemented multi-line parsing of git-config to the point where a sepcific ↵Sebastian Thiel2015-01-101-0/+183
| | | | | | | | | | test-file is working. This brings us much closer to what git can do, and should at least prevent errors while reading configuration files (which would break a lot of features, like handling of remotes since these rely reading configuration files). Fixes #112
* Added test for complex blame revision query.Sebastian Thiel2015-01-091-0/+177
| | | | | It works as expected by me at least. Related to #71
* Added test to verify binary diffs are working as well.Sebastian Thiel2015-01-091-0/+100
| | | | Related to #74
* Added test to verify binary diffs are working as well.Sebastian Thiel2015-01-092-0/+4
| | | | Related to #74
* Added test to assure blame can deal with binary patches.Sebastian Thiel2015-01-091-0/+0
| | | | Fixes #74
* Added support for rename detection in raw mode (which is the default).Sebastian Thiel2015-01-081-0/+1
| | | | Fixes #36
* Fixed io types to make tests work on PY2 once again.py3Sebastian Thiel2015-01-051-0/+1
| | | | Now it's about going through PY3 issues
* Merge branch 'feature/0.3/git-file-support' of ↵Sebastian Thiel2014-11-191-0/+1
|\ | | | | | | | | | | | | | | | | | | https://github.com/igetgames/GitPython into igetgames-feature/0.3/git-file-support Using the previous implementation of read_gitfile, but added the previously missing test from this PR. Conflicts: git/repo/base.py git/test/test_repo.py
| * Add tests for .git-file.Marcus R. Brown2013-01-111-0/+1
| |
* | GPG signature support on commit object.Max Rasskazov2014-09-081-0/+30
|/ | | | | | | | Originals: Pull request "GPG signature support on commit object" #124 by Tatsuki Sugiura. https://github.com/gitpython-developers/GitPython/pull/124 commit 8065d2abdbb18e09560fc061807301b4c834d5a7 commit 62ecd6c66a84144632b045696326af503ee8cd4e
* Greatly improved robustness of config parser - it can now take pretty much ↵Sebastian Thiel2011-06-071-5/+11
| | | | everything. Includes an updated config file which includes all the new additions
* Moved everything into the git subdirectory - some tests still need to be ↵Sebastian Thiel2010-11-2540-0/+3634
adjusted