Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-11-07iterator: submodules are determined by an index or treeCarlos Martín Nieto
We cannot know from looking at .gitmodules whether a directory is a submodule or not. We need the index or tree we are comparing against to tell us. Otherwise we have to assume the entry in .gitmodules is stale or otherwise invalid. Thus we pass the index of the repository into the workdir iterator, even if we do not want to compare against it. This follows what git does, which even for `git diff <tree>`, it will consider staged submodules as such.
2014-07-01Introduce cl_assert_equal_oidEdward Thomson
2014-05-27Fix compile error on Visual StudioCha, Hojeong
2014-05-17Git binary check compat testsRussell Belfer
A variety of data patterns for diffs verified to match the behavior of binary detection with Git on the command line.
2014-05-13Merge pull request #2328 from libgit2/rb/how-broken-can-ignores-beVicent Marti
Improve checks for ignore containment
2014-05-12Don't scale diff stat when not neededRussell Belfer
2014-05-06Improve checks for ignore containmentRussell Belfer
The diff code was using an "ignored_prefix" directory to track if a parent directory was ignored that contained untracked files alongside tracked files. Unfortunately, when negative ignore rules were used for directories inside ignored parents, the wrong rules were applied to untracked files inside the negatively ignored child directories. This commit moves the logic for ignore containment into the workdir iterator (which is a better place for it), so the ignored-ness of a directory is contained in the frame stack during traversal. This allows a child directory to override with a negative ignore and yet still restore the ignored state of the parent when we traverse out of the child. Along with this, there are some problems with "directory only" ignore rules on container directories. Given "a/*" and "!a/b/c/" (where the second rule is a directory rule but the first rule is just a generic prefix rule), then the directory only constraint was having "a/b/c/d/file" match the first rule and not the second. This was fixed by having ignore directory-only rules test a rule against the prefix of a file with LEADINGDIR enabled. Lastly, spot checks for ignores using `git_ignore_path_is_ignored` were tested from the top directory down to the bottom to deal with the containment problem, but this is wrong. We have to test bottom to top so that negative subdirectory rules will be checked before parent ignore rules. This does change the behavior of some existing tests, but it seems only to bring us more in line with core Git, so I think those changes are acceptable.
2014-05-02Remove trace / add git_diff_perfdata struct + apiRussell Belfer
2014-05-02Get rid of redundant git_diff_options_init fnRussell Belfer
Since git_diff_init_options was introduced, remove this old fn.
2014-05-02Add payloads, bitmaps to trace APIRussell Belfer
This is a proposed adjustment to the trace APIs. This makes the trace levels into a bitmask so that they can be selectively enabled and adds a callback-level payload, plus a message-level payload. This makes it easier for me to a GIT_TRACE_PERF callbacks that are simply bypassed if the PERF level is not set.
2014-05-02Don't use trace if GIT_TRACE not definedRussell Belfer
2014-05-02Add GIT_STATUS_OPT_UPDATE_INDEX and use trace APIRussell Belfer
This adds an option to refresh the stat cache while generating status. It also rips out the GIT_PERF stuff I had an makes use of the trace API to keep statistics about what happens during diff.
2014-05-02Add diff option to update index stat cacheRussell Belfer
When diff is scanning the working directory, if it finds a file where it is not sure if the index entry matches the working dir, it will recalculate the OID (which is pretty expensive). This adds a new flag to diff so that if the OID calculation finds that the file actually has not changed (i.e. just the modified time was altered or such), then it will refresh the stat cache in the index so that future calls to diff will not have to check the oid again.
2014-05-02Skip diff oid calc when size definitely changedRussell Belfer
When we think the stat cache in the index seems valid and the size or mode of a file has definitely changed, then don't bother trying to recalculate the OID of the workdir bits to confirm that it is modified - just accept that it is modified. This can result in files that show as modified with no actual diff, but the behavior actually appears to match Git on the command line. This also includes a minor optimization to not perform a submodule lookup on the ".git" directory itself.
2014-05-02Add build option for diff internal statisticsRussell Belfer
2014-04-23Merge pull request #2291 from ethomson/patch_binaryVicent Marti
patch: emit deflated binary patches (optionally)
2014-04-23patch: emit binary patches (optionally)Edward Thomson
2014-04-22Use git_diff_get_stats in example/diff + refactorRussell Belfer
This takes the `--stat` and related example options in the example diff.c program and converts them to use the `git_diff_get_stats` API which nicely formats stats for you. I went to add bar-graph scaling to the stats formatter and noticed that the `git_diff_stats` structure was holding on to all of the `git_patch` objects. Unfortunately, each of these objects keeps the full text of the diff in memory, so this is very expensive. I ended up modifying `git_diff_stats` to keep just the data that it needs to keep and allowed it to release the patches. Then, I added width scaling to the output on top of that. In making the diff example program match 'git diff' output, I ended up removing an newline from the sumamry output which I then had to compensate for in the email formatting to match the expectations. Lastly, I went through and refactored the tests to use a couple of helper functions and reduce the overall amount of code there.
2014-04-18Index locking and entry allocation changesRussell Belfer
This makes the lock management on the index a little bit broader, having a number of routines hold the lock across looking up the item to be modified and actually making the modification. Still not true thread safety, but more pure index modifications are now safe which allows the simple cases (such as starting up a diff while index modifications are underway) safe enough to get the snapshot without hitting allocation problems. As part of this, I simplified the allocation of index entries to use a flex array and just put the path at the end of the index entry. This makes every entry self-contained and makes it a little easier to feel sure that pointers to strings aren't being accidentally copied and freed while other references are still being held.
2014-04-18Decouple index iterator sort from indexRussell Belfer
This makes the index iterator honor the GIT_ITERATOR_IGNORE_CASE and GIT_ITERATOR_DONT_IGNORE_CASE flags without modifying the index data itself. To take advantage of this, I had to export a number of the internal index entry comparison functions. I also wrote some new tests to exercise the capability.
2014-04-18Add public diff print helpersRussell Belfer
The usefulness of these helpers came up for me while debugging some of the iterator changes that I was making, so since they have also been requested (albeit indirectly) I thought I'd include them.
2014-04-15Added a test case for formatting a binary patch e-mailJacques Germishuys
2014-04-15Sanitize git_diff_format_email_options' summary parameterJacques Germishuys
It will form part of the subject line and should thus be one line.
2014-04-15Introduce git_diff_format_email and git_diff_commit_as_emailJacques Germishuys
2014-04-15Introduce git_diff_get_stats, git_diff_stats_files_changed, ↵Jacques Germishuys
git_diff_stats_insertions, git_diff_stats_deletions and git_diff_stats_to_buf
2014-04-02Remove most submodule reloads from testsRussell Belfer
With the new submodule cache validity checks, we generally don't need to call git_submodule_reload_all to have up-to-date submodule data. Some tests are still calling it where I want to actually test that it can be called safely and doesn't break anything, but mostly it is not needed. This also expands some of the existing submodule tests to cover some variants on the behavior that was already being tested.
2014-04-01Improve test of submodule name sortingRussell Belfer
2014-03-28Fix memory leak of test repository objectRussell Belfer
2014-03-26Merge pull request #2204 from libgit2/rb/submodule-reference-countingVicent Marti
Make submodules externally refcounted
2014-03-25Update behavior for untracked sub-reposRussell Belfer
When a directory containing a .git directory (or even just a plain gitlink) was found, libgit2 was going out of its way to treat it specially. This seemed like it was necessary because the diff code was not originally emulating Git's behavior for untracked directories correctly (i.e. scanning for ignored vs untracked items inside). Now that libgit2 diff mimics Git's untracked directory behavior, the special handling for contained Git repos is actually incorrect and this commit rips it out.
2014-03-25Make submodules externally refcountedRussell Belfer
`git_submodule` objects were already refcounted internally in case the submodule name was different from the path at which it was stored. This makes that refcounting externally used as well, so `git_submodule_lookup` and `git_submodule_add_setup` return an object that requires a `git_submodule_free` when done.
2014-03-06git_checkout_opts -> git_checkout_optionsBen Straub
2014-02-28Add buffer to buffer diff and patch APIsRussell Belfer
This adds `git_diff_buffers` and `git_patch_from_buffers`. This also includes a bunch of internal refactoring to increase the shared code between these functions and the blob-to-blob and blob-to-buffer APIs, as well as some higher level assert helpers in the tests to also remove redundancy.
2014-01-28Merge pull request #2066 from libgit2/rb/builtin-diff-driversVicent Marti
Add built in diff drivers
2014-01-27Update Javascript userdiff driver and testsRussell Belfer
Writing a sample Javascript driver pointed out some extra whitespace handling that needed to be done in the diff driver. This adds some tests with some sample javascript code that I pulled off of GitHub just to see what would happen. Also, to clean up the userdiff test data, I did a "git gc" and packed up the test objects.
2014-01-25diff: rename the file's 'oid' to 'id'Carlos Martín Nieto
In the same vein as the previous commits in this series.
2014-01-25index: rename an entry's id to 'id'Carlos Martín Nieto
This was not converted when we converted the rest, so do it now.
2014-01-25Move userdiff tests to be data drivenRussell Belfer
This moves the expected and actual test data along with the source data for the userdiff tests into the tests/resources/userdiff test repo and updates the test to use that.
2014-01-24Update all tests for new pattern extractionRussell Belfer
2014-01-24Implement matched pattern extract for fn headersRussell Belfer
2014-01-24Fix filemode updating in diff textRussell Belfer
2014-01-24Import git drivers and test HTML driverRussell Belfer
Reorganize the builtin driver table slightly so that core Git builtin definitions can be imported verbatim. Then take a few of the core Git drivers and pull them in. This also creates a test of diffs with the builtin HTML driver which led to some small error handling fixes in the driver selection logic.
2014-01-22Drop git_patch_to_strNicolas Hake
It's hard or even impossible to correctly free the string buffer allocated by git_patch_to_str in some circumstances. Drop the function so people have to use git_patch_to_buf instead - git_buf has a dedicated destructor.
2014-01-15refs: remove the _with_log differentiationCarlos Martín Nieto
Any well-behaved program should write a descriptive message to the reflog whenever it updates a reference. Let's make this more prominent by removing the version without the reflog parameters.
2013-12-12More tests of canceling from callbacksRussell Belfer
This covers diff print, push, and ref foreach. This also has a fix for a small memory leak in the push tests.
2013-12-11More improvements to callback return value testsRussell Belfer
This time actually checking return values in diff notify tests and actually testing callbacks for the index all-all/update-all/etc functions.
2013-12-11Remove converting user error to GIT_EUSERRussell Belfer
This changes the behavior of callbacks so that the callback error code is not converted into GIT_EUSER and instead we propagate the return value through to the caller. Instead of using the giterr_capture and giterr_restore functions, we now rely on all functions to pass back the return value from a callback. To avoid having a return value with no error message, the user can call the public giterr_set_str or some such function to set an error message. There is a new helper 'giterr_set_callback' that functions can invoke after making a callback which ensures that some error message was set in case the callback did not set one. In places where the sign of the callback return value is meaningful (e.g. positive to skip, negative to abort), only the negative values are returned back to the caller, obviously, since the other values allow for continuing the loop. The hardest parts of this were in the checkout code where positive return values were overloaded as meaningful values for checkout. I fixed this by adding an output parameter to many of the internal checkout functions and removing the overload. This added some code, but it is probably a better implementation. There is some funkiness in the network code where user provided callbacks could be returning a positive or a negative value and we want to rely on that to cancel the loop. There are still a couple places where an user error might get turned into GIT_EUSER there, I think, though none exercised by the tests.
2013-12-07Don't clobber whitespace settingsBen Straub
2013-12-06Don't use weird return codesBen Straub
2013-12-06Implement GIT_DIFF_FIND_BY_CONFIGBen Straub