aboutsummaryrefslogtreecommitdiffstats
path: root/options.go
Commit message (Collapse)AuthorAgeFilesLines
* git: worktree, add RestoreStaged which works like the "git restore --staged ↵Ben Talbot2024-04-191-0/+26
| | | | | | | | | | <file>..." command Small formatting and style fixes before rebasing against master Setup args for restore in TestExamples Fix typo in error message and remove dependency on fmt in worktree_test
* Merge pull request #1048 from pjbgf/fix-reset-validationPaulo Gomes2024-03-121-0/+5
|\ | | | | git: Add commit validation for Reset
| * git: Add commit validation for Reset. Fixes #878Paulo Gomes2024-03-111-0/+5
| | | | | | | | Signed-off-by: Paulo Gomes <paulo.gomes@suse.com>
* | git: Implement Merge function with initial FastForwardMerge supportPaulo Gomes2024-03-091-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | Introduces the Merge function for merging branches in the codebase. Currently, the function only supports FastForwardMerge strategy, meaning it can efficiently update the target branch pointer if the source branch history is a linear descendant. Support for additional merge strategies (e.g., three-way merge) will be added in future commits. Signed-off-by: Paulo Gomes <paulo.gomes@suse.com>
* | git: Add Merge with ff-onlyJohn Cai2024-03-091-0/+7
|/ | | | | | Add a Merge function that behaves like git merge. This is a first iteration that only supports --ff-only, which is the simplest type of merge.
* *: fetch, adds the prune option. Fixes #316Julien Salleyron2024-02-221-1/+4
| | | | Co-authored-by: Ludovic Fernandez <ldez@users.noreply.github.com>
* git: signer, fix usage of crypto.Signer interfaceBilly Lynch2024-02-131-2/+1
| | | | | | | | | | | | | | | | | | | crypto.Signer was incorrectly used before. Signer documentation says that Signer.Sign should be used on digests, whereas we were using this on message bodies. To fix this, create our own Signer interface (+ signableObject borrowed from #705) that describes more accurately what we want. As before, the expectation is that signer implementations only need to worry about acting on encoded message bodies rather than needing to encode objects themselves. This is technically a breaking change from the previous Signer implementation, but since this is new and hasn't made it into cut release yet, this seems like an acceptible change. Also adds example test showing how signers can be made (uses base64 for consistent outputs).
* Merge pull request #994 from moranCohen26/supportFastAddPathPaulo Gomes2024-01-231-0/+5
|\ | | | | Worktree.AddWithOptions: add skipStatus option when providing a specific path
| * git: Worktree.AddWithOptions, add skipStatus option. #993Moran Cohen2024-01-171-0/+5
| |
* | git: worktree_commit, Add crypto.Signer option to CommitOptions.Billy Lynch2024-01-181-0/+5
|/ | | | | | | | | | | | | This change adds a new crypto.Signer option to CommitOptions as an alternative to SignKey to allow alternative commit signers to be used. This change byitself does not add other signing methods (e.g. ssh, x509, gitsign), but gives callers the ability to add their own. This roughly follows git's sign_buffer approach where go-git handles the commit message body encoding, and hands off the encoded []byte to the signing implementation for the signature to be returned. Signed-off-by: Billy Lynch <billy@chainguard.dev>
* git: worktree checkout tag hash id (#959)Ayman Bagabas2023-12-121-3/+3
| | | | | | | Allow checking out a worktree using a tag hash id. Fixes: https://github.com/go-git/go-git/issues/959 Supersedes: https://github.com/go-git/go-git/pull/964
* git: clone --shared implementedenverbisevac2023-10-081-0/+9
|
* git: allow using `InitOptions` with `PlainInitWithOptions`ThinkChaos2023-09-151-0/+1
|
* git: add `PlainInitOptions.Bare`ThinkChaos2023-09-151-0/+2
| | | | Refactor `PlainInit` to call `PlainInitWithOptions`
* Merge branch 'master' into jc/commit-ammendPaulo Gomes2023-08-051-4/+67
|\
| * Merge pull request #765 from matejrisek/feature/shallow-submodules-optionPaulo Gomes2023-06-071-0/+3
| |\ | | | | | | git: add a clone option to allow for shallow cloning of submodules
| | * git: add a clone option to allow for shallow cloning of submodulesmatej.risek2023-06-051-0/+3
| | | | | | | | | | | | | | | This option matches the git clone option --shallow-submodules. https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---no-shallow-submodules
| * | git: remote, add support for a configurable timeout.Andrew Pollock2023-05-121-0/+2
| |/ | | | | | | | | | | | | The previous hard-coded 10 second value is too short for listing large repositories like https://gitlab.com/gitlab-org/gitlab Return an error on nonsensical subzero timeout values
| * Merge pull request #754 from matejrisek/feature/submodule-clone-depthPaulo Gomes2023-05-041-0/+3
| |\ | | | | | | git: Add Depth to SubmoduleUpdateOptions
| | * git: Add Depth to SubmoduleUpdateOptionsmatej.risek2023-05-041-0/+3
| | |
| * | plumbing/transport: add ProxyOptions to specify proxy detailsSanskar Jaiswal2023-05-041-1/+10
| | | | | | | | | | | | Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
| * | git: Add support to ls-remote with peeled references. Fixes #749Paulo Gomes2023-05-031-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new PeelingOption field was introduced into ListOptions. The new options include the default (and backwards compatible) IgnorePeeled. Plus another two variations which either only returns peeled references (OnlyPeeled), or append peeled references to the list (AppendPeeled). The ls-remote example was updated to align with upstream, in which peeled references are appended to the results by default. A new ErrEmptyUrls error is now returned when List or ListContext do not receive a URL to work with, to improve overall execution flow. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
| * | Merge pull request #728 from aymanbagabas/grep-barePaulo Gomes2023-04-261-1/+7
| |\ \ | | | | | | | | fix: git grep bare repositories
| | * | fix: git grep bare repositoriesAyman Bagabas2023-04-261-1/+7
| | |/ | | | | | | | | | | | | | | | Perform grep on `*Repository` instead of `*Worktree`. Fixes: https://github.com/go-git/go-git/issues/68
| * / feat(clone): add mirror clone optionAyman Bagabas2023-04-171-0/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | Clone remote as a mirror. This fetches all remote refs, implies bare repository, and sets the appropriate configs. Fixes: https://github.com/go-git/go-git/issues/293 Update options.go Co-authored-by: Paulo Gomes <paulo.gomes.uk@gmail.com> Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
| * config: Add Repository Format ExtensionPaulo Gomes2023-03-081-0/+8
| | | | | | | | | | | | Relates to the SHA256 implementation, defined in #706. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
| * Return error instead of creating empty commitsPaulo Gomes2022-12-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BuildTree now returns an ErrEmptyCommit error, when there are no changes to be committed. This can be opted-out via CommitOptions.AllowEmptyCommits. This is a breaking change which enables applications to detect when empty commits are to be created. Some instances in which this can occur is when the fs (e.g. `billy/osfs`) make changes to the underlying files, causing a conflict between what the previous Git worktree state was, and the current state. Changes to the fs implementations are orthogonal to this, and will be dealt with separately. The new behaviour aligns with the Git CLI, in which empty commits returns the error message: 'nothing to commit, working tree clean'. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
| * *: fix typographical errorJames Romeril2022-09-221-1/+1
| |
| * *: fix some typos (#567)cui fliter2022-09-221-2/+2
| | | | | | | | | | Signed-off-by: cui fliter <imcusg@gmail.com> Signed-off-by: cui fliter <imcusg@gmail.com>
* | Add Amend option to CommitOptionsJohn Cai2022-01-031-0/+11
|/ | | | | | Adds an Amend option to CommitOptions that behaves like git --amend. This change includes modifications to the Validate function to disallow a Commit call with both Amend and either Parents or All enabled.
* Merge branch 'master' into jc-push-atomicMáximo Cuadros2021-12-101-0/+17
|\
| * Merge pull request #410 from john-cai/jc-sparseMáximo Cuadros2021-12-101-0/+2
| |\ | | | | | | Worktree: Checkout, simplified sparse checkout
| | * simplified sparse checkoutJohn Cai2021-11-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is the initial logic to support a simple sparse checkout where directories to be included can be specified in CheckoutOptions. This change doesn't fully support the sparse patterns, nor does this change include the optimization to collapse flie entries in ithe index that are excluded via the sparse checkout directory patterns included under the parent directory.
| * | Add ForceWithLease Push OptionJohn Cai2021-11-021-0/+15
| |/ | | | | | | | | | | | | | | --force-with-lease allows a push to force push with some safety measures. If the ref on the remote is what we expect, then the force push is allowed to happen. See https://git-scm.com/docs/git-push#Documentation/git-push.txt---force-with-leaseltrefnamegt for more information
* / Add Atomic to push optionsJohn Cai2021-11-031-0/+2
|/ | | | | | push --atomic allows a push to succeed or fail atomically. If one ref fails, the whole push fails. This commit allows the user to set Atomic as an option for a push.
* Merge pull request #399 from S-Bohn/add-push-optionsMáximo Cuadros2021-11-011-0/+2
|\ | | | | Remote: PushOptions add push-options
| * plumbing: packp, Add encoding for push-options. Fixes #268.Sören Bohn2021-10-261-0/+2
| | | | | | | | go-git: Add field `Options` to `PushOptions`, wire functionality.
* | Document the push refspec formatThibault Jamet2021-10-281-2/+8
|/ | | | | | | | | | Taken from `git help push` and adapted to match the supported features only. Future iterations of this feature may include better support for git "SHA-1 expression", documented in `git help push` as: > any arbitrary "SHA-1 expression", such as master~4 or HEAD (see gitrevisions(7)).
* Merge pull request #375 from noerw/add-remoteurl-optionMáximo Cuadros2021-10-261-1/+7
|\ | | | | Remote: add RemoteURL to {Fetch,Pull,Push}Options
| * Add RemoteURL to {Fetch,Pull,Push}OptionsNorwin2021-09-151-1/+7
| | | | | | | | | | Can be used to override the URL to operate on: RemoteName will be ignored for the actual fetch
* | git: add --follow-tags option for pushesJohn Cai2021-10-051-0/+3
|/ | | | This PR adds support for the --follow-tags option for pushes.
* *: typo fixes #291 Jeff Widman2021-04-161-2/+2
|
* *: replace golang.org/x/crypto/openpgp by ↵Johan Fleury2021-04-061-1/+1
| | | | github.com/ProtonMail/go-crypto/openpgp (#283)
* add RequireRemoteRefs to PushOptions (#258)Andrew Suffield2021-03-251-0/+3
| | | | | | | | | | | | | | | | | | The git protocol itself uses a compare-and-swap mechanism, where changes send the old and new values and the change is only applied if the old value matches. This is used to implement the --force-with-lease feature in git push. go-git populates the `old` field with the current value of the ref that is read from the remote. We can implement a convenient (albeit more limited) form of the --force-with-lease feature just by allowing the caller to specify particular values for this ref. Callers can then implement complex multi-step atomic operations by reading the ref themselves at the start of the process, and passing to in RequireRemoteRefs at the end. This is also a suitable building block for implementing --force-with-lease (#101), which is mostly an exercise in computing the correct hash to require. Hence, this appears to be the most reasonable API to expose.
* Add insecureSkipTLS and cabundle (#228)Daishan Peng2021-01-271-0/+20
| | | | | This PR add insecureSkipTLSVerify and cabundle to any remote http calls so that https repo with private CA signed can be used. This is the equivalent of https.sslVerify and GIT_SSL_CAINFO
* Support `.git/commondir` repository layoutTimofey Kirillov2020-06-151-0/+3
| | | | | | | | | | | | | | | | Git creates `.git/commondir` when there are custom worktrees (see "git worktree add" related commands). `.git/commondir` in such case contains a link to another dot-git repository tree, which could contain some folders like: - objects; - config; - refs; - etc. In this PR a new dotgit.RepositoryFilesystem struct is defined, which is billy.Filesystem interface compatible object-wrapper, that can handle commondir and dispatch all operations to the correct file path. `git.PlainOpen` remain unchanged, but `git.PlainOpenWithOptions` has a new option: `PlainOpenOptions.EnableDotGitCommonDir=true|false` (which is false by default). When `EnableDotGitCommonDir=true` repository-open procedure will read `.git/commondir` (if it exists) and then create dotgit.RepositoryFilesystem object initialized with 2 filesystems. This object then passed into storage and then into dotgit.DotGit as `billy.Filesystem` interface. This object will catch all filesystem operations and dispatch to the correct repository-filesystem (dot-git or common-dot-git) according to the rules described in the doc: https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt. EnableDotGitCommonDir option will only work with the filesystem-backed storage. Also worktree_test.go has been adopted from an older, already existing existing PR: https://github.com/src-d/go-git/pull/1098. This PR needs new fixtures added in the following PR: https://github.com/go-git/go-git-fixtures/pull/1.
* Worktree.AddWithOptions: improve documentation and interfaceMáximo Cuadros2020-06-141-1/+20
|
* feat: add file with using .gitignore, fixed src-d/go-git#1219jk2k2020-06-101-0/+6
|
* CreateTagOptions.Validate: load Tagger from configMáximo Cuadros2020-06-051-2/+34
|
* Merge branch 'master' of github.com:go-git/go-git into scope-configMáximo Cuadros2020-05-241-0/+3
|\