Commit Graph

1090 Commits

Author SHA1 Message Date
Russell Belfer
a9f51e430f Merge git_buf and git_buffer
This makes the git_buf struct that was used internally into an
externally available structure and eliminates the git_buffer.

As part of that, some of the special cases that arose with the
externally used git_buffer were blended into the git_buf, such as
being careful about git_buf objects that may have a NULL ptr and
allowing for bufs with a valid ptr and size but zero asize as a
way of referring to externally owned data.
2013-09-17 09:31:45 -07:00
Russell Belfer
4b11f25a4f Add ident filter
This adds the ident filter (that knows how to replace $Id$) and
tweaks the filter APIs and code so that git_filter_source objects
actually have the updated OID of the object being filtered when
it is a known value.
2013-09-17 09:31:45 -07:00
Russell Belfer
40cb40fab9 Add functions to manipulate filter lists
Extend the git2/sys/filter API with functions to look up a filter
and add it manually to a filter list.  This requires some trickery
because the regular attribute lookups and checks are bypassed when
this happens, but in the right hands, it will allow a user to have
granular control over applying filters.
2013-09-17 09:31:45 -07:00
Russell Belfer
29e92d385e Hook up filter initialize callback
I knew I forgot something
2013-09-17 09:31:44 -07:00
Russell Belfer
2a7d224f99 Extend public filter api with filter lists
This moves the git_filter_list into the public API so that users
can create, apply, and dispose of filter lists.  This allows more
granular application of filters to user data outside of libgit2
internals.

This also converts all the internal usage of filters to the public
APIs along with a few small tweaks to make it easier to use the
public git_buffer stuff alongside the internal git_buf.
2013-09-17 09:31:44 -07:00
Russell Belfer
974774c7b0 Add attributes to filters and fix registry
The filter registry as implemented was too primitive to actually
work once multiple filters were coming into play.  This expands
the implementation of the registry to handle multiple prioritized
filters correctly.

Additionally, this adds an "attributes" field to a filter that
makes it really really easy to implement filters that are based
on one or more attribute values.  The lookup and even simple value
checking can all happen automatically without custom filter code.

Lastly, with the registry improvements, this fills out the filter
lifecycle callbacks, with initialize and shutdown callbacks that
will be called before the filter is first used and after it is
last invoked.  This allows for system-wide initialization and
cleanup by the filter.
2013-09-17 09:31:44 -07:00
Russell Belfer
570ba25cb0 Make git_filter_source opaque 2013-09-17 09:30:06 -07:00
Russell Belfer
85d5481206 Create public filter object and use it
This creates include/sys/filter.h with a basic definition of a
git_filter and then converts the internal code to use it.  There
are related internal objects (git_filter_list) that we will want
to publish at some point, but this is a first step.
2013-09-17 09:30:06 -07:00
Russell Belfer
0cf77103b2 Start of filter API + git_blob_filtered_content
This begins the process of exposing git_filter objects to the
public API.  This includes:

* new public type and API for `git_buffer` through which an
  allocated buffer can be passed to the user
* new API `git_blob_filtered_content`
* make the git_filter type and GIT_FILTER_TO_... constants public
2013-09-17 09:30:06 -07:00
Vicent Martí
efc9e6700f Merge pull request #1856 from libgit2/cmn/no-orphans
No such thing as an orphan branch
2013-09-17 03:45:35 -07:00
Carlos Martín Nieto
605da51a2c No such thing as an orphan branch
Unfortunately git-core uses the term "unborn branch" and "orphan
branch" interchangeably. However, "orphan" is only really there for
the checkout command, which has the `--orphan` option so it doesn't
actually create the branch.

Branches never have parents, so the distinction of a branch with no
parents is odd to begin with. Crucially, the error messages deal with
unborn branches, so let's use that.
2013-09-17 09:50:30 +02:00
Etienne Samson
b622aabec0 Add a wrapper to provide the libssh2 error message 2013-09-16 23:07:19 +02:00
Linquize
f2df503bab git_clone supports optional init_options 2013-09-16 08:02:36 +08:00
Russell Belfer
6c38e60a00 Merge pull request #1838 from libgit2/cmn/first-parent
revwalk: allow simplifying by first-parent
2013-09-10 16:55:58 -07:00
Carlos Martín Nieto
15f7b9b8d9 revwalk: allow simplifying by first-parent
When enabled, only the first parent of each commit will be queued,
enabling a simple way of using first-parent simplification.
2013-09-09 20:31:14 +02:00
John Josef
f313843c8a fixing headers with bad values for objective-c 2013-09-09 13:53:22 -04:00
Russell Belfer
e0b4a8ac33 Merge pull request #1842 from uh-sem-blee/development
fixes issues with objective-git
2013-09-09 10:30:31 -07:00
Russell Belfer
4dfe38205b Comment updates 2013-09-09 10:24:48 -07:00
John Josef
917e5fa9a1 fixes issues with objective-git 2013-09-08 18:31:56 -04:00
nulltoken
031f3f8028 odb: Error when streaming in too [few|many] bytes 2013-09-07 23:00:20 +02:00
nulltoken
4047950f30 odb: Prevent stream_finalize_write() from overwriting
Now that #1785 is merged, git_odb_stream_finalize_write() calculates the object id before invoking the odb backend.

This commit gives a chance to the backend to check if it already knows this object.
2013-09-06 22:47:28 +02:00
Vicent Martí
e98535923b Merge pull request #1817 from libgit2/ntk/fix/backend/honor_refresh_capabilities
Of backends and refreshers...
2013-09-04 06:20:36 -07:00
nulltoken
b1a6c316a6 odb: Move the auto refresh logic to the pack backend
Previously, `git_object_read()`, `git_object_read_prefix()` and
`git_object_exists()` were implementing an auto refresh logic. When the
expected object couldn't be found in any backend, a call to
`git_odb_refresh()` was triggered and the lookup was once again performed
against all backends.

