diff options
| author | Ian Johnson <ian@ianjohnson.dev> | 2023-09-23 00:35:41 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-09-30 18:30:43 -0700 |
| commit | 9a001e1f7cc878579f1c0a614ac0124bfdc58332 (patch) | |
| tree | 71b304520eb8fdd11e1a6bb55487b598f3056be3 /src/git/testdata | |
| parent | 303181901b0a5e62ece5d4b786ee537a50d07709 (diff) | |
| download | zig-9a001e1f7cc878579f1c0a614ac0124bfdc58332.tar.gz zig-9a001e1f7cc878579f1c0a614ac0124bfdc58332.zip | |
Support fetching dependencies over git+http(s)
Closes #14298
This commit adds support for fetching dependencies over git+http(s)
using a minimal implementation of the Git protocols and formats relevant
to fetching repository data.
Git URLs can be specified in `build.zig.zon` as follows:
```zig
.xml = .{
.url = "git+https://github.com/ianprime0509/zig-xml#7380d59d50f1cd8460fd748b5f6f179306679e2f",
.hash = "122085c1e4045fa9cb69632ff771c56acdb6760f34ca5177e80f70b0b92cd80da3e9",
},
```
The fragment part of the URL may specify a commit ID (SHA1 hash), branch
name, or tag. It is an error to omit the fragment: if this happens, the
compiler will prompt the user to add it, using the commit ID of the HEAD
commit of the repository (that is, the latest commit of the default
branch):
```
Fetch Packages... xml... /var/home/ian/src/zig-gobject/build.zig.zon:6:20: error: url field is missing an explicit ref
.url = "git+https://github.com/ianprime0509/zig-xml",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: try .url = "git+https://github.com/ianprime0509/zig-xml#dfdc044f3271641c7d428dc8ec8cd46423d8b8b6",
```
This implementation currently supports only version 2 of Git's wire
protocol (documented in
[protocol-v2](https://git-scm.com/docs/protocol-v2)), which was first
introduced in Git 2.19 (2018) and made the default in 2.26 (2020).
The wire protocol behaves similarly when used over other transports,
such as SSH and the "Git protocol" (git:// URLs), so it should be
reasonably straightforward to support fetching dependencies from such
URLs if the necessary transports are implemented (e.g. #14295).
Diffstat (limited to 'src/git/testdata')
| -rw-r--r-- | src/git/testdata/testrepo.idx | bin | 0 -> 3480 bytes |
| -rw-r--r-- | src/git/testdata/testrepo.pack | bin | 0 -> 6511 bytes |
2 files changed, 0 insertions, 0 deletions
diff --git a/src/git/testdata/testrepo.idx b/src/git/testdata/testrepo.idx Binary files differnew file mode 100644 index 0000000000..fdaba5ed48 --- /dev/null +++ b/src/git/testdata/testrepo.idx diff --git a/src/git/testdata/testrepo.pack b/src/git/testdata/testrepo.pack Binary files differnew file mode 100644 index 0000000000..1b2f5dd650 --- /dev/null +++ b/src/git/testdata/testrepo.pack |
