Commit Graph

8781 Commits

Author SHA1 Message Date
Tim Hentenaar
20f8edb7a5 global: Ensure we free our SSL context. 2015-06-08 09:38:50 +02:00
Carlos Martín Nieto
b6011e296e Merge pull request #3185 from libgit2/cmn/foreach-cancel-loose
path: error out if the callback returns an error
2015-06-07 15:10:28 +02:00
Carlos Martín Nieto
fdb82dcd58 Merge pull request #3175 from git-up/build_warnings
Fixed build warnings on Xcode 6.1
2015-06-07 15:10:13 +02:00
Carlos Martín Nieto
2785544fb5 remote: some error-handling issues from Coverity 2015-06-07 10:45:39 +02:00
Carlos Martín Nieto
3c4442a2aa Merge pull request #3179 from arielb2/master
print_usage functions is defined but not used
2015-06-07 10:03:31 +02:00
Carlos Martín Nieto
8da4404705 path: error out if the callback returns an error
When the callback returns an error, we should stop immediately. This
broke when trying to make sure we pass specific errors up the chain.

This broke cancelling out of the loose backend's foreach.
2015-06-06 03:55:28 +02:00
Carlos Martín Nieto
babdc376c7 Merge pull request #3172 from Therzok/patch-2
Change error when running out of ssh agent keys
2015-06-04 13:02:59 +02:00
Ariel O. Barria
9334c86f49 print_usage functions is defined but not used
Use the previously created function to display a message when the arguments are not valid.

ticket 3095
2015-06-03 14:54:35 -05:00
Pierre-Olivier Latour
9f3c18e2ac Fixed build warnings on Xcode 6.1 2015-06-02 11:49:38 -07:00
Marius Ungureanu
d71e3b2532 Change error when running out of ssh agent keys 2015-06-02 12:32:19 +03:00
Carlos Martín Nieto
aa57231fca indexer: use lseek to extend the packfile
We've been using `p_ftruncate()` to extend the packfile in order to mmap
it and write the new data into it. This works well in the general case,
but as truncation does not allocate space in the filesystem, it must do
so when we write data to it.

The only way the OS has to indicate a failure to allocate space is via
SIGBUS which means we tried to write outside the file. This will cause
everyone to crash as they don't expect to handle this signal.

Switch to using `p_lseek()` and `p_write()` to extend the file in a way
which tells the filesystem to allocate the space for the missing
data. We can then be sure that we have space to write into.
2015-06-02 10:25:22 +02:00
Carlos Martín Nieto
1094073688 clone: fall back to copying when linking does not work
We use heuristics to make a decent guess at when we can save time and
space by linking object files during a clone. Unfortunately checking the
device id isn't enough, as those would be the same during e.g. a bind-mount,
but the OS still does not allow us to link between mounts of the same
filesystem.

