|
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.
|
|
d9eae98b
|
2018-10-24T01:30:12
|
|
refs: assert that we're passed valid refs when renaming
CID 1382962
|
|
5bd78c48
|
2018-12-14T14:41:17
|
|
refs: constify git_reference_peel
We have no need to take a non-const reference. This does involve some other work
to make sure we don't mix const and non-const variables, but by splitting what
we want each variable to do we can also simplify the logic for when we do want
to free a new reference we might have allocated.
|
|
168fe39b
|
2018-11-28T14:26:57
|
|
object_type: use new enumeration names
Use the new object_type enumeration names within the codebase.
|
|
6e9fb040
|
2018-08-25T01:47:39
|
|
merge: make analysis possible against a non-HEAD reference
This moves the current merge analysis code into a more generic version
that can work against any reference.
Also change the tests to check returned analysis values exactly.
|
|
ecf4f33a
|
2018-02-08T11:14:48
|
|
Convert usage of `git_buf_free` to new `git_buf_dispose`
|
|
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.
|
|
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.
|
|
0c7f49dd
|
2017-06-30T13:39:01
|
|
Make sure to always include "common.h" first
Next to including several files, our "common.h" header also declares
various macros which are then used throughout the project. As such, we
have to make sure to always include this file first in all
implementation files. Otherwise, we might encounter problems or even
silent behavioural differences due to macros or defines not being
defined as they should be. So in fact, our header and implementation
files should make sure to always include "common.h" first.
This commit does so by establishing a common include pattern. Header
files inside of "src" will now always include "common.h" as its first
other file, separated by a newline from all the other includes to make
it stand out as special. There are two cases for the implementation
files. If they do have a matching header file, they will always include
this one first, leading to "common.h" being transitively included as
first file. If they do not have a matching header file, they instead
include "common.h" as first file themselves.
This fixes the outlined problems and will become our standard practice
for header and source files inside of the "src/" from now on.
|
|
0f642f31
|
2017-06-06T14:54:19
|
|
refs: properly report errors from `update_wt_heads`
|
|
be343b88
|
2017-05-01T18:56:55
|
|
worktrees: cleanup some memory leaks
Be sure to clean up looked up references. Free buffers instead of
merely clearing them. Use `git__free` instead of `free`.
|
|
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.
|
|
5b65ac25
|
2017-04-05T10:43:18
|
|
refs: implement function to read references from file
Currently, we only provide functions to read references directly from a
repository's reference store via e.g. `git_reference_lookup`. But in
some cases, we may want to read files not connected to the current
repository, e.g. when looking up HEAD of connected work trees. This
commit implements `git_reference__read_head`, which will read out and
allocate a reference at an arbitrary path.
|
|
1255a9ac
|
2017-02-26T13:34:13
|
|
Fix: make reflog include "(merge)" for merge commits
This fixes issue #4094
|
|
13c3bc9a
|
2017-01-27T14:32:23
|
|
strmap: remove GIT__USE_STRMAP macro
|
|
8d3b39a6
|
2017-01-21T23:50:38
|
|
Merge branch 'pr/3912'
|
|
28d0ba0b
|
2017-01-21T23:45:23
|
|
symbolic ref target validation: fixups
Fixups requested in #3912.
|
|
909d5494
|
2016-12-29T12:25:15
|
|
giterr_set: consistent error messages
Error messages should be sentence fragments, and therefore:
1. Should not begin with a capital letter,
2. Should not conclude with punctuation, and
3. Should not end a sentence and begin a new one
|
|
452bf57c
|
2016-08-27T13:42:53
|
|
Make symbolic ref target validation optional
Introduce GIT_OPT_ENABLE_SYMBOLIC_REF_TARGET_VALIDATION option.
Setting this option to 0 allows
validation of a symbolic ref's target to be bypassed.
This option is enabled by default.
This mechanism is added primarily to address a discrepancy between git
behaviour and libgit2 behaviour, whereby the former allows the symbolic
ref target to carry an arbitrary string and the latter does not, so:
$ git symbolic-ref refs/heads/foo bar
$ cat .git/refs/heads/foo
ref: bar
where as attempting the same via libgit2 raises an error:
The given reference name 'bar' is not valid
this mechanism also allows those that might want to make use of
git's more lenient treatment of symbolic ref targets to do so.
|
|
908f24fd
|
2016-04-22T10:34:17
|
|
Allow creating copies of `git_reference` objects.
|
|
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.
|
|
98c34149
|
2016-02-28T15:11:15
|
|
refs: honor strict object creation
|
|
0f4d9c03
|
2015-06-15T09:52:40
|
|
Fixed Xcode 6.1 build warnings
|
|
78db0239
|
2015-03-24T20:58:00
|
|
squash some leaks
|
|
fe21d708
|
2015-03-04T00:29:37
|
|
Plug a few leaks
|
|
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.
|
|
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.
|
|
c8e02b87
|
2015-02-15T21:07:05
|
|
Remove extra semicolon outside of a function
Without this change, compiling with gcc and pedantic generates warning:
ISO C does not allow extra ‘;’ outside of a function.
|
|
f1453c59
|
2015-02-12T12:19:37
|
|
Make our overflow check look more like gcc/clang's
Make our overflow checking look more like gcc and clang's, so that
we can substitute it out with the compiler instrinsics on platforms
that support it. This means dropping the ability to pass `NULL` as
an out parameter.
As a result, the macros also get updated to reflect this as well.
|
|
2884cc42
|
2015-02-11T09:39:38
|
|
overflow checking: don't make callers set oom
Have the ALLOC_OVERFLOW testing macros also simply set_oom in the
case where a computation would overflow, so that callers don't
need to.
|
|
392702ee
|
2015-02-09T23:41:13
|
|
allocations: test for overflow of requested size
Introduce some helper macros to test integer overflow from arithmetic
and set error message appropriately.
|
|
a612a25f
|
2014-07-18T18:22:54
|
|
git_rebase_commit: write HEAD's reflog appropriately
|
|
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.
|
|
824f755f
|
2014-05-20T17:31:53
|
|
Refs: Introduce `git_refname_t`.
|
|
68f9d6b2
|
2014-05-15T22:44:50
|
|
Refs: Fix some issue when core.precomposeunicode = true.
This fixes two issues I found when core.precomposeunicode is enabled:
* When creating a reference with a NFD string, the returned
git_reference would return this NFD string as the reference’s
name. But when looking up the reference later, the name would
then be returned as NFC string.
* Renaming a reference would not honor the core.precomposeunicode and
apply no normalization to the new reference name.
|
|
3b4ba278
|
2014-04-03T15:50:21
|
|
Const correctness!
|
|
853b1407
|
2014-03-17T16:10:33
|
|
branch: constness fixes
|
|
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
|
|
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.
|
|
7ee8c7e6
|
2014-02-05T11:07:34
|
|
refs: placeholder conditional delete
We don't actually pass the old value yet.
|
|
878fb66f
|
2014-02-05T10:19:17
|
|
refs: bring conditional symbolic updates to the frontend
Bring the race detection goodness to symbolic references as well.
|
|
91123661
|
2014-02-04T22:04:00
|
|
refdb: add conditional symbolic updates
Add a parameter to the backend to allow checking for the old symbolic
target.
|
|
5d96fe88
|
2014-01-14T15:33:29
|
|
refs: changes from feedback
Change the name to _matching() intead of _if(), and force _set_target()
to be a conditional update. If the user doesn't care about the old
value, they should use git_reference_create().
|
|
9b148098
|
2013-12-18T19:58:16
|
|
refs: conditional ref updates
Allow updating references if the old value matches the given one.
|
|
86746b4b
|
2014-02-03T15:06:47
|
|
Add reset tests for reflog
|
|
50ad7cc2
|
2014-02-02T18:20:06
|
|
Add `git_reference_is_note`.
|
|
a1710a28
|
2014-01-29T10:35:46
|
|
Enhance testing of signature parameters
|
|
ccf6ce5c
|
2014-01-28T11:30:36
|
|
Ensure renaming a reference updates the reflog
|
|
94f263f5
|
2014-01-25T08:04:49
|
|
Add reflog params to set-head calls
|
|
0b28217b
|
2014-01-15T12:51:31
|
|
refs: remove the _with_log differentiation
Any well-behaved program should write a descriptive message to the
reflog whenever it updates a reference. Let's make this more prominent
by removing the version without the reflog parameters.
|
|
2ad45213
|
2014-01-12T23:31:57
|
|
refs: handle NULL pointers passed to git_reference_iterator_free()
Signed-off-by: Brodie Rao <brodie@sf.io>
|
|
0b795178
|
2014-01-02T16:58:13
|
|
Allow the log message to be NULL.
|
|
e5994eb0
|
2014-01-02T16:56:09
|
|
Add missing `git_reference_symbolic_create_with_log`.
It's exported in the headers, but the implementation was missing.
|
|
4e1f517c
|
2013-12-18T09:33:45
|
|
Merge pull request #1920 from libgit2/cmn/ref-with-log
Reference operations with log
|
|
f10d7a36
|
2013-12-06T15:53:26
|
|
Further callback error check style fixes
Okay, I've decided I like the readability of this style much
better so I used it everywhere.
|
|
26c1cb91
|
2013-12-09T09:44:03
|
|
One more rename/cleanup for callback err functions
|
|
25e0b157
|
2013-12-06T15:07:57
|
|
Remove converting user error to GIT_EUSER
This changes the behavior of callbacks so that the callback error
code is not converted into GIT_EUSER and instead we propagate the
return value through to the caller. Instead of using the
giterr_capture and giterr_restore functions, we now rely on all
functions to pass back the return value from a callback.
To avoid having a return value with no error message, the user
can call the public giterr_set_str or some such function to set
an error message. There is a new helper 'giterr_set_callback'
that functions can invoke after making a callback which ensures
that some error message was set in case the callback did not set
one.
In places where the sign of the callback return value is
meaningful (e.g. positive to skip, negative to abort), only the
negative values are returned back to the caller, obviously, since
the other values allow for continuing the loop.
The hardest parts of this were in the checkout code where positive
return values were overloaded as meaningful values for checkout.
I fixed this by adding an output parameter to many of the internal
checkout functions and removing the overload. This added some
code, but it is probably a better implementation.
There is some funkiness in the network code where user provided
callbacks could be returning a positive or a negative value and
we want to rely on that to cancel the loop. There are still a
couple places where an user error might get turned into GIT_EUSER
there, I think, though none exercised by the tests.
|
|
dab89f9b
|
2013-12-04T21:22:57
|
|
Further EUSER and error propagation fixes
This continues auditing all the places where GIT_EUSER is being
returned and making sure to clear any existing error using the
new giterr_user_cancel helper. As a result, places that relied
on intercepting GIT_EUSER but having the old error preserved also
needed to be cleaned up to correctly stash and then retrieve the
actual error.
Additionally, as I encountered places where error codes were not
being propagated correctly, I tried to fix them up. A number of
those fixes are included in the this commit as well.
|
|
96869a4e
|
2013-12-03T16:45:39
|
|
Improve GIT_EUSER handling
This adds giterr_user_cancel to return GIT_EUSER and clear any
error message that is sitting around. As a result of using that
in places, we need to be more thorough with capturing errors that
happen inside a callback when used internally. To help with that,
this also adds giterr_capture and giterr_restore so that when we
internally use a foreach-type function that clears errors and
converts them to GIT_EUSER, it is easier to restore not just the
return value, but the actual error message text.
|
|
f2105129
|
2013-11-23T14:39:53
|
|
refs: expose has_log() on the backend
The frontend used to look at the file directly, but that's obviously not
the right thing to do. Expose it on the backend and use that function
instead.
|
|
8d5ec910
|
2013-11-23T14:13:01
|
|
refs: expose a way to ensure a ref has a log
Sometimes (e.g. stash) we want to make sure that a log will be written,
even if it's not in one of the standard locations. Let's make that
easier.
|
|
a57dd3b7
|
2013-11-13T18:15:20
|
|
reflog: integrate into the ref writing
Whenever a reference is created or updated, we need to write to the
reflog regardless of whether the user gave us a message, so we shouldn't
leave that to the ref frontend, but integrate it into the backend.
This also eliminates the race between ref update and writing to the
reflog, as we protect the reflog with the ref lock.
As an additional benefit, this reflog append on the backend happens by
appending to the file instead of parsing and rewriting it.
|
|
110df893
|
2013-11-13T13:36:37
|
|
refdb: add a `message` parameter for appending to the log
This is as yet unused.
|
|
a6b50808
|
2013-10-30T17:24:36
|
|
refs: adjust to the new reflog API
|
|
ca84e058
|
2013-05-14T16:40:09
|
|
refs: Introduce git_reference_symbolic_set_target_with_log()
|
|
14ab0e10
|
2013-05-14T16:07:33
|
|
refs: Introduce git_reference_set_target_with_log()
|
|
56ad3782
|
2013-05-13T17:44:39
|
|
refs: Introduce git_reference_symbolic_create_with_log()
|
|
bba25f39
|
2013-05-13T16:21:09
|
|
refs: Introduce git_reference_create_with_log()
|
|
92f95a17
|
2013-05-12T14:16:13
|
|
refs: Centralize reference creation logic
|
|
0bfa7323
|
2013-11-01T17:07:44
|
|
iconv: Do not fake an API when iconv is not available
|
|
8f4a8b09
|
2013-10-28T06:20:28
|
|
Merge pull request #1802 from libgit2/cmn/reflog-backend
Make reflog part of refdb
|
|
74353137
|
2013-10-09T11:57:03
|
|
After iconv init reset ref normalize error
The iconv init was accidentally clearing the default error state
during reference normalization. This resets so that normalization
errors will be detected correctly.
|
|
92dac975
|
2013-10-08T16:35:57
|
|
Make reference lookups apply precomposeunicode
Before these changes, looking up a reference would return the
same precomposed or decomposed form of the reference name that
was used to look it up, so on MacOS which ignores the difference
between the two, a single reference could be looked up either way
and git_reference_name would return the form of the name that was
used to look it up! This change makes lookup always return the
precomposed name if core.precomposeunicode is set regardless of
which version was used to look it up. The reference iterator was
already returning the precomposed form from earlier work.
This also updates the CMakeLists.txt rules for enabling iconv
usage because the clar tests for this code were actually not being
activated properly with the old version.
Finally, this moves git_repository_reset_filesystem from include/
git2/repository.h to include/git2/sys/repository.h since it is not
really a function that normal library users should have to think
about very often.
|
|
b976f3c2
|
2013-08-19T13:01:49
|
|
reflog: move the reflog implementation into refdb_fs
References and their logs are logically coupled, let's make it so in
the code by moving the fs-based reflog implementation to live next to
the fs-based refs one.
As part of the change, make the function take names rather than
references, as only the names are relevant when looking up and
handling reflogs.
|
|
dbecec37
|
2013-08-28T09:38:14
|
|
Merge pull request #1805 from libgit2/threading-packed-load
Thread safety for the refdb_fs
|
|
504850cd
|
2013-08-25T15:59:50
|
|
refs: add git_reference_is_tag
|
|
24c71f14
|
2013-08-21T14:10:27
|
|
Add internal ref set_name fn instead of realloc
The refdb_fs implementation calls realloc directly on a reference
object when it wants to rename it. It is not a public object, so
this doesn't mess with the immutability of references, but it does
assume certain constraints on the reference representation. This
commit wraps that assumption in an isolated API to isolate it.
|
|
114f5a6c
|
2013-06-10T10:10:39
|
|
Reorganize diff and add basic diff driver
This is a significant reorganization of the diff code to break it
into a set of more clearly distinct files and to document the new
organization. Hopefully this will make the diff code easier to
understand and to extend.
This adds a new `git_diff_driver` object that looks of diff driver
information from the attributes and the config so that things like
function content in diff headers can be provided. The full driver
spec is not implemented in the commit - this is focused on the
reorganization of the code and putting the driver hooks in place.
This also removes a few #includes from src/repository.h that were
overbroad, but as a result required extra #includes in a variety
of places since including src/repository.h no longer results in
pulling in the whole world.
|
|
947fad4f
|
2013-06-03T09:28:58
|
|
Merge pull request #1624 from libgit2/vmg/full-ref-iterator
Breaking RefDB changes
|
|
9afc5971
|
2013-05-31T03:09:38
|
|
Merge pull request #1559 from carlosmn/ref-shorthand
Introduce git_reference_shorthand
|
|
979f75d8
|
2013-05-30T17:19:43
|
|
Refcounting
|
|
4e6e2ff2
|
2013-05-30T03:47:10
|
|
...Aaaand this works
|
|
ec24e542
|
2013-05-29T22:47:37
|
|
What are the chances, really
|
|
56960b83
|
2013-05-28T20:47:55
|
|
Liike this
|
|
b6cc559a
|
2013-05-11T02:42:49
|
|
Merge pull request #1385 from carlosmn/refs-iter
Introduce a refs iterator
|
|
c58cac12
|
2013-05-04T18:06:14
|
|
Introduce a glob-filtering iterator
If the backend doesn't provide support for it, the matching is done in
refdb on top of a normal iterator.
|
|
2b562c3a
|
2013-05-04T16:32:58
|
|
refs: remove the OID/SYMBOLIC filtering
Nobody should ever be using anything other than ALL at this level, so
remove the option altogether.
As part of this, git_reference_foreach_glob is now implemented in the
frontend using an iterator. Backends will later regain the ability of
doing the glob filtering in the backend.
|
|
95727245
|
2013-05-04T16:03:17
|
|
refs: implement _foreach with the iterator
|
|
4def7035
|
2013-03-02T19:31:03
|
|
refs: introduce an iterator
This allows us to get a list of reference names in a loop instead of callbacks.
|
|
4f2eb2b7
|
2013-05-08T02:28:47
|
|
Introduce git_reference_shorthand
Generate a shorthand name out of the full refname.
|
|
98d633cc
|
2013-05-07T23:28:21
|
|
Expose git_reference_dwim
Extract this function out of the rev-parse code to be able to DWIM a
reference instead of its target.
|
|
41e93563
|
2013-05-01T15:08:12
|
|
Error messages for a couple other boundary conditions
|
|
cd2ed9f0
|
2013-04-30T04:02:52
|
|
Merge pull request #1518 from arrbee/export-oid-comparison
Remove most inlines from the public API
|
|
b7f167da
|
2013-04-29T13:52:12
|
|
Make git_oid_cmp public and add git_oid__cmp
|
|
528a4e24
|
2013-04-28T14:16:45
|
|
Parse shorthand refspecs as valid
Relax the ONELEVEL ref naming rules so the refspec parsing code can
ask for 'master' to be considered valid.
|
|
21ca0451
|
2013-04-21T12:52:17
|
|
Move git_reference__alloc to include/git2/sys
Create a new include/git2/sys/refs.h and move the reference alloc
functions there. Also fix some documentation issues and some
minor code cleanups.
|
|
4dcd8780
|
2013-04-19T17:17:44
|
|
Move refdb_backend to include/git2/sys
This moves most of the refdb stuff over to the include/git2/sys
directory, with some minor shifts in function organization.
While I was making the necessary updates, I also removed the
trailing whitespace in a few files that I modified just because I
was there and it was bugging me.
|