chore(deps): bump github.com/go-git/go-git/v5 from 5.9.0 to 5.10.0 (#2818)
Bumps [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) from 5.9.0 to 5.10.0. - [Release notes](https://github.com/go-git/go-git/releases) - [Commits](https://github.com/go-git/go-git/compare/v5.9.0...v5.10.0) --- updated-dependencies: - dependency-name: github.com/go-git/go-git/v5 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
caedb08749
commit
fe8200112d
2
go.mod
2
go.mod
|
|
@ -19,7 +19,7 @@ require (
|
||||||
github.com/containerd/cgroups v1.1.0 // indirect
|
github.com/containerd/cgroups v1.1.0 // indirect
|
||||||
github.com/docker/docker v23.0.5+incompatible
|
github.com/docker/docker v23.0.5+incompatible
|
||||||
github.com/go-git/go-billy/v5 v5.5.0
|
github.com/go-git/go-billy/v5 v5.5.0
|
||||||
github.com/go-git/go-git/v5 v5.9.0
|
github.com/go-git/go-git/v5 v5.10.0
|
||||||
github.com/golang/mock v1.6.0
|
github.com/golang/mock v1.6.0
|
||||||
github.com/google/go-cmp v0.6.0
|
github.com/google/go-cmp v0.6.0
|
||||||
github.com/google/go-containerregistry v0.15.2
|
github.com/google/go-containerregistry v0.15.2
|
||||||
|
|
|
||||||
6
go.sum
6
go.sum
|
|
@ -271,9 +271,9 @@ github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66D
|
||||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
|
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
|
||||||
github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU=
|
github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU=
|
||||||
github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
|
github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
|
||||||
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8=
|
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
|
||||||
github.com/go-git/go-git/v5 v5.9.0 h1:cD9SFA7sHVRdJ7AYck1ZaAa/yeuBvGPxwXDL8cxrObY=
|
github.com/go-git/go-git/v5 v5.10.0 h1:F0x3xXrAWmhwtzoCokU4IMPcBdncG+HAAqi9FcOOjbQ=
|
||||||
github.com/go-git/go-git/v5 v5.9.0/go.mod h1:RKIqga24sWdMGZF+1Ekv9kylsDz6LzdTSI2s/OsZWE0=
|
github.com/go-git/go-git/v5 v5.10.0/go.mod h1:1FOZ/pQnqw24ghP2n7cunVl0ON55BsjPYvhWHvZGhoo=
|
||||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,4 @@ coverage.txt
|
||||||
profile.out
|
profile.out
|
||||||
.tmp/
|
.tmp/
|
||||||
.git-dist/
|
.git-dist/
|
||||||
|
.vscode
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,18 @@ compatibility status with go-git.
|
||||||
## Getting and creating repositories
|
## Getting and creating repositories
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| ------- | ------------------------------------------------------------------------------------------------------------------ | ------ | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `init` | | ✅ | | |
|
| `init` | | ✅ | | |
|
||||||
| `init` | `--bare` | ✅ | | |
|
| `init` | `--bare` | ✅ | | |
|
||||||
| `init` | `--template` <br/> `--separate-git-dir` <br/> `--shared` | ❌ | | |
|
| `init` | `--template` <br/> `--separate-git-dir` <br/> `--shared` | ❌ | | |
|
||||||
| `clone` | | ✅ | | - [PlainClone](_examples/clone/main.go) |
|
| `clone` | | ✅ | | - [PlainClone](_examples/clone/main.go) |
|
||||||
| `clone` | Authentication: <br/> - none <br/> - access token <br/> - username + password <br/> - ssh | ✅ | | - [clone ssh](_examples/clone/auth/ssh/main.go) <br/> - [clone access token](_examples/clone/auth/basic/access_token/main.go) <br/> - [clone user + password](_examples/clone/auth/basic/username_password/main.go) |
|
| `clone` | Authentication: <br/> - none <br/> - access token <br/> - username + password <br/> - ssh | ✅ | | - [clone ssh](_examples/clone/auth/ssh/main.go) <br/> - [clone access token](_examples/clone/auth/basic/access_token/main.go) <br/> - [clone user + password](_examples/clone/auth/basic/username_password/main.go) |
|
||||||
| `clone` | `--progress` <br/> `--single-branch` <br/> `--depth` <br/> `--origin` <br/> `--recurse-submodules` | ✅ | | - [recurse submodules](_examples/clone/main.go) <br/> - [progress](_examples/progress/main.go) |
|
| `clone` | `--progress` <br/> `--single-branch` <br/> `--depth` <br/> `--origin` <br/> `--recurse-submodules` <br/>`--shared` | ✅ | | - [recurse submodules](_examples/clone/main.go) <br/> - [progress](_examples/progress/main.go) |
|
||||||
|
|
||||||
## Basic snapshotting
|
## Basic snapshotting
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| -------- | ----------- | ------ | -------------------------------------------------------- | ------------------------------------ |
|
||||||
| `add` | | ✅ | Plain add is supported. Any other flags aren't supported | |
|
| `add` | | ✅ | Plain add is supported. Any other flags aren't supported | |
|
||||||
| `status` | | ✅ | | |
|
| `status` | | ✅ | | |
|
||||||
| `commit` | | ✅ | | - [commit](_examples/commit/main.go) |
|
| `commit` | | ✅ | | - [commit](_examples/commit/main.go) |
|
||||||
|
|
@ -28,7 +28,7 @@ compatibility status with go-git.
|
||||||
## Branching and merging
|
## Branching and merging
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| ----------- | ----------- | ------ | --------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
||||||
| `branch` | | ✅ | | - [branch](_examples/branch/main.go) |
|
| `branch` | | ✅ | | - [branch](_examples/branch/main.go) |
|
||||||
| `checkout` | | ✅ | Basic usages of checkout are supported. | - [checkout](_examples/checkout/main.go) |
|
| `checkout` | | ✅ | Basic usages of checkout are supported. | - [checkout](_examples/checkout/main.go) |
|
||||||
| `merge` | | ❌ | | |
|
| `merge` | | ❌ | | |
|
||||||
|
|
@ -39,7 +39,7 @@ compatibility status with go-git.
|
||||||
## Sharing and updating projects
|
## Sharing and updating projects
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| ----------- | ----------- | ------ | ----------------------------------------------------------------------- | ------------------------------------------ |
|
||||||
| `fetch` | | ✅ | | |
|
| `fetch` | | ✅ | | |
|
||||||
| `pull` | | ✅ | Only supports merges where the merge can be resolved as a fast-forward. | - [pull](_examples/pull/main.go) |
|
| `pull` | | ✅ | Only supports merges where the merge can be resolved as a fast-forward. | - [pull](_examples/pull/main.go) |
|
||||||
| `push` | | ✅ | | - [push](_examples/push/main.go) |
|
| `push` | | ✅ | | - [push](_examples/push/main.go) |
|
||||||
|
|
@ -50,7 +50,7 @@ compatibility status with go-git.
|
||||||
## Inspection and comparison
|
## Inspection and comparison
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| ---------- | ----------- | --------- | ----- | ------------------------------ |
|
||||||
| `show` | | ✅ | | |
|
| `show` | | ✅ | | |
|
||||||
| `log` | | ✅ | | - [log](_examples/log/main.go) |
|
| `log` | | ✅ | | - [log](_examples/log/main.go) |
|
||||||
| `shortlog` | | (see log) | | |
|
| `shortlog` | | (see log) | | |
|
||||||
|
|
@ -59,7 +59,7 @@ compatibility status with go-git.
|
||||||
## Patching
|
## Patching
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| ------------- | ----------- | ------ | ---------------------------------------------------- | -------- |
|
||||||
| `apply` | | ❌ | | |
|
| `apply` | | ❌ | | |
|
||||||
| `cherry-pick` | | ❌ | | |
|
| `cherry-pick` | | ❌ | | |
|
||||||
| `diff` | | ✅ | Patch object with UnifiedDiff output representation. | |
|
| `diff` | | ✅ | Patch object with UnifiedDiff output representation. | |
|
||||||
|
|
@ -69,7 +69,7 @@ compatibility status with go-git.
|
||||||
## Debugging
|
## Debugging
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| -------- | ----------- | ------ | ----- | ---------------------------------- |
|
||||||
| `bisect` | | ❌ | | |
|
| `bisect` | | ❌ | | |
|
||||||
| `blame` | | ✅ | | - [blame](_examples/blame/main.go) |
|
| `blame` | | ✅ | | - [blame](_examples/blame/main.go) |
|
||||||
| `grep` | | ✅ | | |
|
| `grep` | | ✅ | | |
|
||||||
|
|
@ -77,7 +77,7 @@ compatibility status with go-git.
|
||||||
## Email
|
## Email
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| -------------- | ----------- | ------ | ----- | -------- |
|
||||||
| `am` | | ❌ | | |
|
| `am` | | ❌ | | |
|
||||||
| `apply` | | ❌ | | |
|
| `apply` | | ❌ | | |
|
||||||
| `format-patch` | | ❌ | | |
|
| `format-patch` | | ❌ | | |
|
||||||
|
|
@ -87,7 +87,7 @@ compatibility status with go-git.
|
||||||
## External systems
|
## External systems
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| ------------- | ----------- | ------ | ----- | -------- |
|
||||||
| `svn` | | ❌ | | |
|
| `svn` | | ❌ | | |
|
||||||
| `fast-import` | | ❌ | | |
|
| `fast-import` | | ❌ | | |
|
||||||
| `lfs` | | ❌ | | |
|
| `lfs` | | ❌ | | |
|
||||||
|
|
@ -95,7 +95,7 @@ compatibility status with go-git.
|
||||||
## Administration
|
## Administration
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| --------------- | ----------- | ------ | ----- | -------- |
|
||||||
| `clean` | | ✅ | | |
|
| `clean` | | ✅ | | |
|
||||||
| `gc` | | ❌ | | |
|
| `gc` | | ❌ | | |
|
||||||
| `fsck` | | ❌ | | |
|
| `fsck` | | ❌ | | |
|
||||||
|
|
@ -110,14 +110,14 @@ compatibility status with go-git.
|
||||||
## Server admin
|
## Server admin
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| -------------------- | ----------- | ------ | ----- | -------- |
|
||||||
| `daemon` | | ❌ | | |
|
| `daemon` | | ❌ | | |
|
||||||
| `update-server-info` | | ❌ | | |
|
| `update-server-info` | | ❌ | | |
|
||||||
|
|
||||||
## Advanced
|
## Advanced
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| ---------- | ----------- | ----------- | ----- | -------- |
|
||||||
| `notes` | | ❌ | | |
|
| `notes` | | ❌ | | |
|
||||||
| `replace` | | ❌ | | |
|
| `replace` | | ❌ | | |
|
||||||
| `worktree` | | ❌ | | |
|
| `worktree` | | ❌ | | |
|
||||||
|
|
@ -126,14 +126,14 @@ compatibility status with go-git.
|
||||||
## GPG
|
## GPG
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| ------------------- | ----------- | ------ | ----- | -------- |
|
||||||
| `git-verify-commit` | | ✅ | | |
|
| `git-verify-commit` | | ✅ | | |
|
||||||
| `git-verify-tag` | | ✅ | | |
|
| `git-verify-tag` | | ✅ | | |
|
||||||
|
|
||||||
## Plumbing commands
|
## Plumbing commands
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| --------------- | ------------------------------------- | ------------ | --------------------------------------------------- | -------------------------------------------- |
|
||||||
| `cat-file` | | ✅ | | |
|
| `cat-file` | | ✅ | | |
|
||||||
| `check-ignore` | | ❌ | | |
|
| `check-ignore` | | ❌ | | |
|
||||||
| `commit-tree` | | ❌ | | |
|
| `commit-tree` | | ❌ | | |
|
||||||
|
|
@ -158,21 +158,21 @@ compatibility status with go-git.
|
||||||
## Indexes and Git Protocols
|
## Indexes and Git Protocols
|
||||||
|
|
||||||
| Feature | Version | Status | Notes |
|
| Feature | Version | Status | Notes |
|
||||||
|---|---|---|---|
|
| -------------------- | ------------------------------------------------------------------------------- | ------ | ----- |
|
||||||
| index | [v1](https://github.com/git/git/blob/master/Documentation/gitformat-index.txt) | ❌ | |
|
| index | [v1](https://github.com/git/git/blob/master/Documentation/gitformat-index.txt) | ❌ | |
|
||||||
| index | [v2](https://github.com/git/git/blob/master/Documentation/gitformat-index.txt) | ✅ | |
|
| index | [v2](https://github.com/git/git/blob/master/Documentation/gitformat-index.txt) | ✅ | |
|
||||||
| index | [v3](https://github.com/git/git/blob/master/Documentation/gitformat-index.txt) | ❌ | |
|
| index | [v3](https://github.com/git/git/blob/master/Documentation/gitformat-index.txt) | ❌ | |
|
||||||
| pack-protocol | [v1](https://github.com/git/git/blob/master/Documentation/gitprotocol-pack.txt) | ✅ | |
|
| pack-protocol | [v1](https://github.com/git/git/blob/master/Documentation/gitprotocol-pack.txt) | ✅ | |
|
||||||
| pack-protocol | [v2](https://github.com/git/git/blob/master/Documentation/gitprotocol-v2.txt) | ❌ | |
|
| pack-protocol | [v2](https://github.com/git/git/blob/master/Documentation/gitprotocol-v2.txt) | ❌ | |
|
||||||
| multi-pack-index | [v1](https://github.com/git/git/blob/master/Documentation/gitformat-pack.txt) | ❌ | |
|
| multi-pack-index | [v1](https://github.com/git/git/blob/master/Documentation/gitformat-pack.txt) | ❌ | |
|
||||||
| pack-*.rev files | [v1](https://github.com/git/git/blob/master/Documentation/gitformat-pack.txt) | ❌ | |
|
| pack-\*.rev files | [v1](https://github.com/git/git/blob/master/Documentation/gitformat-pack.txt) | ❌ | |
|
||||||
| pack-*.mtimes files | [v1](https://github.com/git/git/blob/master/Documentation/gitformat-pack.txt) | ❌ | |
|
| pack-\*.mtimes files | [v1](https://github.com/git/git/blob/master/Documentation/gitformat-pack.txt) | ❌ | |
|
||||||
| cruft packs | | ❌ | |
|
| cruft packs | | ❌ | |
|
||||||
|
|
||||||
## Capabilities
|
## Capabilities
|
||||||
|
|
||||||
| Feature | Status | Notes |
|
| Feature | Status | Notes |
|
||||||
|---|---|---|
|
| ------------------------------ | ------------ | ----- |
|
||||||
| `multi_ack` | ❌ | |
|
| `multi_ack` | ❌ | |
|
||||||
| `multi_ack_detailed` | ❌ | |
|
| `multi_ack_detailed` | ❌ | |
|
||||||
| `no-done` | ❌ | |
|
| `no-done` | ❌ | |
|
||||||
|
|
@ -204,7 +204,7 @@ compatibility status with go-git.
|
||||||
## Transport Schemes
|
## Transport Schemes
|
||||||
|
|
||||||
| Scheme | Status | Notes | Examples |
|
| Scheme | Status | Notes | Examples |
|
||||||
|---|---|---|---|
|
| -------------------- | ------------ | ---------------------------------------------------------------------- | ---------------------------------------------- |
|
||||||
| `http(s)://` (dumb) | ❌ | | |
|
| `http(s)://` (dumb) | ❌ | | |
|
||||||
| `http(s)://` (smart) | ✅ | | |
|
| `http(s)://` (smart) | ✅ | | |
|
||||||
| `git://` | ✅ | | |
|
| `git://` | ✅ | | |
|
||||||
|
|
@ -215,7 +215,7 @@ compatibility status with go-git.
|
||||||
## SHA256
|
## SHA256
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| -------- | ----------- | ------ | ---------------------------------- | ------------------------------------ |
|
||||||
| `init` | | ✅ | Requires building with tag sha256. | - [init](_examples/sha256/main.go) |
|
| `init` | | ✅ | Requires building with tag sha256. | - [init](_examples/sha256/main.go) |
|
||||||
| `commit` | | ✅ | Requires building with tag sha256. | - [commit](_examples/sha256/main.go) |
|
| `commit` | | ✅ | Requires building with tag sha256. | - [commit](_examples/sha256/main.go) |
|
||||||
| `pull` | | ❌ | | |
|
| `pull` | | ❌ | | |
|
||||||
|
|
@ -225,7 +225,7 @@ compatibility status with go-git.
|
||||||
## Other features
|
## Other features
|
||||||
|
|
||||||
| Feature | Sub-feature | Status | Notes | Examples |
|
| Feature | Sub-feature | Status | Notes | Examples |
|
||||||
|---|---|---|---|---|
|
| --------------- | --------------------------- | ------ | ---------------------------------------------- | -------- |
|
||||||
| `config` | `--local` | ✅ | Read and write per-repository (`.git/config`). | |
|
| `config` | `--local` | ✅ | Read and write per-repository (`.git/config`). | |
|
||||||
| `config` | `--global` <br/> `--system` | ✅ | Read-only. | |
|
| `config` | `--global` <br/> `--system` | ✅ | Read-only. | |
|
||||||
| `gitignore` | | ✅ | | |
|
| `gitignore` | | ✅ | | |
|
||||||
|
|
|
||||||
|
|
@ -42,3 +42,12 @@ test-coverage:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(GIT_DIST_PATH)
|
rm -rf $(GIT_DIST_PATH)
|
||||||
|
|
||||||
|
fuzz:
|
||||||
|
@go test -fuzz=FuzzParser $(PWD)/internal/revision
|
||||||
|
@go test -fuzz=FuzzDecoder $(PWD)/plumbing/format/config
|
||||||
|
@go test -fuzz=FuzzPatchDelta $(PWD)/plumbing/format/packfile
|
||||||
|
@go test -fuzz=FuzzParseSignedBytes $(PWD)/plumbing/object
|
||||||
|
@go test -fuzz=FuzzDecode $(PWD)/plumbing/object
|
||||||
|
@go test -fuzz=FuzzDecoder $(PWD)/plumbing/protocol/packp
|
||||||
|
@go test -fuzz=FuzzNewEndpoint $(PWD)/plumbing/transport
|
||||||
|
|
|
||||||
|
|
@ -63,9 +63,9 @@ type Config struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
User struct {
|
User struct {
|
||||||
// Name is the personal name of the author and the commiter of a commit.
|
// Name is the personal name of the author and the committer of a commit.
|
||||||
Name string
|
Name string
|
||||||
// Email is the email of the author and the commiter of a commit.
|
// Email is the email of the author and the committer of a commit.
|
||||||
Email string
|
Email string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,9 +77,9 @@ type Config struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
Committer struct {
|
Committer struct {
|
||||||
// Name is the personal name of the commiter of a commit.
|
// Name is the personal name of the committer of a commit.
|
||||||
Name string
|
Name string
|
||||||
// Email is the email of the the commiter of a commit.
|
// Email is the email of the committer of a commit.
|
||||||
Email string
|
Email string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,8 +157,8 @@ func ReadConfig(r io.Reader) (*Config, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadConfig loads a config file from a given scope. The returned Config,
|
// LoadConfig loads a config file from a given scope. The returned Config,
|
||||||
// contains exclusively information fom the given scope. If couldn't find a
|
// contains exclusively information from the given scope. If it couldn't find a
|
||||||
// config file to the given scope, a empty one is returned.
|
// config file to the given scope, an empty one is returned.
|
||||||
func LoadConfig(scope Scope) (*Config, error) {
|
func LoadConfig(scope Scope) (*Config, error) {
|
||||||
if scope == LocalScope {
|
if scope == LocalScope {
|
||||||
return nil, fmt.Errorf("LocalScope should be read from the a ConfigStorer")
|
return nil, fmt.Errorf("LocalScope should be read from the a ConfigStorer")
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,15 @@ type CloneOptions struct {
|
||||||
CABundle []byte
|
CABundle []byte
|
||||||
// ProxyOptions provides info required for connecting to a proxy.
|
// ProxyOptions provides info required for connecting to a proxy.
|
||||||
ProxyOptions transport.ProxyOptions
|
ProxyOptions transport.ProxyOptions
|
||||||
|
// When the repository to clone is on the local machine, instead of
|
||||||
|
// using hard links, automatically setup .git/objects/info/alternates
|
||||||
|
// to share the objects with the source repository.
|
||||||
|
// The resulting repository starts out without any object of its own.
|
||||||
|
// NOTE: this is a possibly dangerous operation; do not use it unless
|
||||||
|
// you understand what it does.
|
||||||
|
//
|
||||||
|
// [Reference]: https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---shared
|
||||||
|
Shared bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate validates the fields and sets the default values.
|
// Validate validates the fields and sets the default values.
|
||||||
|
|
@ -737,6 +746,9 @@ type PlainOpenOptions struct {
|
||||||
func (o *PlainOpenOptions) Validate() error { return nil }
|
func (o *PlainOpenOptions) Validate() error { return nil }
|
||||||
|
|
||||||
type PlainInitOptions struct {
|
type PlainInitOptions struct {
|
||||||
|
InitOptions
|
||||||
|
// Determines if the repository will have a worktree (non-bare) or not (bare).
|
||||||
|
Bare bool
|
||||||
ObjectFormat formatcfg.ObjectFormat
|
ObjectFormat formatcfg.ObjectFormat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/bash -eu
|
||||||
|
# Copyright 2023 Google LLC
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
go mod download
|
||||||
|
go get github.com/AdamKorcz/go-118-fuzz-build/testing
|
||||||
|
|
||||||
|
if [ "$SANITIZER" != "coverage" ]; then
|
||||||
|
sed -i '/func (s \*DecoderSuite) TestDecode(/,/^}/ s/^/\/\//' plumbing/format/config/decoder_test.go
|
||||||
|
sed -n '35,$p' plumbing/format/packfile/common_test.go >> plumbing/format/packfile/delta_test.go
|
||||||
|
sed -n '20,53p' plumbing/object/object_test.go >> plumbing/object/tree_test.go
|
||||||
|
sed -i 's|func Test|// func Test|' plumbing/transport/common_test.go
|
||||||
|
fi
|
||||||
|
|
||||||
|
compile_native_go_fuzzer $(pwd)/internal/revision FuzzParser fuzz_parser
|
||||||
|
compile_native_go_fuzzer $(pwd)/plumbing/format/config FuzzDecoder fuzz_decoder_config
|
||||||
|
compile_native_go_fuzzer $(pwd)/plumbing/format/packfile FuzzPatchDelta fuzz_patch_delta
|
||||||
|
compile_native_go_fuzzer $(pwd)/plumbing/object FuzzParseSignedBytes fuzz_parse_signed_bytes
|
||||||
|
compile_native_go_fuzzer $(pwd)/plumbing/object FuzzDecode fuzz_decode
|
||||||
|
compile_native_go_fuzzer $(pwd)/plumbing/protocol/packp FuzzDecoder fuzz_decoder_packp
|
||||||
|
compile_native_go_fuzzer $(pwd)/plumbing/transport FuzzNewEndpoint fuzz_new_endpoint
|
||||||
|
|
@ -133,7 +133,7 @@ func (m FileMode) IsMalformed() bool {
|
||||||
m != Submodule
|
m != Submodule
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns the FileMode as a string in the standatd git format,
|
// String returns the FileMode as a string in the standard git format,
|
||||||
// this is, an octal number padded with ceros to 7 digits. Malformed
|
// this is, an octal number padded with ceros to 7 digits. Malformed
|
||||||
// modes are printed in that same format, for easier debugging.
|
// modes are printed in that same format, for easier debugging.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ func reset() {
|
||||||
algos[crypto.SHA256] = crypto.SHA256.New
|
algos[crypto.SHA256] = crypto.SHA256.New
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterHash allows for the hash algorithm used to be overriden.
|
// RegisterHash allows for the hash algorithm used to be overridden.
|
||||||
// This ensures the hash selection for go-git must be explicit, when
|
// This ensures the hash selection for go-git must be explicit, when
|
||||||
// overriding the default value.
|
// overriding the default value.
|
||||||
func RegisterHash(h crypto.Hash, f func() hash.Hash) error {
|
func RegisterHash(h crypto.Hash, f func() hash.Hash) error {
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ func (t ObjectType) Valid() bool {
|
||||||
return t >= CommitObject && t <= REFDeltaObject
|
return t >= CommitObject && t <= REFDeltaObject
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsDelta returns true for any ObjectTyoe that represents a delta (i.e.
|
// IsDelta returns true for any ObjectType that represents a delta (i.e.
|
||||||
// REFDeltaObject or OFSDeltaObject).
|
// REFDeltaObject or OFSDeltaObject).
|
||||||
func (t ObjectType) IsDelta() bool {
|
func (t ObjectType) IsDelta() bool {
|
||||||
return t == REFDeltaObject || t == OFSDeltaObject
|
return t == REFDeltaObject || t == OFSDeltaObject
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,22 @@ const (
|
||||||
beginpgp string = "-----BEGIN PGP SIGNATURE-----"
|
beginpgp string = "-----BEGIN PGP SIGNATURE-----"
|
||||||
endpgp string = "-----END PGP SIGNATURE-----"
|
endpgp string = "-----END PGP SIGNATURE-----"
|
||||||
headerpgp string = "gpgsig"
|
headerpgp string = "gpgsig"
|
||||||
|
headerencoding string = "encoding"
|
||||||
|
|
||||||
|
// https://github.com/git/git/blob/bcb6cae2966cc407ca1afc77413b3ef11103c175/Documentation/gitformat-signature.txt#L153
|
||||||
|
// When a merge commit is created from a signed tag, the tag is embedded in
|
||||||
|
// the commit with the "mergetag" header.
|
||||||
|
headermergetag string = "mergetag"
|
||||||
|
|
||||||
|
defaultUtf8CommitMesageEncoding MessageEncoding = "UTF-8"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Hash represents the hash of an object
|
// Hash represents the hash of an object
|
||||||
type Hash plumbing.Hash
|
type Hash plumbing.Hash
|
||||||
|
|
||||||
|
// MessageEncoding represents the encoding of a commit
|
||||||
|
type MessageEncoding string
|
||||||
|
|
||||||
// Commit points to a single tree, marking it as what the project looked like
|
// Commit points to a single tree, marking it as what the project looked like
|
||||||
// at a certain point in time. It contains meta-information about that point
|
// at a certain point in time. It contains meta-information about that point
|
||||||
// in time, such as a timestamp, the author of the changes since the last
|
// in time, such as a timestamp, the author of the changes since the last
|
||||||
|
|
@ -38,6 +49,9 @@ type Commit struct {
|
||||||
// Committer is the one performing the commit, might be different from
|
// Committer is the one performing the commit, might be different from
|
||||||
// Author.
|
// Author.
|
||||||
Committer Signature
|
Committer Signature
|
||||||
|
// MergeTag is the embedded tag object when a merge commit is created by
|
||||||
|
// merging a signed tag.
|
||||||
|
MergeTag string
|
||||||
// PGPSignature is the PGP signature of the commit.
|
// PGPSignature is the PGP signature of the commit.
|
||||||
PGPSignature string
|
PGPSignature string
|
||||||
// Message is the commit message, contains arbitrary text.
|
// Message is the commit message, contains arbitrary text.
|
||||||
|
|
@ -46,6 +60,8 @@ type Commit struct {
|
||||||
TreeHash plumbing.Hash
|
TreeHash plumbing.Hash
|
||||||
// ParentHashes are the hashes of the parent commits of the commit.
|
// ParentHashes are the hashes of the parent commits of the commit.
|
||||||
ParentHashes []plumbing.Hash
|
ParentHashes []plumbing.Hash
|
||||||
|
// Encoding is the encoding of the commit.
|
||||||
|
Encoding MessageEncoding
|
||||||
|
|
||||||
s storer.EncodedObjectStorer
|
s storer.EncodedObjectStorer
|
||||||
}
|
}
|
||||||
|
|
@ -173,6 +189,7 @@ func (c *Commit) Decode(o plumbing.EncodedObject) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Hash = o.Hash()
|
c.Hash = o.Hash()
|
||||||
|
c.Encoding = defaultUtf8CommitMesageEncoding
|
||||||
|
|
||||||
reader, err := o.Reader()
|
reader, err := o.Reader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -184,6 +201,7 @@ func (c *Commit) Decode(o plumbing.EncodedObject) (err error) {
|
||||||
defer sync.PutBufioReader(r)
|
defer sync.PutBufioReader(r)
|
||||||
|
|
||||||
var message bool
|
var message bool
|
||||||
|
var mergetag bool
|
||||||
var pgpsig bool
|
var pgpsig bool
|
||||||
var msgbuf bytes.Buffer
|
var msgbuf bytes.Buffer
|
||||||
for {
|
for {
|
||||||
|
|
@ -192,6 +210,16 @@ func (c *Commit) Decode(o plumbing.EncodedObject) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if mergetag {
|
||||||
|
if len(line) > 0 && line[0] == ' ' {
|
||||||
|
line = bytes.TrimLeft(line, " ")
|
||||||
|
c.MergeTag += string(line)
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
mergetag = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if pgpsig {
|
if pgpsig {
|
||||||
if len(line) > 0 && line[0] == ' ' {
|
if len(line) > 0 && line[0] == ' ' {
|
||||||
line = bytes.TrimLeft(line, " ")
|
line = bytes.TrimLeft(line, " ")
|
||||||
|
|
@ -225,6 +253,11 @@ func (c *Commit) Decode(o plumbing.EncodedObject) (err error) {
|
||||||
c.Author.Decode(data)
|
c.Author.Decode(data)
|
||||||
case "committer":
|
case "committer":
|
||||||
c.Committer.Decode(data)
|
c.Committer.Decode(data)
|
||||||
|
case headermergetag:
|
||||||
|
c.MergeTag += string(data) + "\n"
|
||||||
|
mergetag = true
|
||||||
|
case headerencoding:
|
||||||
|
c.Encoding = MessageEncoding(data)
|
||||||
case headerpgp:
|
case headerpgp:
|
||||||
c.PGPSignature += string(data) + "\n"
|
c.PGPSignature += string(data) + "\n"
|
||||||
pgpsig = true
|
pgpsig = true
|
||||||
|
|
@ -286,6 +319,28 @@ func (c *Commit) encode(o plumbing.EncodedObject, includeSig bool) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c.MergeTag != "" {
|
||||||
|
if _, err = fmt.Fprint(w, "\n"+headermergetag+" "); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Split tag information lines and re-write with a left padding and
|
||||||
|
// newline. Use join for this so it's clear that a newline should not be
|
||||||
|
// added after this section. The newline will be added either as part of
|
||||||
|
// the PGP signature or the commit message.
|
||||||
|
mergetag := strings.TrimSuffix(c.MergeTag, "\n")
|
||||||
|
lines := strings.Split(mergetag, "\n")
|
||||||
|
if _, err = fmt.Fprint(w, strings.Join(lines, "\n ")); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if string(c.Encoding) != "" && c.Encoding != defaultUtf8CommitMesageEncoding {
|
||||||
|
if _, err = fmt.Fprintf(w, "\n%s %s", headerencoding, c.Encoding); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if c.PGPSignature != "" && includeSig {
|
if c.PGPSignature != "" && includeSig {
|
||||||
if _, err = fmt.Fprint(w, "\n"+headerpgp+" "); err != nil {
|
if _, err = fmt.Fprint(w, "\n"+headerpgp+" "); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,7 @@ func (r *ServerResponse) decodeLine(line []byte) error {
|
||||||
return fmt.Errorf("unexpected flush")
|
return fmt.Errorf("unexpected flush")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(line) >= 3 {
|
||||||
if bytes.Equal(line[0:3], ack) {
|
if bytes.Equal(line[0:3], ack) {
|
||||||
return r.decodeACKLine(line)
|
return r.decodeACKLine(line)
|
||||||
}
|
}
|
||||||
|
|
@ -108,6 +109,7 @@ func (r *ServerResponse) decodeLine(line []byte) error {
|
||||||
if bytes.Equal(line[0:3], nak) {
|
if bytes.Equal(line[0:3], nak) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return fmt.Errorf("unexpected content %q", string(line))
|
return fmt.Errorf("unexpected content %q", string(line))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ func (d *ulReqDecoder) Decode(v *UploadRequest) error {
|
||||||
return d.err
|
return d.err
|
||||||
}
|
}
|
||||||
|
|
||||||
// fills out the parser stiky error
|
// fills out the parser sticky error
|
||||||
func (d *ulReqDecoder) error(format string, a ...interface{}) {
|
func (d *ulReqDecoder) error(format string, a ...interface{}) {
|
||||||
msg := fmt.Sprintf(
|
msg := fmt.Sprintf(
|
||||||
"pkt-line %d: %s", d.nLine,
|
"pkt-line %d: %s", d.nLine,
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ type EncodedObjectStorer interface {
|
||||||
HasEncodedObject(plumbing.Hash) error
|
HasEncodedObject(plumbing.Hash) error
|
||||||
// EncodedObjectSize returns the plaintext size of the encoded object.
|
// EncodedObjectSize returns the plaintext size of the encoded object.
|
||||||
EncodedObjectSize(plumbing.Hash) (int64, error)
|
EncodedObjectSize(plumbing.Hash) (int64, error)
|
||||||
|
AddAlternate(remote string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeltaObjectStorer is an EncodedObjectStorer that can return delta
|
// DeltaObjectStorer is an EncodedObjectStorer that can return delta
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ type Endpoint struct {
|
||||||
// Host is the host.
|
// Host is the host.
|
||||||
Host string
|
Host string
|
||||||
// Port is the port to connect, if 0 the default port for the given protocol
|
// Port is the port to connect, if 0 the default port for the given protocol
|
||||||
// wil be used.
|
// will be used.
|
||||||
Port int
|
Port int
|
||||||
// Path is the repository path.
|
// Path is the repository path.
|
||||||
Path string
|
Path string
|
||||||
|
|
|
||||||
19
vendor/github.com/go-git/go-git/v5/plumbing/transport/internal/common/common.go
generated
vendored
19
vendor/github.com/go-git/go-git/v5/plumbing/transport/internal/common/common.go
generated
vendored
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -28,6 +29,10 @@ const (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrTimeoutExceeded = errors.New("timeout exceeded")
|
ErrTimeoutExceeded = errors.New("timeout exceeded")
|
||||||
|
// stdErrSkipPattern is used for skipping lines from a command's stderr output.
|
||||||
|
// Any line matching this pattern will be skipped from further
|
||||||
|
// processing and not be returned to calling code.
|
||||||
|
stdErrSkipPattern = regexp.MustCompile("^remote:( =*){0,1}$")
|
||||||
)
|
)
|
||||||
|
|
||||||
// Commander creates Command instances. This is the main entry point for
|
// Commander creates Command instances. This is the main entry point for
|
||||||
|
|
@ -149,10 +154,17 @@ func (c *client) listenFirstError(r io.Reader) chan string {
|
||||||
errLine := make(chan string, 1)
|
errLine := make(chan string, 1)
|
||||||
go func() {
|
go func() {
|
||||||
s := bufio.NewScanner(r)
|
s := bufio.NewScanner(r)
|
||||||
|
for {
|
||||||
if s.Scan() {
|
if s.Scan() {
|
||||||
errLine <- s.Text()
|
line := s.Text()
|
||||||
|
if !stdErrSkipPattern.MatchString(line) {
|
||||||
|
errLine <- line
|
||||||
|
break
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
close(errLine)
|
close(errLine)
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _ = io.Copy(io.Discard, r)
|
_, _ = io.Copy(io.Discard, r)
|
||||||
|
|
@ -393,6 +405,7 @@ var (
|
||||||
gitProtocolNoSuchErr = "ERR no such repository"
|
gitProtocolNoSuchErr = "ERR no such repository"
|
||||||
gitProtocolAccessDeniedErr = "ERR access denied"
|
gitProtocolAccessDeniedErr = "ERR access denied"
|
||||||
gogsAccessDeniedErr = "Gogs: Repository does not exist or you do not have access"
|
gogsAccessDeniedErr = "Gogs: Repository does not exist or you do not have access"
|
||||||
|
gitlabRepoNotFoundErr = "remote: ERROR: The project you were looking for could not be found"
|
||||||
)
|
)
|
||||||
|
|
||||||
func isRepoNotFoundError(s string) bool {
|
func isRepoNotFoundError(s string) bool {
|
||||||
|
|
@ -424,6 +437,10 @@ func isRepoNotFoundError(s string) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(s, gitlabRepoNotFoundErr) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
46
vendor/github.com/go-git/go-git/v5/plumbing/transport/internal/common/mocks.go
generated
vendored
Normal file
46
vendor/github.com/go-git/go-git/v5/plumbing/transport/internal/common/mocks.go
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
gogitioutil "github.com/go-git/go-git/v5/utils/ioutil"
|
||||||
|
|
||||||
|
"github.com/go-git/go-git/v5/plumbing/transport"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MockCommand struct {
|
||||||
|
stdin bytes.Buffer
|
||||||
|
stdout bytes.Buffer
|
||||||
|
stderr bytes.Buffer
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c MockCommand) StderrPipe() (io.Reader, error) {
|
||||||
|
return &c.stderr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c MockCommand) StdinPipe() (io.WriteCloser, error) {
|
||||||
|
return gogitioutil.WriteNopCloser(&c.stdin), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c MockCommand) StdoutPipe() (io.Reader, error) {
|
||||||
|
return &c.stdout, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c MockCommand) Start() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c MockCommand) Close() error {
|
||||||
|
panic("not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
type MockCommander struct {
|
||||||
|
stderr string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c MockCommander) Command(cmd string, ep *transport.Endpoint, auth transport.AuthMethod) (Command, error) {
|
||||||
|
return &MockCommand{
|
||||||
|
stderr: *bytes.NewBufferString(c.stderr),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
@ -614,7 +614,7 @@ func (r *Remote) addOrUpdateReferences(
|
||||||
req *packp.ReferenceUpdateRequest,
|
req *packp.ReferenceUpdateRequest,
|
||||||
forceWithLease *ForceWithLease,
|
forceWithLease *ForceWithLease,
|
||||||
) error {
|
) error {
|
||||||
// If it is not a wilcard refspec we can directly search for the reference
|
// If it is not a wildcard refspec we can directly search for the reference
|
||||||
// in the references dictionary.
|
// in the references dictionary.
|
||||||
if !rs.IsWildcard() {
|
if !rs.IsWildcard() {
|
||||||
ref, ok := refsDict[rs.Src()]
|
ref, ok := refsDict[rs.Src()]
|
||||||
|
|
@ -693,7 +693,7 @@ func (r *Remote) addCommit(rs config.RefSpec,
|
||||||
remoteRef, err := remoteRefs.Reference(cmd.Name)
|
remoteRef, err := remoteRefs.Reference(cmd.Name)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if remoteRef.Type() != plumbing.HashReference {
|
if remoteRef.Type() != plumbing.HashReference {
|
||||||
//TODO: check actual git behavior here
|
// TODO: check actual git behavior here
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -735,7 +735,7 @@ func (r *Remote) addReferenceIfRefSpecMatches(rs config.RefSpec,
|
||||||
remoteRef, err := remoteRefs.Reference(cmd.Name)
|
remoteRef, err := remoteRefs.Reference(cmd.Name)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if remoteRef.Type() != plumbing.HashReference {
|
if remoteRef.Type() != plumbing.HashReference {
|
||||||
//TODO: check actual git behavior here
|
// TODO: check actual git behavior here
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import (
|
||||||
"github.com/go-git/go-git/v5/config"
|
"github.com/go-git/go-git/v5/config"
|
||||||
"github.com/go-git/go-git/v5/internal/path_util"
|
"github.com/go-git/go-git/v5/internal/path_util"
|
||||||
"github.com/go-git/go-git/v5/internal/revision"
|
"github.com/go-git/go-git/v5/internal/revision"
|
||||||
|
"github.com/go-git/go-git/v5/internal/url"
|
||||||
"github.com/go-git/go-git/v5/plumbing"
|
"github.com/go-git/go-git/v5/plumbing"
|
||||||
"github.com/go-git/go-git/v5/plumbing/cache"
|
"github.com/go-git/go-git/v5/plumbing/cache"
|
||||||
formatcfg "github.com/go-git/go-git/v5/plumbing/format/config"
|
formatcfg "github.com/go-git/go-git/v5/plumbing/format/config"
|
||||||
|
|
@ -62,6 +63,7 @@ var (
|
||||||
ErrUnableToResolveCommit = errors.New("unable to resolve commit")
|
ErrUnableToResolveCommit = errors.New("unable to resolve commit")
|
||||||
ErrPackedObjectsNotSupported = errors.New("packed objects not supported")
|
ErrPackedObjectsNotSupported = errors.New("packed objects not supported")
|
||||||
ErrSHA256NotSupported = errors.New("go-git was not compiled with SHA256 support")
|
ErrSHA256NotSupported = errors.New("go-git was not compiled with SHA256 support")
|
||||||
|
ErrAlternatePathNotSupported = errors.New("alternate path must use the file scheme")
|
||||||
)
|
)
|
||||||
|
|
||||||
// Repository represents a git repository
|
// Repository represents a git repository
|
||||||
|
|
@ -235,9 +237,19 @@ func CloneContext(
|
||||||
// if the repository will have worktree (non-bare) or not (bare), if the path
|
// if the repository will have worktree (non-bare) or not (bare), if the path
|
||||||
// is not empty ErrRepositoryAlreadyExists is returned.
|
// is not empty ErrRepositoryAlreadyExists is returned.
|
||||||
func PlainInit(path string, isBare bool) (*Repository, error) {
|
func PlainInit(path string, isBare bool) (*Repository, error) {
|
||||||
|
return PlainInitWithOptions(path, &PlainInitOptions{
|
||||||
|
Bare: isBare,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func PlainInitWithOptions(path string, opts *PlainInitOptions) (*Repository, error) {
|
||||||
|
if opts == nil {
|
||||||
|
opts = &PlainInitOptions{}
|
||||||
|
}
|
||||||
|
|
||||||
var wt, dot billy.Filesystem
|
var wt, dot billy.Filesystem
|
||||||
|
|
||||||
if isBare {
|
if opts.Bare {
|
||||||
dot = osfs.New(path)
|
dot = osfs.New(path)
|
||||||
} else {
|
} else {
|
||||||
wt = osfs.New(path)
|
wt = osfs.New(path)
|
||||||
|
|
@ -246,16 +258,7 @@ func PlainInit(path string, isBare bool) (*Repository, error) {
|
||||||
|
|
||||||
s := filesystem.NewStorage(dot, cache.NewObjectLRUDefault())
|
s := filesystem.NewStorage(dot, cache.NewObjectLRUDefault())
|
||||||
|
|
||||||
return Init(s, wt)
|
r, err := InitWithOptions(s, wt, opts.InitOptions)
|
||||||
}
|
|
||||||
|
|
||||||
func PlainInitWithOptions(path string, opts *PlainInitOptions) (*Repository, error) {
|
|
||||||
wt := osfs.New(path)
|
|
||||||
dot, _ := wt.Chroot(GitDirName)
|
|
||||||
|
|
||||||
s := filesystem.NewStorage(dot, cache.NewObjectLRUDefault())
|
|
||||||
|
|
||||||
r, err := Init(s, wt)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -265,7 +268,7 @@ func PlainInitWithOptions(path string, opts *PlainInitOptions) (*Repository, err
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts != nil {
|
if opts.ObjectFormat != "" {
|
||||||
if opts.ObjectFormat == formatcfg.SHA256 && hash.CryptoType != crypto.SHA256 {
|
if opts.ObjectFormat == formatcfg.SHA256 && hash.CryptoType != crypto.SHA256 {
|
||||||
return nil, ErrSHA256NotSupported
|
return nil, ErrSHA256NotSupported
|
||||||
}
|
}
|
||||||
|
|
@ -886,6 +889,30 @@ func (r *Repository) clone(ctx context.Context, o *CloneOptions) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When the repository to clone is on the local machine,
|
||||||
|
// instead of using hard links, automatically setup .git/objects/info/alternates
|
||||||
|
// to share the objects with the source repository
|
||||||
|
if o.Shared {
|
||||||
|
if !url.IsLocalEndpoint(o.URL) {
|
||||||
|
return ErrAlternatePathNotSupported
|
||||||
|
}
|
||||||
|
altpath := o.URL
|
||||||
|
remoteRepo, err := PlainOpen(o.URL)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to open remote repository: %w", err)
|
||||||
|
}
|
||||||
|
conf, err := remoteRepo.Config()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to read remote repository configuration: %w", err)
|
||||||
|
}
|
||||||
|
if !conf.Core.IsBare {
|
||||||
|
altpath = path.Join(altpath, GitDirName)
|
||||||
|
}
|
||||||
|
if err := r.Storer.AddAlternate(altpath); err != nil {
|
||||||
|
return fmt.Errorf("failed to add alternate file to git objects dir: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ref, err := r.fetchAndUpdateReferences(ctx, &FetchOptions{
|
ref, err := r.fetchAndUpdateReferences(ctx, &FetchOptions{
|
||||||
RefSpecs: c.Fetch,
|
RefSpecs: c.Fetch,
|
||||||
Depth: o.Depth,
|
Depth: o.Depth,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -38,6 +40,7 @@ const (
|
||||||
remotesPath = "remotes"
|
remotesPath = "remotes"
|
||||||
logsPath = "logs"
|
logsPath = "logs"
|
||||||
worktreesPath = "worktrees"
|
worktreesPath = "worktrees"
|
||||||
|
alternatesPath = "alternates"
|
||||||
|
|
||||||
tmpPackedRefsPrefix = "._packed-refs"
|
tmpPackedRefsPrefix = "._packed-refs"
|
||||||
|
|
||||||
|
|
@ -1105,10 +1108,38 @@ func (d *DotGit) Module(name string) (billy.Filesystem, error) {
|
||||||
return d.fs.Chroot(d.fs.Join(modulePath, name))
|
return d.fs.Chroot(d.fs.Join(modulePath, name))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *DotGit) AddAlternate(remote string) error {
|
||||||
|
altpath := d.fs.Join(objectsPath, infoPath, alternatesPath)
|
||||||
|
|
||||||
|
f, err := d.fs.OpenFile(altpath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0640)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot open file: %w", err)
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
|
// locking in windows throws an error, based on comments
|
||||||
|
// https://github.com/go-git/go-git/pull/860#issuecomment-1751823044
|
||||||
|
// do not lock on windows platform.
|
||||||
|
if runtime.GOOS != "windows" {
|
||||||
|
if err = f.Lock(); err != nil {
|
||||||
|
return fmt.Errorf("cannot lock file: %w", err)
|
||||||
|
}
|
||||||
|
defer f.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
|
line := path.Join(remote, objectsPath) + "\n"
|
||||||
|
_, err = io.WriteString(f, line)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error writing 'alternates' file: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Alternates returns DotGit(s) based off paths in objects/info/alternates if
|
// Alternates returns DotGit(s) based off paths in objects/info/alternates if
|
||||||
// available. This can be used to checks if it's a shared repository.
|
// available. This can be used to checks if it's a shared repository.
|
||||||
func (d *DotGit) Alternates() ([]*DotGit, error) {
|
func (d *DotGit) Alternates() ([]*DotGit, error) {
|
||||||
altpath := d.fs.Join("objects", "info", "alternates")
|
altpath := d.fs.Join(objectsPath, infoPath, alternatesPath)
|
||||||
f, err := d.fs.Open(altpath)
|
f, err := d.fs.Open(altpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -74,3 +74,7 @@ func (s *Storage) Filesystem() billy.Filesystem {
|
||||||
func (s *Storage) Init() error {
|
func (s *Storage) Init() error {
|
||||||
return s.dir.Initialize()
|
return s.dir.Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Storage) AddAlternate(remote string) error {
|
||||||
|
return s.dir.AddAlternate(remote)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,10 @@ func (o *ObjectStorage) DeleteLooseObject(plumbing.Hash) error {
|
||||||
return errNotSupported
|
return errNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o *ObjectStorage) AddAlternate(remote string) error {
|
||||||
|
return errNotSupported
|
||||||
|
}
|
||||||
|
|
||||||
type TxObjectStorage struct {
|
type TxObjectStorage struct {
|
||||||
Storage *ObjectStorage
|
Storage *ObjectStorage
|
||||||
Objects map[plumbing.Hash]plumbing.EncodedObject
|
Objects map[plumbing.Hash]plumbing.EncodedObject
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Package binary implements sintax-sugar functions on top of the standard
|
// Package binary implements syntax-sugar functions on top of the standard
|
||||||
// library binary package
|
// library binary package
|
||||||
package binary
|
package binary
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ package merkletrie
|
||||||
// Here is a full list of all the cases that are similar and how to
|
// Here is a full list of all the cases that are similar and how to
|
||||||
// merge them together into more general cases. Each general case
|
// merge them together into more general cases. Each general case
|
||||||
// is labeled with an uppercase letter for further reference, and it
|
// is labeled with an uppercase letter for further reference, and it
|
||||||
// is followed by the pseudocode of the checks you have to perfrom
|
// is followed by the pseudocode of the checks you have to perform
|
||||||
// on both noders to see if you are in such a case, the actions to
|
// on both noders to see if you are in such a case, the actions to
|
||||||
// perform (i.e. what changes to output) and how to advance the
|
// perform (i.e. what changes to output) and how to advance the
|
||||||
// iterators of each tree to continue the comparison process.
|
// iterators of each tree to continue the comparison process.
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ func (w *Worktree) PullContext(ctx context.Context, o *PullOptions) error {
|
||||||
Force: o.Force,
|
Force: o.Force,
|
||||||
InsecureSkipTLS: o.InsecureSkipTLS,
|
InsecureSkipTLS: o.InsecureSkipTLS,
|
||||||
CABundle: o.CABundle,
|
CABundle: o.CABundle,
|
||||||
|
ProxyOptions: o.ProxyOptions,
|
||||||
})
|
})
|
||||||
|
|
||||||
updated := true
|
updated := true
|
||||||
|
|
|
||||||
|
|
@ -465,7 +465,7 @@ github.com/go-git/go-billy/v5/helper/polyfill
|
||||||
github.com/go-git/go-billy/v5/memfs
|
github.com/go-git/go-billy/v5/memfs
|
||||||
github.com/go-git/go-billy/v5/osfs
|
github.com/go-git/go-billy/v5/osfs
|
||||||
github.com/go-git/go-billy/v5/util
|
github.com/go-git/go-billy/v5/util
|
||||||
# github.com/go-git/go-git/v5 v5.9.0
|
# github.com/go-git/go-git/v5 v5.10.0
|
||||||
## explicit; go 1.19
|
## explicit; go 1.19
|
||||||
github.com/go-git/go-git/v5
|
github.com/go-git/go-git/v5
|
||||||
github.com/go-git/go-git/v5/config
|
github.com/go-git/go-git/v5/config
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue