summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
| * | Improve checks for ignore containmentrb/how-broken-can-ignores-beRussell Belfer2014-05-062-1/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #2336 from libgit2/rb/unicode-branch-namesRussell Belfer2014-05-122-1/+58
|\ \ \ | | | | | | | | Pass unconverted Unicode path data when iconv doesn't like it
| * | | Don't always test composed-insensitive lookupsrb/unicode-branch-namesRussell Belfer2014-05-081-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | Only on a filesystem that is composed/decomposed insensitive, should be testing that a branch can be looked up by the opposite form and still work correctly.
| * | | Allow cl_repo_get_bool to work with missing keyRussell Belfer2014-05-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the test helpers provides a quick way for looking up a boolean key. But if the key way missing completely, the check would actually raise an error. Given the way we use this helper, if the key is missing, this should just return false, I think.
| * | | Pass unconverted data when iconv doesn't like itRussell Belfer2014-05-081-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using Iconv to convert unicode data and iconv doesn't like the source data (because it thinks that it's not actual UTF-8), instead of stopping the operation, just use the unconverted data. This will generally do the right thing on the filesystem, since that is the source of the non-UTF-8 path data anyhow. This adds some tests for creating and looking up branches with messy Unicode names. Also, this takes the helper function that was previously internal to `git_repository_init` and makes it into `git_path_does_fs_decompose_unicode` which is a useful in tests to understand what the expected results should be.
* | | | Merge pull request #2334 from libgit2/rb/fix-2333Russell Belfer2014-05-121-3/+10
|\ \ \ \ | | | | | | | | | | Be more careful with user-supplied buffers
| * | | | Be more careful with user-supplied buffersrb/fix-2333Russell Belfer2014-05-081-3/+10
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds in missing calls to `git_buf_sanitize` and fixes a number of places where `git_buf` APIs could inadvertently write NUL terminator bytes into invalid buffers. This also changes the behavior of `git_buf_sanitize` to NUL terminate a buffer if it can and of `git_buf_shorten` to do nothing if it can. Adds tests of filtering code with zeroed (i.e. unsanitized) buffer which was previously triggering a segfault.
* | | | Don't scale diff stat when not neededRussell Belfer2014-05-121-0/+4
| | | |
* | | | Merge pull request #2300 from libgit2/cmn/match-host-testsRussell Belfer2014-05-121-0/+13
|\ \ \ \ | | | | | | | | | | Some improvements to the cert checking
| * | | | netops: unit-test the cert host-name pattern matchingCarlos Martín Nieto2014-04-261-0/+13
| | |_|/ | |/| | | | | | | | | | | | | | This kind of stuff should have unit tests, even if it's just to show what we expect to match successfully.
* | | | Merge pull request #2188 from libgit2/cmn/config-snapshotRussell Belfer2014-05-124-9/+97
|\ \ \ \ | | | | | | | | | | Configuration snapshotting
| * | | | config: refresh on deleteCarlos Martín Nieto2014-04-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we delete an entry, we also want to refresh the configuration to catch any changes that happened externally. This allows us to simplify the logic, as we no longer need to delete these variables internally. The whole state will be refreshed and the deleted entries won't be there.
| * | | | config: refresh before reading a valueCarlos Martín Nieto2014-04-182-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the isolation of complex reads, we can now try to refresh the on-disk file before reading a value from it. This changes the semantics a bit, as before we could be sure that a string we got from the configuration was valid until we wrote or refreshed. This is no longer the case, as a read can also invalidate the pointer.
| * | | | config: refresh the values on writeCarlos Martín Nieto2014-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When writing out, parse the resulting file instead of adding or replacing the value locally. This has the effect of reading external changes as well.
| * | | | config: implement config snapshottingCarlos Martín Nieto2014-04-181-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to have consistent views of the config files for remotes, submodules et al. and a configuration that represents what is currently stored on-disk, we need a way to provide a view of the configuration that does not change. The goal here is to provide the snapshotting part by creating a read-only copy of the state of the configuration at a particular point in time, which does not change when a repository's main config changes.
| * | | | config: document current write behaviour in a testCarlos Martín Nieto2014-04-181-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On set, we set/add the value written to the config's internal values, but we do not refresh old values. Document this in a test in preparation for the refresh changes.
* | | | | Merge pull request #2331 from libgit2/rb/dont-stop-diff-on-safecrlfVicent Marti2014-05-095-21/+76
|\ \ \ \ \ | |_|_|/ / |/| | | | Add filter options and ALLOW_UNSAFE
| * | | | Disable threads::refdb::edit_while_iterate testrb/dont-stop-diff-on-safecrlfRussell Belfer2014-05-081-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems that with the various recent changes to reference updating and reflog writing, that the thread safety of refdb updates has been reduced (either that or it was never thread safe and the window for error has increased). Either way, this test is now sometimes segfaulting which is no good, so let's disable the test for now. We don't really make any public promises about thread safety for this type of operation, so I think this is acceptable, at least in the short term.
| * | | | Add filter options and ALLOW_UNSAFERussell Belfer2014-05-064-14/+64
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Diff and status do not want core.safecrlf to actually raise an error regardless of the setting, so this extends the filter API with an additional options flags parameter and adds a flag so that filters can be applied with GIT_FILTER_OPT_ALLOW_UNSAFE, indicating that unsafe filter application should be downgraded from a failure to a warning.
* | | | odb: ignore files in the objects dircmn/file-in-objects-dirCarlos Martín Nieto2014-05-051-0/+24
|/ / / | | | | | | | | | | | | | | | | | | | | | We assume that everything under GIT_DIR/objects/ is a directory. This is not necessarily the case if some process left a stray file in there. Check beforehand if we do have a directory and ignore the entry otherwise.
* | | Merge pull request #2308 from libgit2/rb/diff-update-index-stat-cacheVicent Marti2014-05-0214-80/+236
|\ \ \ | | | | | | | | Reduce excessive OID calculation for diff and stat
| * | | Some further sandboxing cleanups to testsRussell Belfer2014-05-025-40/+13
| | | | | | | | | | | | | | | | | | | | Trying to find other issues where tests may not clean up quite properly when they are through...
| * | | Improve handling of fake home directoryRussell Belfer2014-05-025-27/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a few tests that set up a fake home directory and a fake GLOBAL search path so that we can test things in global ignore or attribute or config files. This cleans up that code to work more robustly even if there is a test failure. This also fixes some valgrind warnings where scanning search paths for separators could end up doing a little bit of sketchy data access when coming to the end of search list.
| * | | Fix remaining init_options inconsistenciesRussell Belfer2014-05-021-2/+2
| | | | | | | | | | | | | | | | | | | | There were a couple of "init_opts()" functions a few more cases of structure initialization that I somehow missed.
| * | | Remove trace / add git_diff_perfdata struct + apiRussell Belfer2014-05-025-134/+73
| | | |
| * | | Get rid of redundant git_diff_options_init fnRussell Belfer2014-05-022-2/+2
| | | | | | | | | | | | | | | | Since git_diff_init_options was introduced, remove this old fn.
| * | | Add payloads, bitmaps to trace APIRussell Belfer2014-05-025-69/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | Don't use trace if GIT_TRACE not definedRussell Belfer2014-05-022-0/+14
| | | |
| * | | Add GIT_STATUS_OPT_UPDATE_INDEX and use trace APIRussell Belfer2014-05-022-28/+129
| | | | | | | | | | | | | | | | | | | | | | | | 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 diff option to update index stat cacheRussell Belfer2014-05-021-0/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | Skip diff oid calc when size definitely changedRussell Belfer2014-05-022-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | Add build option for diff internal statisticsRussell Belfer2014-05-021-0/+12
| | | |
* | | | Merge pull request #2310 from libgit2/cmn/commit-create-safeRussell Belfer2014-05-022-0/+13
|\ \ \ \ | |/ / / |/| | | commit: safer commit creation with reference update
| * | | commit: safer commit creation with reference updatecmn/commit-create-safeCarlos Martín Nieto2014-04-302-0/+13
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current version of the commit creation and amend function are unsafe to use when passing the update_ref parameter, as they do not check that the reference at the moment of update points to what the user expects. Make sure that we're moving history forward when we ask the library to update the reference for us by checking that the first parent of the new commit is the current value of the reference. We also make sure that the ref we're updating hasn't moved between the read and the write. Similarly, when amending a commit, make sure that the current tip of the branch is the commit we're amending.
* | | Make ** pattern eat trailing slashrb/fix-starstar-againRussell Belfer2014-05-011-0/+18
|/ / | | | | | | This allows "foo/**/*.html" to match "foo/file.html"
* | Reset tests: Use sandboxed indexJiri Pospisil2014-04-251-6/+3
| |
* | Merge pull request #2284 from jacquesg/push-progress-callbackVicent Marti2014-04-251-35/+83
|\ \ | | | | | | Fire progress and update tips callbacks also for pushes.
| * | Verify update_tips callbacks in push test casesJacques Germishuys2014-04-211-35/+83
| | |
* | | Merge pull request #2297 from libgit2/rb/status-with-precomposed-changesVicent Marti2014-04-251-37/+164
|\ \ \ | | | | | | | | Improve test coverage of status with different core.precomposeunicode settings
| * | | Improve docs for status rename detection limitsrb/status-with-precomposed-changesRussell Belfer2014-04-241-2/+5
| | | | | | | | | | | | | | | | and make tests empty on platforms without iconv support.
| * | | Test toggling core.precomposeunicode yields renameRussell Belfer2014-04-241-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is an interesting difference with core Git here, though. Because libgit2 will do rename detection with the working directory, in the last case where the HEAD and the working directory both have the decomposed data and the index has the composed data, we generate a single status record with two renames whereas Git will generate one rename (head to index) and one untracked file.
| * | | Test decomposed unicode renames work as expectedRussell Belfer2014-04-241-37/+92
| | | |
* | | | Merge pull request #2241 from libgit2/rb/stash-skip-submodulesVicent Marti2014-04-252-10/+40
|\ \ \ \ | | | | | | | | | | Improve stash and checkout for ignored + untracked items
| * | | | Make checkout match diff for untracked/ignored dirRussell Belfer2014-04-222-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When diff finds an untracked directory, it emulates Git behavior by looking inside the directory to see if there are any untracked items inside it. If there are only ignored items inside the dir, then diff considers it ignored, even if there is no direct ignore rule for it. Checkout was not copying this behavior - when it found an untracked directory, it just treated it as untracked. Unfortunately, when combined with GIT_CHECKOUT_REMOVE_UNTRACKED, this made is seem that checkout (and stash, which uses checkout) was removing ignored items when you had only asked it to remove untracked ones. This commit moves the logic for advancing past an untracked dir while scanning for non-ignored items into an iterator helper fn, and uses that for both diff and checkout.
| * | | | Failing test for stashing a buried ignored fileRussell Belfer2014-04-221-0/+13
| | | | |
| * | | | Make stash and checkout ignore contained reposRussell Belfer2014-04-222-9/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To emulate git, stash should not remove untracked git repositories inside the parent repo, and checkout's REMOVE_UNTRACKED should also skip over these items. `git stash` actually prints a warning message for these items. That should be possible with a checkout notify callback if you wanted to, although it would require a bit of extra logic as things are at the moment.
* | | | | Merge pull request #2294 from ethomson/merge_checkout_strategyRussell Belfer2014-04-242-9/+27
|\ \ \ \ \ | |_|/ / / |/| | | | Merge checkout strategy
| * | | | merge: checkout default shouldn't clobber givenEdward Thomson2014-04-232-10/+11
| | | | |
| * | | | merge: default checkout strategy for should be SAFEEdward Thomson2014-04-231-0/+17
| | | | |
* | | | | fetchhead: deal with quotes in branch namesCarlos Martín Nieto2014-04-242-0/+12
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current FETCH_HEAD parsing code assumes that a quote must end the branch name. Git however allows for quotes as part of a branch name, which causes us to consider the FETCH_HEAD file as invalid. Instead of searching for a single quote char, search for a quote char followed by SP, which is not a valid part of a ref name.