162 Commits

Author SHA1 Message Date
enverbisevac
479d3e952e git: clone --shared implemented 2023-10-08 00:40:30 +02:00
ThinkChaos
644929ade3 git: allow using InitOptions with PlainInitWithOptions 2023-09-15 12:44:52 -04:00
ThinkChaos
1ad7d8dd02 git: add PlainInitOptions.Bare
Refactor `PlainInit` to call `PlainInitWithOptions`
2023-09-15 12:44:52 -04:00
Arieh Schneier
5dad9b2303 *: Handle paths starting with ~username
Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
2023-07-09 17:08:04 +10:00
ricci2511
a9a658ee4e *: Add test for paths starting with tilde 2023-07-07 14:44:54 +02:00
Paulo Gomes
35f7e67703 Merge pull request #765 from matejrisek/feature/shallow-submodules-option
git: add a clone option to allow for shallow cloning of submodules
2023-06-07 23:56:59 +01:00
matej.risek
2d6af16bf6 git: add a clone option to allow for shallow cloning of submodules
This option matches the git clone option --shallow-submodules.
https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---no-shallow-submodules
2023-06-05 13:59:34 +02:00
Arieh Schneier
5889b758b3 git: Clone HEAD should not force master. Fixes #363
Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
2023-06-04 11:28:26 +10:00
Paulo Gomes
1feac1b959 Merge pull request #764 from techknowlogick/init-options
git: Allow Initial Branch to be configurable
2023-05-23 09:23:27 +01:00
techknowlogick
1aa8e89403 git: Allow Initial Branch to be configurable 2023-05-21 02:24:39 -04:00
Arieh Schneier
b8dd39abcc git: Testing, Fix tests not cleaning temp folders
Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
2023-05-11 11:17:04 +10:00
Arieh Schneier
a4b11abc55 git: fix cloning with branch name
Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
2023-05-03 14:01:24 +10:00
Ayman Bagabas
9a5b08f5c3 feat(clone): add mirror clone option
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>
2023-04-17 17:43:46 -04:00
Paulo Gomes
3486338715 *: Fix panic for empty revisions
Signed-off-by: Paulo Gomes <pjbgf@linux.com>
2023-03-02 21:17:11 +00:00
Christian Muehlhaeuser
935af59cf6 Repository: don't crash accessing invalid pathinfo (#443)
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
2022-01-19 15:51:13 +01:00
Máximo Cuadros
f0b111ab70 Merge pull request #425 from abhinav/error-strings
error strings: Don't capitalize, use periods, or newlines
2021-12-11 12:02:17 +01:00
Abhinav Gupta
4ccea5bb8d Fix repository_test
The test verifies the exact error message.
2021-12-10 01:07:51 -08:00
John Cai
f92011d95f simplified sparse checkout
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.
2021-11-09 08:45:09 -05:00
Máximo Cuadros
01df753699 *: use go-billy instead of os calls 2021-05-02 23:40:08 +02:00
Jeff Widman
a50d22d149 Repository: test, use raw string to avoid double-escape (#288) 2021-04-16 11:53:38 +02:00
Johan Fleury
bd662b091f *: replace golang.org/x/crypto/openpgp by github.com/ProtonMail/go-crypto/openpgp (#283) 2021-04-06 10:58:10 +02:00
Andrew Suffield
e5bbc4d109 plumbing: wire up contexts for Transport.AdvertisedReferences (#246)
* plumbing: wire up contexts for Transport.AdvertisedReferences

* add more tests for context wiring
2021-03-26 17:03:49 +01:00
Ashok Pon Kumar
70b98de494 support file path in PlainOpenWithOptions - do only when detect flag is enabled 2020-09-02 09:19:55 +05:30
Ashok Pon Kumar
e7be6a4e24 support file path in PlainOpenWithOptions 2020-09-02 00:01:12 +05:30
Máximo Cuadros
641ee1dd69 Merge pull request #125 from cristaloleg/minor-linter-fixes
*: minor linter fixes
2020-07-16 21:29:58 +02:00
David Symonds
e28d9c90aa Support partial hashes in Repository.ResolveRevision.
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.
2020-07-16 12:53:37 +10:00
Oleg Kovalov
a99446e290 Minor linter fixes 2020-07-06 17:40:53 +02:00
Oleg Kovalov
27a034c764 fix goreportcard warnings 2020-07-01 20:51:24 +02:00
Máximo Cuadros
531a81eae6 CreateTagOptions.Validate: load Tagger from config 2020-06-05 07:02:15 +02:00
Máximo Cuadros
86c0c01092 Repository.ConfigScoped and Repository.Commit with empty author support 2020-05-24 11:23:04 +02:00
Máximo Cuadros
9d0f15c4fa ci: based on github actions 2020-03-15 21:18:32 +01:00
Máximo Cuadros
2637279338 *: migration from go-git-fixtures/v4 and go-git/gcfg 2020-03-10 01:41:19 +01:00
Máximo Cuadros
2bdfd91f04 *: migration from gopkg to go modules 2020-03-10 00:40:56 +01:00
Saeed Rasooli
027dadf289 add back test for NewCommitFileIterFromIter
Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
2019-11-29 16:46:45 +03:30
Saeed Rasooli
e0378b2c67 repository_test.go: add TestLogPathFilterRegexp
Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
2019-11-29 16:46:45 +03:30
Saeed Rasooli
224f047f4f add PathFilter func(string) bool to LogOptions
Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
2019-11-29 16:46:44 +03:30
Saeed Rasooli
f54ee6d2b1 add NewCommitPathIterFromIter that accepts pathFilter func(string) bool
keep NewCommitFileIterFromIter for compatibilty for now

Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
2019-11-29 16:46:43 +03:30
knqyf263
c7fc75ef6e Add limiting options to git log
Signed-off-by: knqyf263 <knqyf263@gmail.com>
2019-08-04 23:27:33 -10:00
knqyf263
d1f089794a Add TestLogFileWithError for coverage
Signed-off-by: knqyf263 <knqyf263@gmail.com>
2019-08-03 23:24:33 -10:00
knqyf263
d7c00b034f Handle io.EOF error in commitFileIter.ForEach
Signed-off-by: knqyf263 <knqyf263@gmail.com>
2019-08-03 17:08:34 -10:00
knqyf263
0373247790 Add assertion for unhandled error in TestLogFile
Signed-off-by: knqyf263 <knqyf263@gmail.com>
2019-08-03 16:40:35 -10:00
Christian Muehlhaeuser
172a0d8a0e *: added missing error checks in tests
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)
2019-07-29 17:32:34 +02:00
Nao YONASHIRO
8beb3ee820 Worktree: improve build index performance. (#1179) 2019-07-25 10:56:22 +02:00
Mike Lundy
33f05f3773 improve ResolveRevision's Ref lookup path
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>
2019-05-14 16:41:32 -07:00
niukuo
8b789adc35 add Repository.CreateRemoteAnonymous
Signed-off-by: niukuo <niukuo@gmail.com>
2019-03-22 16:32:01 +08:00
Antonio Jesus Navarro Perez
6c2a0daafc Ignore missing references on log --all
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>
2019-02-12 17:09:04 +01:00
kuba--
3180dff8c5 Implement git log --all
Signed-off-by: kuba-- <kuba@sourced.tech>
2019-01-07 08:52:54 +01:00
Santiago M. Mola
7441885e61 repository: fix plain clone error handling regression
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>
2018-11-27 13:18:52 +01:00
Fedor Korotkov
3ab4ee58fe repository: Fix RefSpec for a single tag. Fixes #960
Signed-off-by: Fedor Korotkov <fedor.korotkov@gmail.com>
2018-11-07 08:43:24 -05:00
Santiago M. Mola
3332e8d67d improve cleanup implementation, add more tests
Signed-off-by: Santiago M. Mola <santi@mola.io>
2018-10-30 13:10:00 +01:00