summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* config: return an error if config_refresh is called on a snapshotcmn/config-header-commonCarlos Martín Nieto2018-02-281-1/+1
| | | | | | Instead of treating it as a no-op, treat it as a programming error and return the same kind of error as if you called to set or delete variables on a snapshot.
* config: harden our use of the backend objects a bitCarlos Martín Nieto2018-02-281-2/+5
| | | | | | | | | | When we create an iterator we don't actually know that we have a live config object and we must instead only rely on the header. We fixed it to use this in a previous commit, but this makes it harder to misuse by converting to use the header object in the typecast. We also guard inside the `config_refresh` function against being given a snapshot (although callers right now do check).
* config: move the level field into the headerCarlos Martín Nieto2018-02-281-5/+4
| | | | | We use it in a few places where we might have a full object or a snapshot so move it to where we can actually access it.
* config: move the repository to the diskfile headerCarlos Martín Nieto2018-02-281-4/+4
| | | | | | | | We pass this around and when creating a new iterator we need to read the repository pointer. Put it in a common place so we can reach it regardless of whether we got a full object or a snapshot.
* Merge pull request #4545 from libgit2/ethomson/checkout_filemodev0.27.0-rc2Edward Thomson2018-02-278-17/+112
|\ | | | | Respect core.filemode in checkout
| * checkout: respect core.filemode when comparing filemodesethomson/checkout_filemodeEdward Thomson2018-02-231-13/+21
| | | | | | | | Fixes #4504
| * checkout test: ensure workdir mode is simplifiedEdward Thomson2018-02-231-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | Ensure that when examining the working directory for checkout that the mode is correctly simplified. Git only pays attention to whether a file is executable or not. When examining a working directory, we should coalesce modes in the working directory to either `0755` (indicating that a file is executable) or `0644` (indicating that it is not). Test this by giving the file an exotic mode, and ensuring that when checkout out a branch that changes the file's contents, that we do not have a checkout conflict.
| * checkout test: add core.filemode checkout testsEdward Thomson2018-02-231-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add two tests for filemode. The first ensures that `core.filemode=true` is honored: if we have changed the filemode such that a file that _was_ executable (mode 0755) is now executable (mode 0644) and we go to check out a branch that has otherwise changed the contents of the file, then we should raise a checkout conflict for that file. The second ensures that `core.filemode=false` is honored: in the same situation, we set a file that was executable to be non-executable, and check out the branch that changes the contents of the file. However, since `core.filemode` is false, we do not detect the filemode change. We run these tests on both operating systems that obey `core.filemode` (eg, POSIX) and those that have no conception of filemode (eg, Win32). This ensures that `core.filemode` is always honored, as it is a cache of the underlying filesystem's settings. This ensures that we do not make assumptions based on the operating system, and honor the configuration setting even if it were misconfigured.
| * testrepo: add new branchEdward Thomson2018-02-236-4/+8
| | | | | | | | | | | | Add a new branch to the `testrepo` repository, where the `README` file has changed to executable. This branch enables typechange tests between the new `executable` branch and `master`.
* | Merge pull request #4550 from libgit2/ethomson/winhttpEdward Thomson2018-02-272-4/+28
|\ \ | | | | | | winhttp: enable TLS 1.2
| * | winhttp: enable TLS 1.2 on Windows 7 and earlierethomson/winhttpEdward Thomson2018-02-271-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Versions of Windows prior to Windows 8 do not enable TLS 1.2 by default, though support may exist. Try to enable TLS 1.2 support explicitly on connections. This request may fail if the operating system does not have TLS 1.2 support - the initial release of Vista lacks TLS 1.2 support (though it is available as a software update) and XP completely lacks TLS 1.2 support. If this request does fail, the HTTP context is still valid, and still maintains the original protocol support. So we ignore the failure from this operation.
| * | winhttp: include constants for TLS 1.1/1.2 supportEdward Thomson2018-02-271-5/+8
| | | | | | | | | | | | | | | For platforms that do not define `WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1` and/or `WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2`.
| * | mingw: update TLS option flagsEdward Thomson2018-02-272-4/+11
|/ / | | | | | | | | | | | | | | Include the constants for `WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1` and `WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2` so that they can be used by mingw. This updates both the `deps/winhttp` framework (for classic mingw) and adds the defines for mingw64, which does not use that framework.
* | Merge pull request #4549 from libgit2/ethomson/travis_libsshEdward Thomson2018-02-251-1/+1
|\ \ | | | | | | travis: use custom libssh2-1-dev package
| * | travis: use custom libssh2-1-dev packageethomson/travis_libsshEdward Thomson2018-02-251-1/+1
| | | | | | | | | | | | | | | | | | To avoid pull requests needing to rebase, keep the libssh2-1-dev package as the development package for libssh2. Reverting to the original Debian package structure.
* | | Merge pull request #4548 from libgit2/ethomson/travis_libsshEdward Thomson2018-02-251-1/+1
|\ \ \ | |/ / | | / | |/ |/| travis: use custom libssh2 package
| * travis: use custom libssh2 packageEdward Thomson2018-02-251-1/+1
|/ | | | | Use the custom libssh2 package that is a backport of libssh2 1.8.0 to Ubuntu trusty.
* Merge pull request #4533 from pks-t/pks/v0.27.0-rc1v0.27.0-rc1Edward Thomson2018-02-203-4/+28
|\ | | | | v0.27.0-rc1: version bump
| * Update version number to v0.27Patrick Steinhardt2018-02-202-4/+15
| |
| * CHANGELOG: third batch of updates to the changelog for v0.27.0Patrick Steinhardt2018-02-201-0/+6
| |
| * docs: document increasing the version number for releasesPatrick Steinhardt2018-02-201-0/+7
|/
* Merge pull request #4535 from ↵Patrick Steinhardt2018-02-202-10/+61
|\ | | | | | | | | libgit2/ethomson/checkout_typechange_with_index_and_wd checkout: when examining index (instead of workdir), also examine mode
| * checkout test: further ensure workdir perms are updatedethomson/checkout_typechange_with_index_and_wdEdward Thomson2018-02-201-0/+25
| | | | | | | | | | | | | | When both the index _and_ the working directory has changed permissions on a file permissions on a file - but only the permissions, such that the contents of the file are identical - ensure that `git_checkout` updates the permissions to match the checkout target.
| * checkout test: ensure workdir perms are updatedEdward Thomson2018-02-201-0/+20
| | | | | | | | | | | | | | When the working directory has changed permissions on a file - but only the permissions, such that the contents of the file are identical - ensure that `git_checkout` updates the permissions to match the checkout target.
| * checkout: take mode into account when comparing index to baselineEdward Thomson2018-02-191-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When checking out a file, we determine whether the baseline (what we expect to be in the working directory) actually matches the contents of the working directory. This is safe behavior to prevent us from overwriting changes in the working directory. We look at the index to optimize this test: if we know that the index matches the working directory, then we can simply look at the index data compared to the baseline. We have historically compared the baseline to the index entry by oid. However, we must also compare the mode of the two items to ensure that they are identical. Otherwise, we will refuse to update the working directory for a mode change.
* | Merge pull request #4539 from pks-t/pks/diff_renames_with_rewritesEdward Thomson2018-02-209-20/+255
|\ \ | |/ |/| diff_tform: fix rename detection with rewrite/delete pair
| * diff_tform: fix rename detection with rewrite/delete pairPatrick Steinhardt2018-02-202-1/+216
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A rewritten file can either be classified as a modification of its contents or of a delete of the complete file followed by an addition of the new content. This distinction becomes important when we want to detect renames for rewrites. Given a scenario where a file "a" has been deleted and another file "b" has been renamed to "a", this should be detected as a deletion of "a" followed by a rename of "a" -> "b". Thus, splitting of the original rewrite into a delete/add pair is important here. This splitting is represented by a flag we can set at the current delta. While the flag is already being set in case we want to break rewrites, we do not do so in case where the `GIT_DIFF_FIND_RENAMES_FROM_REWRITES` flag is set. This can trigger an assert when we try to match the source and target deltas. Fix the issue by setting the `GIT_DIFF_FLAG__TO_SPLIT` flag at the delta when it is a rename target and `GIT_DIFF_FIND_RENAMES_FROM_REWRITES` is set.
| * tests: add rename-rewrite scenarios to "renames" repositoryPatrick Steinhardt2018-02-208-0/+15
| | | | | | | | | | | | | | Add two more scenarios to the "renames" repository. The first scenario has a major rewrite of a file and a delete of another file, the second scenario has a deletion of a file and rename of another file to the deleted file. Both scenarios will be used in the following commit.
| * tests: diff::rename: use defines for commit OIDsPatrick Steinhardt2018-02-201-19/+24
|/ | | | | | | While we frequently reuse commit OIDs throughout the file, we do not have any constants to refer to these commits. Make this a bit easier to read by giving the commit OIDs somewhat descriptive names of what kind of commit they refer to.
* Merge pull request #4537 from pks-t/pks/tests-filemode-uninitialized-memoryEdward Thomson2018-02-191-0/+1
|\ | | | | tests: index::filemodes: fix use of uninitialized memory
| * tests: index::filemodes: fix use of uninitialized memoryPatrick Steinhardt2018-02-191-0/+1
|/ | | | | | | | | | | The new index entry structure was not being initialized to all-zeroes. As that structure is used to add a new entry to the current index, and the hashing algorithm of the index making use of the uninitialized flags to calculate the state, we might miscompute the hash of the entry and add it at the wrong position. Later lookups would then fail. Initialize the structure with `memset` to fix the test breaking on some platforms.
* Merge pull request #4529 from libgit2/ethomson/index_add_requires_filesEdward Thomson2018-02-182-5/+70
|\ | | | | git_index_add_frombuffer: only accept files/links
| * git_index_add_frombuffer: only accept files/linksethomson/index_add_requires_filesEdward Thomson2018-02-182-5/+70
| | | | | | | | | | | | | | Ensure that the buffer given to `git_index_add_frombuffer` represents a regular blob, an executable blob, or a link. Explicitly reject commit entries (submodules) - it makes little sense to allow users to add a submodule from a string; there's no possible path to success.
* | Merge pull request #4534 from pks-t/pks/build-warningsEdward Thomson2018-02-188-17/+18
|\ \ | |/ |/| Fix build warnings
| * util: clean up header includesPatrick Steinhardt2018-02-162-6/+7
| | | | | | | | | | | | | | | | | | | | | | While "util.h" declares the macro `git__tolower`, which simply resorts to tolower(3P) on Unix-like systems, the <ctype.h> header is only being included in "util.c". Thus, anybody who has included "util.h" without having <ctype.h> included will fail to compile as soon as the macro is in use. Furthermore, we can clean up additional includes in "util.c" and simply replace them with an include for "common.h".
| * Explicitly mark fallthrough cases with commentsPatrick Steinhardt2018-02-164-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A lot of compilers nowadays generate warnings when there are cases in a switch statement which implicitly fall through to the next case. To avoid this warning, the last line in the case that is falling through can have a comment matching a regular expression, where one possible comment body would be `/* fall through */`. An alternative to the comment would be an explicit attribute like e.g. `[[clang::fallthrough]` or `__attribute__ ((fallthrough))`. But GCC only introduced support for such an attribute recently with GCC 7. Thus, and also because the fallthrough comment is supported by most compilers, we settle for using comments instead. One shortcoming of that method is that compilers are very strict about that. Most interestingly, that comment _really_ has to be the last line. In case a closing brace follows the comment, the heuristic will fail.
| * index: shut up warning on uninitialized variablePatrick Steinhardt2018-02-161-1/+1
| | | | | | | | | | | | | | | | Even though the `entry` variable will always be initialized when `read_entry` returns success and even though we never dereference `entry` in case `read_entry` fails, GCC prints a warning about uninitialized use. Just initialize the pointer to `NULL` in order to shut GCC up.
| * CMakeLists: increase strict aliasing level to 3Patrick Steinhardt2018-02-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The strict aliasing rules disallow dereferencing the pointer to a variable of a certain type as another type, which is frequently used e.g. when casting structs to their base type. We currently have the warning level for strict aliasing rules set to `2`, which is described by gcc(1) as being "Aggressive, quick, not too precise." And in fact, we experience quite a lot of warnings when doing a release build due to that. GCC provides multiple levels, where higher levels are more accurate, but also slower due to the additional analysis required. Still, we want to have warning level 3 instead of 2 to avoid the current warnings we have in the Travis CI release builds. As this is the default warning level when no level is passed to `-Wstrict-aliasing`, we can just remove the level and use that default.
| * streams: openssl: fix use of uninitialized variablePatrick Steinhardt2018-02-161-3/+3
|/ | | | | | | | | | | | | | When verifying the server certificate, we do try to make sure that the hostname actually matches the certificate alternative names. In cases where the host is either an IPv4 or IPv6 address, we have to compare the binary representations of the hostname with the declared IP address of the certificate. We only do that comparison in case we were successfully able to parse the hostname as an IP, which would always result in the memory region being initialized. Still, GCC 6.4.0 was complaining about usage of non-initialized memory. Fix the issue by simply asserting that `addr` needs to be initialized. This shuts up the GCC warning.
* Merge pull request #4532 from pks-t/pks/release-doc-filenamePatrick Steinhardt2018-02-151-0/+0
|\ | | | | docs: fix typo in "release.md" filename
| * docs: fix typo in "release.md" filenamePatrick Steinhardt2018-02-151-0/+0
|/
* Merge pull request #4485 from libgit2/cmn/release-docsPatrick Steinhardt2018-02-151-0/+74
|\ | | | | docs: add release documentation
| * docs: udpates to wording in release documentationcmn/release-docsCarlos Martín Nieto2018-01-271-5/+17
| |
| * docs: add release documentationCarlos Martín Nieto2018-01-191-0/+62
| | | | | | | | | | This should provide the release manager enough to know which steps to take when it's time to cut a new release.
* | Merge pull request #4501 from pks-t/pks/v0.27.0-release-notesPatrick Steinhardt2018-02-151-5/+77
|\ \ | | | | | | CHANGELOG: update for v0.27.0
| * | CHANGELOG: update for v0.27.0, second batchPatrick Steinhardt2018-02-091-6/+15
| | |
| * | CHANGELOG: update for v0.27.0Patrick Steinhardt2018-02-091-0/+63
| | |
* | | Merge pull request #4508 from libgit2/ethomson/user_agentEdward Thomson2018-02-103-27/+30
|\ \ \ | | | | | | | | http: standardize user-agent addition
| * | | http: standardize user-agent additionethomson/user_agentEdward Thomson2018-02-103-27/+30
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The winhttp and posix http each need to add the user-agent to their requests. Standardize on a single function to include this so that we do not get the version numbers we're sending out of sync. Assemble the complete user agent in `git_http__user_agent`, returning assembled strings. Co-authored-by: Patrick Steinhardt <ps@pks.im>
* | | Merge pull request #4527 from pks-t/pks/resource-leaksEdward Thomson2018-02-093-2/+6
|\ \ \ | | | | | | | | Plug resource leaks