Commit Graph

1469 Commits

Author SHA1 Message Date
Vicent Marti
4d116c3413 Merge pull request #1997 from mgbowen/merge-options-init-fix
Fix GIT_MERGE_OPTS_INIT on MSVC.
2014-03-06 16:08:12 +01:00
Matthew Bowen
b9f819978c Added function-based initializers for every options struct.
The basic structure of each function is courtesy of arrbee.
2014-03-05 21:49:23 -05:00
Jiri Pospisil
4ae4a9bbd1 Fix typo 2014-03-05 20:31:15 +01:00
Russell Belfer
13f7ecd7b9 Add git_object_short_id API to get short id string
This finds a short id string that will unambiguously select the
given object, starting with the core.abbrev length (usually 7)
and growing until it is no longer ambiguous.
2014-03-04 16:23:28 -08:00
Russell Belfer
f5753999e4 Add exists_prefix to ODB backend and ODB API 2014-03-04 15:34:23 -08:00
Arthur Schreiber
96484ecd9e Fix the description for GIT_FEATURE_SSH. 2014-03-03 12:59:35 +01:00
Vicent Marti
ebb3c506fd features: Rename _HAS_ to _FEATURE_ 2014-03-03 12:40:25 +01:00
Vicent Marti
2491c416ed caps: Rename the enum name too! 2014-03-03 12:13:17 +01:00
Vicent Marti
c9f5298b0e caps: Rename to features to avoid confusion 2014-03-03 12:10:36 +01:00
Russell Belfer
6789b7a75d Add buffer to buffer diff and patch APIs
This adds `git_diff_buffers` and `git_patch_from_buffers`.  This
also includes a bunch of internal refactoring to increase the
shared code between these functions and the blob-to-blob and
blob-to-buffer APIs, as well as some higher level assert helpers
in the tests to also remove redundancy.
2014-02-27 14:13:22 -08:00
Ben Straub
1574d3884f Merge pull request #2137 from jru/blame-first-parent
Blame first-parent history
2014-02-26 16:58:20 -05:00
Juan Rubén
899bd19a62 Document enumerator and rewording 2014-02-24 21:20:57 +01:00
Juan Rubén
c7c833947e Add option to limit blame to first parent 2014-02-23 23:26:12 +01:00
Edward Thomson
c254e2b641 Improve documentation for merging 2014-02-21 09:28:15 -08:00
Russell Belfer
72556cc63b Address PR comments
* Make GIT_INLINE an internal definition so it cannot be used in
  public headers
* Fix language in CONTRIBUTING
* Make index caps API use signed instead of unsigned values
2014-02-20 14:27:10 -08:00
Russell Belfer
978a4ed5eb Make git_oid_equal a non-inline API 2014-02-20 11:00:31 -08:00
Carlos Martín Nieto
15284a2c5a refs: move current_id before the reflog parameters
Keep the reflog parameters as the last two, as they're the optional
parameters.
2014-02-10 14:52:28 +01:00
Carlos Martín Nieto
77ad675464 refs: conditional wording fixups
This addresses arrbee's concerns about wording in the conditional
reference udpate functions.
2014-02-10 14:38:01 +01:00
Russell Belfer
80c29fe93e Add git_commit_amend API
This adds an API to amend an existing commit, basically a shorthand
for creating a new commit filling in missing parameters from the
values of an existing commit.  As part of this, I also added a new
"sys" API to create a commit using a callback to get the parents.
This allowed me to rewrite all the other commit creation APIs so
that temporary allocations are no longer needed.
2014-02-07 16:17:59 -08:00
Russell Belfer
2d9291943c Merge pull request #2099 from libgit2/bs/more-reflog-stuff
More reflogness
2014-02-07 16:14:17 -08:00
Russell Belfer
57c47af107 Merge pull request #2042 from libgit2/cmn/conditional-ref
refs: conditional ref updates
2014-02-07 16:05:19 -08:00
Ben Straub
db55bb73ff Correct default reflog message for git_remote_fetch 2014-02-06 11:18:10 -08:00
Ben Straub
2bfc673910 Fix terrible indentation 2014-02-06 10:39:57 -08:00
Ben Straub
0de2c4e3a3 Merge remote-tracking branch 'libgit2/development' into bs/more-reflog-stuff 2014-02-05 13:15:57 -08:00
Russell Belfer
df70de071a Merge pull request #2094 from libgit2/cmn/push-non-commit
Add flexibility to the revwalk API
2014-02-05 10:25:50 -08:00
Carlos Martín Nieto
d60064132a docs: produce literal asterisks 2014-02-05 13:09:34 +01:00
Carlos Martín Nieto
d465e4e980 revwalk: ignore wrong object type in glob pushes
Pushing a whole namespace can cause us to attempt to push non-committish
objects. Catch this situation and special-case it for ignoring this.
2014-02-05 12:16:44 +01:00
Carlos Martín Nieto
f61272e047 revwalk: accept committish objects
Let the user push committish objects and peel them to figure out which
commit to push to our queue.

This is for convenience and for allowing uses of

    git_revwalk_push_glob(w, "tags")

