Commit Graph

1937 Commits

Author SHA1 Message Date
Edward Thomson
45165b1208 Merge pull request #3584 from jbreeden/export_fn
Export git_stash_apply_init_options
2016-02-04 16:43:23 -08:00
Ephemera
804bcd6b95 Fix typo 2016-02-05 01:59:07 +09:00
Nicolas Vanheuverzwijn
1087e6be88 Fix a typo in documentation 2016-02-03 17:27:04 -05:00
jbreeden
d02720d8a6 Export git_stash_apply_init_options 2016-01-23 17:13:25 -08:00
Edward Thomson
869320a85d Merge pull request #3546 from Cruel/master
Fix a couple function signatures
2015-12-26 16:55:29 -06:00
tepas
cf339ede0a fix git_blob_create_fromchunks documentation
putting `0.` at the start of the line turns it into a numbered list.
2015-12-16 09:25:18 +11:00
Thomas Edvalson
95746a57c7 Fix a couple function signatures 2015-12-14 19:21:09 -05:00
Edward Thomson
30c8e26074 Merge pull request #3521 from pks-t/blame-line-overflow
Line count overflow in git_blame_hunk and git_blame__entry
2015-12-14 13:53:26 -06:00
Carlos Martín Nieto
6aa06b65cf Merge pull request #3522 from pks-t/email-format-commit-message
diff: include commit message when formatting patch
2015-12-10 12:14:09 +01:00
joshaber
ab273821ee Play nice with the docs. 2015-12-08 11:58:19 -05:00
joshaber
eda726cfb5 Use a typedef for the submodule_foreach callback.
This fits with the style for the rest of the project, but more
importantly, makes life easier for bindings authors who auto-generate
code.
2015-12-08 11:34:00 -05:00
Patrick Steinhardt
254e0a33ee diff: include commit message when formatting patch
When formatting a patch as email we do not include the commit's
message in the formatted patch output. Implement this and add a
test that verifies behavior.
2015-12-01 10:12:53 +01:00
Patrick Steinhardt
7f8fe1d45e commit: introduce git_commit_body
It is already possible to get a commit's summary with the
`git_commit_summary` function. It is not possible to get the
remaining part of the commit message, that is the commit
message's body.

Fix this by introducing a new function `git_commit_body`.
2015-12-01 10:07:00 +01:00
Patrick Steinhardt
cb1cb24ca9 blame: use size_t for line counts in git_blame_hunk
It is not unreasonable to have versioned files with a line count
exceeding 2^16. Upon blaming such files we fail to correctly keep
track of the lines as `git_blame_hunk` stores them in `uint16_t`
fields.

Fix this by converting the line fields of `git_blame_hunk` to
`size_t`. Add test to verify behavior.
2015-12-01 09:02:47 +01:00
Edward Thomson
5b9c63c3f6 recursive merge: add a recursion limit 2015-11-25 16:25:47 -05:00
Edward Thomson
86c8d02c07 merge: add simple recursive test
Add a simple recursive test - where multiple ancestors exist and
creating a virtual merge base from them would prevent a conflict.
2015-11-25 15:37:11 -05:00
Edward Thomson
fa78782f67 merge: rename git_merge_tree_flags_t -> git_merge_flags_t 2015-11-25 15:37:05 -05:00
Carlos Martín Nieto
2ea40fdaac repository: distinguish sequencer cherry-pick and revert
These are not quite like their plain counterparts and require special handling.
2015-11-20 13:19:23 -05:00
Edward Thomson
3eac1037d6 settings: allow users to set PROGRAMDATA
Allow users to set the `git_libgit2_opts` search path for the
`GIT_CONFIG_LEVEL_PROGRAMDATA`.  Convert `GIT_CONFIG_LEVEL_PROGRAMDATA`
to `GIT_SYSDIR_PROGRAMDATA` for setting the configuration.
2015-11-16 23:31:19 -05:00
Carlos Martín Nieto
75a0ccf52f Merge pull request #3170 from CmdrMoozy/nsec_fix
git_index_entry__init_from_stat: set nsec fields in entry stats
2015-11-12 19:53:09 +01:00
Carlos Martín Nieto
de870533e0 settings: add a setter for a custom user-agent 2015-11-12 17:18:42 +01:00
Carlos Martín Nieto
7fafde6325 stream: allow registering a user-provided TLS constructor
This allows the application to use their own TLS stream, regardless of
the capabilities of libgit2 itself.
2015-11-03 08:10:29 -08:00
Jason Haslam
3138ad9366 Add diff progress callback. 2015-11-02 16:33:58 -05:00
Leo Yang
bf28da4718 Fix build for custom transport users
We should explicitly include the declaration of git_strarray
from "include/git2/sys/transport.h"
2015-10-30 14:17:11 -04:00
Vicent Marti
a1f5d691a2 merge: Implement GIT_MERGE_TREE_SKIP_REUC 2015-10-27 22:44:26 +01:00
Edward Thomson
821131fdae Merge pull request #3477 from linquize/inttypes.h
inttypes.h is built-in header file since MSVC 2013
2015-10-23 10:13:14 -05:00
Edward Thomson
8683d31f08 merge: add GIT_MERGE_TREE_FAIL_ON_CONFLICT
Provide a new merge option, GIT_MERGE_TREE_FAIL_ON_CONFLICT, which
will stop on the first conflict and fail the merge operation with
GIT_EMERGECONFLICT.
2015-10-22 14:55:17 -04:00
Linquize
240a85cf10 inttypes.h is built-in header file since MSVC 2013
The reason is that the types defined in libgit2's inttypes.h collide with system inttypes.h
3rd party library header files may directly reference MSVC's built-in inttypes.h

