aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #1047 from avoidalone/masterPaulo Gomes2024-03-121-1/+1
|\ | | | | chore: fix some comments
| * *: fix some commentsavoidalone2024-03-121-1/+1
| | | | | | | | Signed-off-by: avoidalone <wuguangdong@outlook.com>
* | git: Implement Merge function with initial FastForwardMerge supportPaulo Gomes2024-03-091-18/+36
| | | | | | | | | | | | | | | | | | | | | | | | 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/+19
|/ | | | | | 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.
* git: validate reference namesAyman Bagabas2023-11-301-1/+8
| | | | | | | | | | Check reference names format before creating branches/tags/remotes. This should probably be in a lower level somewhere in `plumbing`. Validating the names under `plumbing.NewReference*` is not possible since these functions don't return errors. Fixes: https://github.com/go-git/go-git/issues/929
* git: clone --shared implementedenverbisevac2023-10-081-0/+26
|
* git: allow using `InitOptions` with `PlainInitWithOptions`ThinkChaos2023-09-151-1/+1
|
* git: add `PlainInitOptions.Bare`ThinkChaos2023-09-151-11/+12
| | | | Refactor `PlainInit` to call `PlainInitWithOptions`
* *: Bump dependenciesPaulo Gomes2023-07-211-1/+1
| | | | | | | | | | | | - dario.cat/mergo v1.0.0 - github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 - github.com/skeema/knownhosts v1.2.0 - golang.org/x/crypto v0.11.0 - golang.org/x/net v0.12.0 - golang.org/x/sys v0.10.0 - golang.org/x/text v0.11.0 Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* *: Handle paths starting with ~usernameArieh Schneier2023-07-091-10/+8
| | | | Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* *: Handle paths starting with tildericci25112023-07-061-2/+10
|
* Merge pull request #765 from matejrisek/feature/shallow-submodules-optionPaulo Gomes2023-06-071-1/+7
|\ | | | | 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-1/+7
| | | | | | | | | | This option matches the git clone option --shallow-submodules. https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---no-shallow-submodules
* | git: Clone HEAD should not force master. Fixes #363Arieh Schneier2023-06-041-1/+0
| | | | | | | | Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* | git: enable fetch with unqualified referencesArieh Schneier2023-05-251-21/+22
| | | | | | | | Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* | Merge pull request #764 from techknowlogick/init-optionsPaulo Gomes2023-05-231-1/+17
|\ \ | | | | | | git: Allow Initial Branch to be configurable
| * | git: Allow Initial Branch to be configurabletechknowlogick2023-05-211-1/+17
| |/
* / *: Remove use of deprecated io/utilPaulo Gomes2023-05-111-3/+3
|/ | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* plumbing/transport: add ProxyOptions to specify proxy detailsSanskar Jaiswal2023-05-041-0/+1
| | | | Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
* git: fix cloning with branch nameArieh Schneier2023-05-031-2/+14
| | | | Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* feat(clone): add mirror clone optionAyman Bagabas2023-04-171-4/+10
| | | | | | | | | | | | 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/+37
| | | | | | Relates to the SHA256 implementation, defined in #706. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* *: Fix panic for empty revisionsPaulo Gomes2023-03-021-35/+41
| | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* Repository: don't crash accessing invalid pathinfo (#443)Christian Muehlhaeuser2022-01-191-0/+3
| | | | | | | | | | | | | When fs.Stat returns an error, pathinfo may be nil. In such situations the only safe response seems to be to return the error to the caller. Without this fix, accessing pathinfo.IsDir() below would lead to a crash dereferencing a nil pointer. This crash can be reproduced by trying to initialize a Git repo with an invalid path name. Also see: https://github.com/muesli/gitty/issues/36
* error strings: Don't capitalize, use periods, or newlinesAbhinav Gupta2021-12-041-2/+2
| | | | | | | | | | | | | | | | | | | | | Per [Go Code Review Comments][1], > Error strings should not be capitalized (unless beginning with proper > nouns or acronyms) or end with punctuation staticcheck's [ST1005][2] also complains about these. For example, ``` object_walker.go:63:10: error strings should not be capitalized (ST1005) object_walker.go:101:10: error strings should not be capitalized (ST1005) object_walker.go:101:10: error strings should not end with punctuation or a newline (ST1005) plumbing/format/commitgraph/file.go:17:26: error strings should not be capitalized (ST1005) ``` This fixes all instances of this issue reported by staticcheck. [1]: https://github.com/golang/go/wiki/CodeReviewComments#error-strings [2]: https://staticcheck.io/docs/checks/#ST1005
* *: use go-billy instead of os callsMáximo Cuadros2021-05-021-34/+21
|
* Minor doc fixes (#287)Jeff Widman2021-04-161-8/+4
|
* *: replace golang.org/x/crypto/openpgp by ↵Johan Fleury2021-04-061-1/+1
| | | | github.com/ProtonMail/go-crypto/openpgp (#283)
* Add insecureSkipTLS and cabundle (#228)Daishan Peng2021-01-271-6/+8
| | | | | 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 file path in PlainOpenWithOptions - do only when detect flag is enabledAshok Pon Kumar2020-09-021-1/+1
|
* support file path in PlainOpenWithOptionsAshok Pon Kumar2020-09-021-0/+8
|
* Merge pull request #125 from cristaloleg/minor-linter-fixesMáximo Cuadros2020-07-161-6/+6
|\ | | | | *: minor linter fixes
| * Minor linter fixesOleg Kovalov2020-07-061-6/+6
| |
* | Support partial hashes in Repository.ResolveRevision.David Symonds2020-07-161-6/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | Like `git rev-parse <prefix>`, this enumerates the hashes of objects with the given prefix and adds them to the list of candidates for resolution. This has an exhaustive slow path, which requires enumerating all objects and filtering each one, but also a couple of fast paths for common cases. There's room for future work to make this faster; TODOs have been left for that. Fixes #135.
* | Skip error check explicitlyOleg Kovalov2020-07-061-2/+2
|/
* Support `.git/commondir` repository layoutTimofey Kirillov2020-06-151-1/+48
| | | | | | | | | | | | | | | | 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.
* Repository.SetConfig, shortcut to Repository.Storer.SetConfigMáximo Cuadros2020-05-241-1/+10
|
* Repository.ConfigScoped and Repository.Commit with empty author supportMáximo Cuadros2020-05-241-12/+46
|
* *: migration from gopkg to go modulesMáximo Cuadros2020-03-101-13/+13
|
* add `PathFilter func(string) bool` to LogOptionsSaeed Rasooli2019-11-291-0/+11
| | | | Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
* add NewCommitPathIterFromIter that accepts pathFilter func(string) boolSaeed Rasooli2019-11-291-1/+7
| | | | | | keep NewCommitFileIterFromIter for compatibilty for now 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>
* git : allows to create a Remote without a RepositoryValentin Cocaud2019-06-171-4/+4
| | | | Signed-off-by: Valentin Cocaud <v.cocaud@gmail.com>
* improve ResolveRevision's Ref lookup pathMike Lundy2019-05-141-44/+37
| | | | | | | | | | 1) lookups on an annotated tag oid now work 2) there was a lot of complexity around detection of ambiguity, but unlike git, ambiguous refs are rejected (which causes bugs like #823). The new code matches rev-parse's behavior (prefer the OID), though there is no warning path to report the same warning. Signed-off-by: Mike Lundy <mike@fluffypenguin.org>
* add Repository.CreateRemoteAnonymousniukuo2019-03-221-0/+17
| | | | Signed-off-by: niukuo <niukuo@gmail.com>
* Refine Log.kuba--2019-01-101-40/+59
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* Implement git log --allkuba--2019-01-071-24/+47
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* git: return better error message when packfile cannot be downloadedJavi Fontan2018-11-301-0/+4
| | | | | | | | Previously the error message when the connection was closed while fetching was "object not found" and was misleading. Now when the packfile size is 0 the error "unable to fetch packfile" is returned. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* repository: fix plain clone error handling regressionSantiago M. Mola2018-11-271-11/+14
| | | | | | | | | | | PR #1008 introduced a regression by changing the errors returned by PlainClone when a repository did not exist. This change goes back to returned errors as they were in v4.7.0. Fixes #1027 Signed-off-by: Santiago M. Mola <santi@mola.io>
* repository: Fix RefSpec for a single tag. Fixes #960Fedor Korotkov2018-11-071-15/+19
| | | | Signed-off-by: Fedor Korotkov <fedor.korotkov@gmail.com>