summaryrefslogtreecommitdiff
path: root/tests-clar/status
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #852 from arrbee/submodule-extensionsVicent Martí2012-08-241-15/+9
|\ | | | | Submodule extensions
| * Working implementation of git_submodule_statusRussell Belfer2012-08-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This is a big redesign of the git_submodule_status API and the implementation of the redesigned API. It also fixes a number of bugs that I found in other parts of the submodule API while writing the tests for the status part. This also fixes a couple of bugs in the iterators that had not been noticed before - one with iterating when there is a gitlink (i.e. separate-work-dir) and one where I was treating anything even vaguely submodule-like as a submodule, more aggressively than core git does.
| * Major submodule rewriteRussell Belfer2012-08-241-11/+5
| | | | | | | | | | This replaces the old submodule API with a new extended API that supports most of the things that can be done with `git submodule`.
* | Fix crash with adding internal ignoresRussell Belfer2012-08-241-0/+15
|/ | | | | | Depending on what you had done before adding new items to the internal ignores list, it was possible for the cache of ignore data to be uninitialized.
* Fix warnings and merge issues on Win64Russell Belfer2012-08-233-10/+10
|
* Wrap up ignore API and add testsRussell Belfer2012-08-221-0/+54
| | | | This fills out the ignore API and adds tests.
* Merge pull request #778 from ben/cloneVicent Martí2012-08-191-1/+1
|\ | | | | Clone
| * Enable stats on git_index_read_tree.Ben Straub2012-07-301-1/+1
| | | | | | | | | | Replace with the contents of git_index_read_tree_with_stats() and improve documentation comments.
* | Update iterators for consistency across libraryRussell Belfer2012-08-031-4/+29
|/ | | | | | | | | | | | | | | | | 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.
* tests-clar/status: fix missing-prototype warningMichael Schubert2012-07-251-1/+1
|
* Add flag to turn off pathspec testing for diff and statusyorah2012-07-241-0/+46
|
* Add more test coverage to match default git behavior for files containing ↵yorah2012-07-241-1/+17
| | | | brackets
* Add a test for getting status of files containing bracketsaroben2012-07-241-0/+63
|
* Add flag to write gitlink on setting repo workdirRussell Belfer2012-07-101-2/+2
| | | | | | | | | | | | | | | | | | | | This added a flag to the `git_repository_set_workdir()` function that enables generation of a `.git` gitlink file that links the new workdir to the parent repository. Essentially, the flag tells the function to write out the changes to disk to permanently set the workdir of the repository to the new path. If you pass this flag as true, then setting the workdir to something other than the default workdir (i.e. the parent of the .git repo directory), will create a plain file named ".git" with the standard gitlink contents "gitdir: <repo-path>", and also update the "core.worktree" and "core.bare" config values. Setting the workdir to the default repo workdir will clear the core.worktree flag (but still permanently set core.bare to false). BTW, the libgit2 API does not currently provide a function for clearing the workdir and converting a non-bare repo into a bare one.
* Add a test showing that git_status_file gets confused by spaces in .gitignoreAdam Roben2012-06-091-0/+14
|
* Fix filemode comparison in diffsRussell Belfer2012-06-081-0/+66
| | | | | | | | | | | | | | | 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.
* Fix git_status_file for files that start with a character > 0x7fAdam Roben2012-06-071-4/+12
| | | | | | | | | | | | | | | | git_status_file would always return GIT_ENOTFOUND for these files. The underlying bug was that git__strcmp_cb, which is used by git_path_with_stat_cmp to sort entries in the working directory, compares strings based on unsigned chars (this is confirmed by the strcmp(3) manpage), while git__prefixcmp, which is used by workdir_iterator__entry_cmp to search for a path in the working directory, compares strings based on char. So the sort puts this path at the end of the list, while the search expects it to be at the beginning. The fix was simply to make git__prefixcmp compare using unsigned chars, just like strcmp(3). The rest of the change is just adding/updating tests.
* Fix bugs for status with spaces and reloaded attrsRussell Belfer2012-05-241-0/+65
| | | | | | | | | | | | | | | | | | | | | | This fixes two bugs: * Issue #728 where git_status_file was not working for files that contain spaces. This was caused by reusing the "fnmatch" parsing code from ignore and attribute files to interpret the "pathspec" that constrained the files to apply the status to. In that code, unescaped whitespace was considered terminal to the pattern, so a file with internal whitespace was excluded from the matched files. The fix was to add a mode to that code that allows spaces and tabs inside patterns. This mode only comes into play when parsing in-memory strings. * The other issue was undetected, but it was in the recently added code to reload gitattributes / gitignores when they were changed on disk. That code was not clearing out the old values from the cached file content before reparsing which meant that newly added patterns would be read in, but deleted patterns would not be removed. The fix was to clear the vector of patterns in a cached file before reparsing the file.
* Fix workdir iterators on empty directoriesRussell Belfer2012-05-171-0/+69
| | | | | | | Creating a workdir iterator on a directory with absolutely no files was returning an error (GIT_ENOTFOUND) instead of an iterator for nothing. This fixes that and includes two new tests that cover that case.
* Fix status for files under ignored dirsRussell Belfer2012-05-161-16/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a bug where tracked files inside directories that were inside ignored directories where not being found by status. To make that a little clearer, if you have a .gitignore with: ignore/ And then have the following files: ignore/dir/tracked <-- actually a tracked file ignore/dir/untracked <-- should be ignored Then we would show the tracked file as being removed (because when we got the to contained item "dir/" inside the ignored directory, we decided it was safe to skip -- bzzt, wrong!). This update is much more careful about checking that we are not skipping over any prefix of a tracked item, regardless of whether it is ignored or not. As documented in diff.c, this commit does create behavior that still differs from core git with regards to the handling of untracked files contained inside ignored directories. With libgit2, those files will just not show up in status or diff. With core git, those files don't show up in status or diff either *unless* they are explicitly ignored by a .gitignore pattern in which case they show up as ignored files. Needless to say, this is a local behavior difference only, so it should not be important and (to me) the libgit2 behavior seems more consistent.
* Ranged iterators and rewritten git_status_fileRussell Belfer2012-05-151-0/+7
| | | | | | | | | | | | | | | | | | | | | 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-106-99/+157
| | | | | | | | | | | 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.
* Add support for diffing index with no HEADRussell Belfer2012-05-081-0/+45
| | | | | | | When a repo is first created, there is no HEAD yet and attempting to diff files in the index was showing nothing because a tree iterator could not be constructed. This adds an "empty" iterator and falls back on that when the head cannot be looked up.
* Clean up warnings and testsRussell Belfer2012-05-081-2/+3
|
* status: Prevent git_status_file() from returning ENOTFOUND when not applicablenulltoken2012-05-081-0/+16
|
* Support reading attributes from indexRussell Belfer2012-05-031-2/+2
| | | | | | | | | | | | | | Depending on the operation, we need to consider gitattributes in both the work dir and the index. This adds a parameter to all of the gitattributes related functions that allows user control of attribute reading behavior (i.e. prefer workdir, prefer index, only use index). This fix also covers allowing us to check attributes (and hence do diff and status) on bare repositories. This was a somewhat larger change that I hoped because it had to change the cache key used for gitattributes files.
* Fix leading slash behavior in attrs/ignoresRussell Belfer2012-04-261-0/+28
| | | | | | We were not following the git behavior for leading slashes in path names when matching git ignores and git attribute file patterns. This should fix issue #638.
* Fix warnings on 64-bit windows buildsRussell Belfer2012-04-171-4/+4
| | | | | This fixes all the warnings on win64 except those in deps, which come from the regex code.
* Merge pull request #619 from nulltoken/topic/branchesVicent Martí2012-04-111-3/+3
|\ | | | | Basic branch management API
| * fileops: Make git_futils_mkdir_r() able to skip non-empty directoriesnulltoken2012-04-101-3/+3
| |
* | Clean up valgrind warningsCarlos Martín Nieto2012-04-042-0/+2
|/
* Added submodule API and use in statusRussell Belfer2012-03-281-1/+15
| | | | | | | | | | When processing status for a newly checked out repo, it is possible that there will be submodules that have not yet been initialized. The only way to distinguish these from untracked directories is to have some knowledge of submodules. This commit adds a new submodule API which, given a name or path, can determine if it appears to be a submodule and can give information about the submodule.
* Fix handling of submodules in treesRussell Belfer2012-03-261-7/+5
|
* Restore default status recursion behaviorRussell Belfer2012-03-231-2/+7
| | | | | | | | This gives `git_status_foreach()` back its old behavior of emulating the "--untracked=all" behavior of git. You can get any of the various --untracked options by passing flags to `git_status_foreach_ext()` but the basic version will keep the behavior it has always had.
* Fix crash in new status and add recurse optionRussell Belfer2012-03-232-0/+92
| | | | | | | | | | | | | 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.
* Migrate remaining status tests to ClarRussell Belfer2012-03-221-0/+35
| | | | | This finishes up the migration of remaining tests from tests/t18-status.c over the tests-clar/status/worktree.c.
* More status testingRussell Belfer2012-03-223-0/+291
| | | | | | | | | | This "fixes" the broken t18 status tests to accurately reflect the new behavior for "created" untracked subdirectories. See discussion in the PR for more details. This also contains the submodules unit test that I forgot to git add, and ports most of the t18-status.c tests to clar (still missing a couple of the git_status_file() single file tests).
* Adding new tests for new status commandRussell Belfer2012-03-221-2/+85
| | | | | | | | 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.
* Convert attr, ignore, mwindow, status to new errorsRussell Belfer2012-03-162-4/+4
| | | | | Also cleaned up some previously converted code that still had little things to polish.
* Revert GIT_STATUS constants to avoid issuesRussell Belfer2012-03-022-2/+2
| | | | | | | | | 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.
* Clean up GIT_UNUSED macros on all platformsRussell Belfer2012-03-022-54/+26
| | | | | | | | | | | | | | | | | | | It turns out that commit 31e9cfc4cbcaf1b38cdd3dbe3282a8f57e5366a5 did not fix the GIT_USUSED behavior on all platforms. This commit walks through and really cleans things up more thoroughly, getting rid of the unnecessary stuff. To remove the use of some GIT_UNUSED, I ended up adding a couple of new iterators for hashtables that allow you to iterator just over keys or just over values. In making this change, I found a bug in the clar tests (where we were doing *count++ but meant to do (*count)++ to increment the value). I fixed that but then found the test failing because it was not really using an empty repo. So, I took some of the code that I wrote for iterator testing and moved it to clar_helpers.c, then made use of that to make it easier to open fixtures on a per test basis even within a single test file.
* Update diff to use iteratorsRussell Belfer2012-03-022-2/+2
| | | | | | | | | | | | | 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.
* Add unit tests for recent bug fixesRussell Belfer2012-02-011-0/+12
| | | | | | Add unit tests to confirm ignore directory pattern matches and to confirm that ignore and attribute files are loaded properly into the attribute file cache.
* Rename the Clay test suite to ClarVicent Martí2012-01-244-0/+282
Clay is the name of a programming language on the makings, and we want to avoid confusions. Sorry for the huge diff!