with annotated tags.
2014-02-05 12:16:37 +01:00
Carlos Martín Nieto
5367ec4b84 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.
2014-02-05 12:07:57 +01:00
Carlos Martín Nieto
f44fd59ed7 refs: check the ref's old value when deleting
Recognize when the reference has changed since we loaded it.
2014-02-05 12:07:57 +01:00
Carlos Martín Nieto
7ee8c7e677 refs: placeholder conditional delete
We don't actually pass the old value yet.
2014-02-05 12:07:57 +01:00
Carlos Martín Nieto
878fb66f57 refs: bring conditional symbolic updates to the frontend
Bring the race detection goodness to symbolic references as well.
2014-02-05 12:07:57 +01:00
Carlos Martín Nieto
911236619b refdb: add conditional symbolic updates
Add a parameter to the backend to allow checking for the old symbolic
target.
2014-02-05 12:07:56 +01:00
Carlos Martín Nieto
fc4728e3e2 refs: return GIT_EMODIFIED if the ref target moved
In case we loose the race to update the reference, return GIT_EMODIFIED
to let the user distinguish it from other types of errors.
2014-02-05 12:07:56 +01:00
Carlos Martín Nieto
5d96fe8828 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().
2014-02-05 12:07:56 +01:00
Carlos Martín Nieto
9b148098e6 refs: conditional ref updates
Allow updating references if the old value matches the given one.
2014-02-05 12:07:56 +01:00
Ben Straub
010cec3ac2 Add reflog params to git_repository_detach_head 2014-02-04 20:50:40 -08:00
Ben Straub
c3ab1e5af4 Add reflog parameters to remote apis
Also added a test for git_remote_fetch.
2014-02-04 20:38:13 -08:00
Ben Straub
491cecfe8c Add reflog parameters to git_push_update_tips 2014-02-04 20:27:44 -08:00
Ben Straub
586be3b889 Add reflog parameters to git_reset 2014-02-03 15:05:55 -08:00
Arthur Schreiber
50ad7cc208 Add git_reference_is_note. 2014-02-02 18:20:38 +01:00
Ben Straub
a1b07dca7d Document branch-creation reflog better 2014-01-30 15:53:52 -08:00
Ben Straub
ccf6ce5c89 Ensure renaming a reference updates the reflog 2014-01-30 15:52:13 -08:00
Ben Straub
540c1809f4 Add reflog parameters to git_branch_move 2014-01-30 15:52:13 -08:00
Ben Straub
1cc974ab62 Augment clone API with reflog parameters 2014-01-30 15:52:13 -08:00
Ben Straub
b31ebfbc66 Add reflog params to git_branch_create 2014-01-30 15:52:13 -08:00
Ben Straub
94f263f59b Add reflog params to set-head calls 2014-01-30 15:51:00 -08:00
Russell Belfer
e9d5e5f3d4 Some fixes for Windows x64 warnings 2014-01-30 09:59:59 -08:00
Russell Belfer
c0644c3fbb Make submodule fetchRecurse match other options
This removes the fetchRecurse compiler warnings and makes the
behavior match the other submodule options (i.e. the in-memory
setting can be reset to the on-disk value).
2014-01-30 09:59:59 -08:00
Russell Belfer
5572d2b8a1 Some missing oid to id renames 2014-01-30 09:59:59 -08:00
Arthur Schreiber
e7c16943f4 Add git_graph_descendant_of. 2014-01-28 19:39:14 +01:00
Vicent Marti
93954245e0 Merge pull request #2075 from libgit2/cmn/leftover-oid
Leftover OID -> ID changes
2014-01-27 09:39:36 -08:00
Carlos Martín Nieto
bf522e0811 refspec: move to git_buf for outputting strings 2014-01-27 04:44:06 +01:00
Carlos Martín Nieto
e1d7f0035e messsage: use git_buf in prettify()
A lot of the tests were checking for overflow, which we don't have
anymore, so we can remove them.
2014-01-27 04:44:06 +01:00
Carlos Martín Nieto
ee550477d1 config: use git_buf for returning paths
Again, we already did this internally, so simply remove the conversions.
2014-01-27 04:44:05 +01:00
Carlos Martín Nieto
b25d87c9cd branch: move to git_buf when outputting newly-allocated strings
Internally we already did everything with git_bufs, so this is just
exposing those functions with public names.
2014-01-27 04:44:05 +01:00
Carlos Martín Nieto
7a3bd1e732 repository: move to use a git_buf for outputting strings
Since we now export that type, we can avoid making the user guess a
size.
2014-01-27 04:44:05 +01:00
Arthur Schreiber
991b2840eb Make sure git_remote_dup copies a remote's refspecs correctly. 2014-01-26 19:35:02 +01:00
Arthur Schreiber
11f6ad5fcf Add some missing const declarations. 2014-01-26 18:08:05 +01:00
Carlos Martín Nieto
a1bbc0ce20 merge: rename _oid() -> id()
Following the rest of the series, use 'id' when refering to the value.
2014-01-25 08:15:44 +01:00
Carlos Martín Nieto
86bfc3e1c6 diff: change id abbrev option's name to id_abbrev
Same as the other commits in the series, we use 'id' when talking about
thing rather than the datatype.
2014-01-25 08:15:44 +01:00
Carlos Martín Nieto
9950bb4e8d diff: rename the file's 'oid' to 'id'
In the same vein as the previous commits in this series.
2014-01-25 08:15:44 +01:00
Carlos Martín Nieto
f000ee4e5b tree: remove legacy 'oid' naming
Rename git_tree_entry_byoid() to _byid() as per the convention.
2014-01-25 08:15:44 +01:00
Carlos Martín Nieto
47e28349bc commit: remvoe legacy 'oid' naming 2014-01-25 08:15:44 +01:00
Carlos Martín Nieto
d541170c77 index: rename an entry's id to 'id'
This was not converted when we converted the rest, so do it now.
2014-01-25 08:15:44 +01:00
Carlos Martín Nieto
d0a3de720e note: rename the id getter to git_note_id()
This was left over when we did the general switch.
2014-01-24 11:18:51 +01:00
Nicolas Hake
c05cd7924d Drop git_patch_to_str
It's hard or even impossible to correctly free the string buffer
allocated by git_patch_to_str in some circumstances. Drop the function
so people have to use git_patch_to_buf instead - git_buf has a dedicated
destructor.
2014-01-22 17:51:32 +01:00
Nicolas Hake
450e8e9e62 Expose patch serialization to git_buf
Returning library-allocated strings from libgit2 works fine on Linux,
but may cause problems on Windows because there is no one C Runtime that
everything links against. With libgit2 not exposing its own allocator,
freeing the string is a gamble.

