Commit Graph

10818 Commits

Author SHA1 Message Date
Carlos Martín Nieto
cf716beed2 Merge pull request #3351 from ethomson/error_buf
Error handling: use buffers, improved OOM handling
2015-08-04 11:18:21 +02:00
Edward Thomson
ef4857c2b3 errors: tighten up git_error_state OOMs a bit more
When an error state is an OOM, make sure that we treat is specially
and do not try to free it.
2015-08-03 19:44:51 -04:00
Edward Thomson
bdec336301 win32: ensure hidden files can be staged 2015-08-03 18:33:15 -05:00
Edward Thomson
854b701c8a Merge remote-tracking branches 'upstream/pr/3323' and 'upstream/pr/3329' 2015-08-03 15:02:02 -05:00
Carlos Martín Nieto
f6dedf2c2e Bump version to v0.23.1 2015-08-03 20:07:35 +02:00
Carlos Martín Nieto
5915a2a255 Merge pull request #3349 from libgit2/cmn/for-v23
A second round of 0.23 maint updates
2015-08-03 19:25:03 +02:00
Edward Thomson
16cee5d635 Stage an unregistered submodule in _add_bypath() 2015-08-03 18:23:18 +02:00
Carlos Martín Nieto
62a273ccbb filebuf: remove lockfile upon rename errors
When we have an error renaming the lockfile, we need to make sure
that we remove it upon cleanup. For this, we need to keep track of
whether we opened the file and whether the rename succeeded.

If we did create the lockfile but the rename did not succeed, we
remove the lockfile. This won't protect against all errors, but
the most common ones (target file is open) does get handled.
2015-08-03 18:14:22 +02:00
Carlos Martín Nieto
adb8f8d0bc filebuf: failing test for leaving the lockfile when failing to rename
When we fail to rename, we currently leave the lockfile laying
around. This shows that behaviour.
2015-08-03 18:14:22 +02:00
Michael Procter
988ea59443 Test: check restored oom error points to static buffer 2015-08-03 15:23:17 +01:00
Michael Procter
0fcfb60dc4 Make giterr_restore aware of g_git_oom_error
Allow restoring a previously captured oom error, by
detecting when the captured message pointer points to the
static oom error message.  This means there is no need
to strdup the message in giterr_detach.
2015-08-03 15:23:17 +01:00
Michael Procter
25dbcf3499 Make giterr_detach no longer public 2015-08-03 15:23:17 +01:00
Michael Procter
c2f17bda07 Ensure static oom error message not detached
Error messages that are detached are assumed to be dynamically
allocated.  Passing a pointer to the static oom error message
can cause an attempt to free the static buffer later.  This change
checks if the oom error message is about to be detached and detaches
a copy instead.
2015-08-03 15:23:17 +01:00
Michael Procter
5ef4b86015 Add failing test for capture/restore oom error 2015-08-03 15:23:17 +01:00
Edward Thomson
69adb781e1 Merge pull request #3325 from libgit2/cmn/filebuf-rename-error
filebuf: remove lockfile upon rename errors
2015-08-03 08:33:53 -05:00
Edward Thomson
0dd8daeada Merge pull request #3344 from libgit2/cmn/add-unreg-submodule
index: stage an unregistered submodule as well
2015-08-03 08:17:47 -05:00
Tony Kelman
e874f3c1c0 Increase required version of cmake to 2.8 2015-08-03 10:34:58 +02:00
Simon
7483e08f1a Handle ssh:// and git:// urls containing a '~' character.
For such a path '/~/...' the leading '/' is stripped so the server will
get a path starting with '~' and correctly handle it.
2015-08-03 10:34:36 +02:00
Stefan Widgren
a299d0af1b Remove extra semicolon outside of a function
Without this change, compiling with gcc and pedantic generates warning:
ISO C does not allow extra ‘;’ outside of a function.
2015-08-03 10:34:26 +02:00
Carlos Martín Nieto
e5a7724969 Cherry-pick PR #3332: Resolve documentation warnings 2015-08-03 10:33:50 +02:00
Anders Borum
a91dff8931 case-insensitive check for WWW-Authenticate header
Fixes issue #3338
2015-08-03 10:33:16 +02:00
Carlos Martín Nieto
c5d4317887 iterator: adjust unreadable-dir test to new behaviour
We don't want the iterator to make us stop whenever we hit an unreadable
dir. We should instead move over to the next item.
2015-08-03 10:32:57 +02:00
Carlos Martín Nieto
a4ded362b4 iterator: skip over errors in diriter init
An error here will typically mean that the directory was removed between
the time we iterated the parent and the time we wanted to visit it in
which case we should ignore it.

