summaryrefslogtreecommitdiff
path: root/src/status.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix remaining init_options inconsistenciesRussell Belfer2014-05-021-5/+2
| | | | | There were a couple of "init_opts()" functions a few more cases of structure initialization that I somehow missed.
* Make init_options fns use unsigned ints and macroRussell Belfer2014-05-021-7/+3
| | | | | Use an unsigned int for the version and add a helper macro so the code is simplified (and so the error message is a common string).
* Remove trace / add git_diff_perfdata struct + apiRussell Belfer2014-05-021-6/+30
|
* Add GIT_STATUS_OPT_UPDATE_INDEX and use trace APIRussell Belfer2014-05-021-3/+26
| | | | | | 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.
* Add build option for diff internal statisticsRussell Belfer2014-05-021-4/+4
|
* Added function-based initializers for every options struct.Matthew Bowen2014-03-051-0/+11
| | | | The basic structure of each function is courtesy of arrbee.
* diff: rename the file's 'oid' to 'id'Carlos Martín Nieto2014-01-251-9/+9
| | | | In the same vein as the previous commits in this series.
* Cleanups, renames, and leak fixesRussell Belfer2013-12-121-1/+1
| | | | | | | | | This renames git_vector_free_all to the better git_vector_free_deep and also contains a couple of memory leak fixes based on valgrind checks. The fixes are specifically: failure to free global dir path variables when not compiled with threading on and failure to free filters from the filter registry that had not be initialized fully.
* One more rename/cleanup for callback err functionsRussell Belfer2013-12-111-1/+1
|
* Some callback error check style cleanupsRussell Belfer2013-12-111-2/+3
| | | | I find this easier to read...
* Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-27/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add git_vector_free_allRussell Belfer2013-12-111-7/+1
| | | | | | There are a lot of places that we call git__free on each item in a vector and then call git_vector_free on the vector itself. This just wraps that up into one convenient helper function.
* Further EUSER and error propagation fixesRussell Belfer2013-12-111-2/+1
| | | | | | | | | | | | | This continues auditing all the places where GIT_EUSER is being returned and making sure to clear any existing error using the new giterr_user_cancel helper. As a result, places that relied on intercepting GIT_EUSER but having the old error preserved also needed to be cleaned up to correctly stash and then retrieve the actual error. Additionally, as I encountered places where error codes were not being propagated correctly, I tried to fix them up. A number of those fixes are included in the this commit as well.
* Improve GIT_EUSER handlingRussell Belfer2013-12-111-8/+24
| | | | | | | | | | | This adds giterr_user_cancel to return GIT_EUSER and clear any error message that is sitting around. As a result of using that in places, we need to be more thorough with capturing errors that happen inside a callback when used internally. To help with that, this also adds giterr_capture and giterr_restore so that when we internally use a foreach-type function that clears errors and converts them to GIT_EUSER, it is easier to restore not just the return value, but the actual error message text.
* Convert git_index_read to have a "force" flagRussell Belfer2013-11-011-1/+1
| | | | | This is a little more intuitive than the turned-around option that I originally wrote.
* Make diff and status perform soft index reloadRussell Belfer2013-11-011-6/+11
| | | | | | | | | | | | | | | | | | | | | 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.
* Rename diff objects and split patch.hRussell Belfer2013-10-111-3/+3
| | | | | | 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.
* No such thing as an orphan branchCarlos Martín Nieto2013-09-171-1/+1
| | | | | | | | | | | Unfortunately git-core uses the term "unborn branch" and "orphan branch" interchangeably. However, "orphan" is only really there for the checkout command, which has the `--orphan` option so it doesn't actually create the branch. Branches never have parents, so the distinction of a branch with no parents is odd to begin with. Crucially, the error messages deal with unborn branches, so let's use that.
* Split rewrites, status doesn't return rewritesEdward Thomson2013-08-281-2/+4
| | | | | | | | Ensure that we apply splits to rewrites, even if we're not interested in examining it closely for rename/copy detection. In keeping with core git, status should not display rewrites, it should simply show files as "modified".
* Add rename from rewrites to statusEdward Thomson2013-08-051-22/+7
| | | | | | 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.
* Remove GIT_STATUS_SHOW_INDEX_THEN_WORKDIR optionRussell Belfer2013-07-031-14/+3
| | | | | | 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.
* Fix segfault in git_status_foreach_ext()yorah2013-07-031-5/+7
| | | | Add tests for the `GIT_STATUS_SHOW_XXX` flags.
* Add status flags to force output sort orderRussell Belfer2013-06-201-2/+10
| | | | | | | | | | | | | | | | 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.
* More tests and bug fixes for status with renameRussell Belfer2013-06-171-11/+38
| | | | | | | | | | | | | | | | | | | | | This changes the behavior of the status RENAMED flags so that they will be combined with the MODIFIED flags if appropriate. If a file is modified in the index and also renamed, then the status code will have both the GIT_STATUS_INDEX_MODIFIED and INDEX_RENAMED bits set. If it is renamed but the OID has not changed, then just the GIT_STATUS_INDEX_RENAMED bit will be set. Similarly, the flags GIT_STATUS_WT_MODIFIED and GIT_STATUS_WT_RENAMED can both be set independently of one another. This fixes a serious bug where the check for unmodified files that was done at data load time could end up erasing the RENAMED state of a file that was renamed with no changes. Lastly, this contains a bunch of new tests for status with renames, including tests where the only rename changes are case changes. The expected results of these tests have to vary by whether the platform uses a case sensitive filesystem or not, so the expected data covers those platform differences separately.
* Improve case handling in git_diff__paired_foreachRussell Belfer2013-06-171-89/+82
| | | | | | | | 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.
* Fix broken status EXCLUDE_SUBMODULES logicRussell Belfer2013-06-171-11/+21
| | | | | | | The exclude submodules flag was not doing the right thing, in that a file with no diff between the head and the index and just a delete in the workdir could be excluded if submodules were excluded.
* handle renames in status computationEdward Thomson2013-06-171-14/+92
|
* status access by index, providing more details to callersEdward Thomson2013-06-171-66/+166
|
* Reorganize diff and add basic diff driverRussell Belfer2013-06-101-1/+1
| | | | | | | | | | | | | | | | | | 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.
* Improve ignore handling in git_status_fileRussell Belfer2013-05-101-16/+4
| | | | | | | | | | | | | | | | The git_status_file API was doing a hack to deal with files that are inside ignored directories. The status scan was not reporting any file in this case, so git_status_file would attempt a final "stat()" call, and return IGNORED if the file actually existed. On case-insensitive filesystems where core.ignorecase is set incorrectly, this magic check can "succeed" and report a file as ignored when it should actually return ENOTFOUND. Now that we have the GIT_STATUS_OPT_RECURSE_IGNORED_DIRS, we can use that flag to make sure that git_status_file() will look into ignored directories and eliminate the hack completely, so we give the correct error.
* clarify where error message is setRussell Belfer2013-05-011-2/+2
|
* Implement GIT_STATUS_OPT_EXCLUDE_SUBMODULESRussell Belfer2013-03-251-20/+42
| | | | | | | | | | | 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).
* Recursing into ignored dirs for diff and statusRussell Belfer2013-03-251-1/+2
| | | | | | | | 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.
* Support case insensitive tree iterators and statusRussell Belfer2013-01-151-2/+12
| | | | | | | | | | | This makes tree iterators directly support case insensitivity by using a secondary index that can be sorted by icase. Also, this fixes the ambiguity check in the git_status_file API to also be case insensitive. Lastly, this adds new test cases for case insensitive range boundary checking for all types of iterators. With this change, it should be possible to deprecate the spool and sort iterator, but I haven't done that yet.
* Fix err msg for ambiguous path in git_status_fileRussell Belfer2013-01-151-4/+6
| | | | | | | | Returning GIT_EAMBIGUOUS from inside the status callback gets overridden with GIT_EUSER. `git_status_file` accounted for this via the callback payload, but was allowing the error message to be cleared. Move the `giterr_set` call outside the callback to where the EUSER case was being dealt with.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Fix diff constructor name order confusionRussell Belfer2012-12-171-2/+2
| | | | | | | | | | | | The diff constructor functions had some confusing names, where the "old" side of the diff was coming after the "new" side. This reverses the order in the function name to make it less confusing. Specifically... * git_diff_index_to_tree becomes git_diff_tree_to_index * git_diff_workdir_to_index becomes git_diff_index_to_workdir * git_diff_workdir_to_tree becomes git_diff_tree_to_workdir
* Deploy GITERR_CHECK_VERSIONBen Straub2012-11-301-14/+1
|
* Deploy GIT_STATUS_OPTIONS_INITBen Straub2012-11-301-6/+18
|
* Deploy GIT_DIFF_OPTIONS_INITBen Straub2012-11-301-2/+1
|
* API updates for status.hRussell Belfer2012-11-271-3/+3
|
* Update diff callback param orderRussell Belfer2012-11-271-6/+6
| | | | | | | | This makes the diff functions that take callbacks both take the payload parameter after the callback function pointers and pass the payload as the last argument to the callback function instead of the first. This should make them consistent with other callbacks across the API.
* repo: Make git_repository_head_tree() return error codesnulltoken2012-11-221-2/+4
|
* Add explicit git_index ptr to diff and checkoutRussell Belfer2012-11-141-2/+2
| | | | | | | | A number of diff APIs and the `git_checkout_index` API take a `git_repository` object an operate on the index. This updates them to take a `git_index` pointer explicitly and only fall back on the `git_repository` index if the index input is NULL. This makes it easier to operate on a temporary index.
* Fix diff API to better parameter orderRussell Belfer2012-11-141-2/+2
| | | | | The diff API is not in the parameter order one would expect from other libgit2 APIs. This fixes that.
* Some diff refactorings to help code reuseRussell Belfer2012-11-091-48/+35
| | | | | | | | | | | | | | | | | There are some diff functions that are useful in a rewritten checkout and this lays some groundwork for that. This contains three main things: 1. Share the function diff uses to calculate the OID for a file in the working directory (now named `git_diff__oid_for_file` 2. Add a `git_diff__paired_foreach` function to iterator over two diff lists concurrently. Convert status to use it. 3. Move all the string/prefix/index entry comparisons into function pointers inside the `git_diff_list` object so they can be switched between case sensitive and insensitive versions. This makes them easier to reuse in various functions without replicating logic. As part of this, move a couple of index functions out of diff.c and into index.c.
* Improve docs, examples, warningsRussell Belfer2012-11-011-1/+1
| | | | | | This improves docs in some of the public header files, cleans up and improves some of the example code, and fixes a couple of pedantic warnings in places.
* Merge pull request #968 from arrbee/diff-support-typechangeRussell Belfer2012-10-171-2/+12
|\ | | | | Support TYPECHANGE records in status and adjust checkout accordingly
| * Add complex checkout test and then fix checkoutRussell Belfer2012-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This started as a complex new test for checkout going through the "typechanges" test repository, but that revealed numerous issues with checkout, including: * complete failure with submodules * failure to create blobs with exec bits * problems when replacing a tree with a blob because the tree "example/" sorts after the blob "example" so the delete was being processed after the single file blob was created This fixes most of those problems and includes a number of other minor changes that made it easier to do that, including improving the TYPECHANGE support in diff/status, etc.
| * Introduce status/diff TYPECHANGE flagsRussell Belfer2012-10-091-2/+12
| | | | | | | | | | | | | | | | When I wrote the diff code, I based it on core git's diff output which tends to split a type change into an add and a delete. But core git's status has the notion of a T (typechange) flag for a file. This introduces that into our status APIs and modifies the diff code so it can be forced to not split type changes.