aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
Commit message (Collapse)AuthorAgeFilesLines
* Minor linter fixesOleg Kovalov2020-07-061-6/+6
|
* 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>
* improve cleanup implementation, add more testsSantiago M. Mola2018-10-301-49/+61
| | | | Signed-off-by: Santiago M. Mola <santi@mola.io>
* repository: added cleanup for the PlainCloneContext()Bartek Jaroszewski2018-10-301-1/+59
| | | | Signed-off-by: Bartek Jaroszewski <jaroszewskibartek@gmail.com>
* Merge pull request #984 from mcuadros/open-bareMáximo Cuadros2018-10-161-9/+4
|\ | | | | repository: allow open non-bare repositories as bare
| * repository: allow open non-bare repositories as bareMáximo Cuadros2018-10-151-9/+4
| | | | | | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* | Merge branch 'master' of github.com:src-d/go-git into annotatedMáximo Cuadros2018-10-151-29/+196
|\ \
| * \ Merge pull request #828 from fooker/patch-1Máximo Cuadros2018-10-151-5/+6
| |\ \ | | | | | | | | Use remote name in fetch while clone
| | * | use remote name in fetch while clone, testMáximo Cuadros2018-10-151-1/+1
| | | | | | | | | | | | | | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
| | * | Use remote name in fetch while cloneDustin Frisch2018-05-091-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | Fixes #827 Signed-off-by: Dustin Frisch <fooker@lab.sh>
| * | | Plumbing: object, Add support for Log with filenames. Fixes #826 (#979)Nithin Gangadharan2018-10-111-6/+13
| | |/ | |/| | | | plumbing: object, Add support for Log with filenames. Fixes #826
| * | Merge branch 'master' of github.com:src-d/go-git into f-add-tagging-supportMáximo Cuadros2018-09-101-11/+5
| |\ \
| | * | Expose Storage cache.kuba--2018-09-071-8/+3
| | | | | | | | | | | | | | | | Signed-off-by: kuba-- <kuba@sourced.tech>
| | * | git: do not expose storage options in PlainOpenJavi Fontan2018-08-311-1/+1
| | | | | | | | | | | | | | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
| | * | git, storer: use a common storer.Options for storer and PlainOpenJavi Fontan2018-08-301-5/+1
| | | | | | | | | | | | | | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
| | * | git: add Static option to PlainOpenJavi Fontan2018-08-301-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also adds Static configuration to Storage and DotGit. This option means that the git repository is not expected to be modified while open and enables some optimizations. Each time a file is accessed the storer tries to open an object file for the requested hash. When this is done for a lot of objects it is expensive. With Static option a list of object files is generated the first time an object is accessed and used to check if exists instead of using system calls. A similar optimization is done for packfiles. Signed-off-by: Javi Fontan <jfontan@gmail.com>
| * | | git: s/TagObjectOptions/CreateTagOptions/Chris Marchesi2018-09-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Don't touch tag objects orphaned by tag deletionChris Marchesi2018-09-071-16/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deleting a tag ref for an annotated tag in normal git behavior does not delete the tag object right away. This is handled by the normal GC process. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
| * | | git: s/fetch/returns/ on Tag function docChris Marchesi2018-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is to avoid any ambiguity with the act of "fetching" in git in general. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
| * | | git: Don't return tag object with Tag, adjust docs for Tag and TagsChris Marchesi2018-08-231-15/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've mainly noticed that in using the current Tag function, that there were lots of times that I was ignoring the ref or the object, depending on what I needed. This was evident in the tests as well. As such, I think it just makes more sense for a singular tag fetcher to return just a ref, through which the caller may grab the annotation if they need it, and if it exists. Also, contrary to the docs on Tags, all tags have a ref, even if they are annotated. The difference between a lightweight tag and an annotated tag is the presence of the tag object, which the ref will point to if the tag is annotated. As such I've adjusted the docs with an example as to how one can get the annotation for a tag ref through the iterator. Source: https://git-scm.com/book/en/v2/Git-Internals-Git-References, tags section. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
| * | | git: Discern tag target type from supplied hashChris Marchesi2018-08-231-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Add tagging supportChris Marchesi2018-08-211-1/+133
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Fixed cloning of a single tagFedor Korotkov2018-08-081-3/+3
| | | | | | | | | | | | | | | | | | Relates to #870 Signed-off-by: Fedor Korotkov <fedor.korotkov@gmail.com>
| * | Fix wrong godoc on Tags() method.Antonio Jesus Navarro Perez2018-07-301-2/+3
| | | | | | | | | | | | | | | | | | Reword Tags() method documentation. Point to TagObjects() method to get all the tags on a repository. Signed-off-by: Antonio Jesus Navarro Perez <antnavper@gmail.com>
| * | Fix documentation for NotesMorgan2018-06-161-1/+2
| |/ | | | | | | | | | | It previously said that it returned all references that are branches, but that's not true. Signed-off-by: Morgan Bazalgette <the@howl.moe>
* / Teach ResolveRevision how to look up annotated tagsMike Lundy2018-05-111-10/+35
|/ | | | Signed-off-by: Mike Lundy <mike@fluffypenguin.org>
* git: worktree, Skip special git directory. Fixes #814kuba--2018-04-181-6/+9
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* Resolve full commit sha to plumbing hashantham2018-04-161-5/+20
| | | | Signed-off-by: antham <hamonanth@gmail.com>
* config: adds branches to config for tracking branches against remotes, ↵Jeremy Chambers2018-04-101-2/+77
| | | | | | updates clone to track when cloning a branch. Fixes #313 Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>
* add PlainOpen variant to find .git in parent dirsDaniel Martí2018-04-031-6/+32
| | | | | | | | | 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>
* *: Use CheckClose with named returnsJavi Fontan2018-03-271-4/+2
| | | | | | | | Previously some close errors were losts. This is specially problematic in go-git as lots of work is done here like generating indexes and moving packfiles. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* add LogOrder, LogOptions.Order, implement Order=LogOrderCommitterTime and ↵Saeed Rasooli2018-03-051-1/+13
| | | | | | Order=LogOrderBSF Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
* Support for clone without checkoutMichael Rykov2018-01-171-1/+1
|
* Fix revision solver for branch and tag (#660)Anthony HAMON2017-12-011-28/+15
| | | fix Repository.ResolveRevision for branch and tag
* repository: add tests for pruning and object re-packingJeremy Stribling2017-11-291-0/+17
| | | | | Also, object re-packing should clean up any loose objects that were packed.
* storer: separate loose and packed object mgmt into optional ifacesJeremy Stribling2017-11-291-10/+16
| | | | Suggested by mcuadros.