aboutsummaryrefslogtreecommitdiffstats
path: root/repository_test.go
Commit message (Collapse)AuthorAgeFilesLines
* Repository: don't crash accessing invalid pathinfo (#443)Christian Muehlhaeuser2022-01-191-0/+5
| | | | | | | | | | | | | 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
* Merge pull request #425 from abhinav/error-stringsMáximo Cuadros2021-12-111-1/+1
|\ | | | | error strings: Don't capitalize, use periods, or newlines
| * Fix repository_testAbhinav Gupta2021-12-101-1/+1
| | | | | | | | The test verifies the exact error message.
* | simplified sparse checkoutJohn Cai2021-11-091-0/+31
|/ | | | | | | | | 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.
* *: use go-billy instead of os callsMáximo Cuadros2021-05-021-106/+157
|
* Repository: test, use raw string to avoid double-escape (#288)Jeff Widman2021-04-161-1/+1
|
* *: replace golang.org/x/crypto/openpgp by ↵Johan Fleury2021-04-061-3/+3
| | | | github.com/ProtonMail/go-crypto/openpgp (#283)
* plumbing: wire up contexts for Transport.AdvertisedReferences (#246)Andrew Suffield2021-03-261-6/+6
| | | | | * plumbing: wire up contexts for Transport.AdvertisedReferences * add more tests for context wiring
* support file path in PlainOpenWithOptions - do only when detect flag is enabledAshok Pon Kumar2020-09-021-1/+5
|
* support file path in PlainOpenWithOptionsAshok Pon Kumar2020-09-021-0/+10
|
* Merge pull request #125 from cristaloleg/minor-linter-fixesMáximo Cuadros2020-07-161-1/+1
|\ | | | | *: minor linter fixes
| * Minor linter fixesOleg Kovalov2020-07-061-1/+1
| |
* | Support partial hashes in Repository.ResolveRevision.David Symonds2020-07-161-0/+1
|/ | | | | | | | | | | | | 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.
* fix goreportcard warningsOleg Kovalov2020-07-011-0/+1
|
* CreateTagOptions.Validate: load Tagger from configMáximo Cuadros2020-06-051-9/+1
|
* Repository.ConfigScoped and Repository.Commit with empty author supportMáximo Cuadros2020-05-241-0/+15
|
* ci: based on github actionsv5.0.0Máximo Cuadros2020-03-151-5/+1
|
* *: migration from go-git-fixtures/v4 and go-git/gcfgMáximo Cuadros2020-03-101-6/+2
|
* *: migration from gopkg to go modulesMáximo Cuadros2020-03-101-16/+16
|
* add back test for NewCommitFileIterFromIterSaeed Rasooli2019-11-291-0/+11
| | | | Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
* repository_test.go: add TestLogPathFilterRegexpSaeed Rasooli2019-11-291-0/+36
| | | | Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
* add `PathFilter func(string) bool` to LogOptionsSaeed Rasooli2019-11-291-0/+15
| | | | Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
* add NewCommitPathIterFromIter that accepts pathFilter func(string) boolSaeed Rasooli2019-11-291-4/+7
| | | | | | keep NewCommitFileIterFromIter for compatibilty for now Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
* Add limiting options to git logknqyf2632019-08-041-1/+131
| | | | Signed-off-by: knqyf263 <knqyf263@gmail.com>
* Add TestLogFileWithError for coverageknqyf2632019-08-031-1/+23
| | | | Signed-off-by: knqyf263 <knqyf263@gmail.com>
* Handle io.EOF error in commitFileIter.ForEachknqyf2632019-08-031-1/+1
| | | | Signed-off-by: knqyf263 <knqyf263@gmail.com>
* Add assertion for unhandled error in TestLogFileknqyf2632019-08-031-4/+8
| | | | Signed-off-by: knqyf263 <knqyf263@gmail.com>
* *: added missing error checks in testsChristian Muehlhaeuser2019-07-291-1/+3
| | | | | | | | | | When we assign a value to err, make sure to also check for it being nil afterwards. If those were intentionally unchecked, we should remove the assignment in the first place. Those checks certainly never harm, but please review thoroughly and let me know. Signed-off-by: Christian Muehlhaeuser <muesli@gmail.com> (cherry picked from commit 19d6f42a4d814a50bd262fbb69a9b670db9756a2)
* Worktree: improve build index performance. (#1179)Nao YONASHIRO2019-07-251-0/+20
|
* improve ResolveRevision's Ref lookup pathMike Lundy2019-05-141-5/+5
| | | | | | | | | | 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/+30
| | | | Signed-off-by: niukuo <niukuo@gmail.com>
* Ignore missing references on log --allAntonio Jesus Navarro Perez2019-02-121-0/+62
| | | | | | To mimic the actual standard git behavior, we must ignore references that are pointing to wrong/unexistent objects. Signed-off-by: Antonio Jesus Navarro Perez <antnavper@gmail.com>
* Implement git log --allkuba--2019-01-071-6/+122
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* repository: fix plain clone error handling regressionSantiago M. Mola2018-11-271-8/+43
| | | | | | | | | | | 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-0/+26
| | | | Signed-off-by: Fedor Korotkov <fedor.korotkov@gmail.com>
* improve cleanup implementation, add more testsSantiago M. Mola2018-10-301-6/+48
| | | | Signed-off-by: Santiago M. Mola <santi@mola.io>
* repository: added cleanup for the PlainCloneContext()Bartek Jaroszewski2018-10-301-5/+43
| | | | Signed-off-by: Bartek Jaroszewski <jaroszewskibartek@gmail.com>
* Merge pull request #984 from mcuadros/open-bareMáximo Cuadros2018-10-161-5/+5
|\ | | | | repository: allow open non-bare repositories as bare
| * repository: allow open non-bare repositories as bareMáximo Cuadros2018-10-151-5/+5
| | | | | | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* | teach ResolveRevision how to look up annotated tags, testMáximo Cuadros2018-10-151-2/+1
| | | | | | | | 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-13/+629
|\ \
| * \ Merge pull request #828 from fooker/patch-1Máximo Cuadros2018-10-151-0/+13
| |\ \ | | | | | | | | Use remote name in fetch while clone
| | * | use remote name in fetch while clone, testMáximo Cuadros2018-10-151-0/+13
| | | | | | | | | | | | | | | | 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/+139
| | |/ | |/| | | | plumbing: object, Add support for Log with filenames. Fixes #826
| * | repository: fix test for new Storage constructorMáximo Cuadros2018-09-101-7/+5
| | | | | | | | | | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
| * | Merge branch 'master' of github.com:src-d/go-git into f-add-tagging-supportMáximo Cuadros2018-09-101-16/+8
| |\ \
| | * | Expose Storage cache.kuba--2018-09-071-19/+11
| | | | | | | | | | | | | | | | Signed-off-by: kuba-- <kuba@sourced.tech>
| * | | git: s/TagObjectOptions/CreateTagOptions/Chris Marchesi2018-09-071-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Add some tests for annotated tag deletionChris Marchesi2018-09-071-3/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a couple of tests for annotated tag deletion: * The first one is a general test and should work regardless of the fixture used - the tag object could possibly be packed, so we do a prune *and* a repack operation before testing to see if the object was GCed correctly. * The second one actually creates the tag to be deleted, so that the tag object gets created as a loose, unpacked object. This is so we can effectively test that purning unpacked objects is now working 100% correctly (this was failing before because tag objects were not supported for walking). 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-35/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>