|
13c1bf07
|
2017-05-01T16:17:48
|
|
Merge pull request #4197 from pks-t/pks/verify-object-hashes
Verify object hashes
|
|
5700ee9c
|
2017-05-01T16:10:50
|
|
Merge pull request #4216 from pks-t/pks/debian-test-failures
Debian HTTPS feature test failure
|
|
35079f50
|
2017-04-21T07:31:56
|
|
odb: add option to turn off hash verification
Verifying hashsums of objects we are reading from the ODB may be costly
as we have to perform an additional hashsum calculation on the object.
Especially when reading large objects, the penalty can be as high as
35%, as can be seen when executing the equivalent of `git cat-file` with
and without verification enabled. To mitigate for this, we add a global
option for libgit2 which enables the developer to turn off the
verification, e.g. when he can be reasonably sure that the objects on
disk won't be corrupted.
|
|
28a0741f
|
2017-04-10T09:30:08
|
|
odb: verify object hashes
The upstream git.git project verifies objects when looking them up from
disk. This avoids scenarios where objects have somehow become corrupt on
disk, e.g. due to hardware failures or bit flips. While our mantra is
usually to follow upstream behavior, we do not do so in this case, as we
never check hashes of objects we have just read from disk.
To fix this, we create a new error class `GIT_EMISMATCH` which denotes
that we have looked up an object with a hashsum mismatch. `odb_read_1`
will then, after having read the object from its backend, hash the
object and compare the resulting hash to the expected hash. If hashes do
not match, it will return an error.
This obviously introduces another computation of checksums and could
potentially impact performance. Note though that we usually perform I/O
operations directly before doing this computation, and as such the
actual overhead should be drowned out by I/O. Running our test suite
seems to confirm this guess. On a Linux system with best-of-five
timings, we had 21.592s with the check enabled and 21.590s with the
ckeck disabled. Note though that our test suite mostly contains very
small blobs only. It is expected that repositories with bigger blobs may
notice an increased hit by this check.
In addition to a new test, we also had to change the
odb::backend::nonrefreshing test suite, which now triggers a hashsum
mismatch when looking up the commit "deadbeef...". This is expected, as
the fake backend allocated inside of the test will return an empty
object for the OID "deadbeef...", which will obviously not hash back to
"deadbeef..." again. We can simply adjust the hash to equal the hash of
the empty object here to fix this test.
|
|
d59dabe5
|
2017-04-10T09:00:51
|
|
tests: object: test looking up corrupted objects
We currently have no tests which check whether we fail reading corrupted
objects. Add one which modifies contents of an object stored on disk and
then tries to read the object.
|
|
e29e8029
|
2017-04-10T10:31:22
|
|
tests: odb: make hash of fake backend configurable
In the odb::backend::nonrefreshing test suite, we set up a fake backend
so that we are able to determine if backend functions are called
correctly. During the setup, we also parse an OID which is later on used
to read out the pseudo-object. While this procedure works right now, it
will create problems later when we implement hash verification for
looked up objects. The current OID ("deadbeef") will not match the hash
of contents we give back to the ODB layer and thus cannot be verified.
Make the hash configurable so that we can simply switch the returned for
single tests.
|
|
86c03552
|
2017-04-10T09:27:04
|
|
tests: object: create sandbox
The object::lookup tests do use the "testrepo.git" repository in a
read-only way, so we do not set up the repository as a sandbox but
simply open it. But in a future commit, we will want to test looking up
objects which are corrupted in some way, which requires us to modify the
on-disk data. Doing this in a repository without creating the sandbox
will modify contents of our libgit2 repository, though.
Create the repository in a sandbox to avoid this.
|
|
7df580fa
|
2017-04-28T11:58:49
|
|
Merge pull request #4191 from pks-t/pks/wt-ref-renames
Branch renames with worktrees
|
|
2a7086fa
|
2017-04-25T13:23:04
|
|
tests: config: verify functionality with read-only backends
|
|
417319cc
|
2017-04-25T10:14:37
|
|
tests: core::features: only check for HTTPS if it is supported
|
|
a4de1ae3
|
2017-04-25T10:14:19
|
|
cmake: define GIT_HTTPS when HTTPS is supported
|
|
13c275ab
|
2017-04-21T07:49:08
|
|
tests: threads::diff: fix warning for unused variable
The threads::diff test suite has a static variable `_retries`, which is
used on Windows platforms only. As it is unused on other systems, the
compiler throws a warning there. Fix the warning by wrapping the
declaration in an ifdef.
|
|
8d89e409
|
2017-04-17T17:19:03
|
|
Merge pull request #4192 from libgit2/ethomson/win32_posix
Refactor some of the win32 POSIX emulation
|
|
cf07db2f
|
2017-04-07T16:05:10
|
|
filter: only close filter if it's been initialized correctly
In the function `git_filter_list_stream_data`, we initialize, write and
subesquently close the stream which should receive content processed by
the filter. While we skip writing to the stream if its initialization
failed, we still try to close it unconditionally -- even if the
initialization failed, where the stream might not be set at all, leading
us to segfault.
Semantics in this code is not really clear. The function handling the
same logic for files instead of data seems to do the right thing here in
only closing the stream when initialization succeeded. When stepping
back a bit, this is only reasonable: if a stream cannot be initialized,
the caller would not expect it to be closed again. So actually, both
callers of `stream_list_init` fail to do so. The data streaming function
will always close the stream and the file streaming function will not
close the stream if writing to it has failed.
The fix is thus two-fold:
- callers of `stream_list_init` now close the stream iff it has been
initialized
- `stream_list_init` now closes the lastly initialized stream if
the current stream in the chain failed to initialize
Add a test which segfaulted previous to these changes.
|
|
2a485dab
|
2017-04-04T18:55:57
|
|
refs: update worktree HEADs when renaming branches
Whenever we rename a branch, we update the repository's symbolic HEAD
reference if it currently points to the branch that is to be renamed.
But with the introduction of worktrees, we also have to iterate over all
HEADs of linked worktrees to adjust them. Do so.
|
|
60297256
|
2017-04-04T16:12:27
|
|
tests: worktree::refs: convert spaces to tabs
|
|
48f09c6c
|
2017-04-05T11:59:03
|
|
win32: only set `git_win32__retries` where it exists
|
|
89d403cc
|
2017-04-05T09:50:12
|
|
win32: enable `p_utimes` for readonly files
Instead of failing to set the timestamp of a read-only file (like any
object file), set it writable temporarily to update the timestamp.
|
|
7ece9065
|
2017-04-03T23:07:16
|
|
win32: make posix emulation retries configurable
POSIX emulation retries should be configurable so that tests can disable
them. In particular, maniacally threading tests may end up trying to
open locked files and need retries, which will slow continuous
integration tests significantly.
|
|
6ad091dc
|
2017-03-23T09:33:09
|
|
Merge pull request #4176 from libgit2/ethomson/3872
inet_pton: don't assume addr families don't exist
|
|
f623cf89
|
2017-03-22T20:32:55
|
|
Merge pull request #4163 from pks-t/pks/submodules-with-worktrees
Worktree fixes
|
|
6fd6c678
|
2017-03-22T20:29:22
|
|
Merge pull request #4030 from libgit2/ethomson/fsync
fsync all the things
|
|
983979fa
|
2017-03-22T19:52:38
|
|
inet_pton: don't assume addr families don't exist
Address family 5 might exist on some crazy system like Haiku.
Use `INT_MAX-1` as an unsupported address family.
|
|
31059923
|
2017-03-20T12:16:18
|
|
Merge pull request #4169 from csware/absolute-symlink
|
|
c10ce7c2
|
2017-03-20T12:11:05
|
|
tests: filebuf: test writing to symlink with absolute paths
|
|
b0c9bc92
|
2017-03-15T13:38:54
|
|
submodule: resolve URLs relative to main worktree
It is possible to specify submodule URLs relative to the repository
location. E.g. having a submodule with URL "../submodule" will look for
the submodule at "repo/../submodule".
With the introduction of worktrees, though, we cannot simply resolve the
URL relative to the repository location itself. If the repository for
which a URL is to be resolved is a working tree, we have to resolve the
URL relative to the parent's repository path. Otherwise, the URL would
change depending on where the working tree is located.
Fix this by special-casing when we have a working tree while getting the
URL base.
|
|
097f0105
|
2017-03-17T08:54:53
|
|
refdb: create references in commondir
References for a repository are usually created inside of its gitdir.
When using worktrees, though, these references are not to be created
inside the worktree gitdir, but instead inside the gitdir of its parent
repository, which is the commondir. Like this, branches will still be
available after the worktree itself has been deleted.
The filesystem refdb currently still creates new references inside of
the gitdir. Fix this and have it create references in commondir.
|
|
8f154be3
|
2017-03-17T08:13:59
|
|
worktree: write resolved paths into link files
The three link files "worktree/.git", ".git/worktrees/<name>/commondir"
and ".git/worktrees/<name>/gitdir" should always contain absolute and
resolved paths. Adjust the logic creating new worktrees to first use
`git_path_prettify_dir` before writing out these files, so that paths
are resolved first.
|
|
20a368e2
|
2017-03-15T15:29:29
|
|
worktree: parent path should point to the working dir
The working tree's parent path should not point to the parent's gitdir,
but to the parent's working directory. Pointing to the gitdir would not
make any sense, as the parent's working directory is actually equal to
both repository's common directory.
Fix the issue.
|
|
3017ba94
|
2017-03-15T14:24:25
|
|
worktree: implement `git_worktree_open_from_repository`
While we already provide functionality to look up a worktree from a
repository, we cannot do so the other way round. That is given a
repository, we want to look up its worktree if it actually exists.
Getting the worktree of a repository is useful when we want to get
certain meta information like the parent's location, getting the locked
status, etc.
|
|
f3c30686
|
2017-03-15T15:04:24
|
|
tests: worktree: use joinpath instead of printf to join paths
|
|
fdb3e24a
|
2017-03-15T14:23:59
|
|
tests: worktree: unify init/cleanup in open tests
|
|
548e5bdf
|
2017-03-15T12:28:05
|
|
tests: worktree: unify init/cleanup in submodule tests
|
|
aa593a65
|
2017-03-15T12:01:02
|
|
tests: worktree: move submodule tests into own suite
|
|
c0eba379
|
2017-03-14T11:01:19
|
|
diff_parse: correctly set options for parsed diffs
The function `diff_parsed_alloc` allocates and initializes a
`git_diff_parsed` structure. This structure also contains diff options.
While we initialize its flags, we fail to do a real initialization of
its values. This bites us when we want to actually use the generated
diff as we do not se the option's version field, which is required to
operate correctly.
Fix the issue by executing `git_diff_init_options` on the embedded
struct.
|
|
ad5a909c
|
2017-03-14T09:39:37
|
|
patch_parse: fix parsing minimal trailing diff line
In a diff, the shortest possible hunk with a modification (that is, no
deletion) results from a file with only one line with a single character
which is removed. Thus the following hunk
@@ -1 +1 @@
-a
+
is the shortest valid hunk modifying a line. The function parsing the
hunk body though assumes that there must always be at least 4 bytes
present to make up a valid hunk, which is obviously wrong in this case.
The absolute minimum number of bytes required for a modification is
actually 2 bytes, that is the "+" and the following newline. Note: if
there is no trailing newline, the assumption will not be offended as the
diff will have a line "\ No trailing newline" at its end.
This patch fixes the issue by lowering the amount of bytes required.
|
|
ace3508f
|
2017-03-14T10:37:47
|
|
patch_generate: fix `git_diff_foreach` only working with generated diffs
The current logic of `git_diff_foreach` makes the assumption that all
diffs passed in are actually derived from generated diffs. With these
assumptions we try to derive the actual diff by inspecting either the
working directory files or blobs of a repository. This obviously cannot
work for diffs parsed from a file, where we do not necessarily have a
repository at hand.
Since the introduced split of parsed and generated patches, there are
multiple functions which help us to handle patches generically, being
indifferent from where they stem from. Use these functions and remove
the old logic specific to generated patches. This allows re-using the
same code for invoking the callbacks on the deltas.
|
|
53454be8
|
2017-03-11T19:52:05
|
|
Merge pull request #4157 from adamniedzielski/4099-git-sort-time-uninteresting
Skip uninteresting commits in revwalk timesort iterator
|
|
ffd4df6b
|
2017-03-09T16:32:38
|
|
Merge pull request #4151 from novalis/dturner/rebase-submodule-untracked
rebase: ignore untracked files in submodules
|
|
c11c08a5
|
2017-03-09T14:01:10
|
|
Skip uninteresting commits in revwalk timesort iterator
Fixes #4099
|
|
d24ae06d
|
2017-03-06T13:13:47
|
|
refs::namespace: add namespace tests
These simple tests only ensure that we enforce the existence of a
namespace; these mirror the rugged tests, they are not exhaustive.
|
|
2270ca9f
|
2017-03-03T13:27:47
|
|
rebase: ignore untracked files in submodules
An untracked file in a submodule should not prevent a rebase from
starting. Even if the submodule's SHA is changed, and that file would
conflict with a new tracked file, it's still OK to start the rebase
and discover the conflict later.
Signed-off-by: David Turner <dturner@twosigma.com>
|
|
52d03f37
|
2017-03-03T13:26:29
|
|
git_commit_create: freshen tree objects in commit
Freshen the tree object that a commit points to during commit time.
|
|
d087c8f8
|
2017-02-24T14:14:56
|
|
hash: test for sha1 collision attack detection
|
|
1c04a96b
|
2017-02-28T12:29:29
|
|
Honor `core.fsyncObjectFiles`
|
|
5aa1f12a
|
2017-03-01T07:45:14
|
|
tests: refs::create: fix memory leak
|
|
cf8e9a3a
|
2017-03-01T07:35:44
|
|
Merge pull request #4143 from richardipsum/issue-4094
Fix: make reflog include "(merge)" for merge commits
|
|
397cf1a1
|
2017-02-28T22:22:02
|
|
Add test for inclusion of (merge) in reflog
This test ensures that the string '(merge)' is included in the reflog
when a merge commit is made.
|
|
3ac05d11
|
2017-02-17T16:48:03
|
|
win32: don't fsync parent directories on Windows
Windows doesn't support it.
|
|
2a5ad7d0
|
2017-02-17T16:42:40
|
|
fsync: call it "synchronous" object writing
Rename `GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION` ->
`GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`.
|
|
1229e1c4
|
2017-02-17T16:36:53
|
|
fsync parent directories when fsyncing
When fsync'ing files, fsync the parent directory in the case where we
rename a file into place, or create a new file, to ensure that the
directory entry is flushed correctly.
|
|
eb56ed81
|
2016-12-15T14:49:43
|
|
refdb_fs: optionally fsync packed refs
|
|
af3dcb0e
|
2016-12-15T10:56:52
|
|
refdb_fs: optionally fsync loose references
|
|
1c2c0ae2
|
2016-12-14T12:51:40
|
|
packbuilder: honor git_object__synchronized_writing
Honor `git_object__synchronized_writing` when creating a packfile and
corresponding index.
|
|
e6ed0d2f
|
2016-12-13T11:31:38
|
|
odb_loose: fsync tests
Introduce a simple counter that `p_fsync` implements. This is useful
for ensuring that `p_fsync` is called when we expect it to be, for
example when we have enabled an odb backend to perform `fsync`s when
writing objects.
|
|
a4b5ac64
|
2017-02-26T16:12:30
|
|
Merge pull request #4138 from richardipsum/symbolic-create-arbitrary-tgt-test
tests: Add create__symbolic_with_arbitrary_content
|
|
40170177
|
2017-02-25T10:21:59
|
|
Fix inet_pton tests triggering an assert in Haiku
Haiku will assert in a nightly build if the "dst" input to inet_pton() is NULL.
|
|
b84e58f4
|
2017-02-25T14:17:10
|
|
Whitespace and style fixes
Use C style comments as per style guide,
and fix mismatching indentation.
|
|
d2b3a21f
|
2017-01-22T00:21:30
|
|
tests: Add create__symbolic_with_arbitrary_content
This test ensures that it's possible to create a symbolic ref that
has arbitrary data as its target. It also ensures it's possible
to obtain the target of that symbolic reference from the git_reference
object.
|
|
b13f0da1
|
2017-02-17T16:32:14
|
|
Merge pull request #4130 from libgit2/ethomson/clar_messages
Improve clar messages
|
|
c52480fd
|
2017-02-17T13:01:49
|
|
`cl_git_exec` -> `cl_git_expect`
|
|
a1dcc830
|
2017-02-17T12:13:35
|
|
tests: provide better pass/failure error messages
Provide more detailed messages when conditions pass or fail
unexpectedly. In particular, this provides the error messages when a
test fails with a different error code than was expected.
|
|
0d716905
|
2017-01-27T15:23:15
|
|
oidmap: remove GIT__USE_OIDMAP macro
|
|
13c3bc9a
|
2017-01-27T14:32:23
|
|
strmap: remove GIT__USE_STRMAP macro
|
|
73028af8
|
2017-01-27T14:20:24
|
|
khash: avoid using macro magic to get return address
|
|
85d2748c
|
2017-01-27T14:05:10
|
|
khash: avoid using `kh_key`/`kh_val` as lvalue
|
|
f31cb45a
|
2017-01-25T15:31:12
|
|
khash: avoid using `kh_put` directly
|
|
cb18386f
|
2017-01-25T14:26:58
|
|
khash: avoid using `kh_val`/`kh_value` directly
|
|
a853c527
|
2017-01-25T14:14:32
|
|
khash: avoid using `kh_get` directly
|
|
64e46dc3
|
2017-01-25T14:14:12
|
|
khash: avoid using `kh_end` directly
|
|
4f9f8e0d
|
2017-02-13T11:10:49
|
|
Merge pull request #3436 from pks-t/libgit2-worktree
Worktree implementation
|
|
3f3a4ce7
|
2016-11-09T14:18:22
|
|
worktree: test opening worktree via gitlink, gitdir and worktree
|
|
6f6dd17c
|
2016-11-08T12:13:59
|
|
worktree: test creating and opening submodule worktrees
|
|
1fd6e035
|
2016-11-07T10:23:34
|
|
worktree: test opening discovered submodule worktrees
|
|
39abd3ad
|
2016-11-04T13:39:54
|
|
worktree: compute workdir for worktrees opened via their gitdir
When opening a worktree via the gitdir of its parent repository
we fail to correctly set up the worktree's working directory. The
problem here is two-fold: we first fail to see that the gitdir
actually is a gitdir of a working tree and then subsequently
fail to determine the working tree location from the gitdir.
The first problem of not noticing a gitdir belongs to a worktree
can be solved by checking for the existence of a `gitdir` file in
the gitdir. This file points back to the gitlink file located in
the working tree's working directory. As this file only exists
for worktrees, it should be sufficient indication of the gitdir
belonging to a worktree.
The second problem, that is determining the location of the
worktree's working directory, can then be solved by reading the
`gitdir` file in the working directory's gitdir. When we now
resolve relative paths and strip the final `.git` component, we
have the actual worktree's working directory location.
|
|
84f56cb0
|
2016-11-04T11:59:52
|
|
repository: rename `path_repository` and `path_gitlink`
The `path_repository` variable is actually confusing to think
about, as it is not always clear what the repository actually is.
It may either be the path to the folder containing worktree and
.git directory, the path to .git itself, a worktree or something
entirely different. Actually, the intent of the variable is to
hold the path to the gitdir, which is either the .git directory
or the bare repository.
Rename the variable to `gitdir` to avoid confusion. While at it,
also rename `path_gitlink` to `gitlink` to improve consistency.
|
|
384518d0
|
2015-10-27T14:17:52
|
|
repository: restrict checking out checked out branches
If a branch is already checked out in a working tree we are not
allowed to check out that branch in another repository. Introduce
this restriction when setting a repository's HEAD.
|
|
143e539f
|
2015-11-06T12:33:59
|
|
branch: restrict branch deletion for worktrees
Restrict the ability to delete branches that are checked out in
any linked repository.
|
|
4321595d
|
2015-11-10T16:54:48
|
|
worktree: test basic merge functionality
|
|
04fb12ab
|
2015-10-27T12:37:51
|
|
worktree: implement functions reading HEAD
Implement `git_repository_head_for_worktree` and
`git_repository_head_detached_for_worktree` for directly accessing a
worktree's HEAD without opening it as a `git_repository` first.
|
|
f0cfc341
|
2015-10-21T13:53:18
|
|
worktree: implement `git_worktree_prune`
Implement the `git_worktree_prune` function. This function can be
used to delete working trees from a repository. According to the
flags passed to it, it can either delete the working tree's
gitdir only or both gitdir and the working directory.
|
|
2a503485
|
2015-10-21T16:03:04
|
|
worktree: implement locking mechanisms
Working trees support locking by creating a file `locked` inside
the tree's gitdir with an optional reason inside. Support this
feature by adding functions to get and set the locking status.
|
|
dea7488e
|
2015-10-23T14:11:44
|
|
worktree: implement `git_worktree_add`
Implement the `git_worktree_add` function which can be used to create
new working trees for a given repository.
|
|
372dc9ff
|
2015-10-21T13:49:55
|
|
worktree: implement `git_worktree_validate`
Add a new function that checks wether a given `struct
git_worktree` is valid. The validation includes checking if the
gitdir, parent directory and common directory are present.
|
|
8c8d726e
|
2015-10-21T12:10:30
|
|
worktree: implement `git_repository_open_from_worktree`
Add function `git_repository_open_from_worktree`, which allows to open a
`git_worktree` as repository.
|
|
a6bddf60
|
2017-02-13T10:34:08
|
|
tests: fix permissions on testrepo.git index file
|
|
79ab3ef6
|
2015-10-15T15:58:05
|
|
repository: introduce is_worktree variable
|
|
d3bc09e8
|
2015-10-21T12:02:31
|
|
worktree: introduce `struct git_worktree`
Introduce a new `struct git_worktree`, which holds information
about a possible working tree connected to a repository.
Introduce functions to allow opening working trees for a
repository.
|
|
45f2b7a4
|
2015-10-21T11:48:02
|
|
worktree: implement `git_worktree_list`
Add new module for working trees with the `git_worktree_list`
function. The function lists names for all working trees of a
certain repository.
|
|
4292837d
|
2015-09-24T14:37:10
|
|
config: open configuration in commondir
A repository's configuartion file can always be found in the
GIT_COMMON_DIR, which has been newly introduced. For normal
repositories this does change nothing, but for working trees this
change allows to access the shared configuration file.
|
|
e9403024
|
2015-09-24T15:32:26
|
|
refdb: look for reflog in commondir
|
|
e0a6c28e
|
2015-09-16T16:09:24
|
|
refdb: introduce commondir awareness
The refdb_fs_backend is not aware of the git commondir, which
stores common objects like the o bject database and packed/loose
refereensces when worktrees are used.
Make refdb_fs_backend aware of the common directory by
introducing a new commonpath variable that points to the actual
common path of the database and using it instead of the gitdir
for the mentioned objects.
|
|
c09fd54e
|
2015-09-16T12:10:11
|
|
repository: introduce commondir variable
The commondir variable stores the path to the common directory.
The common directory is used to store objects and references
shared across multiple repositories. A current use case is the
newly introduced `git worktree` feature, which sets up a separate
working copy, where the backing git object store and references
are pointed to by the common directory.
|
|
807d57e7
|
2015-11-11T10:54:41
|
|
tests: implement worktree helpers
|
|
8acc3b16
|
2015-11-10T15:53:09
|
|
tests: add merge-conflict branch for testrepo
Add a new branch that causes a merge conflict to `testrepo` so
that we are able to test merging in worktrees.
|
|
e5a620de
|
2015-11-09T17:00:41
|
|
tests: add submodule worktree test data
Create worktrees for submodule repositories. The worktrees are
created for the parent repository (e.g. the one containing
submodules) and for the contained child repository.
|
|
bd9f4fd2
|
2015-11-11T10:54:08
|
|
tests: add worktree test data
|
|
683ff4f3
|
2017-02-10T11:01:23
|
|
Merge pull request #4111 from pks-t/pks/dos-prefix
dirname with DOS prefixes
|
|
49806e9b
|
2017-02-09T16:52:03
|
|
merge_trees: introduce test for submodule renames
Test that shows that submodules are incorrectly considered in renames,
and `git_merge_trees` will fail to lookup the submodule as a blob.
|
|
3428a523
|
2017-02-08T12:02:32
|
|
tests: repo: assert discovery starting at Win32 roots finishes
As of recently, we failed to correctly discover repositories at a
Win32 system root. Instead of aborting the upwards-traversal of
the file system, we were looping infinitely when traversal
started at either a Win32 drive prefix ("C:/") or a network path
("//somehost").
The issue has been fixed, so add a test to catch regressions.
|