tests


Log

Author Commit Date CI Message
Edward Thomson c40d2dc5 2020-05-15T10:09:51 thread: restore the git_thread_exit tests We were never properly testing git_thread_exit. Do so.
Edward Thomson 6554b40e 2020-05-13T10:39:33 settings: localize global data Move the settings global data teardown into its own separate function, instead of intermingled with the global state.
Edward Thomson c837bff1 2020-10-05T11:03:39 clone: test that the origin HEAD is created Ensure that we created `refs/remotes/origin/HEAD` when cloning, a symbolic link pointing to `refs/remotes/origin/<default>`
lhchavez 005e7715 2020-02-23T22:28:52 multipack: Introduce a parser for multi-pack-index files This change is the first in a series to add support for git's multi-pack-index. This should speed up large repositories significantly. Part of: #5399
Edward Thomson 9293e165 2020-10-04T21:41:28 Merge pull request #5494 from kevinjswinton/master Fix binary diff showing /dev/null
Edward Thomson 3a72345b 2020-10-04T18:25:32 Merge pull request #5581 from libgit2/ethomson/mainbranch Respect `init.defaultBranch` setting
Edward Thomson a94fedc1 2020-10-04T18:04:01 Merge pull request #5620 from dlax/parse-patch-add-delete-no-index patch_parse: handle absence of "index" header for new/deleted cases
Edward Thomson a1f0135d 2020-10-04T18:01:09 Merge pull request #5626 from csware/parse_bool boolean config parsing fails in some cases with mapped values
Edward Thomson 36dc681e 2020-10-04T17:54:15 Merge pull request #5629 from csware/config-multiline-parse Fix config file parsing with multi line values containing quoted parts
Sven Strickroth 6ac18625 2020-09-09T17:51:38 Fix config file parsing with multi line values containing quoted parts Signed-off-by: Sven Strickroth <email@cs-ware.de>
Edward Thomson ae99e697 2020-09-17T11:19:49 Merge pull request #5619 from ddevault/diffstat-segfault diff stats: fix segfaults with new files
Drew DeVault ec26b16d 2020-08-29T10:44:40 diff stats: fix segfaults with new files
Philipp 6887e9db 2020-09-14T15:54:00 Removed FreeBSD-related macros.
Philipp e937a2aa 2020-09-09T19:08:20 Fixed includes for FreeBSD.
Sven Strickroth c464f123 2020-09-09T15:41:12 Improve formatting Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth b97f41db 2020-09-09T15:38:20 Add boolean tests for "on" and "off" Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth 36cf1db2 2020-09-09T12:26:34 Support empty values for git_config_get_mapped and git_config_lookup_map_value Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth 86d04918 2020-09-09T11:55:25 Fix parsing boolean config values when using git_config_get_mapped and git_config_lookup_map_value Signed-off-by: Sven Strickroth <email@cs-ware.de>
Denis Laxalde 74293ea0 2020-08-29T16:46:47 patch_parse: handle absence of "index" header for new/deleted cases This follows up on 11de594f85479e4804b07dc4f7b33cfe9212bea0 which added support for parsing patches without extended headers (the "index <hash>..<hash> <mode>" line); issue #5267. We now allow transition from "file mode" state to "path" state directly if there is no "index", which will happen for patches adding or deleting files as demonstrated in added test case.
Edward Thomson 471ed794 2020-07-13T10:05:04 clone: respect init.defaultBranch when empty When cloning an empty repository, we need to guess what the branch structure should be; instead of hardcoding `master`, use the `init.defaultBranch` setting it if it provided.
Edward Thomson e411aae3 2020-07-13T08:47:15 repo: honor the init.defaultBranch setting As part of a push towards more inclusive language, git is reconsidering using "master" as the default branch name. As a first step, this setting will be configurable with the `init.defaultBranch` configuration option. Honor this during repository initialization. During initialization, we will create an initial branch: 1. Using the `initial_head` setting, if specified; 2. Using the `HEAD` configured in a template, if it exists; 3. Using the `init.defaultBranch` configuration option, if it is set; or 4. Using `master` in the absence of additional configuration.
Edward Thomson c5d41d46 2020-08-03T09:55:22 Merge pull request #5563 from pks-t/pks/worktree-heads Access HEAD via the refdb backends
Edward Thomson a83fd510 2020-07-12T21:26:59 Merge pull request #5396 from lhchavez/mwindow-file-limit mwindow: set limit on number of open files
lhchavez 92d42eb3 2020-07-12T09:53:10 Minor nits and style formatting
Patrick Steinhardt ce4cb073 2020-07-12T18:19:21 tests: verify renaming branch really updates worktree HEAD In case where a branch is getting renamed, all HEADs of the main repository and of its worktrees that point to the old branch need to get updated to point to the new branch. We already do so and have a test for this, but the test only verifies that we're able to lookup the updated HEAD, not what it contains. Let's make the test more specific by verifying the updated HEAD also has the correct updated symbolic target.
Patrick Steinhardt 65895410 2020-06-17T14:56:36 repository: retrieve worktree HEAD via refdb The function `git_repository_head_for_worktree` currently uses `git_reference__read_head` to directly read a given worktree's HEAD from the filesystem. This is broken in case the repository uses a different refdb implementation than the filesystem-based one, so let's instead open the worktree as a real repository and use `git_reference_lookup`. This also fixes the case where the worktree's HEAD is not a symref, but a detached HEAD, which would have resulted in an error previously.
Patrick Steinhardt d1f210fc 2020-06-17T15:09:49 repository: remove function to iterate over HEADs The function `git_repository_foreach_head` is broken, as it directly interacts with the on-disk representation of the reference database, thus assuming that no other refdb is used for the given repository. As this is an internal function only and all users have been replaced, let's remove this function.
Patrick Steinhardt 2fcb4f28 2020-06-17T14:09:04 repository: introduce new function to iterate over all worktrees Given a Git repository, it's non-trivial to iterate over all worktrees that are associated with it, including the "main" repository. This commit adds a new internal function `git_repository_foreach_worktree` that does this for us.
Patrick Steinhardt 9703d26f 2020-06-29T12:22:27 tests: reflog: remove unused signature There's two tests that create a commit signature, but never make any use of it. Let's remove these to avoid any confusion.
lhchavez 3a197ea7 2020-06-27T12:33:32 Make the tests pass cleanly with MemorySanitizer This change: * Initializes a few variables that were being read before being initialized. * Includes https://github.com/madler/zlib/pull/393. As such, it only works reliably with `-DUSE_BUNDLED_ZLIB=ON`.
lhchavez d88994da 2020-06-27T07:34:36 Create the repository within the test This change moves the humongous static repository with 1025 commits into the test file, now with a more modest 16 commits.
lhchavez eab2b044 2020-06-26T16:10:30 Review feedback * Change the default of the file limit to 0 (unlimited). * Changed the heuristic to close files to be the file that contains the least-recently-used window such that the window is the most-recently-used in the file, and the file does not have in-use windows. * Parameterized the filelimit test to check for a limit of 1 and 100 open windows.
lhchavez 9679df57 2020-02-08T20:47:24 mwindow: set limit on number of open files There are some cases in which repositories accrue a large number of packfiles. The existing mwindow limit applies only to the total size of mmap'd files, not on their number. This leads to a situation in which having lots of small packfiles could exhaust the allowed number of open files, particularly on macOS, where the default ulimit is very low (256). This change adds a new configuration parameter (GIT_OPT_SET_MWINDOW_FILE_LIMIT) that sets the maximum number of open packfiles, with a default of 128. This is low enough so that even macOS users should not hit it during normal use. Based on PR #5386, originally written by @josharian. Fixes: #2758
Edward Thomson 74520b91 2020-06-13T19:38:11 Merge pull request #5552 from libgit2/pks/small-fixes Random code cleanups and fixes
Patrick Steinhardt c6184f0c 2020-06-08T21:07:36 tree-wide: do not compile deprecated functions with hard deprecation When compiling libgit2 with -DDEPRECATE_HARD, we add a preprocessor definition `GIT_DEPRECATE_HARD` which causes the "git2/deprecated.h" header to be empty. As a result, no function declarations are made available to callers, but the implementations are still available to link against. This has the problem that function declarations also aren't visible to the implementations, meaning that the symbol's visibility will not be set up correctly. As a result, the resulting library may not expose those deprecated symbols at all on some platforms and thus cause linking errors. Fix the issue by conditionally compiling deprecated functions, only. While it becomes impossible to link against such a library in case one uses deprecated functions, distributors of libgit2 aren't expected to pass -DDEPRECATE_HARD anyway. Instead, users of libgit2 should manually define GIT_DEPRECATE_HARD to hide deprecated functions. Using "real" hard deprecation still makes sense in the context of CI to test we don't use deprecated symbols ourselves and in case a dependant uses libgit2 in a vendored way and knows it won't ever use any of the deprecated symbols anyway.
Patrick Steinhardt 9e4e25b1 2020-06-08T12:57:48 tests: refs: modernize coding style of testcase The coding style of the testcase refs::create::propagate_eexists is not really up-to-date. Convert it to use a more modern coding style.
Edward Thomson c708e5e5 2020-06-05T14:11:34 Merge pull request #5541 from libgit2/ethomson/clar_tap clar: add tap output option
Edward Thomson cad7a1ba 2020-06-05T08:42:38 clar: include the function name
Edward Thomson 06d69dfc 2020-05-01T12:39:48 diff::parse: don't include `diff.h` We don't call any internal functions in the test; we don't need to include `../src/diff.h`.
Edward Thomson f7250cc3 2020-06-04T07:23:15 clar: add tap output
Edward Thomson 691315e6 2020-06-03T15:47:42 clar: add an output abstraction layer Add an output abstraction layer, with a single output format, "clap", the clar protocol, which is the current output format for clar.
Edward Thomson 0187f36a 2020-06-03T15:22:44 clar: parse arguments before printing the header We want to parse arguments before we start printing any output; the arguments themselves may impact the way we display that output.
Patrick Steinhardt 86b85492 2020-06-03T15:40:37 Merge pull request #5537 from libgit2/ethomson/clar_exactmatch tests: offer exact name matching with a `$` suffix
Edward Thomson 107bf1f4 2020-06-03T11:47:13 clar: print indirection
Patrick Steinhardt 53a8f463 2020-06-03T07:40:59 Merge pull request #5536 from libgit2/ethomson/http httpclient: support googlesource
Edward Thomson 6de8aa7f 2020-06-02T12:21:22 Merge pull request #5532 from joshtriplett/pack-default-path git_packbuilder_write: Allow setting path to NULL to use the default path
Edward Thomson 0d3ce2ac 2020-06-02T10:23:41 offer exact name matching with a `$` suffix When using `-s` to specify a particular test, it will do a prefix match. Thus, `-sapply::both::rename_a_to_b_to_c` will match both a test named `test_apply_both__rename_a_to_b_to_c` and a test that begins with that name, like `test_apply_both__rename_a_to_b_to_c_exact`. Permit a trailing `$` to `-s` syntax. This allows a user to specify `-sapply::both::rename_a_to_b_to_c$` to match _only_ the `test_apply_both__rename_a_to_b_to_c` function. We already filter to ensure that the given prefix matches the current test name. Also ensure that the length of the test name matches the length of the filter, sans trailing `$`.
Edward Thomson 2a2c5b40 2020-05-23T15:57:48 clar: remove unused shell_out function
Edward Thomson ee9e9163 2020-05-23T15:56:29 clar: remove files internally instead of /bin/rm Similar to how clar has used `/bin/cp` to copy files, it's used `/bin/rm` to remove them. This has similar deficiencies; meaning that leaks is noisy and it's slow. Move it to an internal function.
Edward Thomson d03fd331 2020-05-23T15:42:51 clar: copy files with sendfile on linux
Edward Thomson 8df4f519 2020-05-23T15:04:54 clar: copy files internally instead of /bin/cp clar has historically shelled out to `/bin/cp` to copy test fixtures into a sandbox. This has two deficiencies: 1. It's slower than simply opening the source and destination and copying them in a read/write loop. On my Mac, the `/bin/cp` based approach takes ~2:40 for a full test pass. Using a read/write loop to copy the files ourselves takes ~1:50. 2. It's noisy. Since the leak detector follows fork/exec, we'll end up running the leak detector on `/bin/cp`. This would be fine, except that the leak detector spams the console on startup and shutdown, so it adds a _lot_ of additional information to the test runs that is useless. By not forking and using this internal system, we see much less output.
Edward Thomson 51eff5a5 2020-05-29T13:13:19 strarray: we should `dispose` instead of `free` We _dispose_ the contents of objects; we _free_ objects (and their contents). Update `git_strarray_free` to be `git_strarray_dispose`. `git_strarray_free` remains as a deprecated proxy function.
Edward Thomson b7bdb071 2020-05-30T15:21:48 online::clone: test a googlesource URL Google Git (googlesource.com) behaves differently than git proper. Test that we can communicate with it.
Patrick Steinhardt 172a2886 2020-06-01T14:04:15 Merge pull request #5529 from libgit2/ethomson/difftest diff::workdir: actually test the buffers
Patrick Steinhardt 1bbdf15d 2020-06-01T13:57:12 Merge pull request #5527 from libgit2/ethomson/config_unreadable Handle unreadable configuration files
Edward Thomson 9df69223 2020-05-23T11:42:19 config: test that unreadable files are treated as notfound
Patrick Wang 1a899008 2020-05-26T20:36:13 tests: index::version: write v4 index: re-open repo to read written v4 index The `git_index_free()` merely decrement the reference counter from 2 to 1, and does not "free" the index. Thus, the following `git_repository_index()` merely increase the counter to 2, instead of read index from disk. The written index is not read and parsed, which makes this test case effectively becomes a no-op.
Josh Triplett 5278a006 2020-05-23T16:07:54 git_packbuilder_write: Allow setting path to NULL to use the default path If given a NULL path, write to the object path of the repository. Add tests for the new behavior.
Edward Thomson 3414d470 2020-05-23T16:27:56 diff::workdir: actually test the buffers The static test data is erroneously initialized with a length of 0 for three of the strings. This means the tests are not actually examining those strings. Provide the length.
Edward Thomson f88e12db 2020-05-23T09:35:53 checkout::index: free the index
Patrick Steinhardt 915f8860 2020-05-16T14:00:11 tests: checkout: fix stylistic issues and static variable The test case checkout::index::can_disable_pathspec_match has some shortcomings when it comes to coding style, which didn't fit our own coding style. Furthermore, it had an unnecessary static local variable. The test has been refactored to address these issues.
Patrick Steinhardt 0cf9b666 2020-05-12T11:41:44 tests: merge: fix printf formatter on 32 bit arches We currently use `PRIuMAX` to print an integer of type `size_t` in merge::trees::rename::cache_recomputation. While this works just fine on 64 bit arches, it doesn't on 32 bit ones. As a result, our nightly builds on x86 and arm32 fail. Fix the issue by using `PRIuZ` instead.
Edward Thomson cbae1c21 2020-04-01T22:12:07 assert: allow non-int returning functions to assert Include GIT_ASSERT_WITH_RETVAL and GIT_ASSERT_ARG_WITH_RETVAL so that functions that do not return int (or more precisely, where `-1` would not be an error code) can assert. This allows functions that return, eg, NULL on an error code to do that by passing the return value (in this example, `NULL`) as a second parameter to the GIT_ASSERT_WITH_RETVAL functions.
Edward Thomson a95096ba 2020-01-12T10:31:07 assert: optionally fall-back to assert(3) Fall back to the system assert(3) in debug builds, which may aide in debugging. "Safe" assertions can be enabled in debug builds by setting GIT_ASSERT_HARD=0. Similarly, hard assertions can be enabled in release builds by setting GIT_ASSERT_HARD to nonzero.
Edward Thomson abe2efe1 2019-12-09T12:37:34 Introduce GIT_ASSERT macros Provide macros to replace usages of `assert`. A true `assert` is punishing as a library. Instead we should do our best to not crash. GIT_ASSERT_ARG(x) will now assert that the given argument complies to some format and sets an error message and returns `-1` if it does not. GIT_ASSERT(x) is for internal usage, and available as an internal consistency check. It will set an error message and return `-1` in the event of failure.
Segev Finer d62e44cb 2019-06-03T18:35:08 checkout: Fix removing untracked files by path in subdirectories The checkout code didn't iterate into a subdir if it didn't match the pathspec, but since the pathspec might match files in the subdir we should recurse into it (In contrast to gitignore handling). Fixes #5089
Edward Thomson 8731e1f4 2020-02-02T19:01:15 tests::checkout: only examine test10 and test11.txt The checkout::index::can_disable_pathspec_match test attempts to set a path filter of `test11.txt` and `test12.txt`, but then validates that `test10.txt` and `test11.txt` were left unmodified. Update the test's path filter to match the expectation.
Felix Lapalme 24bd12c4 2020-02-02T01:00:15 Create test case demonstrating checkout bug w/ pathspec match disabled
Kevin Swinton e72ade87 2020-04-18T11:32:56 Fix binary diff showing /dev/null Fixes issue where a changed binary file's content in the working tree isn't displayed correctly, instead showing an oid of zero, and with its path being reported incorrectly as "/dev/null".
Carl Schwan 9830ab3d 2020-01-29T02:00:04 blame: add option to ignore whitespace changes
Patrick Steinhardt 5a1ec7ab 2020-04-04T13:37:13 Merge pull request #5480 from libgit2/ethomson/coverity repo::open: ensure we can open the repository
Patrick Steinhardt 966db47d 2020-04-04T13:21:02 Merge pull request #5477 from pks-t/pks/rename-detection-negative-caches merge: cache negative cache results for similarity metrics
Edward Thomson cb0cfc5a 2020-04-03T09:17:52 repo::open: ensure we can open the repository Update the test cases to check the `git_repository_open` return code.
Patrick Steinhardt dfd7fcc4 2020-04-02T13:26:13 Merge pull request #5388 from bk2204/repo-format-v1 Handle repository format v1
Patrick Steinhardt 4dfcc50f 2020-04-01T15:16:18 merge: cache negative cache results for similarity metrics When computing renames, we cache the hash signatures for each of the potentially conflicting entries so that we do not need to repeatedly read the file and can at least halfway efficiently determine whether two files are similar enough to be deemed a rename. In order to make the hash signatures meaningful, we require at least four lines of data to be present, resulting in at least four different hashes that can be compared. Files that are deemed too small are not cached at all and will thus be repeatedly re-hashed, which is usually not a huge issue. The issue with above heuristic is in case a file does _not_ have at least four lines, where a line is anything separated by a consecutive run of "\n" or "\0" characters. For example "a\nb" is two lines, but "a\0\0b" is also just two lines. Taken to the extreme, a file that has megabytes of consecutive space- or NUL-only may also be deemed as too small and thus not get cached. As a result, we will repeatedly load its blob, calculate its hash signature just to finally throw it away as we notice it's not of any value. When you've got a comparitively big file that you compare against a big set of potentially renamed files, then the cost simply expodes. The issue can be trivially fixed by introducing negative cache entries. Whenever we determine that a given blob does not have a meaningful representation via a hash signature, we store this negative cache marker and will from then on not hash it again, but also ignore it as a potential rename target. This should help the "normal" case already where you have a lot of small files as rename candidates, but in the above scenario it's savings are extraordinarily high. To verify we do not hit the issue anymore with described solution, this commit adds a test that uses the exact same setup described above with one 50 megabyte blob of '\0' characters and 1000 other files that get renamed. Without the negative cache: $ time ./libgit2_clar -smerge::trees::renames::cache_recomputation >/dev/null real 11m48.377s user 11m11.576s sys 0m35.187s And with the negative cache: $ time ./libgit2_clar -smerge::trees::renames::cache_recomputation >/dev/null real 0m1.972s user 0m1.851s sys 0m0.118s So this represents a ~350-fold performance improvement, but it obviously depends on how many files you have and how big the blob is. The test number were chosen in a way that one will immediately notice as soon as the bug resurfaces.
Patrick Steinhardt 5f47cb48 2020-03-26T14:16:41 patch: correctly handle mode changes for renames When generating a patch for a renamed file whose mode bits have changed in addition to the rename, then we currently fail to parse the generated patch. Furthermore, when generating a diff we output mode bits after the similarity metric, which is different to how upstream git handles it. Fix both issues by adding another state transition that allows similarity indices after mode changes and by printing mode changes before the similarity index.
lhchavez 62d59467 2020-03-08T02:13:11 Fix segfault when calling git_blame_buffer() This change makes sure that the hunk is not null before trying to dereference it. This avoids segfaults, especially when blaming against a modified buffer (i.e. the index). Fixes: #5443
Patrick Steinhardt 163db8f2 2020-02-28T18:53:22 win32: test relative symlinks Ensure that we don't canonicalize symlink targets.
Edward Thomson f2b114ba 2020-03-08T18:11:45 win32: introduce relative path handling function Add a function that takes a (possibly) relative UTF-8 path and emits a UTF-16 path with forward slashes translated to backslashes. If the given path is, in fact, absolute, it will be translated to absolute path handling rules.
Edward Thomson fb7da154 2020-03-08T16:34:23 win32: clarify usage of path canonicalization funcs The path canonicalization functions on win32 are intended to canonicalize absolute paths; those with prefixes. In other words, things start with drive letters (`C:\`), share names (`\\server\share`), or other prefixes (`\\?\`). This function removes leading `..` that occur after the prefix but before the directory/file portion (eg, turning `C:\..\..\..\foo` into `C:\foo`). This translation is not appropriate for local paths.
Patrick Steinhardt 81370261 2020-02-19T15:57:39 Merge pull request #5374 from pks-t/pks/diff-with-empty-subtree tests: diff: verify that we are able to diff with empty subtrees
Patrick Steinhardt 8aa04a37 2020-02-19T12:14:16 Merge pull request #5391 from pks-t/pks/coverity-fixes Coverity fixes
Patrick Steinhardt eaa70c6c 2020-02-18T18:09:11 tests: object: decrease number of concurrent cache accesses In our test case object::cache::fast_thread_rush, we're creating 100 concurrent threads opening a repository and reading objects from it. This test actually fails on ARM32 with an out-of-memory error, which isn't entirely unexpected. Work around the issue by halving the number of threads.
brian m. carlson 06f02300 2020-02-07T00:33:52 repository: handle format v1 Git has supported repository format version 1 for some time. This format is just like version 0, but it supports extensions. Implementations must reject extensions that they don't support. Add support for this format version and reject any extensions but extensions.noop, which is the only extension we currently support. While we're at it, also clean up an error message.
Patrick Steinhardt 17670ef2 2020-02-04T10:58:51 tests: diff: add test to verify behaviour with empty dir ordering It was reported that, given a file "abc.txt", a diff will be shown if an empty directory "abb/" is created, but not if "abd/" is created. Add a test to verify that we do the right thing here and do not depend on any ordering.
Patrick Steinhardt b0691db3 2020-01-31T09:39:12 tests: diff: verify that we are able to diff with empty subtrees While it is not allowed for a tree to have an empty tree as child (e.g. an empty directory), libgit2's tree builder makes it easy to create such trees. As a result, some applications may inadvertently end up with such an invalid tree, and we should try our best and handle them. One such case is when diffing two trees, where one of both trees has such an empty subtree. It was reported that this will cause our diff code to fail. While I wasn't able to reproduce this error, let's still add a test that verifies we continue to handle them correctly.
Patrick Steinhardt 26b71d60 2020-02-07T14:36:10 tests: iterator: fix iterator expecting too few items The testcase iterator::workdir::filesystem_gunk sets up quite a lot of directories, which is why it only runs in case GITTEST_INVASIVE_SPEED is set in the environment. Because we do not run our default CI with this variable, we didn't notice commit 852c83ee4 (refs: refuse to delete HEAD, 2020-01-15) breaking the test as it introduced a new reference to the "testrepo" repository. Fix the oversight by increasing the number of expected iterator items.
Patrick Steinhardt 2e6cbff8 2020-02-07T11:53:51 tests: add missing error checks We should always verify error codes returned by function calls in our test suite to not accidentally miss any weird results. Coverity reported missing checks in several locations, which this commit fixes.
Patrick Steinhardt 7d65d4cb 2020-02-07T11:39:24 tests: blame: fix conversion specifiers in format string While the blame helper function `hunk_message` accepts a printf-style format string, we didn't add a compiler attribute to let the compiler check for correct conversion specifiers. As a result, some users of the function used wrong specifiers. Add the GIT_FORMAT_PRINTF attribute to the function and fix resulting warnings by using the correct specifiers.
Patrick Steinhardt 46228d86 2020-02-06T11:10:27 transports: http: fix custom headers not being applied In commit b9c5b15a7 (http: use the new httpclient, 2019-12-22), the HTTP code got refactored to extract a generic HTTP client that operates independently of the Git protocol. Part of refactoring was the creation of a new `git_http_request` struct that encapsulates the generation of requests. Our Git-specific HTTP transport was converted to use that in `generate_request`, but during the process we forgot to set up custom headers for the `git_http_request` and as a result we do not send out these headers anymore. Fix the issue by correctly setting up the request's custom headers and add a test to verify we correctly send them.
Patrick Steinhardt 93a9044f 2020-01-31T08:49:34 fetchhead: strip credentials from remote URL If fetching from an anonymous remote via its URL, then the URL gets written into the FETCH_HEAD reference. This is mainly done to give valuable context to some commands, like for example git-merge(1), which will put the URL into the generated MERGE_MSG. As a result, what gets written into FETCH_HEAD may become public in some cases. This is especially important considering that URLs may contain credentials, e.g. when cloning 'https://foo:bar@example.com/repo' we persist the complete URL into FETCH_HEAD and put it without any kind of sanitization into the MERGE_MSG. This is obviously bad, as your login data has now just leaked as soon as you do git-push(1). When writing the URL into FETCH_HEAD, upstream git does strip credentials first. Let's do the same by trying to parse the remote URL as a "real" URL, removing any credentials and then re-formatting the URL. In case this fails, e.g. when it's a file path or not a valid URL, we just fall back to using the URL as-is without any sanitization. Add tests to verify our behaviour.
Edward Thomson 3f54ba8b 2020-01-18T13:51:40 credential: change git_cred to git_credential We avoid abbreviations where possible; rename git_cred to git_credential. In addition, we have standardized on a trailing `_t` for enum types, instead of using "type" in the name. So `git_credtype_t` has become `git_credential_t` and its members have become `GIT_CREDENTIAL` instead of `GIT_CREDTYPE`. Finally, the source and header files have been renamed to `credential` instead of `cred`. Keep previous name and values as deprecated, and include the new header files from the previous ones.
Edward Thomson 7fd9b3f5 2020-01-01T20:48:15 ci: add NTLM tests Download poxygit, a debugging git server, and clone from it using NTLM, both IIS-style (with connection affinity) and Apache-style ("broken", requiring constant reauthentication).
Edward Thomson bf55facf 2019-10-25T12:24:34 tests: allow users to use expect/continue
Edward Thomson dcd3b815 2019-12-13T15:28:57 tests: support CLAR_TRACE_LEVEL The CLAR_TRACE_LEVEL environment variable was supported when building with GIT_TRACE. Now we always build with GIT_TRACE, but that variable is not provided to tests. Simply support clar tracing always.
Edward Thomson e995f74e 2019-12-06T15:39:08 net: introduce git_net_url_joinpath Provide a mechanism to add a path and query string to an existing url so that we can easily append `/info/refs?...` type url segments to a url given to us by a user.
Edward Thomson 471daeea 2019-12-01T14:00:49 net: refactor gitno redirect handling Move the redirect handling into `git_net_url` for consistency.
Edward Thomson fe4efe2e 2019-12-03T10:17:30 tests: test that clone returns 4321 This conditional was backwards. We should instead test that clone returns 4321, not that 4321 returns clone.
Edward Thomson e5fb5fe5 2019-10-20T17:19:01 ci: perform SPNEGO tests Attempt to obtain a Kerberos ticket from LIBGIT2.ORG and then clone the Negotiate-protected site at test.libgit2.org with that ticket.
Edward Thomson 94beb3a3 2020-01-18T14:03:23 merge: update enum type name for consistency libgit2 does not use `type_t` suffixes as it's redundant; thus, rename `git_merge_diff_type_t` to `git_merge_diff_t` for consistency.