Commit Graph

14687 Commits

Author SHA1 Message Date
Edward Thomson
9d9a90ad3d clone: test bare clone namespaced repo with no HEAD
Test that we can successfully clone a repository that is namespace
scoped to a bare repository locally. We need not specify a checkout
branch in this case (obviously, since we do not check anything out in a
bare clone).
2022-09-19 05:07:16 -04:00
Edward Thomson
c928d96ea4 clone: narrow success tests on HEAD-less remotes
Only allow the remote default branch checking to fail when the remote
default branch doesn't exist (`git_remote__default_branch` returns
`GIT_ENOTFOUND`). If there was any other type of error - for example, an
allocation failure - we should not swallow that and continue to fail.

This allows us to support the case when a remote has not advertised a
HEAD -- this is possible, for example, when the remote has constrained
the caller to a particular namespace. But other remote failures remain
as failures.
2022-09-19 05:07:16 -04:00
Edward Thomson
ed27768458 Merge remote-tracking branch 'origin/main' into clone_namespace 2022-09-19 05:07:12 -04:00
Edward Thomson
71071360e1 Merge pull request #6403 from libgit2/ethomson/ci
CI Improvements
2022-09-16 16:21:00 +01:00
Edward Thomson
ebb0830c65 ci: clean up daemon processes on exit
We previously (correctly) cleaned up the git daemon and SSH server, but
failed to clean up our bespoke HTTP server and HTTP proxies. Capture
their PIDs on process creation and kill them when we shut down.
2022-09-16 10:46:18 -04:00
Edward Thomson
ec1aec36b3 ci: move to macos-11
GitHub has deprecated macOS 10.15; move to their new macOS 11 build
servers.
2022-09-16 10:24:35 -04:00
Linus Torvalds
bf80cb63a5 Don't fail the whole clone if you can't find a default branch
In commit 6bb358786 ("clone: set refs/remotes/origin/HEAD to default
branch when branch is specified, attempt 2") libgit2 was changed to set
the default remote branch when one was copied.

But it makes update_head_to_branch() return an error if the origin
doesn't even *have* a HEAD in the first place, since
git_remote_default_branch() will fail.

That's entirely wrong, and means that you cannot do "git_clone()" of a
particular branch on a remote repository when that remote doesn't have a
default branch at all.

So don't set the error code.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-07-29 20:24:59 -07:00
Edward Thomson
22f382539d Merge pull request #6357 from boretrk/testutil
clar: remove ftrunacte from libgit2 tests
2022-07-18 21:47:03 -04:00
Peter Pettersson
12d73c4182 clar: remove ftrunacte from libgit2 tests 2022-07-15 12:24:18 +02:00
Edward Thomson
ac0f224551 Merge pull request #6353 from libgit2/ethomson/flaky_googlesource
tests: skip flaky-ass googlesource tests
2022-07-13 23:12:42 -04:00
Edward Thomson
46ce10f062 Merge pull request #6354 from libgit2/ethomson/sha256_experimental
sha256: indirection for experimental functions
2022-07-13 23:12:26 -04:00
Edward Thomson
b43567d655 sha256: indirection for experimental functions
The experimental function signature is only available when
`GIT_EXPERIMENTAL_SHA256` is enabled.
2022-07-13 22:50:33 -04:00
Edward Thomson
433a133402 Merge pull request #6191 from libgit2/ethomson/sha256_poc
RFC: SHA256 proof of concept
2022-07-13 21:08:04 -04:00
Edward Thomson
cbd5319f50 tests: skip flaky-ass googlesource tests 2022-07-13 20:56:03 -04:00
Edward Thomson
21b70f09b4 Merge pull request #6352 from libgit2/ethomson/post_1.5.0
meta: update version number to v1.6.0-alpha
2022-07-13 20:48:04 -04:00
Edward Thomson
43dd3700a2 meta: update version number to v1.6.0-alpha 2022-07-13 20:19:35 -04:00
Edward Thomson
fbea439d4b Merge pull request #6351 from libgit2/ethomson/v1.5.0
v1.5.0
v1.5.0
2022-07-13 20:06:59 -04:00
Edward Thomson
2be53a5da7 v1.5: update version numbers 2022-07-13 12:50:01 -04:00
Edward Thomson
2030358070 v1.5: update the changelog 2022-07-13 12:50:01 -04:00
Edward Thomson
fb02e339fe meta: update release.yml for security information 2022-07-13 12:27:43 -04:00
Edward Thomson
3c8a860df4 Merge pull request #6348 from lya001/fix-invalid-branch-name
Fix creation of branches and tags with invalid names
2022-07-13 10:19:14 -04:00
Edward Thomson
be08ef7fd7 Update src/libgit2/tag.c 2022-07-12 22:39:25 -04:00
Edward Thomson
b70dbaa2f2 Merge pull request #6347 from libgit2/ethomson/no_pack_v3
pack: don't pretend we support pack files v3
2022-07-12 22:12:36 -04:00
Edward Thomson
f6be8c2697 Apply suggestions from code review 2022-07-12 22:09:25 -04:00
Edward Thomson
53cfad9e4b Merge pull request #6350 from libgit2/ethomson/zlib
zlib: update bundled zlib to v1.2.12
2022-07-12 15:07:11 -04:00
Edward Thomson
4ae8704b9f Merge pull request #6349 from libgit2/ethomson/cve-2022-29187
Fixes for CVE 2022-29187
2022-07-12 14:42:50 -04:00
Mark Adler
af76267ad7 zlib: Silence some warnings from Visual Studio C. 2022-07-12 14:27:46 -04:00
Andrzej Hunt
39ba0ee604 zlib: slide_hash: add MSAN annotation to suppress known read from uninitialised memory
slide_hash knowingly reads (possibly) uninitialised memory, see comment
lower down about prev[n] potentially being garbage. In this case, the
result is never used - so we don't care about MSAN complaining about
this read.

By adding the no_sanitize("memory") attribute, clients of zlib won't
see this (unnecessary) error when building and running with
MemorySanitizer. An alternative approach is for clients to build zlib
with -fsanitize-ignorelist=... where the ignorelist contains something
like 'fun:slide_hash'. But that's more work and needs to be redone
for any and all CI systems running a given project with MSAN. Adding
this annotation to zlib's sources is overall more convenient - but
also won't affect non-MSAN builds.

This specific issue was found while running git's test suite, but has
also been reported by other clients, see e.g. #518.
2022-07-12 14:27:46 -04:00
Edward Thomson
6febb7d767 zlib: declare prototypes for new functions
The `crc32_combine_gen64` missed a prototype in our define path.
Add one.
2022-07-12 14:27:46 -04:00
Edward Thomson
2db6cdcd66 zlib: updated bundled zlib to v1.2.12 2022-07-12 14:27:46 -04:00
Edward Thomson
ed24b8bacc repo: allow users running with sudo to access their repositories
In the ownership checks implemented for CVE-2022-24765, we disallowed
users to access their own repositories when running with `sudo`.

Examine the `SUDO_UID` environment variable and allow users running
with `sudo`. This matches git's behavior.
2022-07-12 14:12:48 -04:00
Edward Thomson
af9e00321f repo: validate gitdir and gitlink ownership
To match git's behavior with CVE 2022-29187, validate not only the
working directory, but also the gitdir and gitlink (if it exists). This
a follow up to CVE-2022-24765 that was fixed earlier.
2022-07-12 14:12:48 -04:00
Edward Thomson
d1001fd05b Merge pull request #6341 from libgit2/ethomson/ownership2
Fix erroneously lax configuration ownership checks
2022-07-12 14:12:15 -04:00
yuangli
760a5acc73 Merge branch 'main' into fix-invalid-branch-name 2022-07-12 15:07:54 +01:00
yuangli
1912f145e1 tests: free resources in invalid tag name test 2022-07-11 15:53:35 +01:00
yuangli
7456e81934 tests: error when create tag with invalid name 2022-07-11 15:42:16 +01:00
yuangli
fe9bfec46b tag: refactor tag name validity checks 2022-07-11 15:35:15 +01:00
yuangli
7560ac4d2f branches: fix error message for invalid name 2022-07-11 15:25:51 +01:00
yuangli
724b5a0e97 tests: rename to follow clar naming convention 2022-07-11 15:24:34 +01:00
yuangli
2e9228e85a tests: rename test for consistency 2022-07-11 15:23:41 +01:00
yuangli
391afec497 branch: refactor branch name validity checks 2022-07-11 13:54:38 +01:00
yuangli
71fafae17a tests: error when create branch with invalid name 2022-07-11 12:03:37 +01:00
yuangli
e4f98ac4b8 tests: follow clar naming convention 2022-07-11 12:00:23 +01:00
Edward Thomson
4597b869f7 pack: don't pretend we support pack files v3
Pack files v3 are introduced in the SHA256 hash transition document
https://github.com/git/git/blob/master/Documentation/technical/hash-function-transition.txt

Obviously we do not support these yet. Stop pretending that we do.
2022-07-08 21:30:21 -04:00
Edward Thomson
56aaaf532d repo: allow admin owned configs by admin users
Allow users in the administrator group to use git configs that are owned
by administrators.
2022-07-07 10:38:01 -04:00
Edward Thomson
5bc01a7ddb fs: allow ownership match if user is in admin group
Allow the user ownership to match if the file is owned by the admin
group and the user is in the admin group, even if the current process is
not running as administrator directly.
2022-07-07 10:37:54 -04:00
Edward Thomson
433f0166c9 fs: refactor file ownership checks
Refactor the file ownership checks so that callers can provide discrete
information about the ownership expectations to a single function.
2022-07-07 10:37:49 -04:00
Edward Thomson
df354ec25d fs: remove mock naming from change ownership constants
The file ownership concepts can reflect the actual file ownership, they
are not necessarily limited to mocking the interface. Rename them so
that they can be more broadly applicable.
2022-07-07 10:37:44 -04:00
Edward Thomson
78af6b5eb6 repo: add tests for bare repo permissions
Ensure that we test opening a bare repository with odd permissions.
2022-07-07 10:37:02 -04:00
Edward Thomson
f51f66468a Revert "repo: allow administrator to own the configuration"
This reverts commit cdff2f0237.

This change erroneously allowed system users to own a worktree; this
should only be allowed when the current user is in the Administrator
group on Windows as well.
2022-07-07 10:36:52 -04:00