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
2013-11-02Fix --assume-unchanged supportRussell Belfer
This was never really working right because we were checking the wrong flag and not checking it in all the places that we need to be checking it. I finally got around to writing a test and adding actual support for it.
2013-11-01Add git_diff_options_init helperRussell Belfer
Sometimes the static initializer for git_diff_options cannot be used and since setting them to all zeroes doesn't actually work quite right, this adds a new helper for that situation. This also adds an explicit new value to the submodule settings options to be used when those enums need static initialization.
2013-11-01Convert git_index_read to have a "force" flagRussell Belfer
This is a little more intuitive than the turned-around option that I originally wrote.
2013-11-01Make diff and status perform soft index reloadRussell Belfer
This changes `git_index_read` to have two modes - a hard index reload that always resets the index to match the on-disk data (which was the old behavior) and a soft index reload that uses the timestamp / file size information and only replaces the index data if the file on disk has been modified. This then updates the git_status code to do a soft reload unless the new GIT_STATUS_OPT_NO_REFRESH flag is passed in. This also changes the behavior of the git_diff functions that use the index so that when an index is not explicitly passed in (i.e. when the functions call git_repository_index for you), they will also do a soft reload for you. This intentionally breaks the file signature of git_index_read because there has been some confusion about the behavior previously and it seems like all existing uses of the API should probably be examined to select the desired behavior.
2013-11-01Fix some of the glaring errors in GIT_DIFF_REVERSERussell Belfer
These changes fix the basic problem with GIT_DIFF_REVERSE being broken for text diffs. The reversed diff entries were getting added to the git_diff correctly, but some of the metadata was kept incorrectly in a way that prevented the text diffs from being generated correctly. Once I fixed that, it became clear that it was not possible to merge reversed diffs correctly. This has a first pass at fixing that problem. We probably need more tests to make sure that is really fixed thoroughly.
2013-10-21Tweak to git_diff_delta structure for nfilesRussell Belfer
While the base git_diff_delta structure always contains two files, when we introduce conflict data, it will be helpful to have an indicator when an additional file is involved.
2013-10-16Diff API cleanupRussell Belfer
This lays groundwork for separating formatting options from diff creation options. This groups the formatting flags separately from the diff list creation flags and reorders the options. This also tweaks some APIs to further separate code that uses patches from code that just looks at git_diffs.
2013-10-12Rename diff objects and split patch.hRussell Belfer
This makes no functional change to diff but renames a couple of the objects and splits the new git_patch (formerly git_diff_patch) into a new header file.
2013-09-21Merge pull request #1840 from linquize/warningVicent Martí
Fix warning
2013-09-19Fix warningLinquize
2013-09-17Add ident filterRussell Belfer
This adds the ident filter (that knows how to replace $Id$) and tweaks the filter APIs and code so that git_filter_source objects actually have the updated OID of the object being filtered when it is a known value.
2013-09-17Create public filter object and use itRussell Belfer
This creates include/sys/filter.h with a basic definition of a git_filter and then converts the internal code to use it. There are related internal objects (git_filter_list) that we will want to publish at some point, but this is a first step.
2013-08-05Add rename from rewrites to statusEdward Thomson
In git_diff_paired_foreach, temporarily resort the index->workdir diff list by index path so that we can track a rename in the workdir from head->index->workdir.
2013-07-10Untracked directories with .git should be ignoredRussell Belfer
This restores a behavior that was accidentally lost during some diff refactoring where an untracked directory that contains a .git item should be treated as IGNORED, not as UNTRACKED. The submodule code already detects this, but the diff code was not handling the scenario right. This also updates a number of existing tests that were actually exercising the behavior but did not have the right expectations in place. It actually makes the new `test_diff_submodules__diff_ignore_options` test feel much better because the "not-a-submodule" entries are now ignored instead of showing up as untracked items. Fixes #1697
2013-07-10Add ignore_submodules to diff optionsRussell Belfer
This adds correct support for an equivalent to --ignore-submodules in diff, where an actual ignore value can be passed to diff to override the per submodule settings in the configuration. This required tweaking the constants for ignore values so that zero would not be used and could represent an unset option to the diff. This was an opportunity to move the submodule values into include/git2/types.h and to rename the poorly named DEFAULT values for ignore and update constants to RESET instead. Now the GIT_DIFF_IGNORE_SUBMODULES flag is exactly the same as setting the ignore_submodules option to GIT_SUBMODULE_IGNORE_ALL (which is actually a minor change from the old behavior in that submodules will now be treated as UNMODIFIED deltas instead of being left out totally - if you set GIT_DIFF_INCLUDE_UNMODIFIED). This includes tests for the various new settings.
2013-07-10Update diff to new internal submodule status APIRussell Belfer
Submodules now expose an internal status API that allows diff to get back the OID values from the submodule very easily and also to avoiding caching issues and to override the ignore setting for the submodule.
2013-07-10Add git_pathspec_match_diff APIRussell Belfer
This adds an additional pathspec API that will match a pathspec against a diff object. This is convenient if you want to handle renames (so you need the whole diff and can't use the pathspec constraint built into the diff API) but still want to tell if the diff had any files that matched the pathspec. When the pathspec is matched against a diff, instead of keeping a list of filenames that matched, instead the API keeps the list of git_diff_deltas that matched and they can be retrieved via a new API git_pathspec_match_list_diff_entry. There are a couple of other minor API extensions here that were mostly for the sake of convenience and to reduce dependencies on knowing the internal data structure between files inside the library.
2013-07-10Add public API for pathspec matchingRussell Belfer
This adds a new public API for compiling pathspecs and matching them against the working directory, the index, or a tree from the repository. This also reworks the pathspec internals to allow the sharing of code between the existing internal usage of pathspec matching and the new external API. While this is working and the new API is ready for discussion, I think there is still an incorrect behavior in which patterns are always matched against the full path of an entry without taking the subdirectories into account (so "s*" will match "subdir/file" even though it wouldn't with core Git). Further enhancements are coming, but this was a good place to take a functional snapshot.
2013-07-03Remove GIT_STATUS_SHOW_INDEX_THEN_WORKDIR optionRussell Belfer
This option serves no benefit now that the git_status_list API is available. It was of questionable value before and now it would just be a bad idea to use it rather than the indexed API.
2013-07-03Fix segfault in git_status_foreach_ext()yorah
Add tests for the `GIT_STATUS_SHOW_XXX` flags.
2013-06-20Add status flags to force output sort orderRussell Belfer
Files in status will, be default, be sorted according to the case insensitivity of the filesystem that we're running on. However, in some cases, this is not desirable. Even on case insensitive file systems, 'git status' at the command line will generally use a case sensitive sort (like 'ls'). Some GUIs prefer to display a list of file case insensitively even on case-sensitive platforms. This adds two new flags: GIT_STATUS_OPT_SORT_CASE_SENSITIVELY and GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY that will override the default sort order of the status output and give the user control. This includes tests for exercising these new options and makes the examples/status.c program emulate core Git and always use a case sensitive sort.
2013-06-20Fix bug in diff untracked dir scanRussell Belfer
When scanning untracked directories looking for non-ignored files there was a bug where an empty directory would generate a false error.
2013-06-20Add index pathspec-based operationsRussell Belfer
This adds three new public APIs for manipulating the index: 1. `git_index_add_all` is similar to `git add -A` and will add files in the working directory that match a pathspec to the index while honoring ignores, etc. 2. `git_index_remove_all` removes files from the index that match a pathspec. 3. `git_index_update_all` updates entries in the index based on the current contents of the working directory, either added the new information or removing the entry from the index.
2013-06-17Always do tree to index diffs case sensitivelyRussell Belfer
Trees are always case sensitive. The index is always case preserving and will be case sensitive when it is turned into a tree. Therefore the tree and the index can and should always be compared to one another case sensitively. This will restore the index to case insensitive order after the diff has been generated. Consider this a short-term fix. The long term fix is to have the index always stored both case sensitively and case insensitively (at least on platforms that sometimes require case insensitivity).
2013-06-17Improve case handling in git_diff__paired_foreachRussell Belfer
This commit reinstates some changes to git_diff__paired_foreach that were discarded during the rebase (because the diff_output.c file had gone away), and also adjusts the case insensitively logic slightly to hopefully deal with either mismatched icase diffs and other case insensitivity scenarios.
2013-06-17Be more careful about the path with diffsRussell Belfer
This makes diff more careful about picking the canonical path when generating a delta so that it won't accidentally pick up a case-mismatched path on a case-insensitive file system. This should make sure we use the "most accurate" case correct version of the path (i.e. from the tree if possible, or the index if need be).
2013-06-12util: It's called `memzero`Vicent Marti
2013-06-12Merge remote-tracking branch 'arrbee/minor-paranoia' into developmentVicent Marti
2013-06-10Reorganize diff and add basic diff driverRussell Belfer
This is a significant reorganization of the diff code to break it into a set of more clearly distinct files and to document the new organization. Hopefully this will make the diff code easier to understand and to extend. This adds a new `git_diff_driver` object that looks of diff driver information from the attributes and the config so that things like function content in diff headers can be provided. The full driver spec is not implemented in the commit - this is focused on the reorganization of the code and putting the driver hooks in place. This also removes a few #includes from src/repository.h that were overbroad, but as a result required extra #includes in a variety of places since including src/repository.h no longer results in pulling in the whole world.
2013-06-07Add safe memset and use itRussell Belfer
This adds a `git__memset` routine that will not be optimized away and updates the places where I memset() right before a free() call to use it.
2013-06-01Zero memory for major objects before freeingRussell Belfer
By zeroing out the memory when we free larger objects (i.e. those that serve as collections of other data, such as repos, odb, refdb), I'm hoping that it will be easier for libgit2 bindings to find errors in their object management code.
2013-05-31Make iterators use GIT_ITEROVER & smart advanceRussell Belfer
1. internal iterators now return GIT_ITEROVER when you go past the last item in the iteration. 2. git_iterator_advance will "advance" to the first item in the iteration if it is called immediately after creating the iterator, which allows a simpler idiom for basic iteration. 3. if git_iterator_advance encounters an error reading data (e.g. a missing tree or an unreadable file), it returns the error but also attempts to advance past the invalid data to prevent an infinite loop. Updated all tests and internal usage of iterators to account for these new behaviors.
2013-05-24Clarify GIT_DIFF_INCLUDE_UNTRACKED_CONTENT optionRussell Belfer
This improves the docs for GIT_DIFF_INCLUDE_UNTRACKED_CONTENT as well as the other flags related to UNTRACKED items in diff, plus it makes that flag now automatically turn on GIT_DIFF_INCLUDE_UNTRACKED which seems like a reasonable dwim type of change.
2013-05-18Fix delta compare to use correct pathnameRussell Belfer
The delta cmp function needs to choose the correct path for ordering when a delta is ADDED, RENAMED, or COPIED.
2013-05-16Fix diff crash when last item is untracked dirRussell Belfer
When the last item in a diff was an untracked directory that only contained ignored items, the loop to scan the contents would run off the end of the iterator and dereference a NULL pointer. This includes a test that reproduces the problem and a fix.
2013-05-08Fix dumb type in time comparisonRussell Belfer
2013-05-07Add GIT_DIFF_LINE_CONTEXT_EOFNLRussell Belfer
This adds a new line origin constant for the special line that is used when both files end without a newline. In the course of writing the tests for this, I was having problems with modifying a file but not having diff notice because it was the same size and modified less than one second from the start of the test, so I decided to start working on nanosecond timestamp support. This commit doesn't contain the nanosecond support, but it contains the reorganization of maybe_modified and the hooks so that if the nanosecond data were being read by stat() (or rather being copied by git_index_entry__init_from_stat), then the nsec would be taken into account. This new stuff could probably use some more tests, although there is some amount of it here.
2013-05-03fix some leaksEdward Thomson
2013-04-30Fix some formatting inconsistencyRussell Belfer
2013-04-30Update diff handling of untracked directoriesRussell Belfer
When diff encounters an untracked directory, there was a shortcut that it took which is not compatible with core git. This makes the default behavior no longer take that shortcut and instead look inside the untracked directory to see if there are any untracked files within it. If there are not, then the directory is treated as an ignore directory instead of an untracked directory. This has implications for the git_status APIs.
2013-04-30Reorganize diff code into functionsRussell Belfer
In preparation for more changes to the internal diff logic, it seemed wise to split the very large git_diff__from_iterators into separate functions that handle the four main cases (unmatched old item, unmatched new item, unmatched new directory, and matched old and new items). Hopefully this will keep the logic easier to follow even as more cases have to be added to this code.
2013-04-30Make git_oid_cmp public and add git_oid__cmpRussell Belfer
2013-04-23Make sure diff output is cleared on errorRussell Belfer
2013-04-23Improve diff config options handlingRussell Belfer
This makes diff use the cvar cache for config options where possible, and also adds support for a number of other config options to diff including "diff.context", "diff.ignoreSubmodules", "diff.noprefix", "diff.mnemonicprefix", and "core.abbrev". To make this natural, this involved a rearrangement of the code that allocates the diff object vs. the code that initializes it based on the combination of options passed in by the user and read from the config. This commit includes tests for most of these new options as well.
2013-04-23Make tree to tree diffs case sensitiveRussell Belfer
When case insensitive tree iterators were added, we started reading the case sensitivity of the index to decide if the tree should be case sensitive. This is good for index-to-tree comparisons, but for tree-to-tree comparisons, we should really default to doing a case sensitive comparison unless the user really wants otherwise.
2013-04-23Support diff.context configLinquize
2013-04-10Tests and more fixes for submodule diffsRussell Belfer
This adds tests for diffs with submodules in them and (perhaps unsurprisingly) requires further fixes to be made. Specifically, this fixes: - when considering if a submodule is dirty in the workdir, it was being treated as dirty even if only the index was dirty. - git_diff_patch_to_str (and git_diff_patch_print) were "printing" the headers for files (and submodules) that were unmodified or had no meaningful content. - added comment to previous fix and removed unneeded parens.
2013-03-26Fix some diff ignores and submodule dirty workdirRussell Belfer
This started out trying to look at the problems from issue #1425 and gradually grew to a broader set of fixes. There are two core things fixed here: 1. When you had an ignore like "/bin" which is rooted at the top of your tree, instead of immediately adding the "bin/" entry as an ignored item in the diff, we were returning all of the direct descendants of the directory as ignored items. This changes things to immediately ignore the directory. Note that this effects the behavior in test_status_ignore__subdirectories so that we no longer exactly match core gits ignore behavior, but the new behavior probably makes more sense (i.e. we now will include an ignored directory inside an untracked directory that we previously would have left off). 2. When a submodule only contained working directory changes, the diff code was always considering it unmodified which was just an outright bug. The HEAD SHA of the submodule matches the SHA in the parent repo index, and since the SHAs matches, the diff code was overwriting the actual status with UNMODIFIED. These fixes broke existing tests test_diff_workdir__submodules and test_status_ignore__subdirectories but looking it over, I actually think the new results are correct and the old results were wrong. @nulltoken had actually commented on the subdirectory ignore issue previously. I also included in the tests some debugging versions of the shared iteration callback routines that print status or diff information. These aren't used actively in the tests, but can be quickly swapped in to test code to give a better picture of what is being scanned in some of the complex test scenarios.
2013-03-26Implement GIT_STATUS_OPT_EXCLUDE_SUBMODULESRussell Belfer
This option has been sitting unimplemented for a while, so I finally went through and implemented it along with some tests. As part of this, I improved the implementation of GIT_DIFF_IGNORE_SUBMODULES so it be more diligent about avoiding extra work and about leaving off delta records for submodules to the greatest extent possible (though it may include them still if you are request TYPECHANGE records).
2013-03-26Recursing into ignored dirs for diff and statusRussell Belfer
This implements working versions of GIT_DIFF_RECURSE_IGNORED_DIRS and GIT_STATUS_OPT_RECURSE_IGNORED_DIRS along with some tests for the newly available behaviors. This is not turned on by default for status, but can be accessed via the options to the extended version of the command.