aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/dotgit/dotgit.go
Commit message (Collapse)AuthorAgeFilesLines
* storage: dotgit, head reference usually comes firstAyman Bagabas2024-04-261-7/+8
| | | | | | | When reading the repository references from DotGit, the HEAD reference should always come first. This mimics the behavior of `git show-ref --head`
* storage: filesystem, Add option to set a specific FS for alternatesPaulo Gomes2023-12-021-16/+48
| | | | | | | | | | | Introduces the option to set a FS for alternates, enabling more flexible cross FS sharing of alternates. If none is set, falls back to the current FS used for the object storage. The changes only process a given path once, and if an alternates dir is not valid, exits with error - aligning behaviour with upstream. Signed-off-by: Paulo Gomes <paulo.gomes@suse.com>
* git: clone --shared implementedenverbisevac2023-10-081-1/+32
|
* storage: filesystem/dotgit, add support for tmp_objdir prefixSavely Krasovsky2023-07-201-1/+3
|
* *: Remove use of deprecated io/utilPaulo Gomes2023-05-111-2/+1
| | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* storage: filesystem/dotgit, Improve load packed-refsForce Charlie2023-04-251-42/+38
|
* Merge pull request #707 from pjbgf/experimental-sha256Paulo Gomes2023-04-111-5/+7
|\ | | | | *: Add support for initializing SHA256 repositories
| * *: Support variable length plumbing.HashPaulo Gomes2023-03-081-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | The variable length for plumbing.Hash is defined at build time, blocked by tag sha256. This approach was a trade-off between keeping backwards compatibility while making progress towards supporting SHA256 with a small amount of changes. Relates to the SHA256 implementation, defined in #706. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* | dotgit: fix a filesystem race in Refs/walkReferencesTreeMichael Muré2023-01-141-0/+5
|/ | | | | | | | | | | | In walkReferencesTree(), the filesystem is browsed recursively. After a folder is listed, each child element (directory, file) are inspected. What can happen is that by the time we get to operate on the child element, it might have been deleted from the filesystem and we would get a PathError. In the case of directories there was already a case to avoid bubbling up the error (we consider that there is no ref there, which is correct), but that was missing for files. This commit just apply the same logic.
* Support partial hashes in Repository.ResolveRevision.David Symonds2020-07-161-3/+74
| | | | | | | | | | | | | 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.
* Support `.git/commondir` repository layoutTimofey Kirillov2020-06-151-0/+6
| | | | | | | | | | | | | | | | 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-241-35/+15
| | | | | This reverts commit 3127ad9a44a2ee935502816065dfe39f494f583d, reversing changes made to 73c52edaad2dae256be61bd1dbbab08e1092f58e.
* storage/filesystem: dotgit, sanity check provided reference pathKyle Evans2020-04-231-0/+11
| | | | | | | | | | 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>
* 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 gopkg to go modulesMáximo Cuadros2020-03-101-5/+5
|
* 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>
* 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>
* 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>
* Expose Storage cache.kuba--2018-09-071-2/+2
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* storage/dotgit: add KeepDescriptors optionJavi Fontan2018-09-041-1/+42
| | | | | | | | | | 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/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-211-3/+50
|\ | | | | added support for quarantine directory
| * added hook supportnoxora2018-08-161-3/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* storage/filesystem: avoid norwfs build flagSantiago M. Mola2018-06-211-1/+1
| | | | | | | | | | | | | | | | | 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-051-0/+808
Signed-off-by: Antonio Jesus Navarro Perez <antnavper@gmail.com>