Thanks to visit codestin.com
Credit goes to github.com

Skip to content

v0.26.3 backports #4475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 60 commits into from
Mar 12, 2018
Merged

v0.26.3 backports #4475

merged 60 commits into from
Mar 12, 2018

Conversation

pks-t
Copy link
Member

@pks-t pks-t commented Jan 12, 2018

Proposed backports for v0.26.1. This includes all PRs that I've currently marked with the "backport" label:

I've initially included #4277 as well, but that code was only merged after v0.26.0 in #4202.

@pks-t pks-t changed the base branch from master to maint/v0.26 January 12, 2018 11:00
@pks-t
Copy link
Member Author

pks-t commented Jan 12, 2018

Ugh. AppVeyor and Coverity are hung now because I erroneously based this on "master" first.

@pks-t pks-t force-pushed the pks/v0.26.1-backports branch from 92e6cb2 to b49ecfe Compare January 12, 2018 13:21
@carlosmn
Copy link
Member

We should not include #4408 as it's a breaking change. The size of git_time will be different depending on which version of the headers you get.

#4455 and #4357 I'm unsure about as they introduce new behaviour.

@tiennou
Copy link
Contributor

tiennou commented Jan 17, 2018

Can #4275 be considered ? Also, I don't remember whether 0.26 branched before or after the CMake changes, but maybe #4439 too ?

@pks-t
Copy link
Member Author

pks-t commented Jan 18, 2018

@tiennou: it branched after the big CMake changes, so #4439 is not needed. #4275 looks good to me, though

@carlosmn: true, didn't think of ABI compatibility here, so #4408 should definitly not be part. I'm kind of indifferent to #4357 and #4455, but I see your point, so I'll remove them as well.

@pks-t pks-t force-pushed the pks/v0.26.1-backports branch from 92e6cb2 to 71efe99 Compare January 18, 2018 13:14
@pks-t
Copy link
Member Author

pks-t commented Jan 18, 2018

Updated according to my last comment.

@pks-t
Copy link
Member Author

pks-t commented Jan 26, 2018

Added #4472

@pks-t
Copy link
Member Author

pks-t commented Feb 2, 2018

Included 54214d6 (cmake: fix linker error with dbghelper library, 2017-09-15) to unbreak AppVeyor builds.

@pks-t pks-t force-pushed the pks/v0.26.1-backports branch from 7c61320 to 8a22ddd Compare February 2, 2018 11:20
@pks-t
Copy link
Member Author

pks-t commented Feb 20, 2018

Updated to include #4535, #4497, #4539, #4491

@pks-t pks-t force-pushed the pks/v0.26.1-backports branch from 9adb068 to 2184991 Compare February 28, 2018 14:07
@pks-t
Copy link
Member Author

pks-t commented Feb 28, 2018

Added #4550, #4555, #4553

@pks-t pks-t force-pushed the pks/v0.26.1-backports branch 3 times, most recently from 9d80dbe to f24deea Compare March 7, 2018 13:43
@pks-t
Copy link
Member Author

pks-t commented Mar 7, 2018

Dropped #4424 as that actually changes the API in a rather subtle way and included the upgrade of zlib to 1.2.11

@pks-t pks-t force-pushed the pks/v0.26.1-backports branch from f24deea to 3fcbea8 Compare March 7, 2018 22:23
@pks-t pks-t changed the title v0.26.1 backports v0.26.2 backports Mar 7, 2018
@pks-t
Copy link
Member Author

pks-t commented Mar 7, 2018

Rebased on v0.26.1 and made this the v0.26.2 release

tiennou and others added 22 commits March 10, 2018 17:45
When initializing a `git_diff_file_content` from a source whose data is
derived from a blob, we simply assign the blob's pointer to the
resulting struct without incrementing its refcount. Thus, the structure
can only be used as long as the blob is kept alive by the caller.

Fix the issue by using `git_blob_dup` instead of a direct assignment.
This function will increment the refcount of the blob without allocating
new memory, so it does exactly what we want. As
`git_diff_file_content__unload` already frees the blob when
`GIT_DIFF_FLAG__FREE_BLOB` is set, we don't need to add new code
handling the free but only have to set that flag correctly.
If an element has been cached, but then the call to
packfile_unpack_compressed() fails, the very next thing that happens is
that its data is freed and then the element is not removed from the
cache, which frees the data again.

This change sets obj->data to NULL to avoid the double-free. It also
stops trying to resolve deltas after two continuous failed rounds of
resolution, and adds a test for this.
Provide a simple function to reverse an oidarray.
When the commits being merged have multiple merge bases, reverse the
order when creating the virtual merge base.  This is for compatibility
with git's merge-recursive algorithm, and ensures that we build
identical trees.

Git does this to try to use older merge bases first.  Per 8918b0c:

> It seems to be the only sane way to do it: when a two-head merge is
> done, and the merge-base and one of the two branches agree, the
> merge assumes that the other branch has something new.
>
> If we start creating virtual commits from newer merge-bases, and go
> back to older merge-bases, and then merge with newer commits again,
> chances are that a patch is lost, _because_ the merge-base and the
> head agree on it. Unlikely, yes, but it happened to me.
Virtual base building: ensure that the virtual base is created and
revwalked in the same way as git.
Our virtual commit must be the last argument to merge-base: since our
algorithm pushes _both_ parents of the virtual commit, it needs to be
the last argument, since merge-base:

> Given three commits A, B and C, git merge-base A B C will compute the
> merge base between A and a hypothetical commit M

We want to calculate the merge base between the actual commit ("two")
and the virtual commit ("one") - since one actually pushes its parents
to the merge-base calculation, we need to calculate the merge base of
"two" and the parents of one.
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.
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.
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.
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.
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.
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.
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.
For platforms that do not define `WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1`
and/or `WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2`.
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.
The win32 C library is compiled cdecl, however when configured with
`STDCALL=ON`, our functions (and function pointers) will use the stdcall
calling convention.  You cannot set a `__stdcall` function pointer to a
`__cdecl` function, so it's easier to just use our `git__strncmp`
instead of sorting that mess out.
Instead of laving it uninitialized and relying on luck for it to be non-zero,
let's give it a dummy hash so we make valgrind happy (in this case the hash
comes from `sha1sum </dev/null`.
Our curl-based streams make use of the easy curl interface. This
interface automatically initializes and de-initializes the global curl
state by calling out to `curl_global_init` and `curl_global_cleanup`.
Thus, all global state will be repeatedly re-initialized when creating
multiple curl streams in succession. Despite being inefficient, this is
not thread-safe due to `curl_global_init` being not thread-safe itself.
Thus a multi-threaded programing handling multiple curl streams at the
same time is inherently racy.

Fix the issue by globally initializing and cleaning up curl's state.
@pks-t pks-t force-pushed the pks/v0.26.1-backports branch from 3fcbea8 to 43166c4 Compare March 10, 2018 17:59
@pks-t pks-t changed the title v0.26.2 backports v0.26.3 backports Mar 10, 2018
@pks-t
Copy link
Member Author

pks-t commented Mar 10, 2018

Rebased on v0.26.2, bumped to v0.26.3 and added a changelog. Will finally release this either tomorrow or on Monday when the CI is green.

@pks-t pks-t force-pushed the pks/v0.26.1-backports branch from 43166c4 to bb00842 Compare March 12, 2018 11:59
@pks-t pks-t merged commit b55bb43 into libgit2:maint/v0.26 Mar 12, 2018
@pks-t pks-t deleted the pks/v0.26.1-backports branch March 12, 2018 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.