git_patch_to_str already serializes to a buffer, then returns the
underlying memory. Expose the functionality directly, so callers can use
the git_buf_free function to free the memory later.
2014-01-22 13:40:19 +01:00
Edward Thomson
db3462ce77 Support union merges 2014-01-20 17:15:15 -05:00
Edward Thomson
0e1ba46cfb Remove the "merge none" flag
The "merge none" (don't automerge) flag was only to aide in
merge trivial tests.  We can easily determine whether merge
trivial resulted in a trivial merge or an automerge by examining
the REUC after automerge has completed.
2014-01-20 17:15:14 -05:00
Edward Thomson
e651e8e2b5 Introduce diff3 mode for checking out conflicts 2014-01-20 17:15:13 -05:00
Edward Thomson
c1d648c5c6 merge_file should use more aggressive levels
The default merge_file level was XDL_MERGE_MINIMAL, which will
produce conflicts where there should not be in the case where
both sides were changed identically.  Change the defaults to be
more aggressive (XDL_MERGE_ZEALOUS) which will more aggressively
compress non-conflicts.  This matches git.git's defaults.

Increase testing around reverting a previously reverted commit to
illustrate this problem.
2014-01-20 17:15:11 -05:00
Edward Thomson
b554ca5dc1 "Uninitialized" submodules are "unmodified"
Extend the "unmodified" submodule workdir test to include
uninitialized submodules, to prevent reporting submodules as
modified when they're not in the workdir at all.
2014-01-20 17:09:31 -05:00
Arthur Schreiber
3f033c5595 Revert a wrong doc change. 2014-01-16 21:53:25 +01:00
Arthur Schreiber
3f0e3e1662 Fix some documentation issues. 2014-01-16 21:42:28 +01:00
Carlos Martín Nieto
0b28217bda 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.
2014-01-15 13:32:43 +01:00
Arthur Schreiber
529f342aba Align git_tree_entry_dup. 2014-01-14 21:33:59 +01:00
Arthur Schreiber
29be3a6d9e Align git_signature_dup.
This changes git_signature_dup to actually honor oom conditions raised by
the call to git__strdup. It also aligns it with the error code return
pattern used everywhere else.
2014-01-14 21:33:35 +01:00
Arthur Schreiber
40ef47dd46 Add git_remote_dup. 2014-01-14 21:03:01 +01:00
Edward Thomson
6adcaab70c Handle git_buf's from users more liberally 2014-01-08 10:08:23 -08:00
John Crepezzi
e7f89b46c3 Fix spelling mistake
Closes #2029
2014-01-04 18:18:59 -05:00
Russell Belfer
ac9f92316b Merge pull request #2022 from KTXSoftware/development
submodule branch option + little VS2013 fix
2014-01-03 14:40:25 -08:00
Russell Belfer
9152417290 Fix warnings with submodule changes 2014-01-02 14:30:24 -08:00
Robert Konrad
1031197949 Read the submodule branch option from Git 1.8.2. 2014-01-02 15:10:32 +01:00
Linquize
fccadba252 Accept 'submodule.*.fetchRecurseSubmodules' config 'on-demand' value 2013-12-31 07:34:39 +08:00
Vicent Marti
4e1f517c61 Merge pull request #1920 from libgit2/cmn/ref-with-log
Reference operations with log
2013-12-18 09:33:45 -08:00
Edward Thomson
81a2012d99 Overwrite ignored files on checkout 2013-12-13 09:29:55 -05:00
Russell Belfer
452c7de668 Add git_treebuilder_insert test and clarify doc
This wasn't being tested and since it has a callback, I fixed it
even though the return value of this callback is not treated like
any of the other callbacks in the API.
2013-12-12 14:16:40 -08:00
Russell Belfer
9cfce2735d Cleanups, renames, and leak fixes
This renames git_vector_free_all to the better git_vector_free_deep
and also contains a couple of memory leak fixes based on valgrind
checks.  The fixes are specifically: failure to free global dir
path variables when not compiled with threading on and failure to
free filters from the filter registry that had not be initialized
fully.
2013-12-12 12:11:38 -08:00
Russell Belfer
7697e54176 Test cancel from indexer progress callback
This adds tests that try canceling an indexer operation from
within the progress callback.

After writing the tests, I wanted to run this under valgrind and
had a number of errors in that situation because mmap wasn't
working.  I added a CMake option to force emulation of mmap and
consolidated the Amiga-specific code into that new place (so we
don't actually need separate Amiga code now, just have to turn on
-DNO_MMAP).

Additionally, I made the indexer code propagate error codes more
reliably than it used to.
2013-12-11 15:02:20 -08:00
Russell Belfer
8f1066a05f Update clone doc and tests for callback return val
Clone callbacks can return non-zero values to cancel the clone.
This adds some tests to verify that this actually works and updates
the documentation to be clearer that this can happen and that the
return value will be propagated back by the clone function.
2013-12-11 10:57:51 -08:00
Russell Belfer
cbd048969e Fix checkout notify callback docs and tests
The checkout notify callback behavior on non-zero return values
was not being tested.  This adds tests, fixes a bug with positive
values, and clarifies the documentation to make it clear that the
checkout can be canceled via this mechanism.
2013-12-11 10:57:50 -08:00
Russell Belfer
19853bdd97 Update git_blob_create_fromchunks callback behavr
The callback to supply data chunks could return a negative value
to stop creation of the blob, but we were neither using GIT_EUSER
nor propagating the return value.  This makes things use the new
behavior of returning the negative value back to the user.
2013-12-11 10:57:50 -08:00
Russell Belfer
373cf6a932 Update docs for new callback return value behavior 2013-12-11 10:57:50 -08:00
Russell Belfer
25e0b1576d 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.
2013-12-11 10:57:49 -08:00
Russell Belfer
96869a4edb 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.
2013-12-11 10:57:49 -08:00
Russell Belfer
9f77b3f6f5 Add config read fns with controlled error behavior
This adds `git_config__lookup_entry` which will look up a key in
a config and return either the entry or NULL if the key was not
present.  Optionally, it can either suppress all errors or can
return them (although not finding the key is not an error for this
function).  Unlike other accessors, this does not normalize the
config key string, so it must only be used when the key is known
to be in normalized form (i.e. all lower-case before the first dot
and after the last dot, with no invalid characters).

This also adds three high-level helper functions to look up config
values with no errors and a fallback value.  The three functions
are for string, bool, and int values, and will resort to the
fallback value for any error that arises.  They are:

* `git_config__get_string_force`
* `git_config__get_bool_force`
* `git_config__get_int_force`

None of them normalize the config `key` either, so they can only
be used for internal cases where the key is known to be in normal
format.
2013-12-11 10:57:49 -08:00
Matthew Bowen
0db9322547 Fix GIT_MERGE_OPTS_INIT on MSVC. 2013-12-09 10:44:26 -05:00
Carlos Martín Nieto
f21051297c 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.
2013-12-09 15:55:11 +01:00
Carlos Martín Nieto
8d5ec9106a 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.
2013-12-09 15:55:11 +01:00
Ben Straub
a7c83aec21 Clarify docs 2013-12-06 13:39:08 -08:00
Ben Straub
710f383868 Clarify default value and behavior 2013-12-06 09:32:09 -08:00
Ben Straub
a6ebc2bdb3 Introduce GIT_DIFF_FIND_BY_CONFIG 2013-12-05 08:11:00 -08:00
Edward Thomson
eac938d96e Bare naked merge and rebase 2013-12-03 10:18:53 -05:00
Vicent Martí
db0a7e39b3 Merge pull request #1977 from ethomson/revert
Revert support for a single commit
2013-12-03 02:11:55 -08:00
Edward Thomson
bab0b9f2d2 clean up state metadata more consistently 2013-12-02 16:57:41 -06:00
Edward Thomson
300d192f7e Introduce git_revert to revert a single commit 2013-12-02 16:57:41 -06:00
Russell Belfer
f62c174d0d GIT_DIFF_FIND_REMOVE_UNMODIFIED sounds better 2013-12-02 13:49:58 -08:00
Russell Belfer
97ad85b88d Add GIT_DIFF_FIND_DELETE_UNMODIFIED flag
When doing copy detection, it is often necessary to include
UNMODIFIED records in the git_diff so they are available as source
records for GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED.  Yet in the final
diff, often you will not want to have these UNMODIFIED records.
This adds a flag which marks these UNMODIFIED records for deletion
from the diff list so they will be removed after the rename detect
phase is over.
2013-12-02 13:30:05 -08:00
Carlos Martín Nieto
13c9e44af9 reflog: remove git_reflog_append_to()
This was a convenience method for the refs front-end to do the reflog
writing. This is now done in the backend and it has no more reason for
being.
2013-11-23 14:55:02 +01:00
Carlos Martín Nieto
a57dd3b7a4 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.
2013-11-23 14:55:02 +01:00
Carlos Martín Nieto
110df89317 refdb: add a message parameter for appending to the log
This is as yet unused.
2013-11-23 13:35:53 +01:00
nulltoken
ca84e05850 refs: Introduce git_reference_symbolic_set_target_with_log() 2013-11-23 13:35:53 +01:00
nulltoken
14ab0e100e refs: Introduce git_reference_set_target_with_log() 2013-11-23 13:35:51 +01:00
nulltoken
56ad3782e0 refs: Introduce git_reference_symbolic_create_with_log() 2013-11-23 13:34:51 +01:00
nulltoken
bba25f39a2 refs: Introduce git_reference_create_with_log() 2013-11-23 13:34:46 +01:00
Alessandro Ghedini
138e014c38 transport: document ssh-agent authentication 2013-11-20 14:25:55 +01:00
Vicent Marti
43cb8b3242 libgit2 0.20.0 "anmeldung"
Apologies for the delay. This release is chunky,
but you're probably used to chunky releases by now.

Full changelog follows:

Internal changes
	+ Added support for decomposed Unicode paths in Mac OS X
	+ Added support for junctions in win32
	+ Fixed issues with HTTP redirects in the network stack
	+ Performance improvements (as always)

git2/blame.h
	+ added full support for blame operations

git2/blob.h
	+ added `git_blob_filtered_content` to load blobs in
	memory with their corresponding filters applied

git2/branch.h
	+ added branch iterators as an alternative to the
	callback-based API

git2/buffer.h
	+ exported the git_buf struct to allow binary buffers
	to be passed from/to the library. This simplifies
	several APIs

git2/checkout.h
	+ implemented additional checkout options ('skip unmerged',
	'use ours' and 'use theirs')

git2/clone.h
	+ simplified the clone API
	+ added new `git_clone_into` to clone into an existing
	(empty) repository

git2/commit.h
	+ added APIs to access the raw (uncleaned) text of a commit
	message

git2/common.h
	+ added global options to set the default paths to load
	templates from

git2/config.h
	+ added multivar iterators
	+ added globbing iterator
	+ added `git_config_foreach_match` to perform operations
	on every single var in a config file

git2/diff.h
	+ restructured and simplified the diff API

git2/filter.h
	+ added external APIs to configure and apply custom filters
	to checked out blobs

git2/index.h
	+ `git_index_read` can now force a reload of the index file
	even if it hasn't changed on-disk

git2/indexer.h
	+ improved the streaming indexer APIs

git2/merge.h
	+ added support for merge!

git2/object.h
	+ added helper API to lookup a generic object by path

git2/pack.h
	+ added progress callbacks to the packbuilder

git2/patch.h
	+ added support for patch generation as part of the Diff
	API revamp

git2/pathspec.h
	+ added helper APIs to work with pathspecs and match files
	in the workdir or diffs

git2/push.h
	+ added progress callbacks to push

git2/reflog.h
	+ changed reflog APIs to work on reference names instead of
	the references themselves, so they become less racy

git2/remote.h
	+ added support for setting refspecs on remotes, either at
	creation or on existing ones
	+ simplified the remotes API

git2/revwalk.h
	+ add API to simplify parents during a walk

git2/signature.h
	+ add helper to create a signature with the default values for
	a repository (i.e. the set `user.name` and `user.email` values,
	and the current time)

git2/submodules.h
	+ improve the status detection for submodules

git2/sys/
	+ exported many new internal APIs, such as pluggabe transport
	APIs

-vmg, out
2013-11-20 12:53:33 +01:00
Carlos Martín Nieto
1b3fe73c8d Formatting fix for cred_acquire_cb 2013-11-20 11:55:32 +01:00
Nick Hengeveld
d8e7ffc2a2 Add content offset to git_diff_line
For additions and deletions, external consumers like subversion
can make use of the content offset to generate diffs in their
proprietary formats.
2013-11-18 14:03:25 -08:00
Edward Thomson
84efffc33a Introduce git_cred_default for NTLM/SPNEGO auth 2013-11-18 12:56:35 -05:00
Ben Straub
83e1efbf46 Update files that reference tests-clar 2013-11-14 14:10:32 -08:00
Vicent Martí
7b947bf5cc Merge pull request #1951 from victorgp/create-remote-plus-fetch
Allowing create remotes with custom fetch spec
2013-11-14 07:21:47 -08:00
Vicent Martí
6414fd338d Merge pull request #1956 from libgit2/cmn/fetch-default-head
Remote revamp (director's cut)
2013-11-11 06:47:15 -08:00
Carlos Martín Nieto
359dce726d remote: make _ls return the list directly
The callback-based method of listing remote references dates back to the
beginning of the network code's lifetime, when we didn't know any
better.

We need to keep the list around for update_tips() after disconnect() so
let's make use of this to simply give the user a pointer to the array so
they can write straightforward code instead of having to go through a
callback.
2013-11-11 15:35:51 +01:00
Carlos Martín Nieto
266af6d819 remote: don't allow such direct access to the refspecs
Removing arbitrary refspecs makes things more complex to reason
about. Instead, let the user set the fetch and push refspec list to
whatever they want it to be.
2013-11-10 22:21:25 +01:00
Victor Garcia
886cc44738 fixing typo 2013-11-08 15:42:52 +01:00
Victor Garcia
40b99d05b4 splitting funcionality in two methods to avoid ambiguity with NULL 2013-11-08 12:14:31 +01:00
Edward Thomson
1e60e5f42d Allow callers to set mode on packfile creation 2013-11-07 12:04:32 -05:00
Victor Garcia
99feb98897 adding doc for new param and test to check fetch spec is correctly added 2013-11-07 16:22:49 +01:00
Edward Thomson
cc2447da32 Add git_packbuilder_hash to query pack filename 2013-11-07 09:43:24 -05:00
Victor Garcia
0fe522d105 allowing create remote with custom fetch spec 2013-11-07 14:16:20 +01:00
Carlos Martín Nieto
a8baf4b160 Merge pull request #1946 from arthurschreiber/change-branch-iterator-definition
Change the git_branch_iterator_new definition to use git_branch_t
2013-11-05 12:26:41 -08:00
Arthur Schreiber
a667ca8298 Change the git_branch_iterator_new and git_branch_next definitions to use git_branch_t. 2013-11-05 20:51:07 +01:00
Ben Straub
8adea28ae9 Blame: change signature to be more binding-friendly 2013-11-05 11:44:42 -08:00
Edward Thomson
039db728f3 merge branch into current, updating workdir 2013-11-05 10:00:39 -05:00
Vicent Martí
c82f7f8e99 Merge pull request #1938 from libgit2/cmn/branch-iterator
branch: move from foreach to an iterator
2013-11-05 06:55:16 -08:00
Vicent Martí
ffd040532a Merge pull request #1941 from libgit2/rb/preserve-iterator-error
Preserve error messages during file system iterator cleanup
2013-11-05 06:05:32 -08:00
Carlos Martín Nieto
8ec889a45f branch: move from foreach to an iterator
Create a git_branch_iterator type which is equivalent to the foreach but
lets us write loops instead of callbacks.

Since the introduction of git_reference_shorthand(), the added value of
passing the name is reduced.
2013-11-05 14:58:16 +01:00
Vicent Marti
1eab9f0e32 error: Simplify giterr_detach 2013-11-05 14:56:10 +01:00
Edward Thomson
f966acd133 Take umask into account in filebuf_commit 2013-11-04 22:32:50 -05:00
Russell Belfer
d6c6016966 Add giterr_detach API to get and clear error
There are a number of cases where it is convenient to be able to
fetch and "claim" the current error string, clearing the error.
This is helpful when you need to call some code that may alter
the error and you want to restore it later on and/or report it via
some other mechanism.
2013-11-04 15:45:31 -08:00
Vicent Martí
0e1115d287 Merge pull request #1939 from ethomson/readwrite_odb
Allow backend consumers to specify file mode
2013-11-04 12:16:14 -08:00
Edward Thomson
dd64c71c26 Allow backend consumers to specify file mode 2013-11-04 14:50:25 -05:00
Russell Belfer
fb6b0e019e Merge pull request #1317 from libgit2/blame
Blame Canada
2013-11-04 10:44:59 -08:00
Vicent Martí
44acdd1f9a Merge pull request #1937 from scunz/checkout_assert
Don't assert in git_checkout_tree
2013-11-04 08:09:58 -08:00
Sascha Cunz
352214416c Checkout: Don't assert if treeish is NULL
In git_checkout_tree, the first check tests if either repo or treeish is
NULL and says that eithor of them has to have a valid value. But there
is no code to handle the treeish == NULL case.

So, do something meaningful in that case: use HEAD instead.
2013-11-02 03:43:34 +00:00
Sascha Cunz
10749f6ca2 Checkout: Unifiy const-ness of opts parameter
Since all 3 checkout APIs perform the same operation with the options,
all of them should use the same const-ness.
2013-11-02 03:20:05 +00:00
Carlos Martín Nieto
2f03050f4f remote: download HEAD when no refspecs are given
The correct behaviour when a remote has no refspecs (e.g. a URL from the
command-line) is to download the remote's HEAD. Let's do that.

This fixes #1261.
2013-11-01 22:47:06 +01:00
Russell Belfer
a5c16f3cfb Add git_diff_options_init helper
Sometimes the static initializer for git_diff_options cannot be
used and since setting them to all zeroes doesn't actually work
quite right, this adds a new helper for that situation.

This also adds an explicit new value to the submodule settings
options to be used when those enums need static initialization.
2013-11-01 10:20:51 -07:00
Russell Belfer
8e5a8ef86f Convert git_index_read to have a "force" flag
This is a little more intuitive than the turned-around option that
I originally wrote.
2013-11-01 10:20:51 -07:00
Russell Belfer
4bf630b6ba Make diff and status perform soft index reload
This changes `git_index_read` to have two modes - a hard index
reload that always resets the index to match the on-disk data
(which was the old behavior) and a soft index reload that uses
the timestamp / file size information and only replaces the index
data if the file on disk has been modified.

This then updates the git_status code to do a soft reload unless
the new GIT_STATUS_OPT_NO_REFRESH flag is passed in.

This also changes the behavior of the git_diff functions that use
the index so that when an index is not explicitly passed in (i.e.
when the functions call git_repository_index for you), they will
also do a soft reload for you.

This intentionally breaks the file signature of git_index_read
because there has been some confusion about the behavior previously
and it seems like all existing uses of the API should probably be
examined to select the desired behavior.
2013-11-01 10:20:51 -07:00
Vicent Martí
ac5e507cec Merge pull request #1918 from libgit2/cmn/indexer-naming
indexer: remove the stream infix
2013-11-01 09:31:52 -07:00
Daniel Rodríguez Troitiño
3793fa9b18 Fix saving remotes with several fetch/push ref specs.
At some moment git_config_delete_entry lost the ability to delete one entry of
a multivar configuration. The moment you had more than one fetch or push
ref spec for a remote you will not be able to save that remote anymore. The
changes in network::remote::remotes::save show that problem.

I needed to create a new git_config_delete_multivar because I was not able to
remove one or several entries of a multivar config with the current API.
Several tries modifying how git_config_set_multivar(..., NULL) behaved were
not successful.

git_config_delete_multivar is very similar to git_config_set_multivar, and
delegates into config_delete_multivar of config_file. This function search
for the cvar_t that will be deleted, storing them in a temporal array, and
rebuilding the linked list. After calling config_write to delete the entries,
the cvar_t stored in the temporal array are freed.

There is a little fix in config_write, it avoids an infinite loop when using
a regular expression (case for the multivars). This error was found by the
test network::remote::remotes::tagopt.
2013-11-01 00:08:52 +01:00
Carlos Martín Nieto
97d32abb49 Remove leftover function declaration 2013-10-30 15:15:54 +01:00
Carlos Martín Nieto
a6154f2183 indexer: remove the stream infix
It was there to keep it apart from the one which read in from a file on
disk. This other indexer does not exist anymore, so there is no need for
anything other than git_indexer to refer to it.

While here, rename _add() function to _append() and _finalize() to
_commit(). The former change is cosmetic, while the latter avoids
talking about "finalizing", which OO languages use to mean something
completely different.
2013-10-30 15:00:05 +01:00
Ben Straub
42c8f8f807 Merge remote-tracking branch 'libgit2/development' into blame 2013-10-28 11:04:58 -07:00
Vicent Martí
5c50f22a93 Merge pull request #1891 from libgit2/cmn/fix-thin-packs
Add support for thin packs
2013-10-28 09:25:44 -07:00
Vicent Martí
5565f3cda8 Merge pull request #1904 from libgit2/cmn/ssh-naming
Rename the ssh credentials
2013-10-28 07:04:58 -07:00
Ben Straub
8f4a8b096b Merge pull request #1802 from libgit2/cmn/reflog-backend
Make reflog part of refdb
2013-10-28 06:20:28 -07:00
Carlos Martín Nieto
5cb136705d transport: let the progress output return an error
There are any number of issues that can come up in the progress
callback, and we should let the user cancel at that point as well.
2013-10-23 15:45:29 +02:00
Carlos Martín Nieto
ab46b1d8eb indexer: include the delta stats
The user is unable to derive the number of deltas in the pack, as that
would require them to capture the stats exactly in the moment between
download and final processing, which is abstracted away in the fetch.

Capture these numbers for the user and expose them in the progress
struct. The clone and fetch examples now also present this information
to the user.
2013-10-23 15:08:18 +02:00
Carlos Martín Nieto
70a8c78f36 Rename the ssh credentials
The names from libssh2 are somewhat obtuse for us. We can simplify the
usual key/passphrase credential's name, as well as make clearer what the
custom signature function is.
2013-10-23 12:08:54 +02:00
Vicent Martí
1c74686e05 Merge pull request #1897 from libgit2/split-patch-from-diff
RFC: Proposed reworking of diff APIs
2013-10-22 11:55:54 -07:00
Russell Belfer
7ce60099ee Fix typo 2013-10-22 11:12:44 -07:00
Vicent Marti
98fec8a937 Implement git_odb_object_dup 2013-10-22 16:06:12 +02:00
Russell Belfer
5de4ec8104 Implement patience and minimal diff flags
It seems that to implement these options, we just have to pass
the appropriate flags through to the libxdiff code taken from
core git.  So let's do it (and add a test).
2013-10-21 15:36:38 -07:00
Russell Belfer
3b5f795446 Create git_diff_line and extend git_diff_hunk
Instead of having functions with so very many parameters to pass
hunk and line data, this takes the existing git_diff_hunk struct
and extends it with more hunk data, plus adds a git_diff_line.
Those structs are used to pass back hunk and line data instead of
the old APIs that took tons of parameters.

Some work that was previously only being done for git_diff_patch
creation (scanning the diff content for exact line counts) is now
done for all callbacks, but the performance difference should not
be noticable.
2013-10-21 13:42:42 -07:00
Edward Thomson
2648dc1a06 Allowed credential types should be a bitfield 2013-10-21 14:02:36 -05:00
Russell Belfer
74a627f045 Tweak to git_diff_delta structure for nfiles
While the base git_diff_delta structure always contains two files,
when we introduce conflict data, it will be helpful to have an
indicator when an additional file is involved.
2013-10-21 09:07:19 -07:00
Edward Thomson
629b661caa checkout (from index) can write conflicts 2013-10-16 16:20:06 -04:00
Russell Belfer
10672e3e45 Diff API cleanup
This lays groundwork for separating formatting options from diff
creation options.  This groups the formatting flags separately
from the diff list creation flags and reorders the options.  This
also tweaks some APIs to further separate code that uses patches
from code that just looks at git_diffs.
2013-10-15 15:10:07 -07:00
Russell Belfer
3ff1d12373 Rename diff objects and split patch.h
This makes no functional change to diff but renames a couple of
the objects and splits the new git_patch (formerly git_diff_patch)
into a new header file.
2013-10-11 14:51:54 -07:00
Carlos Martín Nieto
893055f22e indexer: clearer stats for thin packs
Don't increase the number of total objects, as it can produce
suprising progress output. The only addition compared to pre-thin is
the addition of local_objects to allow an output similar to git's
"completed with %d local objects".
2013-10-11 17:26:20 +02:00
Ben Straub
364d800b01 Move flag dependencies into docs and code. 2013-10-10 14:53:07 -07:00
Ben Straub
c1ca2b67e1 Include signatures in blame hunks 2013-10-10 14:30:05 -07:00
Vicent Martí
95c148b2c7 Merge pull request #1886 from libgit2/precompose-utf8
Add support for core.precomposeunicode on Mac
2013-10-08 17:03:12 -07:00
Russell Belfer
867f7c9b33 Rename new fn to git_repository_reinit_filesystem 2013-10-08 16:59:59 -07:00
Russell Belfer
92dac97586 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.
2013-10-08 16:35:57 -07:00
Russell Belfer
14997dc5f6 More filemode cleanups for FAT on MacOS
This cleans up some additional issues.  The main change is that
on a filesystem that doesn't support mode bits, libgit2 will now
create new blobs with GIT_FILEMODE_BLOB always instead of being
at the mercy to the filesystem driver to report executable or not.
This means that if "core.filemode" lies and claims that filemode
is not supported, then we will ignore the executable bit from the
filesystem.  Previously we would have allowed it.

This adds an option to the new git_repository_reset_filesystem to
recurse through submodules if desired.  There may be other types
of APIs that would like a "recurse submodules" option, but this
one is particularly useful.

This also has a number of cleanups, etc., for related things
including trying to give better error messages when problems come
up from the filesystem.  For example, the FAT filesystem driver on
MacOS appears to return errno EINVAL if you attempt to write a
filename with invalid UTF-8 in it.  We try to capture that with a
better error message now.
2013-10-08 12:45:43 -07:00
Carlos Martín Nieto
13f670a5d9 tree: allow retrieval of raw attributes
When a tool needs to recreate the tree object (for example an
interface to another VCS), it needs to use the raw attributes,
forgoing any normalization.
2013-10-08 10:07:31 +02:00
Russell Belfer
5173ea921d Add git_repository_reset_filesystem and fix tests
When a repository is transferred from one file system to another,
many of the config settings that represent the properties of the
file system may be wrong.  This adds a new public API that will
refresh the config settings of the repository to account for the
change of file system.  This doesn't do a full "reinitialize" and
operates on a existing git_repository object refreshing the config
when done.

This commit then makes use of the new API in clar as each test
repository is set up.

This commit also has a number of other clar test fixes where we
were making assumptions about the type of filesystem, either based
on outdated config data or based on the OS instead of the FS.
2013-10-04 16:32:16 -07:00
Carlos Martín Nieto
0b33fca03e indexer: fix thin packs
When given an ODB from which to read objects, the indexer will attempt
to inject the missing bases at the end of the pack and update the
header and trailer to reflect the new contents.
2013-10-04 15:26:41 +02:00
nulltoken
6445ae994c index: Enhance documentation 2013-10-04 13:49:26 +02:00
Vicent Martí
146b4d1c5f Merge pull request #1888 from jamill/network_cancellation
network cancellation improvements
2013-10-03 08:18:41 -07:00
Ben Straub
fc1f7d4f15 Merge branch 'development' into blame
Conflicts:
	include/git2.h
2013-10-03 06:20:20 -07:00
nulltoken
598f069b99 commit: Introduce git_commit_message_raw() 2013-10-03 07:59:55 +02:00
Jameson Miller
5b18822545 Support cancellation in push operation
This commit adds cancellation for the push operation. This work consists of:

1) Support cancellation during push operation
    - During object counting phase
    - During network transfer phase
        - Propagate GIT_EUSER error code out to caller
2) Improve cancellation support during fetch
    - Handle cancellation request during network transfer phase
    - Clear error string when cancelled during indexing
