aboutsummaryrefslogtreecommitdiffstats
path: root/options.go
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* 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
|\
| * Remote.Push: support force optionkappyhappy2020-05-211-1/+4
| |
* | Repository.ConfigScoped and Repository.Commit with empty author supportMáximo Cuadros2020-05-241-3/+43
|/
* *: migration from gopkg to go modulesMáximo Cuadros2020-03-101-5/+5
|
* add `PathFilter func(string) bool` to LogOptionsSaeed Rasooli2019-11-291-0/+7
| | | | Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
* Add limiting options to git logknqyf2632019-08-041-0/+9
| | | | Signed-off-by: knqyf263 <knqyf263@gmail.com>
* add Prune option to PushOptionsStanislav Seletskiy2019-07-251-0/+3
| | | | Signed-off-by: Stanislav Seletskiy <s.seletskiy@gmail.com>
* Keep local changes when checkout branch in worktree.Linuxer Wang2019-05-151-0/+5
| | | | Signed-off-by: Linuxer Wang <linuxerwang@gmail.com>
* Merge pull request #1072 from jeremyschlatter/patch-3Máximo Cuadros2019-03-041-1/+1
|\ | | | | git: Fix typo
| * git: Fix typoJeremy Schlatter2019-02-221-1/+1
| | | | | | Signed-off-by: Jeremy Schlatter <jeremy.schlatter@gmail.com>
* | git: Fix typoJeremy Schlatter2019-02-221-1/+1
|/ | | Signed-off-by: Jeremy Schlatter <jeremy.schlatter@gmail.com>
* Implement git log --allkuba--2019-01-071-0/+5
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* repository: improve CheckoutOption.Hash docMáximo Cuadros2018-10-161-2/+3
| | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* Plumbing: object, Add support for Log with filenames. Fixes #826 (#979)Nithin Gangadharan2018-10-111-0/+4
| | | plumbing: object, Add support for Log with filenames. Fixes #826
* git: s/TagObjectOptions/CreateTagOptions/Chris Marchesi2018-09-071-3/+3
| | | | | | | Just renaming the TagObjectOptions type to CreateTagOptions so that it's consistent with the other option types. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* git: Discern tag target type from supplied hashChris Marchesi2018-08-231-12/+0
| | | | | | | | | | I figured there was a way to do this without having to have TagObjectOptions supply this in - there is. Added support for this in and removed the object type from TagObjectOptions. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* git: Canonicalize incoming annotated tag messagesChris Marchesi2018-08-211-1/+7
| | | | | | | | | | Tag messages are highly sensitive to being in the expected format, especially when encoding/decoding for PGP verification. As such, we do a simple trimming of whitespace on the incoming message and add a newline on the end, to ensure there are no surprises here. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* git: Add tagging supportChris Marchesi2018-08-211-2/+45
| | | | | | | | | | | | | | | | | | | | | | | This adds a few methods: * CreateTag, which can be used to create both lightweight and annotated tags with a supplied TagObjectOptions struct. PGP signing is possible as well. * Tag, to fetch a single tag ref. As opposed to Tags or TagObjects, this will also fetch the tag object if it exists and return it along with the output. Lightweight tags just return the object as nil. * DeleteTag, to delete a tag. This simply deletes the ref. The object is left orphaned to be GCed later. I'm not 100% sure if DeleteTag is the correct behavior - looking for details on exactly *what* happens to a tag object if you delete the ref and not the tag were sparse, and groking the Git source did not really produce much insight to the untrained eye. This may be something that comes up in review. If deletion of the object is necessary, the in-memory storer may require some updates to allow DeleteLooseObject to be supported. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* git: Add ability to PGP sign commitsChris Marchesi2018-08-161-0/+4
| | | | | | | | | | This adds the ability to sign commits by adding the SignKey field to CommitOptions. If present, the commit will be signed during the WorkTree.Commit call. The supplied SignKey must already be decrypted by the caller. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* add PlainOpen variant to find .git in parent dirsDaniel Martí2018-04-031-0/+11
| | | | | | | | | This is the git tool's behavior that people are used to; if one runs a git command in a repository's subdirectory, git still works. Fixes #765. Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
* add LogOrder, LogOptions.Order, implement Order=LogOrderCommitterTime and ↵Saeed Rasooli2018-03-051-0/+15
| | | | | | Order=LogOrderBSF Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
* Support for clone without checkoutMichael Rykov2018-01-171-0/+2
|
* git: Worktree.Grep() support multiple patterns and pathspecsSunny2017-12-201-4/+4
| | | | Signed-off-by: Sunny <me@darkowlzz.space>
* git: worktree, add Grep() method for git grep (#686)Sunny2017-12-121-0/+38
| | | This change implemented grep on worktree with options to invert match and specify pathspec. Also, a commit hash or reference can be used to specify the worktree to search.
* git: worktree, add Clean() method for git cleanSunny2017-12-041-0/+5
| | | | | | | This change implement git clean with a `Dir` option. By default, clean removes only the untracked files in the working directory. If `Dir` option is set to true, untracked files under other directories are also cleaned.
* Support non-force fetchesNick Thomas2017-11-271-0/+6
|
* Create ListOptions and rename LSRemote to List.Sunny2017-10-041-0/+6
|
* Repository.Clone added Tags option, and set by default AllTags as git doesMáximo Cuadros2017-09-041-6/+18
|