Commit Graph

1061 Commits

Author SHA1 Message Date
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
Carlos Martín Nieto
3a7ffc29c9 config: initial multivar iterator 2013-08-08 16:18:07 +02:00
Carlos Martín Nieto
eba7399251 config: move next() and free() into the iterator
Like we have in the references iterator, next and free belong in the
iterator itself.
2013-08-08 14:39:32 +02:00
Carlos Martín Nieto
4efa32903a config: get_multivar -> get_multivar_foreach
The plain function will return an iterator, so move this one out of
the way.
2013-08-08 13:57:01 +02:00
Carlos Martín Nieto
4d588d9713 Don't typedef a pointer
Make the iterator structure opaque and make sure it compiles.
2013-08-08 11:40:41 +02:00
Nico von Geyso
a603c19157 replaced foreach() with non callback based iterations in git_config_backend
new functions in struct git_config_backend:
  * iterator_new(...)
  * iterator_free(...)
  * next(...)

The old callback based foreach style can still be used with `git_config_backend_foreach_match`
2013-08-08 11:14:53 +02:00
Russell Belfer
437224b4b9 More tests for ambiguous OIDs across packs
The test coverage for ambiguous OIDs was pretty thin.  This adds
a bunch of new objects both in packs, across packs, and loose that
match to 8 characters so that we can test various cases of
ambiguous lookups.
2013-08-05 21:46:32 -07:00
Edward Thomson
e38f0d69ab Add rename from rewrites to status
In git_diff_paired_foreach, temporarily resort the
index->workdir diff list by index path so that we can
track a rename in the workdir from head->index->workdir.
2013-08-05 14:09:56 -05:00
Russell Belfer
9b7d02ff2d Update submodule documentation
Fixes #1762
2013-08-05 10:53:39 -07:00
Russell Belfer
eb1c1707ab Restore GIT_DIFF_LINE_BINARY usage
This restores the usage of GIT_DIFF_LINE_BINARY for the diff
output line that reads "Binary files x and y differ" so that it
can be optionally colorized independently of the file header.
2013-07-23 15:45:58 -07:00
Russell Belfer
197b8966db Add hunk/file headers to git_diff_patch_size
This allows git_diff_patch_size to account for hunk headers and
file headers in the returned size.  This required some refactoring
of the code that is used to print file headers so that it could be
invoked by the git_diff_patch_size API.

Also this increases the test coverage and fixes an off-by-one bug
in the size calculation when newline changes happen at the end of
the file.
2013-07-23 14:34:31 -07:00
Carlos Martín Nieto
64061d4a14 remote: fix git_remote_download() documentation
The description of what the function does hasn't been true for quite a
while. Change it to reflect the way it currently works.

While here, remove an even older comment about missing features that
have been implemented.
2013-07-23 10:51:14 +02:00
Carlos Martín Nieto
c05a55b056 Clean up some documentation
clang's docparser highlighted these.
2013-07-23 09:40:19 +02:00
Russell Belfer
b4a4cf24a5 Add git_diff_patch_size() API
This adds a new API to get the size in bytes of the diffs in a
git_diff_patch object.
2013-07-22 16:07:56 -07:00
Andy Lindeman
51b0397a66 Small grammar fix in docs 2013-07-15 23:40:57 -04:00
Etienne Samson
85e1eded6a Add git_remote_owner 2013-07-15 16:31:25 +02:00
Andy Lindeman
960431c380 Fixes return type documentation 2013-07-14 18:08:54 -04:00
Russell Belfer
d70ce9bd7a Clarify docs for git_status_file 2013-07-10 15:38:57 -07:00
Russell Belfer
f9775a37aa Add ignore_submodules to diff options
This adds correct support for an equivalent to --ignore-submodules
in diff, where an actual ignore value can be passed to diff to
override the per submodule settings in the configuration.

This required tweaking the constants for ignore values so that
zero would not be used and could represent an unset option to the
diff.  This was an opportunity to move the submodule values into
include/git2/types.h and to rename the poorly named DEFAULT values
for ignore and update constants to RESET instead.

