Commit Graph

1469 Commits

Author SHA1 Message Date
Carlos Martín Nieto
4386d80be1 clone: perform a "local clone" when given a local path
When git is given such a path, it will perform a "local clone",
bypassing the git-aware protocol and simply copying over all objects
that exist in the source.

Copy this behaviour when given a local path.
2014-05-28 15:40:20 +02:00
Edward Thomson
eff531e103 Modify GIT_MERGE_CONFIG -> GIT_MERGE_PREFERENCE 2014-05-27 20:58:20 -05:00
Edward Thomson
a3622ba6cc Move GIT_MERGE_CONFIG_* to its own enum 2014-05-27 20:49:20 -05:00
Edward Thomson
d362093f9e Introduce GIT_MERGE_CONFIG_* for merge.ff settings
git_merge_analysis will now return GIT_MERGE_CONFIG_NO_FASTFORWARD
when merge.ff=false and GIT_MERGE_CONFIG_FASTFORWARD_ONLY when
merge.ff=true
2014-05-27 20:49:16 -05:00
Michael Anderson
31b0cb518f Fixed miscellaneous documentation errors. 2014-05-23 15:57:20 +08:00
Alan Rogers
7c4bbbf46d Try a value for UNREADABLE that won't get masked out?! 2014-05-23 00:27:34 +10:00
Alan Rogers
86c9d3dae2 Return GIT_FILEMODE_UNREADABLE for files that fail to stat. 2014-05-21 22:54:34 +10:00
Carlos Martín Nieto
d22db24fb7 remote: add api to guess the remote's default branch
If the remote supports the symref protocol extension, then we return
that, otherwise we guess with git's rules.
2014-05-21 12:12:32 +02:00
Carlos Martín Nieto
306475eb01 remote: expose the remote's symref mappings
Add a symref_target field to git_remote_head to expose the symref
mappings to the user.
2014-05-21 12:12:32 +02:00
Alan Rogers
61bef72dc3 Start adding GIT_DELTA_UNREADABLE and GIT_STATUS_WT_UNREADABLE. 2014-05-20 23:57:40 +10:00
Alan Rogers
9055347944 Rename GIT_ENOACCESS -> GIT_EUNREADABLE 2014-05-20 17:40:28 +10:00
Carlos Martín Nieto
49e369b29d message: don't assume the comment char
The comment char is configurable and we need to provide a way for the
user to specify which comment char they chose for their message.
2014-05-18 10:06:49 +02:00
Vicent Marti
228272ef58 Merge pull request #2313 from libgit2/cmn/remote-delete
Remote deletion
2014-05-16 11:56:37 +02:00
Alan Rogers
158c8ba1ee Return a specific error for EACCES. 2014-05-15 16:54:46 +10:00
Russell Belfer
b1914c3651 Minor fixes for warnings and error propagation 2014-05-12 10:24:46 -07:00
Russell Belfer
d2c4d1c63d Merge pull request #2188 from libgit2/cmn/config-snapshot
Configuration snapshotting
2014-05-12 10:04:52 -07:00
Russell Belfer
45c53eb6cb Use unsigned type for APIs with opt flag mask 2014-05-08 10:46:04 -07:00
Carlos Martín Nieto
ac99d86ba5 repository: introduce a convenience config snapshot method
Accessing the repository's config and immediately taking a snapshot of
it is a common operation, so let's provide a convenience function for
it.
2014-05-07 11:34:32 +02:00
Russell Belfer
5269008cf6 Add filter options and ALLOW_UNSAFE
Diff and status do not want core.safecrlf to actually raise an
error regardless of the setting, so this extends the filter API
with an additional options flags parameter and adds a flag so that
filters can be applied with GIT_FILTER_OPT_ALLOW_UNSAFE, indicating
that unsafe filter application should be downgraded from a failure
to a warning.
2014-05-06 16:01:49 -07:00
Russell Belfer
d2c16e9ac4 Doc fixes 2014-05-02 15:15:43 -07:00
Vicent Marti
272b462db7 Merge pull request #2308 from libgit2/rb/diff-update-index-stat-cache
Reduce excessive OID calculation for diff and stat
2014-05-02 09:50:15 -07:00
Russell Belfer
9862ef8ef8 Merge pull request #2310 from libgit2/cmn/commit-create-safe
commit: safer commit creation with reference update
2014-05-02 09:42:07 -07:00
Russell Belfer
bc91347b58 Fix remaining init_options inconsistencies
There were a couple of "init_opts()" functions a few more cases
of structure initialization that I somehow missed.
2014-05-02 09:21:33 -07:00
Russell Belfer
702efc891f Make init_options fns use unsigned ints and macro
Use an unsigned int for the version and add a helper macro so the
code is simplified (and so the error message is a common string).
2014-05-02 09:21:33 -07:00
Russell Belfer
9c8ed49997 Remove trace / add git_diff_perfdata struct + api 2014-05-02 09:21:33 -07:00
Russell Belfer
7a2e56a3f6 Get rid of redundant git_diff_options_init fn
Since git_diff_init_options was introduced, remove this old fn.
2014-05-02 09:21:33 -07:00
Russell Belfer
b23b112dfe Add payloads, bitmaps to trace API
This is a proposed adjustment to the trace APIs.  This makes the
trace levels into a bitmask so that they can be selectively enabled
and adds a callback-level payload, plus a message-level payload.