This commit removes this auto-refresh logic from the odb layer and pushes
it down into the pack-backend (as it's the only one currently exposing
a `refresh()` endpoint).
2013-09-04 07:44:53 +02:00
Vicent Martí
6208bd499b Merge pull request #1804 from ethomson/rewrites
Minor changes for rewrites
2013-09-03 12:29:18 -07:00
Vicent Martí
ac2e7dc6fb Merge pull request #1820 from linquize/git_oid_streq
Update documentation of git_oid_streq to remove outdated error code
2013-09-01 08:40:48 -07:00
Linquize
d45e9480e7 oid: git_oid_shorten_add() sets GITERR_INVALID when OID set is full 2013-08-31 18:22:50 +08:00
Linquize
e68938e0b9 Update documentation of git_oid_streq to remove outdated error code 2013-08-31 18:19:44 +08:00
Vicent Martí
dbecec37a7 Merge pull request #1805 from libgit2/threading-packed-load
Thread safety for the refdb_fs
2013-08-28 09:38:14 -07:00
Russell Belfer
b2d3efcbce Some documentation improvements 2013-08-28 09:31:32 -07:00
Edward Thomson
17c7fbf6d2 Split rewrites, status doesn't return rewrites
Ensure that we apply splits to rewrites, even if we're not
interested in examining it closely for rename/copy detection.

In keeping with core git, status should not display rewrites,
it should simply show files as "modified".
2013-08-28 08:30:19 -05:00
Vicent Martí
b8b22d774e Merge pull request #1772 from libgit2/config-iter
Configuration iterators redux
2013-08-28 06:04:51 -07:00
Nikolai Vladimirov
504850cdf5 refs: add git_reference_is_tag 2013-08-26 08:04:10 +03:00
Fraser Tweedale
3261444056 push: small documentation fix 2013-08-25 17:01:04 +10:00
Edward Thomson
67c177ef26 Don't expose git_hash_ctx since it's internal
And doing so makes the mingw build choke.
2013-08-19 11:42:50 -05:00
Vicent Martí
520287f63a Merge pull request #1785 from libgit2/cmn/odb-hash-frontend
odb: move hashing to the frontend for streaming
2013-08-19 02:17:00 -07:00
Carlos Martín Nieto
3d27687475 index: report when it's locked
Report the index being locked with its own error code in order to be
able to differentiate, as a locked index is typically the result of a
crashed process or concurrent access, both of which often require user
intervention to fix.
2013-08-19 10:30:44 +02:00
Carlos Martín Nieto
7a3764bee9 odb: document git_odb_stream
Clarify the role of each function and in particular mention that there
is no need for the backend or stream to worry about the object's id,
as it will be given when `finalize_write` is called.
2013-08-17 02:02:28 +02:00
Carlos Martín Nieto
fe0c6d4e71 odb: make it clearer that the id is calculated in the frontend
The frontend is in charge of calculating the id of the objects. Thus
the backends should treat it as a read-only value. The positioning in
the function signature made it seem as though it was an output
parameter.

Make the id const and move it from the front to behind the subject
(backend or stream).
2013-08-17 01:41:08 +02:00
Russell Belfer
ce23330fd6 Add new git_signature_default API using config
This adds a new API for creating a signature that uses the
config to look up "user.name" and "user.email".
2013-08-16 15:04:15 -07:00
Carlos Martín Nieto
8380b39a67 odb: perform the stream hashing in the frontend
Hash the data as it's coming into the stream and tell the backend what
its name is when finalizing the write. This makes it consistent with
the way a plain git_odb_write() performs the write.
2013-08-15 14:29:39 +02:00
Carlos Martín Nieto
376e6c9f96 odb: wrap the stream reading and writing functions
This is in preparation for moving the hashing to the frontend, which
requires us to handle the incoming data before passing it to the
backend's stream.
2013-08-15 14:29:27 +02:00
Carlos Martín Nieto
f4be8209af config: don't special-case the multivar iterator
Build it on top of the normal iterator instead, which lets use re-use
a lot of code.
2013-08-14 00:45:05 +02:00
Carlos Martín Nieto
7affc2f7de Include username in each credential type
Key-based authentication also needs an username, so include it in each
one.

Also stop assuming a default username of "git" in the ssh transport
which has no business making such a decision.
2013-08-12 12:07:21 +02:00
Carlos Martín Nieto
54f3a572b4 config: introduce a regex-filtering iterator 2013-08-12 11:40:57 +02:00
Carlos Martín Nieto
5880962d90 config: introduce _iterator_new()
As the name suggests, it iterates over all the entries
2013-08-12 11:40:57 +02:00
Russell Belfer
fbb6c0c84c Merge pull request #1764 from ethomson/status_renames_from_rewrites
Add rename from rewrites to status
2013-08-09 09:35:23 -07:00
Carlos Martín Nieto
1e96c9d534 config: add _next() and _iterator_free()
Make it look like the refs iterator API.
2013-08-08 20:47:06 +02:00
Carlos Martín Nieto
99dfb538ad config: working multivar iterator
Implement the foreach version as a wrapper around the iterator.
2013-08-08 20:38:42 +02:00
Ben Straub
5e96f31638 Merge pull request #1738 from libgit2/diff-patch-content-size
Add API for getting at git_diff_patch->content_size
2013-08-08 08:54:38 -07:00
Carlos Martín Nieto
cca5df6376 config: hopefully get the iterator to work on multivars 2013-08-08 16:59:39 +02:00