Now the GIT_DIFF_IGNORE_SUBMODULES flag is exactly the same as
setting the ignore_submodules option to GIT_SUBMODULE_IGNORE_ALL
(which is actually a minor change from the old behavior in that
submodules will now be treated as UNMODIFIED deltas instead of
being left out totally - if you set GIT_DIFF_INCLUDE_UNMODIFIED).

This includes tests for the various new settings.
2013-07-10 12:15:03 -07:00
Russell Belfer
1aad6137d2 Submodule status improvements
This fixes the way that submodule status is checked to bypass just
about all of the caching in the submodule object.  Based on the
ignore value, it will try to do the minimum work necessary to find
the current status of the submodule - but it will actually go to
disk to get all of the current values.

This also removes the custom refcounting stuff in favor of the
common git_refcount style.  Right now, it is still for internal
purposes only, but it should make it easier to add true submodule
refcounting in the future with a public git_submodule_free call
that will allow bindings not to worry about the submodule object
getting freed from underneath them.
2013-07-10 12:14:13 -07:00
Russell Belfer
3fe046cfdb Add BARE option to git_repository_open_ext
This adds a BARE option to git_repository_open_ext which allows
a fast open path that still knows how to read gitlinks and to
search for the actual .git directory from a subdirectory.

`git_repository_open_bare` is still simpler and faster, but having
a gitlink aware fast open is very useful for submodules where we
want to quickly be able to peek at the HEAD and index data without
doing any other meaningful repo operations.
2013-07-10 12:14:13 -07:00
Russell Belfer
41f1f9d732 Add API to get path to index file 2013-07-10 12:14:13 -07:00
Russell Belfer
2b672d5b64 Add git_pathspec_match_diff API
This adds an additional pathspec API that will match a pathspec
against a diff object.  This is convenient if you want to handle
renames (so you need the whole diff and can't use the pathspec
constraint built into the diff API) but still want to tell if the
diff had any files that matched the pathspec.

When the pathspec is matched against a diff, instead of keeping
a list of filenames that matched, instead the API keeps the list
of git_diff_deltas that matched and they can be retrieved via a
new API git_pathspec_match_list_diff_entry.

There are a couple of other minor API extensions here that were
mostly for the sake of convenience and to reduce dependencies
on knowing the internal data structure between files inside the
library.
2013-07-10 20:50:33 +02:00
Russell Belfer
3e96ecf219 Improve include/git2/pathspec.h docs 2013-07-10 20:50:33 +02:00
Russell Belfer
f094f9052f Add raw header access to commit API 2013-07-10 20:50:32 +02:00
Russell Belfer
d2ce27dd49 Add public API for pathspec matching
This adds a new public API for compiling pathspecs and matching
them against the working directory, the index, or a tree from the
repository.  This also reworks the pathspec internals to allow the
sharing of code between the existing internal usage of pathspec
matching and the new external API.

While this is working and the new API is ready for discussion, I
think there is still an incorrect behavior in which patterns are
always matched against the full path of an entry without taking
the subdirectories into account (so "s*" will match "subdir/file"
even though it wouldn't with core Git).  Further enhancements are
coming, but this was a good place to take a functional snapshot.
2013-07-10 20:50:31 +02:00
Vicent Martí
b8cd7aa9f6 Merge pull request #1704 from arrbee/kill-status-index-then-workdir
Remove GIT_STATUS_SHOW_INDEX_THEN_WORKDIR option
2013-07-09 17:20:55 -07:00
Vicent Martí
77fa06f3d9 Merge pull request #1695 from arrbee/fix-1695
API should not be ifdeffed
2013-07-09 17:20:36 -07:00
Russell Belfer
290e147985 Add GIT_CAP_SSH if library was built with SSH
This also adds a test that actually calls git_libgit2_capabilities
and git_libgit2_version.
2013-07-09 16:17:41 -07:00
Russell Belfer
a3c062dbf8 Make SSH APIs present even without SSH support
The SSH APIs will just return an error code and state that the
library was built without SSH support if they are called in
that case.
2013-07-09 09:58:33 -07:00