Fixes #3476
2015-10-22 07:56:34 +08:00
Edward Thomson
44b1e3e390 Merge pull request #3475 from libgit2/cmn/programdata-config
config: add a ProgramData level
2015-10-21 13:43:22 -07:00
Edward Thomson
0f9b6742ad win32: add c linkage guard around inttypes.h inclusion 2015-10-21 09:24:10 -04:00
Carlos Martín Nieto
8c7c5fa585 config: add a ProgramData level
This is where portable git stores the global configuration which we can
use to adhere to it even though git isn't quite installed on the system.
2015-10-21 15:11:18 +02:00
Carlos Martín Nieto
8321596a49 Merge pull request #3444 from ethomson/add_preserves_conflict_mode
Preserve modes from a conflict in `git_index_insert`
2015-10-15 12:22:10 +02:00
Axel Rasmussen
c7b17fb5cd Merge branch 'master' into nsec_fix_next 2015-10-01 18:01:32 -07:00
Arthur Schreiber
d3b29fb94b refdb and odb backends must provide free function
As refdb and odb backends can be allocated by client code, libgit2
can’t know whether an alternative memory allocator was used, and thus
should not try to call `git__free` on those objects.

Instead, odb and refdb backend implementations must always provide
their own `free` functions to ensure memory gets freed correctly.
2015-10-01 00:50:37 +02:00
Edward Thomson
21515f228b index: also try conflict mode when inserting
When we do not trust the on-disk mode, we use the mode of an existing
index entry.  This allows us to preserve executable bits on platforms
that do not honor them on the filesystem.

If there is no stage 0 index entry, also look at conflicts to attempt
to answer this question:  prefer the data from the 'ours' side, then
the 'theirs' side before falling back to the common ancestor.
2015-09-30 09:06:09 -04:00
Carlos Martín Nieto
72b7c57093 Merge pull request #3411 from spraints/custom-push-headers
Include custom HTTP headers
2015-09-30 09:17:18 +02:00
Axel Rasmussen
0269833f92 settings: expose GIT_USE_NSEC flag in git_libgit2_features 2015-09-18 23:33:56 -07:00
Matt Burke
c49126c87f Accept custom headers for fetch too 2015-09-10 08:34:35 -04:00
Matt Burke
4f2b6093a6 Tell the git_transport about the custom_headers 2015-09-08 14:02:33 -04:00
Matt Burke
9da32a6255 Add custom_headers to git_push_options 2015-09-08 14:02:25 -04:00
Matt Burke
24f5b4e155 Drop extra_http_headers from git_remote 2015-09-08 14:01:57 -04:00
Leo Yang
c097f7173d New API: git_index_find_prefix
Find the first index entry matching a prefix.
2015-09-04 12:24:36 -04:00
Matt Burke
59d6128e27 Allow the world to set HTTP headers for remotes 2015-09-04 09:36:50 -04:00
Carlos Martín Nieto
1cef6b9f19 config: correct documentation for non-existent config file 2015-09-03 11:38:21 +02:00
Carlos Martín Nieto
21e7015ca3 Merge pull request #3402 from ethomson/faster_diff
Provide path matching in the iterators (for faster diffs)
2015-09-01 02:26:11 +02:00
Edward Thomson
53c2296bfe iterator: better document GIT_DIFF_DISABLE_PATHSPEC_MATCH 2015-08-31 19:41:43 -04:00
Edward Thomson
56ed415a24 diff: drop FILELIST_MATCH
Now that non-pathspec matching diffs are implemented at the iterator
level, drop `FILELIST_MATCH`ing.
2015-08-30 19:11:31 -04:00
Carlos Martín Nieto
ed38e26db5 Merge pull request #3401 from phatblat/pb/doc-warning
Escape @ in doc comment
2015-08-30 15:47:49 +02:00
Ben Chatelain
91c9484c23 Escape @ in doc comment 2015-08-29 17:46:34 -06:00
Edward Thomson
3273ab3f0b diff: better document GIT_DIFF_PATHSPEC_DISABLE
Document that `GIT_DIFF_PATHSPEC_DISABLE` is not necessarily about
explicit path matching, but also includes matching of directory
names.  Enforce this in a test.
2015-08-28 20:45:08 -04:00
Edward Thomson
ef206124de Move filelist into the iterator handling itself. 2015-08-28 18:39:52 -04:00
Carlos Martín Nieto
57af0b928e cred: add a free function wrapper 2015-08-19 02:23:18 +02:00
Carlos Martín Nieto
47ed7e5acd transport: provide a way to get the callbacks
libgit2 implementations of smart subtransports can simply reach through
the structure, but external implementors cannot.

Add these two functions as a way for the smart subtransports to get the
callbacks as set by the user.
2015-08-19 02:23:18 +02:00
Carlos Martín Nieto
5340d63d38 config: perform unlocking via git_transaction
This makes the API for commiting or discarding changes the same as for
references.
2015-08-12 04:09:38 +02:00
Carlos Martín Nieto
36f784b538 config: expose locking via the main API
This lock/unlock pair allows for the cller to lock a configuration file
to avoid concurrent operations.

