summaryrefslogtreecommitdiff
path: root/include/git2/status.h
Commit message (Collapse)AuthorAgeFilesLines
* Update iterators for consistency across libraryRussell Belfer2012-08-031-2/+2
| | | | | | | | | | | | | | | | | This updates all the `foreach()` type functions across the library that take callbacks from the user to have a consistent behavior. The rules are: * A callback terminates the loop by returning any non-zero value * Once the callback returns non-zero, it will not be called again (i.e. the loop stops all iteration regardless of state) * If the callback returns non-zero, the parent fn returns GIT_EUSER * Although the parent returns GIT_EUSER, no error will be set in the library and `giterr_last()` will return NULL if called. This commit makes those changes across the library and adds tests for most of the iteration APIs to make sure that they follow the above rules.
* Add flag to turn off pathspec testing for diff and statusyorah2012-07-241-0/+3
|
* Fix filemode comparison in diffsRussell Belfer2012-06-081-1/+1
| | | | | | | | | | | | | | | File modes were both not being ignored properly on platforms where they should be ignored, nor be diffed consistently on platforms where they are supported. This change adds a number of diff and status filemode change tests. This also makes sure that filemode-only changes are included in the diff output when they occur and that filemode changes are ignored successfully when core.filemode is false. There is no code that automatically toggles core.filemode based on the capabilities of the current platform, so the user still needs to be careful in their .git/config file.
* errors: Rename error codesVicent Martí2012-05-181-1/+1
|
* errors: Rename the generic return codesVicent Martí2012-05-181-2/+2
|
* Properly tag all `enums` with a `_t`Vicent Martí2012-05-181-15/+18
|
* Ranged iterators and rewritten git_status_fileRussell Belfer2012-05-151-11/+20
| | | | | | | | | | | | | | | | | | | | | The goal of this work is to rewrite git_status_file to use the same underlying code as git_status_foreach. This is done in 3 phases: 1. Extend iterators to allow ranged iteration with start and end prefixes for the range of file names to be covered. 2. Improve diff so that when there is a pathspec and there is a common non-wildcard prefix of the pathspec, it will use ranged iterators to minimize excess iteration. 3. Rewrite git_status_file to call git_status_foreach_ext with a pathspec that covers just the one file being checked. Since ranged iterators underlie the status & diff implementation, this is actually fairly efficient. The workdir iterator does end up loading the contents of all the directories down to the single file, which should ideally be avoided, but it is pretty good.
* Add cache busting to attribute cacheRussell Belfer2012-05-101-2/+2
| | | | | | | | | | | This makes the git attributes and git ignores cache check stat information before using the file contents from the cache. For cached files from the index, it checks the SHA of the file instead. This should reduce the need to ever call `git_attr_cache_flush()` in most situations. This commit also fixes the `git_status_should_ignore` API to use the libgit2 standard parameter ordering.
* Fix crash in new status and add recurse optionRussell Belfer2012-03-231-6/+14
| | | | | | | | | | | | | This fixes the bug that @nulltoken found (thank you!) where if there were untracked directories alphabetically after the last tracked item, the diff implementation would deref a NULL pointer. The fix involved the code which decides if it is necessary to recurse into a directory in the working dir, so it was easy to add a new option `GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS` to control if the contents of untracked directories should be included in status.
* New status fixesRussell Belfer2012-03-221-3/+3
| | | | | | | This adds support for roughly-right tracking of submodules (although it does not recurse into submodules to detect internal modifications a la core git), and it adds support for including unmodified files in diff iteration if requested.
* Adding new tests for new status commandRussell Belfer2012-03-221-2/+1
| | | | | | | | This is a work in progress. This adds two new sets of tests, the issue_592 tests from @nulltoken's pull request #601 and some new tests for submodules. The submodule tests still have issues where the status is not reported correctly. That needs to be fixed before merge.
* Reimplment git_status_foreach using git diffRussell Belfer2012-03-211-1/+67
| | | | | This is an initial reimplementation of status using diff a la the way that core git does it.
* Revert GIT_STATUS constants to avoid issuesRussell Belfer2012-03-021-1/+1
| | | | | | | | | This reverts the changes to the GIT_STATUS constants and adds a new enumeration to describe the type of change in a git_diff_delta. I don't love this solution, but it should prevent strange errors from occurring for now. Eventually, I would like to unify the various status constants, but it needs a larger plan and I just wanted to eliminate this breakage quickly.
* Update diff to use iteratorsRussell Belfer2012-03-021-1/+1
| | | | | | | | | | | | | This is a major reorganization of the diff code. This changes the diff functions to use the iterators for traversing the content. This allowed a lot of code to be simplified. Also, this moved the functions relating to outputting a diff into a new file (diff_output.c). This includes a number of other changes - adding utility functions, extending iterators, etc. plus more tests for the diff code. This also takes the example diff.c program much further in terms of emulating git-diff command line options.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* Patch cleanup for mergeRussell Belfer2012-01-161-0/+16
| | | | | | | | | | After reviewing the gitignore support with Vicent, we came up with a list of minor cleanups to prepare for merge, including: * checking git_repository_config error returns * renaming git_ignore_is_ignored and moving to status.h * fixing next_line skipping to include \r skips * commenting on where ignores are and are not included
* Initial implementation of gitignore supportRussell Belfer2012-01-111-5/+5
| | | | | | | | Adds support for .gitignore files to git_status_foreach() and git_status_file(). This includes refactoring the gitattributes code to share logic where possible. The GIT_STATUS_IGNORED flag will now be passed in for files that are ignored (provided they are not already in the index or the head of repo).
* Tabify everythingVicent Marti2011-09-191-7/+7
| | | | | | There were quite a few places were spaces were being used instead of tabs. Try to catch them all. This should hopefully not break anything. Except for `git blame`. Oh well.
* Cleanup legal dataVicent Marti2011-09-191-21/+3
| | | | | | | | | | 1. The license header is technically not valid if it doesn't have a copyright signature. 2. The COPYING file has been updated with the different licenses used in the project. 3. The full GPLv2 header in each file annoys me.
* status: enhance determination of status for a single filenulltoken2011-09-151-1/+3
| | | | | | - fix retrieval of a file status when working against a newly initialized repository - reduce memory pressure - prevents a directory from being tested
* Standardized doxygen @return lines for int functions to say "GIT_SUCCESS or ↵David Boyce2011-09-131-2/+2
| | | | an error code".
* status: CleanupVicent Marti2011-07-091-12/+0
| | | | | | | | The `hashfile` function has been moved to ODB, next to `git_odb_hash`. Global state has been removed from the dirent call in `status.c`, because global state is killing the rainforest and causing global warming.
* status: get status for single fileJason Penny2011-07-091-0/+10
| | | | | Add git_status_file to be able to retrieve status of single file by supplying a path.
* status: get file statuses and run callbackJason Penny2011-07-091-0/+27
| | | | | Add git_status_foreach() to run a callback on each file passing the path and a status value.
* status: get blob object id of file on diskJason Penny2011-07-091-0/+54
Add git_status_hashfile() to get blob's object id for a file without adding it to the object database or needing a repository at all. This functionality is similar to `git hash-object` without '-w'.