3) Fix error handling in git_smart__download_pack

Cancellation during push is still only handled in the pack building and
network transfer stages of push (and not during packbuilding).
2013-10-02 15:12:44 -04:00
Carlos Martín Nieto
0e0cf78773 clone: put the callbacks struct directly in the clone options
There's no need for this to be a pointer to somewhere else.
2013-10-02 14:04:44 +02:00
Carlos Martín Nieto
0174794a95 reflog: bring _append and _drop back to the frontend
These functions act purely on the reflog data structure.
2013-10-02 06:53:24 +02:00
Carlos Martín Nieto
d274deea23 reflog: add a convenience append function
Provide a function that reads a reflog, performs an append and writes back to the
backend in one call.
2013-10-02 06:53:24 +02:00
Carlos Martín Nieto
b976f3c2c2 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.
2013-10-02 06:53:24 +02:00
Carlos Martín Nieto
ffc97d5126 remote: add some comments to the callback struct
Hopefully clear up what they're for.
2013-10-02 06:42:27 +02:00
Carlos Martín Nieto
36a241acbb clone: mention clone_into in the clone documentation
Make the difference more explicit.
2013-10-02 06:42:27 +02:00
Carlos Martín Nieto
c833893c64 clone: re-allow using a custom remote name
This is a small thing that by itself doesn't quite justify making the
user use clone_into.
2013-10-02 06:42:26 +02:00
Carlos Martín Nieto
eec1c1fe1e clone: const-ify checkout options
The removal of many options which lead to the direct usage of the
user's checkout options means we should make sure they remain const.
2013-10-02 06:42:26 +02:00
Carlos Martín Nieto
b9bf5d701d clone: re-add a way to ignore certificate errors
This used to be done via transport flags, which was removed in a
previous commit.
2013-10-02 06:42:26 +02:00
Carlos Martín Nieto
6ac15eff6d clone: remove more options from basic clone
The basic clone function is there to make it easy to create a "normal"
clone. Remove a bunch of options that are about changing the remote's
configuration.
2013-10-02 06:42:26 +02:00
Carlos Martín Nieto
c8dbec4803 clone: remove the autotag option
Downloading all tags is part of what makes it a clone instead of
simply a fetch.
2013-10-02 06:41:42 +02:00
Carlos Martín Nieto
fe3a40a4ff remote: add a convenience 'fetch' function. 2013-10-02 06:41:42 +02:00