This makes it easier for me to a GIT_TRACE_PERF callbacks that
are simply bypassed if the PERF level is not set.
2014-05-02 09:21:33 -07:00
Russell Belfer
cd424ad551 Add GIT_STATUS_OPT_UPDATE_INDEX and use trace API
This adds an option to refresh the stat cache while generating
status.  It also rips out the GIT_PERF stuff I had an makes use
of the trace API to keep statistics about what happens during diff.
2014-05-02 09:21:33 -07:00
Russell Belfer
94fb4aadc8 Add diff option to update index stat cache
When diff is scanning the working directory, if it finds a file
where it is not sure if the index entry matches the working dir,
it will recalculate the OID (which is pretty expensive).  This
adds a new flag to diff so that if the OID calculation finds that
the file actually has not changed (i.e. just the modified time was
altered or such), then it will refresh the stat cache in the index
so that future calls to diff will not have to check the oid again.
2014-05-02 09:21:33 -07:00
Russell Belfer
0fc8e1f6bd Lay groundwork for updating stat cache in diff
This reorganized the diff OID calculation to make it easier to
correctly update the stat cache during a diff once the flags to
do so are enabled.

This includes marking the path of a git_index_entry as const so
we can make a "fake" git_index_entry with a "const char *" path
and not get warnings.  I was a little surprised at how unobtrusive
this change was, but I think it's probably a good thing.
2014-05-02 09:21:33 -07:00
nulltoken
40e48ea40f remote: Introduce git_remote_delete() 2014-04-30 11:45:49 +02:00
Carlos Martín Nieto
891b0277af refs: document _next_name()
If it's not documented, it doesn't show up in the docs (and we really
should document, anyway).
2014-04-30 11:20:51 +02:00
Carlos Martín Nieto
217c029b54 commit: safer commit creation with reference update
The current version of the commit creation and amend function are unsafe
to use when passing the update_ref parameter, as they do not check that
the reference at the moment of update points to what the user expects.

Make sure that we're moving history forward when we ask the library to
update the reference for us by checking that the first parent of the new
commit is the current value of the reference. We also make sure that the
ref we're updating hasn't moved between the read and the write.

Similarly, when amending a commit, make sure that the current tip of the
branch is the commit we're amending.
2014-04-30 00:41:37 +02:00
Vicent Marti
8443ed6c1d Merge pull request #2284 from jacquesg/push-progress-callback
Fire progress and update tips callbacks also for pushes.
2014-04-25 02:10:19 -07:00
Russell Belfer
6b833e3a4a Improve docs for status rename detection limits
and make tests empty on platforms without iconv support.
2014-04-24 15:40:50 -07:00
Vicent Marti
212b6205d7 Merge pull request #2291 from ethomson/patch_binary
patch: emit deflated binary patches (optionally)
2014-04-23 09:27:15 -07:00
Edward Thomson
e349ed500b patch: emit binary patches (optionally) 2014-04-22 19:08:21 -05:00
Russell Belfer
8d09efa24e Use git_diff_get_stats in example/diff + refactor
This takes the `--stat` and related example options in the example
diff.c program and converts them to use the `git_diff_get_stats`
API which nicely formats stats for you.