If we fail to perform the links, fall back to copying the contents into
a new file as a last attempt.
2015-06-01 22:15:11 +02:00
Carlos Martín Nieto
be5fda7587 Include git2/transaction.h
This was forgotten when the feature was implemented.
2015-05-31 19:22:12 +02:00
Carlos Martín Nieto
449f9ec97e Merge pull request #3152 from tkelman/patch-1
build maint branches on appveyor
2015-05-31 18:53:42 +02:00
Carlos Martín Nieto
ac587e7596 Merge pull request #3048 from pks-t/insteadof
Implementation of url.*.insteadOf
2015-05-31 15:45:56 +02:00
Patrick Steinhardt
9e88a823f6 remote: test insteadOf for anonymous remotes 2015-05-31 13:26:05 +02:00
Patrick Steinhardt
771069e1fb Add CHANGELOG entry for url.*.insteadOf feature. 2015-05-31 13:22:48 +02: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
Edward Thomson
bad33a5dfb git__tolower: test that some non-ASCII downcasing isn't 2015-05-29 18:16:51 -04:00
Edward Thomson
75a4636f50 git__tolower: a tolower() that isn't dumb
Some brain damaged tolower() implementations appear to want to
take the locale into account, and this may require taking some
insanely aggressive lock on the locale and slowing down what should
be the most trivial of trivial calls for people who just want to
downcase ASCII.
2015-05-29 18:16:46 -04:00
Edward Thomson
006548da91 git__strcasecmp: treat input bytes as unsigned
Treat input bytes as unsigned before doing arithmetic on them,
lest we look at some non-ASCII byte (like a UTF-8 character) as a
negative value and perform the comparison incorrectly.
2015-05-29 16:07:51 -04:00
Carlos Martín Nieto
a5670d4f2d CHANGELOG: fill in a few missing entries 2015-05-29 20:09:46 +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
Carlos Martín Nieto
64be170d47 Merge pull request #3163 from ethomson/emergeconflict
Rename GIT_EMERGECONFLICT to GIT_ECONFLICT
2015-05-29 16:42:40 +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
Edward Thomson
41a71c1a5e Merge pull request #3161 from fxfactorial/master
Changed README to use new OCaml bindings to git
2015-05-28 16:29:52 -04:00
Edgar Aroutiounian
69560cc089 Changed README to use new OCaml bindings to git 2015-05-28 15:19:53 -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
Edward Thomson
fb92b48d54 Merge pull request #3149 from libgit2/cmn/upstream-matching-push
Fill the pointers for matching refspecs
2015-05-28 10:13:07 -04: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
9b3e41f72b index_add_all: remove conflicts when no wd file
If there exists a conflict in the index, but no file in the working
directory, this implies that the user wants to accept the resolution
by removing the file.  Thus, remove the conflict entry from the
index, instead of trying to add a (nonexistent) file.
2015-05-28 09:47:51 -04: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
666ae18821 git_index_add_all: test that conflicts are handled
When confronted with a conflict in the index, `git_index_add_all`
should stage the working directory copy.  If there is no file in the
working directory, the conflict should simply be removed.
2015-05-28 09:47:43 -04:00
Edward Thomson
1c4b5cee00 Introduce cl_git_sandbox_init_new()
cl_git_sandbox_init_new() will create a clar temp directory and
initialize a new repository at that location.
2015-05-28 09:47:39 -04:00
Edward Thomson
253a05f76b diff: prettify maybe_modified a little 2015-05-28 09:47:35 -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
2f1080ea04 conflict tests: use GIT_IDXENTRY_STAGE_SET 2015-05-28 09:44:22 -04:00
Edward Thomson
191e97a02b diff conflicts: don't include incorrect ID
Since a diff entry only concerns a single entry, zero the information
for the index side of a conflict.  (The index entry would otherwise
erroneously include the lowest-stage index entry - generally the
ancestor of a conflict.)

Test that during status, the index side of the conflict is empty.
2015-05-28 09:44:18 -04:00
Edward Thomson
b22369efa2 diff conflicts: test index to workdir w/ conflicts 2015-05-28 09:44:14 -04:00
Edward Thomson
bb815157da diff conflicts: add tests for tree to index 2015-05-28 09:44:10 -04:00
Edward Thomson
7877146fc2 diff: for conflicts w/o workdir, blank nitem side
Make sure that we provide a blanked nitem side when the item does not
exist in the working directory.
2015-05-28 09:44:06 -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
d67f270e58 index: validate mode of new conflicts 2015-05-28 09:43:57 -04:00
Edward Thomson
3ab5a65967 index: remove error message in non-error remove
If `git_index_remove_bypath` does no work, and returns an OK error
code, it should not set an error message.
2015-05-28 09:43:53 -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
Edward Thomson
1b6c26db97 diff: wrap the iterator functions
Wrap the iterator current / advance functions so that we can extend
them, but also handle GIT_ITEROVER cases in the iterator funcs
instead of the callers.
2015-05-28 09:43:45 -04:00
Edward Thomson
aa3af01db0 index iterator: optionally include conflicts 2015-05-28 09:43:41 -04:00
Carlos Martín Nieto
9566ce430f remote: call the update_tips callback for opportunisitc updates
These are updates, same as the rest, we should call this callback. As we
are using the callback, let's make sure to skip unnecessary updates.
2015-05-28 15:32:20 +02: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