It also allows for a transactional approach to updating a configuration
file. If multiple updates must be made atomically, they can be done
while the config is locked.
2015-08-12 04:09:38 +02:00
Carlos Martín Nieto
b166703964 config: implement basic transactional support
When a configuration file is locked, any updates made to it will be done
to the in-memory copy of the file. This allows for multiple updates to
happen while we hold the lock, preventing races during complex
config-file manipulation.
2015-08-12 04:09:09 +02:00
Michael Procter
25dbcf3499 Make giterr_detach no longer public 2015-08-03 15:23:17 +01:00
Carlos Martín Nieto
c400bac4db Merge pull request #3332 from phatblat/ben/doc-warnings
Resolve documentation warnings
2015-08-01 15:38:04 +02:00
Ben Chatelain
08afd227df Fix remaining documentation warnings 2015-07-27 18:32:55 -06:00
Ben Chatelain
f90fbb8d22 Use correct Doxygen trailing comment syntax 2015-07-27 17:42:08 -06:00
Ben Chatelain
41808d0470 Fix @param names in doc comments 2015-07-27 14:46:50 -06:00
Edward Thomson
759b2230a5 Merge pull request #3303 from libgit2/cmn/index-add-submodule
Allow adding a submodule through git_index_add_bypath
2015-07-24 15:04:20 -05:00
Edward Thomson
91dad18143 Merge pull request #3305 from libgit2/cmn/reflog-del-backend
refdb: delete a ref's reflog upon deletion
2015-07-24 15:01:04 -05:00
Ryan Roden-Corrent
37996d474b Document git_fetch_options struct and fix typo.
git_fetch_options was missing from the API docs because it lacked a
documentation comment above the struct declaration.
I used the git_checkout_options docstring as a template.

Also fixes a typo in git_remote_prune_refs (remote, not reamote).
2015-07-20 09:48:01 -04:00
Carlos Martín Nieto
01d0c02dba refdb: delete a ref's reflog upon deletion
Removing a reflog upon ref deletion is something which only some
backends might wish to do. Backends which are database-backed may wish
to archive a reflog, log-based ones may not need to do anything.
2015-07-12 19:08:06 +02:00
Carlos Martín Nieto
8a52ed7a48 errors: add EDIRECTORY
This is to be returned when the operation which the user asked for is
not possible to do on a directory.
2015-07-12 12:11:22 +02:00
Edward Thomson
79698030b0 git_cert: child types use proper base type 2015-07-10 09:28:33 -05:00
Carlos Martín Nieto
9847d80ddc Merge pull request #3281 from ethomson/wildcard_filters
filters: custom filters with wildcard attributes
2015-07-09 18:21:31 +02:00
Carlos Martín Nieto
3704ac35d3 Merge pull request #3277 from git-up/git_diff_index_to_index
Added git_diff_index_to_index()
2015-07-07 12:38:47 +02:00
Carlos Martín Nieto
a94d3e68bf filter: add docs for streaming filters
These functions are available on the public API but don't have any
documentation, so they don't appear on the API reference. Fix that.
2015-07-03 14:36:41 +02:00
Carlos Martín Nieto
34065968ed submodule: completely remove reload_all
The function was removed, but its declaration and changelog entry about
its removal were forgotten.

The comment in the test doesn't make any sense as the function doesn't
exist anymore, so get rid of it as well.
2015-07-01 17:49:07 +02:00
Edward Thomson
63924435a1 filters: custom filters with wildcard attributes
Allow custom filters with wildcard attributes, so that clients
can support some random `filter=foo` in a .gitattributes and look
up the corresponding smudge/clean commands in the configuration file.
2015-07-01 09:40:11 -05:00
Pierre-Olivier Latour
ccef5adb63 Added git_diff_index_to_index() 2015-06-30 10:03:32 -07:00
Carlos Martín Nieto
84d5a98f80 Bump version to 0.23.0 and SOVERSION to 23 2015-06-28 14:53:30 +02:00
Carlos Martín Nieto
354268ca48 Merge pull request #3259 from ethomson/stash_apply_argh
Stash apply: stage new files even when not updating the index
2015-06-26 17:46:35 +02:00
Edward Thomson
c0280bdd15 Merge pull request #3255 from libgit2/cmn/rename-unspecified
Rename FALLBACK to UNSPECIFIED
2015-06-25 18:55:48 -04:00
Edward Thomson
82b1c93d08 stash: don't allow apply with staged changes 2015-06-25 18:34:36 -04:00
Edward Thomson
87987fd1e0 Merge pull request #3246 from libgit2/cmn/dont-grow-borrowed
Don't allow growing borrowed buffers
2015-06-25 15:26:43 -04:00
Carlos Martín Nieto
c2418f4613 Rename FALLBACK to UNSPECIFIED
Fallback describes the mechanism, while unspecified explains what the
user is thinking.
2015-06-25 12:48:44 +02:00
Carlos Martín Nieto
189aad45af errors: introduce EINVALID
We've been using EINVALIDSPEC for a while to mean this, but that name
is too specific. Introduce this to be more explicit.
2015-06-24 23:49:10 +02:00
Carlos Martín Nieto
bd470d0034 blob: don't recomment using git_buf_grow
We currently recommend using `git_buf_grow` in order to make a buffer
make an owned copy of the memory it points to. This is not behaviour we
should encourage, so remove this recommendation.

