aboutsummaryrefslogtreecommitdiffstats
path: root/worktree.go
Commit message (Collapse)AuthorAgeFilesLines
* git: worktree, add RestoreStaged which works like the "git restore --staged ↵Ben Talbot2024-04-191-9/+81
| | | | | | | | | | <file>..." command Small formatting and style fixes before rebasing against master Setup args for restore in TestExamples Fix typo in error message and remove dependency on fmt in worktree_test
* git: worktree, Don't panic on empty or root path when checking if it is validtim7752024-03-061-0/+4
| | | | I didn't dig into the specific case that was triggering this, but we did have a panic in our production system.
* git: worktree checkout tag hash id (#959)Ayman Bagabas2023-12-121-13/+10
| | | | | | | Allow checking out a worktree using a tag hash id. Fixes: https://github.com/go-git/go-git/issues/959 Supersedes: https://github.com/go-git/go-git/pull/964
* git: worktree, Align validation with upstream rulesPaulo Gomes2023-12-081-0/+107
| | | | | | | | Some worktree validation rules observed upstream are not checked by go-git, leading to scenarios in which what seems to be a valid repository for go-git is not necessarily the case for the git cli. Signed-off-by: Paulo Gomes <paulo.gomes@suse.com>
* Merge pull request #939 from dhoizner/fix-pull-after-shallowPaulo Gomes2023-12-011-2/+11
|\ | | | | git: stop iterating at oldest shallow when pulling. Fixes #305
| * git: stop iterating at oldest shallow when pulling. Fixes #305Dan Hoizner2023-11-271-2/+11
| |
* | git: validate reference namesAyman Bagabas2023-11-301-0/+4
|/ | | | | | | | | | 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: worktree:: apply ProxyOption on Pull. Fixes #840nodivbyzero2023-09-151-0/+1
|
* git: worktree, reset ignored files that are part of the worktree: Fixes #819Stephan2023-09-041-2/+2
|
* *: Remove use of deprecated io/utilPaulo Gomes2023-05-111-3/+2
| | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* fix: git grep bare repositoriesAyman Bagabas2023-04-261-8/+13
| | | | | | Perform grep on `*Repository` instead of `*Worktree`. Fixes: https://github.com/go-git/go-git/issues/68
* git: worktree: check for empty parent dirs during Reset (Fixes #670) (#671)mbohy2023-01-281-10/+39
| | | | | | | | | | When we delete dir1/dir2/file1, we currently check if dir2 becomes empty with the deletion of file1, and if so, we delete dir2. If dir1 becomes empty with the deletion of dir2, we don't notice that, and dir1 is left behind. This commit adds a loop to check each parent directory in the file path for emptiness, removing empty directories along the way until a non-empty directory is found (or an error occurs).
* Optimize zlib reader and consolidate sync.poolsPaulo Gomes2022-11-071-12/+4
| | | | | | | | | | | | | | | | | | | Expands on the optimisations from https://github.com/fluxcd/go-git/pull/5 and ensures that zlib reader does not need to recreate a deflate dictionary at every use. The use of sync pools was consolidated into a new sync utils package. name old time/op new time/op delta Parser-16 7.51ms ± 3% 7.71ms ± 6% ~ (p=0.222 n=5+5) name old alloc/op new alloc/op delta Parser-16 4.65MB ± 3% 1.90MB ± 3% -59.06% (p=0.008 n=5+5) name old allocs/op new allocs/op delta Parser-16 3.48k ± 0% 3.32k ± 0% -4.57% (p=0.016 n=5+4) Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* Use Sync.Pool pointers to optimise memory usagePaulo Gomes2022-11-071-3/+5
| | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* simplified sparse checkoutJohn Cai2021-11-091-7/+18
| | | | | | | | | 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 RemoteURL to {Fetch,Pull,Push}OptionsNorwin2021-09-151-0/+1
| | | | | Can be used to override the URL to operate on: RemoteName will be ignored for the actual fetch
* Minor doc fixes (#287)Jeff Widman2021-04-161-1/+1
|
* worktree: Don't remove root directory when cleaning (#230)hansmi2021-01-271-1/+1
| | | | | | | When using a separate worktree directory while working on a bare repository, cleaning with CleanOptions{Dir: true} would also remove the root worktree directory if empty. Signed-off-by: Michael Hanselmann <public@hansmi.ch>
* Add insecureSkipTLS and cabundle (#228)Daishan Peng2021-01-271-5/+7
| | | | | 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
* Fix relative submodule resolutionAxel Christ2020-10-281-22/+0
| | | | | | | | | | | | | | | | | With the current behavior, the config will always hold the resolved, absolute URL, leavin the user of go-git no choice to determine whether the original URL is relative or not. This changes to employ relative URL resolution only when resolving a submodule to a repository to keep the correct configuration 'unresolved' and intact. Change relative resolution using `filepath.Dir` to `path.Join` while parsing both the 'root' and the relative URL with `net/url.URL`. Adapt test to verify the new behavior. Re-fixes #184 (see comments).
* git: worktree, Support relative submodule URL.Mitsutaka Naito2020-10-131-1/+27
|
* fix goreportcard warningsOleg Kovalov2020-07-011-2/+1
|
* Report "Already up to date" when local repository ahead of remoteMathias Rüdiger2020-06-221-1/+7
| | | | | | | If you run 'git pull', do a commit and run 'git pull' again git will report "Already up to date" whereas go-git would report a reports non-fast-forward update. This commit changes the behavior of go-git to match that of git.
* *: migration from gopkg to go modulesMáximo Cuadros2020-03-101-12/+12
|
* Worktree: improve build index performance. (#1179)Nao YONASHIRO2019-07-251-17/+56
|
* use constant instead of literal stringnoonehereplzgo2019-06-111-1/+1
| | | | Signed-off-by: Mohammad Kefah <mo@edraj.io>
* Keep local changes when checkout branch in worktree.Linuxer Wang2019-05-151-0/+2
| | | | Signed-off-by: Linuxer Wang <linuxerwang@gmail.com>
* git: remove potentially duplicate check for unstaged filesTobias Meinhardt2019-03-051-11/+0
| | | | Signed-off-by: Tobias Meinhardt <tobias.meinhardt89@gmail.com>
* worktree: add sentinel error for non-fast-forward pullAlexey Smirnov2019-02-071-5/+6
| | | | Signed-off-by: Alexey Smirnov <unlinkat@gmail.com>
* Add Status.IsUntracked functionkuba--2018-08-291-3/+1
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* Remove empty dirs when cleaning with Dir opt.kuba--2018-08-291-14/+44
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* worktree: Don't allow .gitmodules to be a symlink. Fixes CVE-2018-11235Joseph Vusich2018-05-301-0/+12
| | | | | | | | | References: * https://blogs.msdn.microsoft.com/devops/2018/05/29/announcing-the-may-2018-git-security-vulnerability/ * https://security-tracker.debian.org/tracker/CVE-2018-11235 * https://github.com/git/git/commit/10ecfa76491e4923988337b2e2243b05376b40de Signed-off-by: Joseph Vusich <jvusich@amazon.com>
* Worktree: Provide ability to add excludes (#825)Alan D. Cabrera2018-05-111-0/+3
| | | Worktree: Provide ability to add excludes
* Added support for non-symlink checkouts on Windows when elevated rights are ↵Felix Kollmann2018-03-121-0/+16
| | | | | | missing This implementation mimicks the behavior of Git on Windows Signed-off-by: Felix Kollmann <mail@fkollmann.de>
* all: remove some unused codeDaniel Martí2018-03-011-4/+0
| | | | Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
* git: Worktree.Grep() support multiple patterns and pathspecsSunny2017-12-201-23/+61
| | | | Signed-off-by: Sunny <me@darkowlzz.space>
* git: worktree, add Grep() method for git grep (#686)Sunny2017-12-121-0/+100
| | | 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/+27
| | | | | | | 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/+1
|
* update to go-billy.v4 and go-git-fixtures.v3Máximo Cuadros2017-11-231-2/+2
| | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* Fix spelling Unstagged -> UnstagedBenjamin Nørgaard2017-10-081-3/+3
|
* Worktree.Reset ignore untracked files on Merge modeMáximo Cuadros2017-09-011-73/+115
|
* Merge pull request #531 from mcuadros/ref-nameMáximo Cuadros2017-08-021-3/+3
|\ | | | | plumbing: moved `Reference.Is*` methods to `ReferenceName.Is*`
| * *: use the new API for ReferenceName.Is* methodsMáximo Cuadros2017-08-021-3/+3
| |
* | reuse Auth method when recursing submodules, fixes #521Devon Barrett2017-07-291-7/+7
|/
* Merge pull request #513 from mcuadros/worktree-fsMáximo Cuadros2017-07-271-10/+12
|\ | | | | worktree: expose underlying filesystem
| * worktree: expose underlying filesystemMáximo Cuadros2017-07-261-10/+12
| |
* | remote: pull refactor to match default behaviourMáximo Cuadros2017-07-261-3/+46
|/
* *: package context support in Repository, Remote and SubmoduleMáximo Cuadros2017-07-261-2/+16
|
* move Repository.Pull to Worktree.PullMáximo Cuadros2017-07-241-0/+41
|