I went to add bar-graph scaling to the stats formatter and noticed
that the `git_diff_stats` structure was holding on to all of the
`git_patch` objects.  Unfortunately, each of these objects keeps
the full text of the diff in memory, so this is very expensive.  I
ended up modifying `git_diff_stats` to keep just the data that it
needs to keep and allowed it to release the patches.  Then, I added
width scaling to the output on top of that.

In making the diff example program match 'git diff' output, I ended
up removing an newline from the sumamry output which I then had to
compensate for in the email formatting to match the expectations.

Lastly, I went through and refactored the tests to use a couple of
helper functions and reduce the overall amount of code there.
2014-04-22 12:33:27 -07:00
Russell Belfer
12e422a056 Some doc and examples/diff.c changes
I was playing with "git diff-index" and wanted to be able to
emulate that behavior a little more closely with the diff example.

Also, I wanted to play with running `git_diff_tree_to_workdir`
directly even though core Git doesn't exactly have the equivalent,
so I added a command line option for that and tweaked some other
things in the example code.

This changes a minor output thing in that the "raw" print helper
function will no longer add ellipses (...) if the OID is not
actually abbreviated.
2014-04-22 09:17:29 -07:00
Carlos Martín Nieto
bc0a619867 transports: allow the creds callback to say it doesn't exist
Allow the credentials callback to return GIT_PASSTHROUGH to make the
transports code behave as though none was set.

This should make it easier for bindings to behave closer to the C code
when there is no credentials callback set at their level.
2014-04-22 14:34:26 +02:00
Carlos Martín Nieto
2efd7df6b1 remote: provide read access to the callback structure
This should make it easier for bindings to dynamically override their
own callbacks.
2014-04-22 14:32:19 +02:00
Jacques Germishuys
48e60ae75e Don't redefine the same callback types, their signatures may change 2014-04-21 11:28:49 +02:00
Jacques Germishuys
98020d3a73 Rename progress callback to sideband_progress 2014-04-21 10:55:37 +02:00
Jacques Germishuys
4f62163ead Check the return codes of remote callbacks.
The user may have requested that the operation be cancelled.
2014-04-21 10:24:16 +02:00
Jacques Germishuys
9effa2fb72 Fire progress callbacks also for pushes.
It's not very useful to only know that a pre-receive hook has declined
a push, you probably want to know why.
2014-04-20 22:06:45 +02:00
Jacques Germishuys
043112dc1c Replace void * with proper callback types 2014-04-18 17:58:25 +02:00
Jacques Germishuys
8ec0a55273 Make git_cred_ssh_custom_new() naming more consistent 2014-04-18 17:58:25 +02:00
Jacques Germishuys
478408c010 Introduce git_cred_ssh_interactive_new()
This allows for keyboard-interactive based SSH authentication
2014-04-18 17:58:25 +02:00
Carlos Martín Nieto
c20d71eac9 config: document the how long the pointers are valid for 2014-04-18 16:07:33 +02:00
Carlos Martín Nieto
523032cd24 config: refresh before reading a value
With the isolation of complex reads, we can now try to refresh the
on-disk file before reading a value from it.

This changes the semantics a bit, as before we could be sure that a
string we got from the configuration was valid until we wrote or
refreshed. This is no longer the case, as a read can also invalidate the
pointer.
2014-04-18 16:07:33 +02:00
Carlos Martín Nieto
55ebd7d369 config: implement config snapshotting
In order to have consistent views of the config files for remotes,
submodules et al. and a configuration that represents what is currently
stored on-disk, we need a way to provide a view of the configuration
that does not change.

The goal here is to provide the snapshotting part by creating a
read-only copy of the state of the configuration at a particular point
in time, which does not change when a repository's main config changes.
2014-04-18 16:03:01 +02:00
Russell Belfer
aba6b5edbd Fix leak in git_index_conflict_cleanup
I introduced a leak into conflict cleanup by removing items from
inside the git_vector_remove_matching call.  This simplifies the
code to just use one common way for the two conflict cleanup APIs.

When an index has an active snapshot, removing an item can cause
an error (inserting into the deferred deletion vector), so I made
the git_index_conflict_cleanup API return an error code.  I felt
like this wasn't so bad since it is just like the other APIs.

