aboutsummaryrefslogtreecommitdiffstats
path: root/worktree_test.go
Commit message (Collapse)AuthorAgeFilesLines
* git: worktree: check for empty parent dirs during Reset (Fixes #670) (#671)mbohy2023-01-281-0/+51
| | | | | | | | | | 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).
* Worktree: Add, fix add removed files. Fixes #223 (#652)v5.5.2Taketoshi Fujiwara2023-01-051-0/+45
|
* Return error instead of creating empty commitsPaulo Gomes2022-12-031-3/+33
| | | | | | | | | | | | | | | | | | | | BuildTree now returns an ErrEmptyCommit error, when there are no changes to be committed. This can be opted-out via CommitOptions.AllowEmptyCommits. This is a breaking change which enables applications to detect when empty commits are to be created. Some instances in which this can occur is when the fs (e.g. `billy/osfs`) make changes to the underlying files, causing a conflict between what the previous Git worktree state was, and the current state. Changes to the fs implementations are orthogonal to this, and will be dealt with separately. The new behaviour aligns with the Git CLI, in which empty commits returns the error message: 'nothing to commit, working tree clean'. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* Merge pull request #418 from abhinav/unusedMáximo Cuadros2021-12-101-1/+2
|\ | | | | Remove unused vars/types/funcs/fields
| * Remove unused variables/types/functionsAbhinav Gupta2021-11-271-1/+2
| | | | | | | | | | | | | | | | [staticcheck](https://staticcheck.io/) reported a number of unused fields, functions, types, and variables across the code. Where possible, use them (assert unchecked errors in tests, for example) and otherwise remove them.
* | simplified sparse checkoutJohn Cai2021-11-091-0/+32
|/ | | | | | | | | 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-34/+40
|
* worktree: Don't remove root directory when cleaning (#230)hansmi2021-01-271-0/+32
| | | | | | | 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>
* Fix relative submodule resolutionAxel Christ2020-10-281-4/+19
| | | | | | | | | | | | | | | | | 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/+43
|
* Report "Already up to date" when local repository ahead of remoteMathias Rüdiger2020-06-221-0/+20
| | | | | | | 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.
* Support `.git/commondir` repository layoutTimofey Kirillov2020-06-151-0/+75
| | | | | | | | | | | | | | | | 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.
* Worktree.AddWithOptions: improve documentation and interfaceMáximo Cuadros2020-06-141-2/+2
|
* feat: add file with using .gitignore, fixed src-d/go-git#1219jk2k2020-06-101-0/+46
|
* Worktree: revert url change on testMáximo Cuadros2020-03-161-1/+1
|
* ci: based on github actionsv5.0.0Máximo Cuadros2020-03-151-2/+2
|
* *: migration from go-git-fixtures/v4 and go-git/gcfgMáximo Cuadros2020-03-101-1/+1
|
* *: migration from gopkg to go modulesMáximo Cuadros2020-03-101-11/+11
|
* *: avoid unnecessary conversionsChristian Muehlhaeuser2019-07-291-1/+1
| | | | | | | No need to convert these values, they're already of the right type. Signed-off-by: Christian Muehlhaeuser <muesli@gmail.com> (cherry picked from commit a1d8a7ac8bd0e4aff0f27dbb8bb37b8bd13a1346)
* *: added missing error checks in testsChristian Muehlhaeuser2019-07-291-0/+1
| | | | | | | | | | 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)
* Keep local changes when checkout branch in worktree.Linuxer Wang2019-05-151-0/+40
| | | | Signed-off-by: Linuxer Wang <linuxerwang@gmail.com>
* worktree: test hardcoded excludes when no gitignore is presentFabian Sabau2019-03-041-0/+28
| | | | Signed-off-by: Fabian Sabau <fabian.sabau+git@gmail.com>
* Merge pull request #1065 from vmarkovtsev/fix-unicodev4.10.0Máximo Cuadros2019-02-141-4/+31
|\ | | | | Remove Unicode normalization in difftree
| * Remove Unicode normalization in difftreeVadim Markovtsev2019-02-111-4/+31
| | | | | | | | | | | | Fixes #1057 Signed-off-by: Vadim Markovtsev <vadim@sourced.tech>
* | worktree: add sentinel error for non-fast-forward pullAlexey Smirnov2019-02-071-1/+1
|/ | | | Signed-off-by: Alexey Smirnov <unlinkat@gmail.com>
* Remove empty dirs when cleaning with Dir opt.kuba--2018-08-291-0/+9
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* Worktree: Provide ability to add excludes (#825)Alan D. Cabrera2018-05-111-0/+30
| | | Worktree: Provide ability to add excludes
* git: worktree, Skip special git directory. Fixes #814kuba--2018-04-181-0/+38
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* *: skip time consuming testsMáximo Cuadros2018-03-211-0/+9
| | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* new methods Worktree.[AddGlob|RemoveBlob] and recursive Worktree.[Add|Remove]Máximo Cuadros2018-02-261-14/+125
| | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* new methods Worktree.[AddGlob|AddDirectory]Máximo Cuadros2018-02-011-0/+160
| | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* Merge pull request #695 from darkowlzz/grep-multiple-patterns-pathspecMáximo Cuadros2017-12-201-8/+59
|\ | | | | git: Worktree.Grep() support multiple patterns and pathspecs
| * git: Worktree.Grep() support multiple patterns and pathspecsSunny2017-12-201-8/+59
| | | | | | | | Signed-off-by: Sunny <me@darkowlzz.space>
* | *: simplicationferhat elmas2017-12-181-2/+2
|/ | | | | | - no unnecessary err/bool check, uses them directly Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
* git: worktree, add Grep() method for git grep (#686)Sunny2017-12-121-0/+185
| | | 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.
* storage: filesystem, add support for git alternates (#663)Sunny2017-12-061-0/+30
| | | | This change adds a new method Alternates() in DotGit to check and query alternate source.
* test: git, Worktree.Clean()Sunny2017-12-041-0/+35
|
* all: fixes for ineffective assignferhat elmas2017-11-261-0/+12
|
* update to go-billy.v4 and go-git-fixtures.v3Máximo Cuadros2017-11-231-6/+5
| | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* Fix spelling Unstagged -> UnstagedBenjamin Nørgaard2017-10-081-1/+1
|
* Worktree.Add: Support Add deleted files, fixes #571 (#577)grunenwflorian2017-09-051-0/+4
|
* Worktree.Reset ignore untracked files on Merge modeMáximo Cuadros2017-09-011-35/+114
|
* *: windows support, some more fixes (2) (#536)Manuel Carmona2017-08-071-0/+4
| | | | | | | | | | | | | | * fixed windows failed test: "143 FAIL: worktree_test.go:314: WorktreeSuite.TestFilenameNormalization" * fixed windows failed test: "489: FAIL: auth_method_test.go:106: SuiteCommon.TestNewSSHAgentAuthNoAgent" * fixed windows failed test: "279 FAIL: server_test.go:50: ServerSuite.TestClone" fixed windows failed test: "298 FAIL: server_test.go:37: ServerSuite.TestPush" * fixed windows failed test: "316 FAIL: <autogenerated>:26: UploadPackSuite.TearDownSuite" * fixed windows failed test: "FAIL: <autogenerated>:6: IndexSuite.TearDownSuite"
* *: windows support, some more fixes (#533)Manuel Carmona2017-08-031-4/+11
| | | | | | | | | | * fixed windows failed test: "134 FAIL: repository_test.go:340: RepositorySuite.TestPlainOpenBareRelativeGitDirFileTrailingGarbage" * fixed windows failed test: "143 FAIL: worktree_test.go:367: WorktreeSuite.TestCheckoutIndexOS" * fixed windows failed test: "296 FAIL: receive_pack_test.go:36: ReceivePackSuite.TearDownTest" * fixed windows failed test: "152 FAIL: worktree_test.go:278: WorktreeSuite.TestCheckoutSymlink"
* Merge pull request #526 from joshbetz/fix/filename-formMáximo Cuadros2017-08-021-0/+43
|\ | | | | Normalize filenames before comparing.
| * worktree: normalized string comparison testsMáximo Cuadros2017-08-021-0/+43
| |
* | config: multiple values in RemoteConfig (URLs and Fetch)Santiago M. Mola2017-08-011-4/+4
|/ | | | | | | | * Change `URL string` to `URL []string` in `RemoteConfig`, since git allows multiple URLs per remote. See: http://marc.info/?l=git&m=116231242118202&w=2 * Fix marshalling of multiple fetch refspecs.
* Merge pull request #513 from mcuadros/worktree-fsMáximo Cuadros2017-07-271-60/+60
|\ | | | | worktree: expose underlying filesystem
| * worktree: expose underlying filesystemMáximo Cuadros2017-07-261-60/+60
| |
* | remote: pull refactor to match default behaviourMáximo Cuadros2017-07-261-0/+60
|/