Other kinds of errors such as permissions (or transient errors) also
better dealt with by pretending we didn't see it.
2015-08-03 10:32:48 +02:00
Carlos Martín Nieto
3cf4eb0922 Merge pull request #3348 from MrHacky/remote-path-with-tilde
Handle ssh:// and git:// urls containing a '~' character.
2015-08-03 10:29:17 +02:00
Simon
ac728c2483 Handle ssh:// and git:// urls containing a '~' character.
For such a path '/~/...' the leading '/' is stripped so the server will
get a path starting with '~' and correctly handle it.
2015-08-03 07:38:07 +01:00
Carlos Martín Nieto
ea961abf24 index: stage an unregistered submodule as well
We previously added logic to `_add_bypath()` to update a submodule. Go
further and stage the submodule even if it's not registered to behave
like git.
2015-08-01 20:01:11 +02:00
Carlos Martín Nieto
b426ac90a9 index: test that an unregistered submodule gets staged
When we pass the path of a repository to `_bypath()`, we should behave
like git and stage it as a `_COMMIT` regardless of whether it is
registered a a submodule.
2015-08-01 19:52:25 +02:00
Linquize
63e5b55122 index: add test for adding an old-style submodule to index 2015-08-01 19:35:59 +02: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
Carlos Martín Nieto
6a0d569669 Merge pull request #3333 from libgit2/cmn/for-v23
Maintenance updates for v0.23
2015-08-01 15:37:04 +02:00
Edward Thomson
723babd712 Merge pull request #3341 from stewid/pedantic-compiler-warning
Remove extra semicolon outside of a function
2015-07-31 15:36:22 -05:00
Stefan Widgren
c369b37919 Remove extra semicolon outside of a function
Without this change, compiling with gcc and pedantic generates warning:
ISO C does not allow extra ‘;’ outside of a function.
2015-07-31 16:23:11 +02:00
Edward Thomson
9d4b7d2524 Merge pull request #3328 from libgit2/cmn/iterator-skip-diriter
iterator: skip over errors in diriter init
2015-07-29 16:46:47 -05:00
Edward Thomson
a8058ffda7 Merge pull request #3339 from palmin/palmin-issue-3338
case-insensitive check for WWW-Authenticate header
2015-07-29 16:35:08 -05:00
Anders Borum
31a76374a9 case-insensitive check for WWW-Authenticate header
Fixes issue #3338
2015-07-29 22:23:00 +02:00
Ben Chatelain
6d8f3a5162 Better param docs 2015-07-28 08:28:33 -06:00
Carlos Martín Nieto
f85fc367e0 error: store the error messages in a reusable buffer
Instead of allocating a brand new buffer for each error string we want
to store, we can use a per-thread buffer to store the error string and
re-use the underlying storage. We already use the buffer to format the
string, so this mostly makes that more direct.
2015-07-28 09:31:00 +02:00
Sven Strickroth
ac1a5e20b8 Make libgit2 work on Windows Vista again
(fixes issue #3316)

Signed-off-by: Sven Strickroth <email@cs-ware.de>
2015-07-28 08:28:04 +02:00
Ryan Roden-Corrent
555b351896 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-28 08:27:56 +02:00
Fallso
2563101b4f Fix macro redefinition warning 2015-07-28 08:27:45 +02:00
Carlos Martín Nieto
55bc135130 submodule: normalize slashes in resolve_url
Our path functions expect to work with slashes, so convert a
path with backslashes into one with slashes at the top of
the function.
2015-07-28 08:25:41 +02:00
Carlos Martín Nieto
a89a756d87 submodule: add failing test for backslash in url 2015-07-28 08:25:41 +02:00
Matthew Plough
38dc994031 Fix #3094 - improve use of portable size_t/ssize_t format specifiers.
The header src/cc-compat.h defines portable format specifiers PRIuZ, PRIdZ, and PRIxZ. The original report highlighted the need to use these specifiers in examples/network/fetch.c.  For this commit, I checked all C source and header files not in deps/ and transitioned to the appropriate format specifier where appropriate.
2015-07-28 08:25:23 +02:00
Carlos Martín Nieto
34ff34fd6a filter: make sure to close the stream even on error
When the stream list init or write fail, we must also make sure to close
the stream, as that's the function contract.
2015-07-28 08:25:06 +02:00
Carlos Martín Nieto
678c4aacf5 index: allow add_bypath to update submodules
Similarly to how git itself does it, allow the index update operation to
stage a change in a submodule's HEAD.
2015-07-28 08:24:55 +02:00
Carlos Martín Nieto
aafaa491ba blob: fail to create a blob from a dir with EDIRECTORY
This also affects `git_index_add_bypath()` by providing a better error
message and a specific error code when a directory is passed.
2015-07-28 08:24:55 +02:00
Carlos Martín Nieto
7624b91fd3 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-28 08:24:55 +02:00
Carlos Martín Nieto
e48dd86eca submodule: lookup the submodule by path if available
If we get the path from the gitmodules file, look up the submodule we're
interested in by path, rather then by name. Otherwise we might get
duplicate results.
2015-07-28 08:22:59 +02:00
Carlos Martín Nieto
1207b8f2a7 submdule: reproduce double-reporting of a submodule in foreach
When we rename a submodule, we should be merging two sets of information
based on whether their path is the same. We currently only deduplicate
on equal name, which causes us to double-report.
2015-07-28 08:22:59 +02:00
Edward Thomson
f2dc6b77ee khash: add eol so picky compilers stop warning 2015-07-28 08:22:26 +02:00