The function itself is not changed, as we need to remain compatible, but
it will be changed not to allow usage on borrowed buffers.
2015-06-24 23:49:10 +02:00
Carlos Martín Nieto
daacf96d10 Merge pull request #3097 from libgit2/cmn/submodule-config-state
Remove run-time configuration settings from submodules
2015-06-24 23:34:40 +02:00
Carlos Martín Nieto
cdee630f6f curl: extract certificate information
The information is exposed by curl for some crypto libraries in the form
of name:content strings. We can't do much more than return this
information.
2015-06-24 17:26:36 +02:00
Carlos Martín Nieto
1376e784c6 stream: add support for setting a proxy
If the stream claims to support this feature, we can let the transport
set the proxy.

We also set HTTPPROXYTUNNEL option so curl can create a tunnel through
the proxy which lets us create our own TLS session (if needed).
2015-06-24 17:26:36 +02:00
Edward Thomson
09f3364d7a Merge pull request #3131 from urkud/const-char
Add `const` qualifier
2015-06-23 23:40:02 -04:00
Carlos Martín Nieto
783672fa5b submodule: remove the RESET enum values
These are not useful anymore, as we don't affect the instance's
configuration.
2015-06-22 17:02:56 +02:00
Carlos Martín Nieto
961861fafa submodule: get rid of _save()
We no longer have any setters which affect an instance, so
`git_submodule_save()` is no longer relevant.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
d6073b30f3 submodule: make _set_url() affect the configuration
With this one, we can get rid of the edit_and_save test.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
486ba4cdd3 submodule: make _set_branch() affect the configuration 2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
4e63642321 submodule: make _set_update_fetch_recurse_submodules() affect the config
Similarly to the other ones. In this test we copy over testing
`RECURSE_YES` which shows an error in our handling of the `YES` variant
which we may have to port to the rest.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
e8a39f8ed1 submodule: make _set_update() affect the configuration
Moving on with the removal of runtime-changing variables, the update
setting for a remote is whatever it was when it was looked up.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
c6f489c964 submodule: add an ignore option to status
This lets us specify in the status call which ignore rules we want to
use (optionally falling back to whatever the submodule has in its
configuration).

This removes one of the reasons for having `_set_ignore()` set the value
in-memory. We re-use the `IGNORE_RESET` value for this as it is no
longer relevant but has a similar purpose to `IGNORE_FALLBACK`.

Similarly, we remove `IGNORE_DEFAULT` which does not have use outside of
initializers and move that to fall back to the configuration as well.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
64bbd47a32 submodule: don't let status change an existing instance
As submodules are becomes more like values, we should not let a status
check to update its properties. Instead of taking a submodule, have
status take a repo and submodule name.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
5a9fc6c83c submodule: make set_ignore() affect the configuration
Instead of affecting a particular instance, make it change the
configuration.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
a3f42fe8e4 commit: allow retrieving an arbitrary header field
This allows the user to look up fields which we don't parse in libgit2,
and allows them to access gpgsig or mergetag fields if they wish to
check the signature.
2015-06-22 15:56:31 +02:00
Carlos Martín Nieto
5e947c91d4 index: use the checksum to check whether it's been modified
We currently use a timetamp to check whether an index file has been
modified since we last read it, but this is racy. If two updates happen
in the same second and we read after the first one, we won't detect the
second one.

Instead read the SHA-1 checksum of the file, which are its last 20 bytes which
gives us a sure-fire way to detect whether the file has changed since we
last read it.

As we're now keeping track of it, expose an accessor to this data.
2015-06-19 22:05:08 +02:00
Edward Thomson
8147b1aff5 diff: introduce binary diff callbacks
Introduce a new binary diff callback to provide the actual binary
delta contents to callers.  Create this data from the diff contents
(instead of directly from the ODB) to support binary diffs including
the workdir, not just things coming out of the ODB.
2015-06-12 09:39:20 -04:00
Carlos Martín Nieto
2deb36081c Merge pull request #3155 from mgorny/userpass-const
cred_helpers: Add 'const' qualifiers to git_cred_userpass_payload
2015-06-11 08:54:48 +02:00
Edward Thomson
2eecc2886b Introduce git_filter_list_contains
`git_filter_list_contains` can be used to query a filter list to
determine if a given filter will be run.
2015-06-10 14:43:49 -04:00
Patrick Steinhardt
ec0c4c4001 remote: apply insteadOf configuration.
A remote's URLs are now modified according to the url.*.insteadOf
and url.*.pushInsteadOf configurations. This allows a user to
replace URL prefixes by setting the corresponding keys. E.g.
"url.foo.insteadOf = bar" would replace the prefix "bar" with the
new prefix "foo".
2015-05-31 13:21:53 +02:00
Carlos Martín Nieto
2c8550f040 Merge pull request #3157 from mgorny/ssh_memory_auth
Support getting SSH keys from memory, pt. 2
2015-05-29 19:38:11 +02:00
Edward Thomson
885b94aac0 Rename GIT_EMERGECONFLICT to GIT_ECONFLICT
We do not error on "merge conflicts"; on the contrary, merge conflicts
are a normal part of merging.  We only error on "checkout conflicts",
where a change exists in the index or the working directory that would
otherwise be overwritten by performing the checkout.