I fixed up a couple of comments while I was changing the header.
2014-04-17 14:43:46 -07:00
Russell Belfer
27e54bcf82 Add public diff print helpers
The usefulness of these helpers came up for me while debugging
some of the iterator changes that I was making, so since they
have also been requested (albeit indirectly) I thought I'd include
them.
2014-04-17 14:43:45 -07:00
Russell Belfer
3dbee45656 Some index internals refactoring
Again, laying groundwork for some index iterator changes, this
contains a bunch of code refactorings for index internals that
should make it easier down the line to add locking around index
modifications.  Also this removes the redundant prefix_position
function and fixes some potential memory leaks.
2014-04-17 14:43:45 -07:00
Vicent Marti
c5cacc4ec2 Merge pull request #2261 from jacquesg/format-patch
Support for format-patch
2014-04-16 19:09:35 +02:00
Sven Strickroth
fa13ee2d7c Add GIT_BRANCH_ALL to git_branch_t enum
git_branch_t is an enum so requesting GIT_BRANCH_LOCAL | GIT_BRANCH_REMOTE is not possible as it is not a member of the enum (at least VS2013 C++ complains about it).

This fixes a regression introduced in commit a667ca8298 (PR #1946).

Signed-off-by: Sven Strickroth <email@cs-ware.de>
2014-04-16 18:51:16 +02:00
Jacques Germishuys
d8cc1fb653 Introduce git_diff_format_email and git_diff_commit_as_email 2014-04-15 17:22:17 +02:00
Jacques Germishuys
360314c9db Introduce git_diff_get_stats, git_diff_stats_files_changed, git_diff_stats_insertions, git_diff_stats_deletions and git_diff_stats_to_buf 2014-04-15 17:22:12 +02:00
Jacques Germishuys
4d7b993904 Added cherry-pick support 2014-04-14 16:16:21 +02:00
Jacques Germishuys
7a28f268ad Fix const-correctness of git_patch_get_delta, git_patch_num_hunks, git_patch_num_lines_in_hunk 2014-04-11 21:55:36 +02:00
Jacques Germishuys
3b4ba27870 Const correctness! 2014-04-03 16:06:31 +02:00
Rob Rix
ddc66e27b6 Give the correct name for the function in the doc.
Per @carlosmn, git_index_add is now named git_index_add_bypath.
2014-04-02 08:02:43 -04:00
Rob Rix
bb439de039 Correct a stale reference to GIT_EBAREINDEX 2014-04-01 16:37:19 -04:00
Russell Belfer
2450d4c63a Merge pull request #2208 from libgit2/vmg/mempack
In-memory packing backend
2014-04-01 09:33:18 -07:00
Vicent Marti
9325460a93 Merge pull request #2206 from libgit2/cmn/inmemory-swap-order
Rename in-memory remote to anonymous and swap url and fetch order
2014-04-01 13:47:44 +02:00
Carlos Martín Nieto
fd536d29c1 remote: rename inmemory to anonymous and swap url and fetch order
The order in this function is the opposite to what
create_with_fetchspec() has, so change this one, as url-then-refspec is
what git does.

As we need to break compilation and the swap doesn't do that, let's take
this opportunity to rename in-memory remotes to anonymous as that's
really what sets them apart.
2014-04-01 13:38:04 +02:00
Edward Thomson
7f930ded88 Const up members of git_merge_file_result 2014-03-31 11:08:31 -07:00
Edward Thomson
976634c467 Introduce git_merge_head_id 2014-03-31 11:43:38 -05:00
Russell Belfer
22df47cbc5 Fix segfault if gitmodules is invalid
The reload_all call could end up dereferencing a NULL pointer if
there was an error while attempting to load the submodules config
data (i.e. invalid content in the gitmodules file).  This fixes it.
2014-03-26 14:38:26 -07:00
Vicent Marti
dc7efa1aef Merge pull request #2204 from libgit2/rb/submodule-reference-counting
Make submodules externally refcounted
2014-03-26 18:29:34 +01:00
Vicent Marti
6105d59707 In-memory packing backend 2014-03-26 18:17:08 +01:00
Edward Thomson
451aaf866a Merge pull request #2181 from anuraggup/hide_cb
Callback function to hide commit and its parents in revision walker
2014-03-25 10:33:18 -07:00
Russell Belfer
a15c7802c8 Make submodules externally refcounted
`git_submodule` objects were already refcounted internally in case
the submodule name was different from the path at which it was
stored.  This makes that refcounting externally used as well, so
`git_submodule_lookup` and `git_submodule_add_setup` return an
object that requires a `git_submodule_free` when done.
2014-03-25 09:14:48 -07:00
Anurag Gupta
892b7c9fef Correcting format of comments in header file 2014-03-24 11:20:51 -07:00
Anurag Gupta
3a666071d9 Unit Tests for hide_cb in revwalk 2014-03-24 11:20:13 -07:00
Anurag Gupta
892aa808e2 Callback to hide commits in revision walker. 2014-03-24 11:20:03 -07:00
Vicent Marti
85a41fc4bf Merge pull request #2183 from ethomson/merge_refactor
Refactor the `git_merge` API
2014-03-24 18:09:13 +01:00
Carlos Martín Nieto
6057c4a038 opts: bits are not bytes
The default cache size is 256 megabytes, not megabits as claimed in the
docs.
2014-03-24 13:21:51 +01:00
Carlos Martín Nieto
42dee8ecd7 settings: use git_buf for returning strings
This survived the last round of culling, as the signature is only in the
comments.
2014-03-24 13:21:51 +01:00
Edward Thomson
58c2b1c421 UNBORN implies FAST_FORWARD 2014-03-20 09:35:22 -07:00
Edward Thomson
ac584fcfd3 Introduce GIT_MERGE_ANALYSIS_UNBORN 2014-03-20 09:25:11 -07:00
Edward Thomson
97f3462ae6 git_merge_status -> git_merge_analysis 2014-03-20 09:25:10 -07:00
Edward Thomson
d9fdee6e4c Remove git_merge_result as it's now unnecessary 2014-03-20 09:25:09 -07:00
Edward Thomson
5aa2ac6de1 Update git_merge_tree_opts to git_merge_options 2014-03-20 09:25:08 -07:00
Edward Thomson
02105a27f0 Change signature of git_merge to take merge and checkout opts 2014-03-20 09:25:07 -07:00
Edward Thomson
1c0b6a38ba Remove fastforward / uptodate from git_merge 2014-03-20 09:25:06 -07:00
Edward Thomson
ccb308273a Add git_merge_status to provide info about an upcoming merge 2014-03-20 09:25:06 -07:00
Edward Thomson
05d47768ca Introduce git_merge_file for consumers 2014-03-20 09:25:05 -07:00
Vicent Marti
5dd7d2432e Merge pull request #2189 from Aimeast/octopus
Implement git_merge_base_octopus
2014-03-18 16:23:51 +01:00
Aimeast
0aee025bef Implement git_merge_base_octopus 2014-03-18 22:31:14 +08:00
Vicent Marti
dd4c6962d7 Merge pull request #2192 from phkelley/development
Seamless support for NTLM/Kerberos auth on Windows
2014-03-18 15:25:43 +01:00
Philip Kelley
1392418ea8 Seamless support for NTLM/Kerberos auth on Windows 2014-03-18 10:24:23 -04:00
Carlos Martín Nieto
853b1407c0 branch: constness fixes 2014-03-17 17:47:46 +01:00
Carlos Martín Nieto
2b40390f22 refs: fix copy-paste doc error 2014-03-13 15:54:53 +01:00
Jan Melcher
52fba18f4e Add git_submodule_resolve_url() 2014-03-10 18:16:10 +01:00
Vicent Marti
041cd4a23f Merge pull request #2028 from libgit2/options-names
Rename options structures
2014-03-07 19:02:58 +01:00
Russell Belfer
5a6de908f6 Merge pull request #2153 from mekishizufu/tag_example
Add a tag example
2014-03-07 09:13:43 -08:00
Ben Straub
aa17c3c63c git_revert_opts -> git_revert_options 2014-03-06 09:44:52 -08:00
Ben Straub
6affd71f33 git_checkout_opts -> git_checkout_options 2014-03-06 09:44:51 -08:00
Vicent Marti
2ab6d2cd47 Revert pull request #1997 2014-03-06 16:08:17 +01:00