| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| | |
Close Reader & Writer of EncodedObject after use
|
| | |
|
| | |
|
|/
|
|
|
| |
This reverts commit 3127ad9a44a2ee935502816065dfe39f494f583d, reversing
changes made to 73c52edaad2dae256be61bd1dbbab08e1092f58e.
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
...for reading and writing global (~/.git/config) and reading system (/etc/gitconfig) configs in addition to local repo config
|
| |
|
| |
|
| |
|
|\
| |
| | |
storage/filesystem: dotgit, unable to work with .git folder with temporal packfiles
|
| |
| |
| |
| |
| |
| | |
prefix and suffix. Fixes #1149
Signed-off-by: Yuichi Watanabe <yuichi.watanabe.ja@gmail.com>
|
| |
| |
| |
| | |
Signed-off-by: Yuichi Watanabe <yuichi.watanabe.ja@gmail.com>
|
| |
| |
| |
| | |
Signed-off-by: Yuichi Watanabe <yuichi.watanabe.ja@gmail.com>
|
| |
| |
| |
| | |
Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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 option
|
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
|/
|
|
|
|
|
|
|
|
| |
Large performance increase by buffering reads.
There were a few instances where binary.Read() would end up using reflection on
&plumbing.Hash, rather than treating it as a byte slice. This has now been
resolved.
Signed-off-by: Arran Walker <arran.walker@fiveturns.org>
|
|
|
|
| |
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|\
| |
| | |
storage: transactional, new storage with transactional capabilities
|
| |
| |
| |
| | |
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
|
| |
| |
| |
| | |
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
|
| |
| |
| |
| |
| |
| | |
CheckAndSetReference
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
|
| |
| |
| |
| | |
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If the cache is shared between several repositories getFromUnpacked can
erroneously return an object from other repository.
This decreases performance a little bit as there's an extra fs operation
when the object is in the cache but is correct when the cache is shared.
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
| |
| |
| |
| | |
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| | |
commit histories (#963)
Signed-off-by: Filip Navara <navara@emclient.com>
|
|/
|
|
| |
Signed-off-by: Javier Peletier <jm@epiclabs.io>
|
|
|
|
|
|
| |
Suggested by taruti.
Signed-off-by: Jeremy Stribling <strib@alum.mit.edu>
|
|
|
|
| |
Signed-off-by: Jeremy Stribling <strib@alum.mit.edu>
|
|
|
|
| |
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
|
|
|
|
| |
PackfileIter was not taking into account the option KeepDescriptors
and was always closing the file. This caused "file already closed"
errors when iterating packfiles in with KeepDescriptors active.
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
| |
Signed-off-by: kuba-- <kuba@sourced.tech>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
Also delete Close from MockObjectStorage and memory storer.
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
| |
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
| |
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
| |
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
| |
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
Also reformatted function comment and fixed some typos.
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|