aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/dotgit
Commit message (Collapse)AuthorAgeFilesLines
* fix goreportcard warningsOleg Kovalov2020-07-011-1/+1
|
* Support `.git/commondir` repository layoutTimofey Kirillov2020-06-153-0/+241
| | | | | | | | | | | | | | | | 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.
* Revert "Merge pull request #20 from quorumcontrol/feature/other-configs"Máximo Cuadros2020-05-242-38/+18
| | | | | This reverts commit 3127ad9a44a2ee935502816065dfe39f494f583d, reversing changes made to 73c52edaad2dae256be61bd1dbbab08e1092f58e.
* storage/filesystem: dotgit, sanity check provided reference pathKyle Evans2020-04-232-1/+12
| | | | | | | | | | On some operating systems, read() of a directory fd may actually succeed and return garbage resembling on-disk contents. As a result, dotgit may return successful from readReferenceFile() when it should in-fact not. This fixes readReferenceFile() on FreeBSD. Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
* storage/filesystem: dotgit, add a test for reading refs from a directoryKyle Evans2020-04-231-1/+13
| | | | | | Specifically, the problem demonstrated is that on some OS (e.g. FreeBSD), read() on a directory will succeed. The current implementation will accept that and return incorrect results, rather than rejecting the directory.
* Fix dotgit testsWes Morgan2020-04-061-3/+3
|
* Add Merged configWes Morgan2020-04-061-15/+35
| | | | ...for reading and writing global (~/.git/config) and reading system (/etc/gitconfig) configs in addition to local repo config
* *: migration from go-git-fixtures/v4 and go-git/gcfgMáximo Cuadros2020-03-102-9/+8
|
* *: migration from gopkg to go modulesMáximo Cuadros2020-03-106-22/+22
|
* Merge pull request #6 from go-git/pr-1153Máximo Cuadros2020-03-102-4/+10
|\ | | | | storage/filesystem: dotgit, unable to work with .git folder with temporal packfiles
| * storage/filesystem: dotgit, Change the order of checking packfile name ↵Yuichi Watanabe2019-05-171-1/+1
| | | | | | | | | | | | prefix and suffix. Fixes #1149 Signed-off-by: Yuichi Watanabe <yuichi.watanabe.ja@gmail.com>
| * storage/filesystem: dotgit, Add prefix check to packfile name. Fixes #1149Yuichi Watanabe2019-05-171-4/+5
| | | | | | | | Signed-off-by: Yuichi Watanabe <yuichi.watanabe.ja@gmail.com>
| * storage/filesystem: dotgit, Reproduce packfile parse error. Fixes #1149Yuichi Watanabe2019-05-171-0/+5
| | | | | | | | Signed-off-by: Yuichi Watanabe <yuichi.watanabe.ja@gmail.com>
* | *: 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)
* filesystem: ObjectStorage, MaxOpenDescriptors optionArran Walker2019-04-221-9/+11
| | | | | | | | The MaxOpenDescriptors option provides a middle ground solution between keeping all packfiles open (as offered by the KeepDescriptors option) and keeping none open. Signed-off-by: Arran Walker <arran.walker@fiveturns.org>
* Merge pull request #1006 from mcuadros/transactional-storageMáximo Cuadros2019-02-021-1/+2
|\ | | | | storage: transactional, new storage with transactional capabilities
| * storage: new storage.ErrReferenceHasChanged error and test for ↵Máximo Cuadros2018-12-101-1/+2
| | | | | | | | | | | | CheckAndSetReference Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* | storage/dotgit: test setRef with a non rwfsJavi Fontan2018-12-101-1/+24
| | | | | | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
* | storage/dotgit: use fs capabilities in setRefJavi Fontan2018-12-102-49/+49
|/ | | | | | | Do not use tags to check if the filesystem is able to open files in read/write mode. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* Expose Storage cache.kuba--2018-09-071-2/+2
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* storage/filesystem: compare files using offset in testJavi Fontan2018-09-061-2/+13
| | | | | | | | Using equals to compare files it uses diff to do so. This can potentially consume lots of ram. Changed the comparison to use file offsets. If the descriptor is reused the offset is maintained. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* storage/dotgit: add KeepDescriptors optionJavi Fontan2018-09-042-1/+70
| | | | | | | | | | This option maintains packfile file descriptors opened after reading objects from them. It improves performance as it does not have to be opening packfiles each time an object is needed. Also adds Close to EncodedObjectStorer to close all the files manualy. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* storage/dotgit: add ExclusiveAccess tests in dotgitJavi Fontan2018-09-041-0/+24
| | | | | | | | This functionality was already tested in storage/filesystem. The coverage tool only takes into account files from the same package of the test. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* storage/filesystem: move Options to filesytem and dotgitJavi Fontan2018-09-031-11/+17
| | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
* plumbing/storer: rename Static option to ExclusiveAccessJavi Fontan2018-08-311-5/+5
| | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
* dotgit: fix typo in commentJavi Fontan2018-08-301-1/+1
| | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
* git, storer: use a common storer.Options for storer and PlainOpenJavi Fontan2018-08-301-11/+6
| | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
* git: add Static option to PlainOpenJavi Fontan2018-08-301-3/+179
| | | | | | | | | | | | | | | | 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>
* storage/dotgit: use HasPrefix instead of SplitJavi Fontan2018-08-271-6/+9
| | | | | | Also reformatted function comment and fixed some typos. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* storage/dotgit: search for incoming dir only onceJavi Fontan2018-08-251-13/+28
| | | | | | | | | Search for incoming object directory was done once each time objects were accessed. This means a ReadDir of the objects path that is expensive. Now incoming directory is searched the first time an object is accessed and its name kept in DotGit to be reused. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* Merge pull request #887 from noxora/hook-supportMáximo Cuadros2018-08-212-3/+101
|\ | | | | added support for quarantine directory
| * dotgit: fix object delete testSantiago M. Mola2018-08-171-14/+18
| | | | | | | | Signed-off-by: Santiago M. Mola <santi@mola.io>
| * added hook supportnoxora2018-08-162-4/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: noxora <ldecker@indeed.com> trying a possible fix to the delete test Signed-off-by: noxora <ldecker@indeed.com> still trying to fix this test Signed-off-by: noxora <ldecker@indeed.com> fixes did not work, seems to be a windows env problem Signed-off-by: noxora <ldecker@indeed.com>
* | plumbing: packfile, open and close packfile on FSObject readsMiguel Molina2018-08-091-0/+5
| | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* | plumbing: packfile, allow non-seekable sources on ParserMiguel Molina2018-08-081-1/+6
| | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* | plumbing, storage: integrate new indexJavi Fontan2018-07-262-19/+17
|/ | | | | | Now dotgit.PackWriter uses the new packfile.Parser and index. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* storage/filesystem: avoid norwfs build flagSantiago M. Mola2018-06-215-94/+82
| | | | | | | | | | | | | | | | | norwfs build flag was used to work on filesystems that do not support neither opening a file in read/write mode or renaming a file (e.f. sivafs). This had two problems: - go-git could not be compiled to work properly both with regular filesystems and limited filesystems at the same time. - the norwfs trick was not available on Windows. This PR removes the norwfs build flag, as well as the windows conditional flag on the dotgit package. For the file open mode, we use the new billy capabilities, to check at runtime if the filesystem supports opening a file in read/write mode or not. For the renaming, we just try and fallback to alternative methods if billy.ErrNotSupported is returned. Signed-off-by: Santiago M. Mola <santi@mola.io>
* dotgit: Move package outside internal.Antonio Jesus Navarro Perez2018-06-059-0/+2112
Signed-off-by: Antonio Jesus Navarro Perez <antnavper@gmail.com>