|
e54343a4
|
2019-06-29T09:17:32
|
|
fileops: rename to "futils.h" to match function signatures
Our file utils functions all have a "futils" prefix, e.g.
`git_futils_touch`. One would thus naturally guess that their
definitions and implementation would live in files "futils.h" and
"futils.c", respectively, but in fact they live in "fileops.h".
Rename the files to match expectations.
|
|
51214b85
|
2019-04-26T10:15:49
|
|
refs: loosen restriction on wildcard "*" refspecs
In commit cd377f45c9 (refs: loosen restriction on wildcard "*"
refspecs, 2015-07-22) in git.git, the restrictions on wildcard
"*" refspecs has been loosened. While wildcards were previously
only allowed if the component is a single "*", this was changed
to also accept other patterns as part of the component.
We never adapted to that change and still reject any wildcard
patterns that aren't a single "*" only. Update our tests to
reflect the upstream change and adjust our own code accordingly.
|
|
0a25141e
|
2019-02-21T21:42:25
|
|
branch: add test for git_branch_lookup to accept GIT_BRANCH_ALL
|
|
bf013fc0
|
2019-02-14T13:30:33
|
|
branch: fix `branch_is_checked_out` with bare repos
In a bare repository, HEAD usually points to the branch that is
considered the "default" branch. As the current implementation for
`git_branch_is_checked_out` only does a comparison of HEAD with the
branch that is to be checked, it will say that the branch pointed to by
HEAD in such a bare repo is checked out.
Fix this by skipping the main repo's HEAD when it is bare.
|
|
788cd2d5
|
2019-02-14T13:49:35
|
|
branches: do not assert that the given ref is a branch
Libraries should use assert(3P) only very scarcely. First, we usually
shouldn't cause the caller of our library to abort in case where the
assert fails. Second, if code is compiled with -DNDEBUG, then the assert
will not be included at all.
In our `git_branch_is_checked_out` function, we have an assert that
verifies that the given reference parameter is non-NULL and in fact a
branch. While the first check is fine, the second is not. E.g. when
compiled with -DNDEBUG, we'd proceed and treat the given reference as a
branch in all cases.
Fix the issue by instead treating a non-branch reference as not being
checked out. This is the obvious solution, as references other than
branches cannot be directly checked out.
|
|
a0f87e16
|
2019-02-14T13:26:30
|
|
branches: add tests for `git_branch_is_checked_out`
We currently do not have any tests at all for the
`git_branch_is_checked_out` function. Add some basic ones.
|
|
f673e232
|
2018-12-27T13:47:34
|
|
git_error: use new names in internal APIs and usage
Move to the `git_error` name in the internal API for error-related
functions.
|
|
ed8cfbf0
|
2019-01-17T00:32:31
|
|
references: use new names in internal usage
Update internal usage to use the `git_reference` names for constants.
|
|
bc219657
|
2018-12-19T11:01:55
|
|
Merge pull request #4833 from csware/drop-empty-dirs
Remove empty (sub-)directories when deleting refs
|
|
168fe39b
|
2018-11-28T14:26:57
|
|
object_type: use new enumeration names
Use the new object_type enumeration names within the codebase.
|
|
e226ad8f
|
2018-11-17T17:55:10
|
|
refs: add support for core.logAllRefUpdates=always
Since we were not expecting this config entry to contain a string, we
would fail as soon as its (cached) value would be accessed. Hence,
provide some constants for the 4 states we use, and account for "always"
when we decide to reflog changes.
|
|
9f48dc3b
|
2018-10-05T12:47:32
|
|
Remove empty directories when deleting refs
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
9994cd3f
|
2018-06-25T11:56:52
|
|
treewide: remove use of C++ style comments
C++ style comment ("//") are not specified by the ISO C90 standard and
thus do not conform to it. While libgit2 aims to conform to C90, we did
not enforce it until now, which is why quite a lot of these
non-conforming comments have snuck into our codebase. Do a tree-wide
conversion of all C++ style comments to the supported C style comments
to allow us enforcing strict C90 compliance in a later commit.
|
|
ecf4f33a
|
2018-02-08T11:14:48
|
|
Convert usage of `git_buf_free` to new `git_buf_dispose`
|
|
d7eca4c3
|
2018-06-01T08:57:17
|
|
refdb_fs: add test for globbing of nonexistant refs
|
|
0750d0cc
|
2018-05-04T15:25:22
|
|
tests: refs::normalize: simplify code to avoid GCC warning
Since version 8.1, GCC will do some automatic bounds checking
when printing static content into a buffer with known size. The
bounds checking doesn't yet work quite right in all scenarios and
may thus lead to false positives. Fix one of these false
positives in refs::normalize by simplifying the code.
|
|
5e19a7f9
|
2018-04-10T21:16:43
|
|
refs: preserve the owning refdb when duping reference
This fixes a segfault in git_reference_owner on references returned from git_reference__read_head and git_reference_dup ones.
|
|
18d9c847
|
2018-02-20T00:32:38
|
|
testrepo: add new branch
Add a new branch to the `testrepo` repository, where the `README` file
has changed to executable. This branch enables typechange tests between
the new `executable` branch and `master`.
|
|
782402c2
|
2018-01-12T13:09:23
|
|
tests: refs::iterator: fix memory leak due to ref names not being free'd
The test refs::iterator::foreach_name iterates through every reference
and copies its name into a local vector. While the test makes sure to
free the vector afterwards, the copied reference names are not being
free'd. Fix that.
|
|
7a830f28
|
2017-12-30T00:46:17
|
|
refs:iterator: add tests to recurse symlinks
Ensure that we can recurse into directories via symbolic links.
|
|
da635eda
|
2017-11-22T23:47:29
|
|
tests: move free functions at the end
|
|
ebe5d8ec
|
2017-07-21T20:12:01
|
|
tests: move static method to the top
|
|
f01a8587
|
2017-07-21T17:45:44
|
|
tests: make reflog_check_entry more clar-y
|
|
b9b1f9f8
|
2017-07-14T03:21:02
|
|
tests: clarify which steps corresponds to each checks
|
|
53672128
|
2017-07-21T17:35:30
|
|
tests: gather the reflog entry content tests
|
|
b112b1e9
|
2017-10-06T11:24:11
|
|
refs: do not use peeled OID if peeling to a tag
If a reference stored in a packed-refs file does not directly point to a
commit, tree or blob, the packed-refs file will also will include a
fully-peeled OID pointing to the first underlying object of that type.
If we try to peel a reference to an object, we will use that peeled OID
to speed up resolving the object.
As a reference for an annotated tag does not directly point to a commit,
tree or blob but instead to the tag object, the packed-refs file will
have an accomodating fully-peeled OID pointing to the object referenced
by that tag. When we use the fully-peeled OID pointing to the referenced
object when peeling, we obviously cannot peel that to the tag anymore.
Fix this issue by not using the fully-peeled OID whenever we want to
peel to a tag. Note that this does not include the case where we want to
resolve to _any_ object type. Existing code may make use from the fact
that we resolve those to commit objects instead of tag objects, even
though that behaviour is inconsistent between packed and loose
references. Furthermore, some tests of ours make the assumption that we
in fact resolve those references to a commit.
|
|
b6ed67c2
|
2017-05-10T12:54:14
|
|
tests: refs::crashes: create sandbox for creating symref
The test `refs::crashes::double_free` operates on our in-source
"testrepo.git" repository without creating a copy first. As the test
will try to create a new symbolic reference, this will fail when we want
to do a pure out-of-tree build with a read-only source tree.
Fix the issue by creating a sandbox first.
|
|
6c23704d
|
2017-06-08T21:40:18
|
|
settings: rename `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`
Initially, the setting has been solely used to enable the use of
`fsync()` when creating objects. Since then, the use has been extended
to also cover references and index files. As the option is not yet part
of any release, we can still correct this by renaming the option to
something more sensible, indicating not only correlation to objects.
This commit renames the option to `GIT_OPT_ENABLE_FSYNC_GITDIR`. We also
move the variable from the object to repository source code.
|
|
8b107dc5
|
2017-05-03T11:20:57
|
|
revparse: support open-ended ranges
Support '..' and '...' ranges where one side is not specified.
The unspecified side defaults to HEAD.
Closes #4223
|
|
6fd6c678
|
2017-03-22T20:29:22
|
|
Merge pull request #4030 from libgit2/ethomson/fsync
fsync all the things
|
|
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.
|
|
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
|
|
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.
|
|
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.
|
|
bd9f4fd2
|
2015-11-11T10:54:08
|
|
tests: add worktree test data
|
|
8f0d5cde
|
2016-12-29T12:55:49
|
|
tests: update error message checking
|
|
f9793884
|
2016-10-28T14:32:01
|
|
branch: fix forced branch creation on HEAD of a bare repo
The code correctly detects that forced creation of a branch on a
nonbare repo should not be able to overwrite a branch which is
the HEAD reference. But there's no reason to prevent this on
a bare repo, and in fact, git allows this. I.e.,
git branch -f master new_sha
works on a bare repo with HEAD set to master. This change fixes
that problem, and updates tests so that, for this case, both the
bare and nonbare cases are checked for correct behavior.
|
|
908f24fd
|
2016-04-22T10:34:17
|
|
Allow creating copies of `git_reference` objects.
|
|
0e00eecf
|
2016-04-11T13:29:54
|
|
Merge pull request #3736 from libgit2/cmn/dwim-general-message
refs: provide a more general error message for dwim
|
|
d22a8b95
|
2016-04-11T11:50:11
|
|
refs::create: strict object creation on by default
When we turned strict object creation validation on by default, we
forgot to inform the refs::create tests of this. They, in fact,
believed that strict object creation was off by default. As a result,
their cleanup function went and turned strict object creation off for
the remaining tests.
|
|
77965c68
|
2016-04-11T17:43:07
|
|
refs: provide a more general error message for dwim
If we cannot dwim the input, set the error message to be explicit about
that. Otherwise we leave the error for the last failed lookup, which
can be rather unexpected as it mentions a remote when the user thought
they were trying to look up a branch.
|
|
9b3fc895
|
2016-03-03T11:17:36
|
|
tests: plug a leak
|
|
98c34149
|
2016-02-28T15:11:15
|
|
refs: honor strict object creation
|
|
0a700ee3
|
2015-11-03T17:34:54
|
|
reflog: error when a directory is at reflog path
When a non-empty directory exists and prevents the creation of a
reflog, provide a more informative error message.
|
|
b46c7ee5
|
2015-11-03T17:18:00
|
|
refs: complain when a directory exists at ref
When a (non-empty) directory exists at the reference target
location, complain with a more actionable error message.
|
|
2d556f31
|
2015-11-03T14:48:31
|
|
reflog: test reflog is deleted when ref is deleted
|
|
335c9e2f
|
2015-10-26T15:33:00
|
|
Prevent segfault when parsing a reflog with oid parse error
Using calloc instead of malloc because the parse error will lead to an immediate free of committer (and its properties, which can segfault on free if undefined - test_refs_reflog_reflog__reading_a_reflog_with_invalid_format_returns_error segfaulted before the fix).
#3458
|
|
ac2fba0e
|
2015-09-16T15:07:27
|
|
git_futils_mkdir_*: make a relative-to-base mkdir
Untangle git_futils_mkdir from git_futils_mkdir_ext - the latter
assumes that we own everything beneath the base, as if it were
being called with a base of the repository or working directory,
and is tailored towards checkout and ensuring that there is no
bogosity beneath the base that must be cleaned up.
This is (at best) slow and (at worst) unsafe in the larger context
of a filesystem where we do not own things and cannot do things like
unlink symlinks that are in our way.
|
|
01d0c02d
|
2015-07-12T19:08:06
|
|
refdb: delete a ref's reflog upon deletion
Removing a reflog upon ref deletion is something which only some
backends might wish to do. Backends which are database-backed may wish
to archive a reflog, log-based ones may not need to do anything.
|
|
a2f8d1ae
|
2015-06-26T16:48:58
|
|
revparse: Add test to make sure this doesn't regress
|
|
5014fe95
|
2015-05-22T12:24:09
|
|
branch: error out if we cannot find the remote
When we look for which remote corresponds to a remote-tracking branch,
we look in the refspecs to see which ones matches. If none do, we should
abort. We currently ignore the error message from this operation, so
let's not do that anymore.
As part of the test we're writing, let's test for the expected behaviour
if we cannot find a refspec which tells us what the remote-tracking
branch for a remote would look like.
|
|
77254990
|
2015-04-23T06:51:34
|
|
remote: remove live changing of refspecs
The base refspecs changing can be a cause of confusion as to what is the
current base refspec set and complicate saving the remote's
configuration.
Change `git_remote_add_{fetch,push}()` to update the configuration
instead of an instance.
This finally makes `git_remote_save()` a no-op, it will be removed in a
later commit.
|
|
a5815a2a
|
2015-03-07T00:30:40
|
|
Add tests for the annotated versions of ref-modifying functions
This also brings the soft-reset tests back to life. The function name
was missing an underscore, meaning they had not been running.
|
|
d578b45f
|
2015-03-08T16:46:33
|
|
refdb: use the same id for old and new when renaming a reference
When we rename a reference, we want the old and new ids to be the same
one (as we did not change it). The normal code path looks up the old id
from the current value of the brtanch, but by the time we look it up, it
does not exist anymore and thus we write a zero id.
Pass the old id explicitly instead.
|
|
7eb76734
|
2015-03-04T22:01:20
|
|
branch: fix generated reflog message upon renaming
|
|
015d4b7b
|
2015-03-04T21:48:54
|
|
branch: fix generated reflog message upon creation
|
|
9a97f49e
|
2014-12-21T15:31:03
|
|
config: borrow refcounted references
This changes the get_entry() method to return a refcounted version of
the config entry, which you have to free when you're done.
This allows us to avoid freeing the memory in which the entry is stored
on a refresh, which may happen at any time for a live config.
For this reason, get_string() has been forbidden on live configs and a
new function get_string_buf() has been added, which stores the string in
a git_buf which the user then owns.
The functions which parse the string value takea advantage of the
borrowing to parse safely and then release the entry.
|
|
4e498646
|
2015-01-15T16:50:31
|
|
repository: remove log message override for switching the active branch
We want to use the "checkout: moving from ..." message in order to let
git know when a change of branch has happened. Make the convenience
functions for this goal write this message.
|
|
6bfb990d
|
2015-01-07T14:47:02
|
|
branch: don't accept a reflog message override
This namespace is about behaving like git's branch command, so let's do
exactly that instead of taking a reflog message.
This override is still available via the reference namespace.
|
|
659cf202
|
2015-01-07T12:23:05
|
|
Remove the signature from ref-modifying functions
The signature for the reflog is not something which changes
dynamically. Almost all uses will be NULL, since we want for the
repository's default identity to be used, making it noise.
In order to allow for changing the identity, we instead provide
git_repository_set_ident() and git_repository_ident() which allow a user
to override the choice of signature.
|
|
d24a5312
|
2015-02-12T02:34:58
|
|
Merge pull request #2866 from ethomson/checkout_perf2
Checkout performance
|
|
1589a93a
|
2015-02-02T16:50:10
|
|
Fix branch creation when branch name matches namespace of previously deleted branch
|
|
60561d54
|
2015-02-03T03:36:07
|
|
tests: update for new test data
|
|
ee5da720
|
2014-12-02T22:20:42
|
|
reference_create: validate loose names
Validate loose reference names on Win32.
|
|
753e17b0
|
2014-11-19T18:42:29
|
|
peel: reject bad queries with EINVALIDSPEC
There are some combination of objects and target types which we know
cannot be fulfilled. Return EINVALIDSPEC for those to signify that there
is a mismatch in the user-provided data and what the object model is
capable of satisfying.
If we start at a tag and in the course of peeling find out that we
cannot reach a particular type, we return EPEEL.
|
|
5915d700
|
2014-11-17T14:28:22
|
|
branch: consider an empty upstream remote config as not found
|
|
82374d98
|
2014-11-08T20:00:17
|
|
branch: add getter for the upstream remote name
This gets the value from branch.<foo>.remote.
|
|
c327d5db
|
2014-10-09T16:29:30
|
|
transaction: rename lock() to lock_ref()
This leaves space for future expansion to locking other resources
without having to change the API for references.
|
|
ab8d9242
|
2014-06-28T06:39:38
|
|
Introduce reference transactions
A transaction allows you to lock multiple references and set up changes
for them before applying the changes all at once (or as close as the
backend supports).
This can be used for replication purposes, or for making sure some
operations run when the reference is locked and thus cannot be changed.
|
|
c7dd0a56
|
2014-07-12T14:44:58
|
|
Use p_snprintf also in tests
|
|
0cee70eb
|
2014-07-01T14:09:01
|
|
Introduce cl_assert_equal_oid
|
|
4ee2543c
|
2014-06-02T16:46:47
|
|
refs: failing test for concurrent ref access
If we remove a reference while we're iterating through the packed refs,
the position in the iterator will be off.
|
|
9d6c3d28
|
2014-05-30T15:15:54
|
|
Refs: Extend unicode test for branch creation.
This adds another assertion to ensure that the reference name inside
the git_reference struct returned by `git_branch_create` is returned as
precomposed if `core.precomposeunicode` is enabled.
|
|
1a90b1e3
|
2014-05-30T14:53:28
|
|
Refs: Add a unicode test for git_branch_move.
This tests that decomposed branch names are correctly precomposed when
passed to `git_branch_move` and `core.precomposeunicode` is enabled.
|
|
8a2ef218
|
2014-05-08T14:48:27
|
|
Don't always test composed-insensitive lookups
Only on a filesystem that is composed/decomposed insensitive,
should be testing that a branch can be looked up by the opposite
form and still work correctly.
|
|
43a04135
|
2014-05-08T13:52:46
|
|
Pass unconverted data when iconv doesn't like it
When using Iconv to convert unicode data and iconv doesn't like
the source data (because it thinks that it's not actual UTF-8),
instead of stopping the operation, just use the unconverted data.
This will generally do the right thing on the filesystem, since
that is the source of the non-UTF-8 path data anyhow.
This adds some tests for creating and looking up branches with
messy Unicode names. Also, this takes the helper function that
was previously internal to `git_repository_init` and makes it
into `git_path_does_fs_decompose_unicode` which is a useful in
tests to understand what the expected results should be.
|
|
99dfa470
|
2014-05-01T15:12:12
|
|
Some further sandboxing cleanups to tests
Trying to find other issues where tests may not clean up quite
properly when they are through...
|
|
fa13ee2d
|
2014-04-16T16:59:43
|
|
Add GIT_BRANCH_ALL to git_branch_t enum
git_branch_t is an enum so requesting GIT_BRANCH_LOCAL | GIT_BRANCH_REMOTE is not possible as it is not a member of the enum (at least VS2013 C++ complains about it).
This fixes a regression introduced in commit a667ca8298193b3103c1dbdcb1f6c527e6e99eb2 (PR #1946).
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
83504371
|
2014-03-19T22:27:23
|
|
reflog: follow core.logallrefupdates
On bare by default, or when core.logallrefupdates is false, we must not
write the reflog.
|
|
1afe1400
|
2014-03-18T22:16:58
|
|
refdb: don't update when there's no need
If the caller wants to update a ref to point to the same target as it
currently has, we should return early and avoid writing to the reflog.
|
|
4b7e1b9e
|
2014-01-15T13:19:48
|
|
refs: append to the HEAD reflog when updating the current branch
When we update the current branch, we must also append to HEAD's reflog
to keep them in sync.
This is a bit of a hack, but as git.git says, it covers 100% of
default cases.
|
|
494be429
|
2014-03-02T09:00:00
|
|
Merge pull request #2144 from linquize/branch-f-current
Do not allow git_branch_create() to force update branch
|
|
1d08b72e
|
2014-03-02T19:14:20
|
|
Add unit test to show git_branch_create() fails if attempt to force create current branch
|
|
15284a2c
|
2014-02-10T14:52:28
|
|
refs: move current_id before the reflog parameters
Keep the reflog parameters as the last two, as they're the optional
parameters.
|
|
2d929194
|
2014-02-07T16:14:17
|
|
Merge pull request #2099 from libgit2/bs/more-reflog-stuff
More reflogness
|
|
878fb66f
|
2014-02-05T10:19:17
|
|
refs: bring conditional symbolic updates to the frontend
Bring the race detection goodness to symbolic references as well.
|
|
b7ae71ec
|
2014-02-05T11:47:33
|
|
refs: catch cases where the ref type has changed
If the type of the on-disk reference has changed, the old value
comparison should fail.
|
|
5367ec4b
|
2014-02-05T12:02:52
|
|
refs: add an unconditional delete
Add it under the git_reference_remove() name, letting the user pass the
repo and name, analogous to unconditional setting/creation.
|
|
f44fd59e
|
2014-02-05T11:21:14
|
|
refs: check the ref's old value when deleting
Recognize when the reference has changed since we loaded it.
|
|
d6236cf6
|
2014-02-04T21:40:22
|
|
refs: add tests for conditional updates
|
|
010cec3a
|
2014-02-04T20:50:40
|
|
Add reflog params to git_repository_detach_head
|