This *may* happen during merge (after the production of the new index
that we're going to checkout) but it could happen during any checkout.
2015-05-29 09:55:09 -04:00
Carlos Martín Nieto
ff8d635adb Merge pull request #3139 from ethomson/diff_conflicts
Include conflicts when diffing
2015-05-28 18:45:57 +02:00
Carlos Martín Nieto
2b92283221 Merge pull request #3127 from libgit2/cmn/remote-fixups
Tackle remote API issues from bindings
2015-05-28 16:09:17 +02:00
Edward Thomson
10549a2df1 Introduce GIT_DIFF_FLAG_EXISTS
Mark the `old_file` and `new_file` sides of a delta with a new bit,
`GIT_DIFF_FLAG_EXISTS`, that introduces that a particular side of
the delta exists in the diff.

This is useful for indicating whether a working directory item exists
or not, in the presence of a conflict.  Diff users may have previously
used DELETED to determine this information.
2015-05-28 09:47:47 -04:00
Edward Thomson
9f545b9d71 introduce git_index_entry_is_conflict
It's not always obvious the mapping between stage level and
conflict-ness.  More importantly, this can lead otherwise sane
people to write constructs like `if (!git_index_entry_stage(entry))`,
which (while technically correct) is unreadable.

Provide a nice method to help avoid such messy thinking.
2015-05-28 09:47:31 -04:00
Edward Thomson
7c94801400 diff/status: introduce conflicts
When diffing against an index, return a new `GIT_DELTA_CONFLICTED`
delta type for items that are conflicted.  For a single file path,
only one delta will be produced (despite the fact that there are
multiple entries in the index).

Index iterators now have the (optional) ability to return conflicts
in the index.  Prior to this change, they would be omitted, and callers
(like diff) would omit conflicted index entries entirely.
2015-05-28 09:44:02 -04:00
Edward Thomson
ecd60a56eb conflicts: when adding conflicts, remove staged
When adding a conflict for some path, remove the staged entry.
Otherwise, an illegal index (with both stage 0 and high-stage
entries) would result.
2015-05-28 09:43:49 -04:00
Carlos Martín Nieto
c6e942fb3d remote: validate refspecs before adding to config
When we moved from acting on the instance to acting on the
configuration, we dropped the validation of the passed refspec, which
can lead to writing an invalid refspec to the configuration. Bring that
validation back.
2015-05-28 15:32:20 +02:00
Carlos Martín Nieto
ae5b93629c remote: remove fetch parameter from create_anonymous
An anonymous remote is not configured and cannot therefore have
configured refspecs. Remove the parameter which adds this from the
constructor.
2015-05-28 15:32:20 +02:00
Michał Górny
f7142b5e4a cred: Declare GIT_CREDTYPE_SSH_MEMORY unconditionally
Declare GIT_CREDTYPE_SSH_MEMORY to have consistent API independently of
whether libgit2 was built with or without in-memory key passing support.
Or rather, to have it at all since build-time definitions are not stored
in headers.
2015-05-27 20:36:53 +02:00
David Calavera
08e6b875c1 Return an error when ssh memory credentials are not supported.
To not modify the external api.
2015-05-27 20:36:53 +02:00
David Calavera
7a8b85032f Add support to read ssh keys from memory. 2015-05-27 20:36:53 +02:00
Michał Górny
462865d702 cred_helpers: Add 'const' qualifiers to git_cred_userpass_payload
Make both username & password in git_cred_userpass_payload 'const'.
The values are not altered anywhere, and the extra qualifier allows
clients to assign 'const' values there.
2015-05-24 13:18:30 +02:00
Jason Haslam
d30155f2f9 Fix error when building as C++. 2015-05-20 14:26:05 -06:00
Carlos Martín Nieto
cd3f3c2844 Add a missing include for reset
Our doc parser really wants the types to be declared in the header it's
reading.
2015-05-20 21:06:01 +02:00
Carlos Martín Nieto
1396c38178 errors: add GIT_EEOF to indicate early EOF
This can be used by tools to show mesages about failing to communicate
with the server. The error message in this case will often contain the
server's error message, as far as it managed to send anything.
2015-05-20 15:08:39 +02:00
Carlos Martín Nieto
70f7484d2a remote: get rid of the run-time refspec setters
These were left over from the culling as it's not clear which use-cases
might benefit from this. It is not clear that we want to support any
use-case which depends on changing the remote's idea of the base
refspecs rather than passing in different per-operation refspec list, so
remove these functions.
2015-05-17 15:45:37 +02:00
Yury G. Kudryashov
c8022e6ce7 Add const qualifier
This fixes a warning in `examples/describe.c` without breaking the main build.

OTOH, I'm not sure if this is an API-compatible change.
2015-05-15 00:34:43 +03:00
Edward Thomson
a6f2ceaf48 Merge pull request #3118 from libgit2/cmn/stream-size
odb: make the writestream's size a git_off_t
2015-05-13 12:11:55 -04:00
Edward Thomson
d01737b419 Merge pull request #3117 from libgit2/cmn/index-more-accurate
index: make the entries have more accurate sizes
2015-05-13 09:11:38 -04:00
Carlos Martín Nieto
a4b6452a6a remote: remove git_remote_save()
It has now become a no-op, so remove the function and all references to
it.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
7725499072 remote: remove live changing of refspecs
The base refspecs changing can be a cause of confusion as to what is the
current base refspec set and complicate saving the remote's
configuration.

Change `git_remote_add_{fetch,push}()` to update the configuration
instead of an instance.

This finally makes `git_remote_save()` a no-op, it will be removed in a
later commit.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
35a8a8c546 remote: move the tagopt setting to the fetch options
This is another option which we should not be keeping in the remote, but
is specific to each particular operation.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
3eff2a5728 remote: move the update_fetchhead setting to the options
While this will rarely be different from the default, having it in the
remote adds yet another setting it has to keep around and can affect its
behaviour. Move it to the options.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
058b753ceb remote: move the transport ctor to the callbacks
Instead of having it set in a different place from every other callback,
put it the main structure. This removes some state from the remote and
makes it behave more like clone, where the constructors are passed via
the options.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
6fb373a0e8 remote: add prune option to fetch
Add a prune setting in the fetch options to allow to fall back to the
configuration (the default) or to set it on or off.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
22261344de remote: remove url and pushurl from the save logic
As a first step in removing the repository-saving logic, don't allow
chaning the url or push url from a remote object, but change the
configuration on the configuration immediately.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
8f0104ecc5 Remove the callbacks struct from the remote
Having the setting be different from calling its actions was not a great
idea and made for the sake of the wrong convenience.

Instead of that, accept either fetch options, push options or the
callbacks when dealing with the remote. The fetch options are currently
only the callbacks, but more options will be moved from setters and
getters on the remote to the options.

This does mean passing the same struct along the different functions but
the typical use-case will only call git_remote_fetch() or
git_remote_push() and so won't notice much difference.
2015-05-13 09:46:35 +02:00
Carlos Martín Nieto
77b339f7b6 odb: make the writestream's size a git_off_t
Restricting files to size_t is a silly limitation. The loose backend
writes to a file directly, so there is no issue in using 63 bits for the
size.

We still assume that the header is going to fit in 64 bytes, which does
mean quite a bit smaller files due to the run-length encoding, but it's
still a much larger size than you would want Git to handle.
2015-05-13 09:34:20 +02:00
Carlos Martín Nieto
ca29427979 index: make the entries have more accurate sizes
While we are confident about the size of an int in architectures we're
likely to care about, the index format is defined by the exact size of
the fields. Use the definitions which show the exact width of the entry
fields.

As part of that, bring back 32-bit time and size fields, which currently
are 64 bits wide and can bring a false sense of security in how much
data they really store. Document that these fields are not to be taken
as authoritative.
2015-05-12 11:43:27 +02:00
Edward Thomson
1f1f5c639e checkout: better document the baseline_index opt 2015-05-11 14:13:31 -04:00
Edward Thomson
4ea3eebf4b stash_apply: provide progress callbacks 2015-05-11 14:12:42 -04:00
Edward Thomson
19c80a6fd1 stash_apply: provide its own options structure 2015-05-11 14:12:39 -04:00
Edward Thomson
12149a20ef stash apply: default to at least GIT_CHECKOUT_SAFE 2015-05-11 14:12:31 -04:00
Edward Thomson
958950b6e0 stash: document merge conflicts 2015-05-11 14:12:23 -04:00
Edward Thomson
f0957589ee stash: refactor to use merge_iterators 2015-05-11 14:12:19 -04:00
Edward Thomson
73dce1f688 checkout: allow baseline to be specified as index
Allow the baseline to be specified as an index, so that users
need not write their index to a tree just to checkout with that
as the baseline.
2015-05-11 14:12:01 -04:00
Pierre-Olivier Latour
bf8dd3f53d Added git_stash_apply() and git_stash_pop() APIs 2015-05-11 14:11:53 -04:00
Edward Thomson
4beab1f8bb checkout: break case-changes into delete/add
When checking out with a case-insensitive working directory, we
want to change the case of items in the working directory to
reflect changes that occured in the checkout target.  Diff now
has an option to break case-changing renames into delete/add.
2015-05-04 07:18:28 -05:00
Edward Thomson
cbe8a61dfa Merge pull request #3059 from libgit2/cmn/negotiation-notify
[WIP/RFC] push: report the update plan to the caller
2015-05-01 11:28:54 -04:00
Jameson Miller
bf2ba5290a Update documentation for API changes 2015-04-30 10:59:50 -04:00
Edward Thomson
aa9bb425a9 rebase: correct documentation, CHANGELOG 2015-04-20 17:22:39 -04:00
Edward Thomson
94c988f6d6 rebase: include checkout opts within rebase opts 2015-04-20 17:19:08 -04:00
Edward Thomson
f3a199dd99 rebase: init and open take a rebase_options
`git_rebase_init` and `git_rebase_open` should take a
`git_rebase_options` and use it for future rebase operations on
that `rebase` object.
2015-04-20 16:22:54 -04:00
Edward Thomson
5ae38538c6 rebase: take checkout_options where appropriate 2015-04-20 16:22:49 -04:00
Edward Thomson
649834fd6e reset: git_checkout_options is const 2015-04-20 16:22:44 -04:00
Edward Thomson
30640aa9ad rebase: identify a rebase that has not started
In `git_rebase_operation_current()`, indicate when a rebase has not
started (with `GIT_REBASE_NO_OPERATION`) rather than conflating that
with the first operation being in-progress.
2015-04-20 16:22:27 -04:00
Carlos Martín Nieto
efc2fec50e push: report the update plan to the caller
It can be useful for the caller to know which update commands will be
sent to the server before the packfile is pushed up. git does this via
the pre-push hook.

We don't have hooks, but as it adds introspection into what is
happening, we can add a callback which performs the same function.
2015-04-19 01:02:29 +02:00
Edward Thomson
a0e652d281 Merge pull request #2999 from pks-t/submodule-set-url
Implement git_submodule_set_branch.
2015-04-17 12:35:41 -05:00
Edward Thomson
6f80bf4afb Merge pull request #3037 from libgit2/cmn/hide-then-push
Handle hide-then-push in the revwalk
2015-04-16 19:12:28 -05:00
Carlos Martín Nieto
05d9202678 revwalk: reword the push text
As it seems it's not quite clear what it means to push a commit, try to
be more explicit about adding a new root and that we may not see this
commit if it is hidden.
2015-04-13 18:03:03 +02:00
Patrick Steinhardt
129788a623 Implement git_submodule_set_branch. 2015-04-12 10:51:08 +02:00
Edward Thomson
623fbd93f1 Merge pull request #2974 from libgit2/cmn/clone-everything
Make sure to pack referenced objects for non-branches
2015-04-10 11:38:07 +02:00
Pierre-Olivier Latour
807566d554 Entry argument passed to git_index_add_frombuffer() should be const 2015-04-03 18:59:11 -07:00
Edward Thomson
c5e071873c Merge pull request #2990 from leoyanggit/custom_param
Add a custom param to git_smart_subtransport_definition
2015-03-24 14:03:51 -04:00
Edward Thomson
95d1624b8d Merge pull request #2947 from libgit2/cmn/notes-buf
note: use a git_buf to return the default namespace
2015-03-24 08:34:12 -04:00
Edward Thomson
89ba9f1acc Merge pull request #2967 from jacquesg/merge-whitespace
Allow merges of files (and trees) with whitespace problems/fixes
2015-03-18 13:17:04 -04:00
Leo Yang
142e5379ca Add a custom param to git_smart_subtransport_definition
The smart transport has already take the payload param. For the
sub transport a payload param is useful for the implementer.
2015-03-18 13:15:21 -04:00
Carlos Martín Nieto
a61fa4c0c7 packbuilder: introduce git_packbuilder_insert_recur()
This function recursively inserts the given object and any referenced
ones. It can be thought of as a more general version of the functions to
insert a commit or tree.
2015-03-17 20:51:14 +01:00
Carlos Martín Nieto
385449b1df note: use a git_buf to return the default namespace
The caller has otherwise no way to know how long the string will be
allocated or ability to free it.

This fixes #2944.
2015-03-17 20:50:02 +01:00
Edward Thomson
9bbc8f350b Merge pull request #2962 from libgit2/cmn/reflog-annotated
Add annotated versions of ref-modying functions
2015-03-17 10:21:28 -04:00
Edward Thomson
7800048afb Merge pull request #2972 from libgit2/cmn/pack-objects-walk
[WIP] Smarter pack-building
2015-03-17 10:06:50 -04:00
Carlos Martín Nieto
62dd4d71db annotated_commit: provide a constructor from a revspec
This extra constructor will be useful for the annotated versions of
ref-modifying functions, as it allows us to create a commit with the
extended sha syntax which was used to retrieve it.
2015-03-16 16:57:30 +01:00
Carlos Martín Nieto
62d38a1ddb Add annotated commit versions of reflog-modifying functions
We do not always want to put the id directly into the reflog, but we
want to speicfy what a user typed. For this use-case we provide
annotated version of a few functions which let the caller specify what
user-friendly name was used when asking for the operation.
2015-03-16 16:57:30 +01:00
Jacques Germishuys
74c37c2a48 Added options to enable patience and minimal diff drivers 2015-03-16 09:53:27 +02:00
Jacques Germishuys
13de936316 Collapse whitespace flags into git_merge_file_flags_t 2015-03-16 09:53:27 +02:00
Jacques Germishuys
f29dde6828 Renamed git_merge_options 'flags' to 'tree_flags' 2015-03-16 09:53:27 +02:00
Jacques Germishuys
45a86bbfd0 Allow for merges with whitespace discrepancies 2015-03-16 09:53:27 +02:00
Carlos Martín Nieto
15f581747c Merge commit 'refs/pull/2879/head' of ssh://github.com/libgit2/libgit2 2015-03-11 17:55:39 +01:00
Carlos Martín Nieto
04a36feff1 pack-objects: fill a packbuilder from a walk
Most use-cases for the object packer communicate in terms of commits
which each side has. We already have an object to specify this
relationship between commits, namely git_revwalk.

By knowing which commits we want to pack and which the other side
already has, we can perform similar optimisations to git, by marking
each tree as interesting or uninteresting only once, and not sending
those trees which we know the other side has.
2015-03-11 02:36:11 +01:00
Carlos Martín Nieto
9a97f49e3a config: borrow refcounted references
This changes the get_entry() method to return a refcounted version of
the config entry, which you have to free when you're done.

This allows us to avoid freeing the memory in which the entry is stored
on a refresh, which may happen at any time for a live config.

For this reason, get_string() has been forbidden on live configs and a
new function get_string_buf() has been added, which stores the string in
a git_buf which the user then owns.

The functions which parse the string value takea advantage of the
borrowing to parse safely and then release the entry.
2015-03-03 18:35:12 +01:00
Carlos Martín Nieto
4e498646b6 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.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
412a380888 push: remove reflog message override
We always use "update by push".
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
6bfb990dc7 branch: don't accept a reflog message override
This namespace is about behaving like git's branch command, so let's do
exactly that instead of taking a reflog message.

This override is still available via the reference namespace.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
23a17803b6 reset: remove reflog message override
This function is meant to simulate what git does in the reset command,
so we should include the reflog message in that.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
659cf2029f 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.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
99b68a2aec Merge pull request #2908 from ethomson/safe_create
Allow checkout to handle newly cloned repositories, remove `GIT_CHECKOUT_SAFE_CREATE`
2015-03-03 13:47:13 +01:00
Edward Thomson
bf1476f190 win32: add the patch level to the .dll fileversion
Win32 DLLs have four fields for the version number (major, minor,
teeny, patch).  If a consumer wants to build a custom DLL, it may
be useful to set the patchlevel version number in the DLL.

This value only affects the DLL version number, it does not affect
the resultant "version number", which remains major.minor.teeny.
2015-03-02 10:35:26 -05:00
Edward Thomson
96b82b11c6 checkout: remove GIT_CHECKOUT_SAFE_CREATE as a strategy 2015-02-27 13:50:44 -05:00
Damien PROFETA
a275fbc0f7 Add API to add a memory buffer to an index
git_index_add_frombuffer enables now to store a memory buffer in the odb
and to store an entry in the index directly if the index is attached to a
repository.
2015-02-25 10:24:13 +01:00
Edward Thomson
795eaccd66 git_filter_opt_t -> git_filter_flag_t
For consistency with the rest of the library, where an opt is an
options *structure*.
2015-02-19 11:09:54 -05:00
Edward Thomson
b75f15aaf1 git_writestream: from git_filter_stream 2015-02-18 10:24:23 -05:00
Edward Thomson
fbdc9db364 filters: introduce streaming filters
Add structures and preliminary functions to take a buffer, file or
blob and write the contents in chunks through an arbitrary number
of chained filters, finally writing into a user-provided function
accept the contents.
2015-02-17 02:19:05 -05:00
Carlos Martín Nieto
a291790a8d Merge pull request #2831 from ethomson/merge_lock
merge: lock index during the merge (not just checkout)
2015-02-15 05:18:01 +01:00
Edward Thomson
8639ea5f98 checkout: introduce GIT_CHECKOUT_DONT_WRITE_INDEX 2015-02-14 09:25:35 -05:00
Edward Thomson
49b8293c75 rebase: allow NULL branch to indicate HEAD
Don't require the branch to rebase, if given `NULL`, simply look up
`HEAD`.
2015-02-13 11:20:32 -05:00
Carlos Martín Nieto
dc63c0496b Merge pull request #2893 from phatblat/ben/pr/doc-comments
Fix doc comment formatting
2015-02-11 23:44:05 +01:00
John Haley
a36486ef26 Fixed error when including git2/include/sys/stream.h 2015-02-11 23:30:34 +01:00
Ben Chatelain
c03e8c224c Use correct Doxygen trailing comment syntax 2015-02-10 12:44:05 -07:00
Ben Chatelain
ec7e1c93ce Fix doc comment formatting 2015-02-10 08:31:48 -07:00
Edward Thomson
3538f8f131 diff docs: update git_diff_delta description 2015-02-03 13:41:35 -05:00
Pierre-Olivier Latour
9a294fd8c5 Clarified git_repository_is_empty() documentation 2015-01-27 08:17:23 -08:00
Edward Thomson
1ac5acdc69 Merge pull request #2819 from libgit2/cmn/config-get-path
config: add parsing and getter for paths
2015-01-26 11:28:59 -06:00
Edward Thomson
f483720c6f Merge pull request #2839 from swisspol/typo
Fixed typo in git_repository_reinit_filesystem() documentation
2015-01-26 11:25:16 -06:00
Pierre-Olivier Latour
86815dca20 Make sure sys/repository.h includes the required headers
It was missing "common.h" and "types.h" like other system headers.
This generated compilation errors if including it directly.
2015-01-23 16:04:23 -08:00
Pierre-Olivier Latour
22b6a92365 Fixed typo in git_repository_reinit_filesystem() documentation 2015-01-23 15:59:54 -08:00
Edward Thomson
e74340b000 checkout: remove files before writing new ones
On case insensitive filesystems, we may have files in the working
directory that case fold to a name we want to write.  Remove those
files (by default) so that we will not end up with a filename that
has the unexpected case.
2015-01-20 17:13:31 -06:00
Edward Thomson
fe598f0903 mkdir: walk up tree to mkdir
Walk up the tree to mkdir, which is less immediately efficient,
but allows us to look at intermediate directories that may need
attention.
2015-01-20 17:12:46 -06:00
Edward Thomson
1d50b3649d checkout: introduce git_checkout_perfdata
Checkout can now provide performance data about the number of (some)
syscalls performed using an optional callback.
2015-01-20 17:12:23 -06:00