]> git.proxmox.com Git - libgit2.git/log
libgit2.git
8 years agotests: create a ctest target for cred_callback
Carlos Martín Nieto [Thu, 3 Mar 2016 18:21:07 +0000 (19:21 +0100)]
tests: create a ctest target for cred_callback

8 years agowinhttp: retry authentication
Carlos Martín Nieto [Thu, 3 Mar 2016 09:48:24 +0000 (10:48 +0100)]
winhttp: retry authentication

If the caller has provided bad authentication, give them another
apportunity to get it right until they give up. This brings WinHTTP in
line with the other transports.

8 years agotest: make sure we retry the auth callback on all platforms
Carlos Martín Nieto [Thu, 3 Mar 2016 09:08:00 +0000 (10:08 +0100)]
test: make sure we retry the auth callback on all platforms

We were missing this test on Windows, which meant we didn't notice that
we never fixed the single authentication attempt it tries, nor its wrong
return code.

Enable this for the unix platforms as well over HTTP. We previously were
doing it locally but disabled it on OS X due to issues with its sshd not
accepting password authentication.

8 years agotests: plug a leak
Carlos Martín Nieto [Thu, 3 Mar 2016 10:17:36 +0000 (11:17 +0100)]
tests: plug a leak

8 years agoMerge pull request #3633 from ethomson/safe_creation
Edward Thomson [Tue, 1 Mar 2016 17:16:27 +0000 (17:16 +0000)]
Merge pull request #3633 from ethomson/safe_creation

Stricter object dependency checking during creation

8 years agoMerge pull request #3567 from sba1/few-p_getaddrinfo-fixes
Edward Thomson [Mon, 29 Feb 2016 01:13:24 +0000 (20:13 -0500)]
Merge pull request #3567 from sba1/few-p_getaddrinfo-fixes

Few p_getaddrinfo fixes

8 years agoturn on strict object validation by default
Edward Thomson [Sun, 28 Feb 2016 20:51:38 +0000 (15:51 -0500)]
turn on strict object validation by default

8 years agotests: use legitimate object ids
Edward Thomson [Sun, 28 Feb 2016 21:02:49 +0000 (16:02 -0500)]
tests: use legitimate object ids

Use legitimate (existing) object IDs in tests so that we have the
ability to turn on strict object validation when running tests.

8 years agorefs: honor strict object creation
Edward Thomson [Sun, 28 Feb 2016 20:11:15 +0000 (15:11 -0500)]
refs: honor strict object creation

8 years agogit_object__is_valid: use `odb_read_header`
Edward Thomson [Sun, 28 Feb 2016 19:37:37 +0000 (14:37 -0500)]
git_object__is_valid: use `odb_read_header`

This allows lighter weight validation in `git_object__is_valid` that
does not require reading the entire object.

8 years agogit_index_add: validate objects in index entries (optionally)
Edward Thomson [Tue, 23 Feb 2016 23:29:16 +0000 (18:29 -0500)]
git_index_add: validate objects in index entries (optionally)

When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate
the index entries given to `git_index_add`.

8 years agoMerge pull request #3644 from ethomson/debug_pool
Carlos Martín Nieto [Sun, 28 Feb 2016 18:43:45 +0000 (19:43 +0100)]
Merge pull request #3644 from ethomson/debug_pool

travis ci: enable debug pool for valgrind builds

8 years agotreebuilder: validate tree entries (optionally)
Edward Thomson [Tue, 23 Feb 2016 20:00:27 +0000 (15:00 -0500)]
treebuilder: validate tree entries (optionally)

When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate
the tree and parent ids given to treebuilder insertion.

8 years agogit_commit: validate tree and parent ids
Edward Thomson [Tue, 23 Feb 2016 18:34:35 +0000 (13:34 -0500)]
git_commit: validate tree and parent ids

When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate
the tree and parent ids given to commit creation functions.

8 years agogit_object__is_valid: simple object validity test
Edward Thomson [Tue, 23 Feb 2016 18:33:10 +0000 (13:33 -0500)]
git_object__is_valid: simple object validity test

8 years agogit_libgit2_opts: introduce `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION`
Edward Thomson [Tue, 23 Feb 2016 04:46:50 +0000 (23:46 -0500)]
git_libgit2_opts: introduce `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION`

8 years agotravis ci: enable debug pool for valgrind builds
Edward Thomson [Sun, 28 Feb 2016 16:34:36 +0000 (11:34 -0500)]
travis ci: enable debug pool for valgrind builds

8 years agoMerge pull request #3577 from rossdylan/rossdylan/pooldebug
Edward Thomson [Sun, 28 Feb 2016 16:31:10 +0000 (11:31 -0500)]
Merge pull request #3577 from rossdylan/rossdylan/pooldebug

Add a new build flag to disable the pool allocator

8 years agoFixed typo in one of the ifndef's in pool.h used to enable/disable debug mode
Ross Delinger [Fri, 26 Feb 2016 17:51:13 +0000 (12:51 -0500)]
Fixed typo in one of the ifndef's in pool.h used to enable/disable debug mode

8 years agoMerge pull request #3638 from ethomson/nsec
Carlos Martín Nieto [Thu, 25 Feb 2016 17:42:09 +0000 (18:42 +0100)]
Merge pull request #3638 from ethomson/nsec

USE_NSECS fixes

8 years agoMerge pull request #3628 from pks-t/pks/coverity-fixes
Edward Thomson [Thu, 25 Feb 2016 17:09:49 +0000 (12:09 -0500)]
Merge pull request #3628 from pks-t/pks/coverity-fixes

Coverity fixes

8 years agoMerge pull request #3630 from libgit2/cmn/idx-extra-check
Edward Thomson [Thu, 25 Feb 2016 16:59:00 +0000 (11:59 -0500)]
Merge pull request #3630 from libgit2/cmn/idx-extra-check

Extra checks for packfile indices

8 years agonsec: support NDK's crazy nanoseconds
Edward Thomson [Thu, 25 Feb 2016 16:23:19 +0000 (11:23 -0500)]
nsec: support NDK's crazy nanoseconds

Android NDK does not have a `struct timespec` in its `struct stat`
for nanosecond support, instead it has a single nanosecond member inside
the struct stat itself.  We will use that and use a macro to expand to
the `st_mtim` / `st_mtimespec` definition on other systems (much like
the existing `st_mtime` backcompat definition).

8 years agonsec: update staging test for GIT_USE_NSECS
Edward Thomson [Thu, 25 Feb 2016 16:31:18 +0000 (11:31 -0500)]
nsec: update staging test for GIT_USE_NSECS

The index::nsec::staging_maintains_other_nanos test was created to
ensure that when we stage an entry when GIT_USE_NSECS is *unset* that
we truncate the index entry and do not persist the (old, invalid)
nanosec values.  Ensure that when GIT_USE_NSECS is *set* that we do
not do that, and actually write the correct nanosecond values.

8 years agopack: don't allow a negative offset
Carlos Martín Nieto [Thu, 25 Feb 2016 14:46:59 +0000 (15:46 +0100)]
pack: don't allow a negative offset

8 years agopack: make sure we don't go out of bounds for extended entries
Carlos Martín Nieto [Tue, 23 Feb 2016 17:15:43 +0000 (18:15 +0100)]
pack: make sure we don't go out of bounds for extended entries

A corrupt index might have data that tells us to go look past the end of
the file for data. Catch these cases and return an appropriate error
message.

8 years agoMerge pull request #3637 from libgit2/cmn/conventions
Edward Thomson [Thu, 25 Feb 2016 14:08:23 +0000 (09:08 -0500)]
Merge pull request #3637 from libgit2/cmn/conventions

CONVENTIONS: update to include general public API principles

8 years agoCONVENTIONS: update to include general public API principles
Carlos Martín Nieto [Thu, 25 Feb 2016 13:51:00 +0000 (14:51 +0100)]
CONVENTIONS: update to include general public API principles

8 years agoopenssl: we already had the function, just needed the header
Carlos Martín Nieto [Wed, 24 Feb 2016 16:17:57 +0000 (17:17 +0100)]
openssl: we already had the function, just needed the header

8 years agoopenssl: export the locking function when building without OpenSSL
Carlos Martín Nieto [Wed, 24 Feb 2016 15:38:22 +0000 (16:38 +0100)]
openssl: export the locking function when building without OpenSSL

This got lost duing the move and it lets the users call this function
just in case.

8 years agoMerge pull request #3631 from ethomson/giterr_fixups
Carlos Martín Nieto [Tue, 23 Feb 2016 21:27:36 +0000 (22:27 +0100)]
Merge pull request #3631 from ethomson/giterr_fixups

Minor `giterr` fixups

8 years agogiterr_set_str: remove `GITERR_OS` documentation
Edward Thomson [Tue, 23 Feb 2016 18:05:49 +0000 (13:05 -0500)]
giterr_set_str: remove `GITERR_OS` documentation

The `giterr_set_str` does not actually honor `GITERR_OS`.  Remove
the documentation that claims that we do.

8 years agomap: use `giterr_set` internally
Edward Thomson [Tue, 23 Feb 2016 18:02:07 +0000 (13:02 -0500)]
map: use `giterr_set` internally

Use the `giterr_set` function, which actually supports `GITERR_OS`.
The `giterr_set_str` function is exposed for external users and will
not append the operating system's error message.

8 years agodiff_tform: fix potential NULL pointer access
Patrick Steinhardt [Tue, 23 Feb 2016 10:07:03 +0000 (11:07 +0100)]
diff_tform: fix potential NULL pointer access

The `normalize_find_opts` function in theory allows for the
incoming diff to have no repository. When the caller does not
pass in diff find options or if the GIT_DIFF_FIND_BY_CONFIG value
is set, though, we try to derive the configuration from the
diff's repository configuration without first verifying that the
repository is actually set to a non-NULL value.

Fix this issue by explicitly checking if the repository is set
and if it is not, fall back to a default value of
GIT_DIFF_FIND_RENAMES.

8 years agoxmerge: fix memory leak on error path
Patrick Steinhardt [Mon, 22 Feb 2016 16:13:23 +0000 (17:13 +0100)]
xmerge: fix memory leak on error path

8 years agoopenssl_stream: fix NULL pointer dereference
Patrick Steinhardt [Tue, 23 Feb 2016 10:16:36 +0000 (11:16 +0100)]
openssl_stream: fix NULL pointer dereference

8 years agoopenssl_stream: fix memory leak when creating new stream
Patrick Steinhardt [Mon, 22 Feb 2016 15:08:56 +0000 (16:08 +0100)]
openssl_stream: fix memory leak when creating new stream

8 years agorebase: plug memory leak in `rebase_alloc`
Patrick Steinhardt [Mon, 22 Feb 2016 15:05:13 +0000 (16:05 +0100)]
rebase: plug memory leak in `rebase_alloc`

Convert `rebase_alloc` to use our usual error propagation
patterns, that is accept an out-parameter and return an error
code that is to be checked by the caller. This allows us to use
the GITERR_CHECK_ALLOC macro, which helps static analysis.

8 years agoremote: set error code in `create_internal`
Patrick Steinhardt [Mon, 22 Feb 2016 15:01:03 +0000 (16:01 +0100)]
remote: set error code in `create_internal`

Set the error code when an error occurs in any of the called
functions. This ensures we pass the error up to callers and
actually free the remote when an error occurs.

8 years agoindex: fix contradicting comparison
Patrick Steinhardt [Tue, 23 Feb 2016 10:23:26 +0000 (11:23 +0100)]
index: fix contradicting comparison

The overflow check in `read_reuc` tries to verify if the
`git__strtol32` parses an integer bigger than UINT_MAX. The `tmp`
variable is casted to an unsigned int for this and then checked
for being greater than UINT_MAX, which obviously can never be
true.

Fix this by instead fixing the `mode` field's size in `struct
git_index_reuc_entry` to `uint32_t`. We can now parse the int
with `git__strtol64`, which can never return a value bigger than
`UINT32_MAX`, and additionally checking if the returned value is
smaller than zero.

We do not need to handle overflows explicitly here, as
`git__strtol64` returns an error when the returned value would
overflow.

8 years agoindex: plug memory leak in `read_conflict_names`
Patrick Steinhardt [Mon, 22 Feb 2016 14:59:15 +0000 (15:59 +0100)]
index: plug memory leak in `read_conflict_names`

8 years agotransports: smart_pkt: fix memory leaks on error paths
Patrick Steinhardt [Mon, 22 Feb 2016 14:52:49 +0000 (15:52 +0100)]
transports: smart_pkt: fix memory leaks on error paths

8 years agorefdb_fs: remove unnecessary check for NULL
Patrick Steinhardt [Mon, 22 Feb 2016 13:06:48 +0000 (14:06 +0100)]
refdb_fs: remove unnecessary check for NULL

The fail-label of `reflog_parse` explicitly checks the entry
poitner for NULL before freeing it. When we jump to the label the
variable has to be set to a non-NULL and valid pointer though: if
the allocation fails we immediately return with an error code and
if the loop was not entered we return with a success code,
withouth executing the label's code.

Remove the useless NULL-check to silence Coverity.

8 years agodiff_print: assert patch is non-NULL
Patrick Steinhardt [Mon, 22 Feb 2016 13:01:50 +0000 (14:01 +0100)]
diff_print: assert patch is non-NULL

When invoking `diff_print_info_init_frompatch` it is obvious that
the patch should be non-NULL. We explicitly check if the variable
is set and continue afterwards, happily dereferencing the
potential NULL-pointer.

Fix this by instead asserting that patch is set. This also
silences Coverity.

8 years agopack-objects: return early when computing write order fails
Patrick Steinhardt [Mon, 22 Feb 2016 12:48:45 +0000 (13:48 +0100)]
pack-objects: return early when computing write order fails

The function `compute_write_order` may return a `NULL`-pointer
when an error occurs. In such cases we jump to the `done`-label
where we try to clean up allocated memory. Unfortunately we try
to deallocate the `write_order` array, though, which may be NULL
here.

Fix this error by returning early instead of jumping to the
`done` label. There is no data to be cleaned up anyway.

8 years agopack-objects: check realloc in try_delta with GITERR_CHECK_ALLOC
Patrick Steinhardt [Tue, 23 Feb 2016 09:45:09 +0000 (10:45 +0100)]
pack-objects: check realloc in try_delta with GITERR_CHECK_ALLOC

8 years agocrlf: do not ignore GIT_PASSTHROUGH error
Patrick Steinhardt [Mon, 22 Feb 2016 12:33:48 +0000 (13:33 +0100)]
crlf: do not ignore GIT_PASSTHROUGH error

When no payload is set for `crlf_apply` we try to compute the
crlf attributes ourselves with `crlf_check`. When the function
determines that the current file does not require any treatment
we return the GIT_PASSTHROUGH error code without actually
allocating the out-pointer, which indicates the file should not
be passed through the filter.

The `crlf_apply` function explicitly checks for the
GIT_PASSTHROUGH return code and ignores it. This means we will
try to apply the crlf-filter to the current file, leading us to
dereference the unallocated payload-pointer.

Fix this obviously incorrect behavior by not treating
GIT_PASSTHROUGH in any special way. This is the correct thing to
do anyway, as the code indicates that the file should not be
passed through the filter.

8 years agorefspec: check buffer with GITERR_CHECK_ALLOC_BUF
Patrick Steinhardt [Tue, 23 Feb 2016 09:09:03 +0000 (10:09 +0100)]
refspec: check buffer with GITERR_CHECK_ALLOC_BUF

8 years agorevwalk: use GITERR_CHECK_ALLOC_BUF
Patrick Steinhardt [Tue, 23 Feb 2016 10:48:30 +0000 (11:48 +0100)]
revwalk: use GITERR_CHECK_ALLOC_BUF

8 years agosmart_pkt: check buffer with GITERR_CHECK_ALLOC_BUF
Patrick Steinhardt [Tue, 23 Feb 2016 10:45:43 +0000 (11:45 +0100)]
smart_pkt: check buffer with GITERR_CHECK_ALLOC_BUF

8 years agopath: use GITERR_CHECK_ALLOC_BUF to verify passed in buffer
Patrick Steinhardt [Tue, 23 Feb 2016 09:02:44 +0000 (10:02 +0100)]
path: use GITERR_CHECK_ALLOC_BUF to verify passed in buffer

8 years agocommon: introduce GITERR_CHECK_ALLOC_BUF
Patrick Steinhardt [Tue, 23 Feb 2016 08:54:26 +0000 (09:54 +0100)]
common: introduce GITERR_CHECK_ALLOC_BUF

We commonly have to check if a git_buf has been allocated
correctly or if we ran out of memory. Introduce a new macro
similar to `GITERR_CHECK_ALLOC` which checks if we ran OOM and if
so returns an error. Provide a `#nodef` for Coverity to mark the
error case as an abort path.

8 years agocoverity: hint git_vector_foreach does not deref NULL contents
Patrick Steinhardt [Mon, 22 Feb 2016 13:43:28 +0000 (14:43 +0100)]
coverity: hint git_vector_foreach does not deref NULL contents

Coverity does not comprehend the connection between a vector's
size and the contents pointer, that is that the vector's pointer
is non-NULL when its size is positive. As the vector code should
be reasonably well tested and users are expected to not manually
modify a vector's contents it seems save to assume that the
macros will never dereference a NULL pointer.

Fix Coverity warnings by overriding the foreach macros with
macros that explicitly aborting when (v)->contents is NULL.

8 years agoMerge pull request #3629 from ethomson/set_user_agent_doc
Vicent Marti [Tue, 23 Feb 2016 07:16:12 +0000 (08:16 +0100)]
Merge pull request #3629 from ethomson/set_user_agent_doc

git_libgit2_opts: minor documentation & usage fixes

8 years agogit_libgit2_opts: validate key
Edward Thomson [Tue, 23 Feb 2016 04:04:40 +0000 (23:04 -0500)]
git_libgit2_opts: validate key

8 years agogit_libgit2_opts: document GIT_OPT_SET_USER_AGENT
Edward Thomson [Tue, 23 Feb 2016 03:26:01 +0000 (22:26 -0500)]
git_libgit2_opts: document GIT_OPT_SET_USER_AGENT

8 years agoMerge pull request #3627 from libgit2/cmn/typo
Edward Thomson [Mon, 22 Feb 2016 15:16:49 +0000 (10:16 -0500)]
Merge pull request #3627 from libgit2/cmn/typo

Fix a few checkout -> rebase typos

8 years agoFix a few checkout -> rebase typos
Carlos Martín Nieto [Mon, 22 Feb 2016 14:41:01 +0000 (15:41 +0100)]
Fix a few checkout -> rebase typos

8 years agoopenssl: re-export the last-resort locking function
Carlos Martín Nieto [Fri, 19 Feb 2016 15:23:14 +0000 (16:23 +0100)]
openssl: re-export the last-resort locking function

We need to include the header where we define the function. Otherwise it
won't be available on the DLL.

8 years agoRemove unnecessary ifdef in pool.h
Ross Delinger [Fri, 19 Feb 2016 14:13:40 +0000 (09:13 -0500)]
Remove unnecessary ifdef in pool.h

8 years agoCHANGELOG: add a few missing changes
Carlos Martín Nieto [Fri, 19 Feb 2016 12:52:04 +0000 (13:52 +0100)]
CHANGELOG: add a few missing changes

8 years agoopenssl: free the context even if we don't connect
Carlos Martín Nieto [Fri, 19 Feb 2016 12:31:54 +0000 (13:31 +0100)]
openssl: free the context even if we don't connect

8 years agoglobal: remove an unused variable
Carlos Martín Nieto [Fri, 19 Feb 2016 12:24:41 +0000 (13:24 +0100)]
global: remove an unused variable

8 years agoMerge pull request #3597 from ethomson/filter_registration
Carlos Martín Nieto [Fri, 19 Feb 2016 12:06:51 +0000 (13:06 +0100)]
Merge pull request #3597 from ethomson/filter_registration

Filter registration

8 years agoMerge pull request #3614 from pks-t/pks/coverity-fixes
Carlos Martín Nieto [Fri, 19 Feb 2016 09:21:37 +0000 (10:21 +0100)]
Merge pull request #3614 from pks-t/pks/coverity-fixes

Coverity fixes

8 years agonetops: fix memory leak when an error occurs
Patrick Steinhardt [Mon, 15 Feb 2016 10:28:33 +0000 (11:28 +0100)]
netops: fix memory leak when an error occurs

8 years agotransports: smart_pkt: fix memory leaks
Patrick Steinhardt [Mon, 15 Feb 2016 10:46:10 +0000 (11:46 +0100)]
transports: smart_pkt: fix memory leaks

8 years agotransports: smart: fix memory leak on OOM path
Patrick Steinhardt [Mon, 15 Feb 2016 10:37:48 +0000 (11:37 +0100)]
transports: smart: fix memory leak on OOM path

8 years agosignature: use GITERR_CHECK_ALLOC to check for OOM situation
Patrick Steinhardt [Mon, 15 Feb 2016 10:30:48 +0000 (11:30 +0100)]
signature: use GITERR_CHECK_ALLOC to check for OOM situation

When checking for out of memory situations we usually use the
GITERR_CHECK_ALLOC macro. Besides conforming to our current code
base it adds the benefit of silencing errors in Coverity due to
Coverity handling the macro's error path as abort.

8 years agocoverity: hint that string length is at least 2
Patrick Steinhardt [Mon, 15 Feb 2016 09:58:52 +0000 (10:58 +0100)]
coverity: hint that string length is at least 2

When checking if a string is prefixed by a drive letter (e.g.
"C:") we verify this by inspecting the first and second character
of the string. Coverity thinks this is a defect as we do not
check the string's length first, but in fact we only check the
second character if the first character is part of the alphabet,
that is it cannot be '\0'.

Fix this by overriding the macro and explicitly checking the
string's length.

8 years agocoverity: add nodefs for abort macros
Patrick Steinhardt [Mon, 15 Feb 2016 08:41:08 +0000 (09:41 +0100)]
coverity: add nodefs for abort macros

Add nodefs for macros that abort the current flow due to errors.
This includes macros that trigger on integer overflows and for
the version check macro. This aids Coverity as we point out that
these paths will cause a fatal error.

8 years agoMerge pull request #3604 from ethomson/nsec_xplat
Carlos Martín Nieto [Thu, 18 Feb 2016 14:11:31 +0000 (15:11 +0100)]
Merge pull request #3604 from ethomson/nsec_xplat

Handle `USE_NSECS`

8 years agoMerge pull request #3606 from ethomson/drop_xp
Carlos Martín Nieto [Thu, 18 Feb 2016 14:11:02 +0000 (15:11 +0100)]
Merge pull request #3606 from ethomson/drop_xp

win32: drop xp support in WideCharToMultiByte

8 years agoMerge pull request #3613 from ethomson/fixups
Carlos Martín Nieto [Thu, 18 Feb 2016 11:31:56 +0000 (12:31 +0100)]
Merge pull request #3613 from ethomson/fixups

Remove most of the silly warnings

8 years agoMerge pull request #3619 from ethomson/win32_forbidden
Carlos Martín Nieto [Thu, 18 Feb 2016 11:28:06 +0000 (12:28 +0100)]
Merge pull request #3619 from ethomson/win32_forbidden

win32: allow us to read indexes with forbidden paths on win32

8 years agoMerge pull request #3621 from pra85/patch-1
Carlos Martín Nieto [Thu, 18 Feb 2016 10:44:04 +0000 (11:44 +0100)]
Merge pull request #3621 from pra85/patch-1

Fix a typo

8 years agoPROJECTS: remove a few things we do have
Carlos Martín Nieto [Thu, 18 Feb 2016 10:39:55 +0000 (11:39 +0100)]
PROJECTS: remove a few things we do have

8 years agoFix a typo
Prayag Verma [Thu, 18 Feb 2016 07:56:08 +0000 (13:26 +0530)]
Fix a typo

`compatability` → `compatibility`

8 years agoindex: allow read of index w/ illegal entries
Edward Thomson [Tue, 16 Feb 2016 17:11:46 +0000 (17:11 +0000)]
index: allow read of index w/ illegal entries

Allow `git_index_read` to handle reading existing indexes with
illegal entries.  Allow the low-level `git_index_add` to add
properly formed `git_index_entry`s even if they contain paths
that would be illegal for the current filesystem (eg, `AUX`).
Continue to disallow `git_index_add_bypath` from adding entries
that are illegal universally illegal (eg, `.git`, `foo/../bar`).

8 years agoiterator: assert tree_iterator has a frame
Edward Thomson [Tue, 16 Feb 2016 13:08:55 +0000 (13:08 +0000)]
iterator: assert tree_iterator has a frame

Although a `tree_iterator` that failed to be properly created
does not have a frame, all other `tree_iterator`s should.  Do not
call `pop` in the failure case, but assert that in all other
cases there is a frame.

8 years agoValidate pointer before access the member.
Colin Xu [Fri, 22 Jan 2016 08:03:37 +0000 (16:03 +0800)]
Validate pointer before access the member.

When Git repository at network locations, sometimes git_iterator_for_tree
fails at iterator__update_ignore_case so it goes to git_iterator_free.
Null pointer will crash the process if not check.

Signed-off-by: Colin Xu <colin.xu@gmail.com>
8 years agowin32: tests around handling forbidden paths
Edward Thomson [Tue, 16 Feb 2016 18:50:08 +0000 (18:50 +0000)]
win32: tests around handling forbidden paths

Introduce a repository that contains some paths that were illegal
on PC-DOS circa 1981 (like `aux`, `con`, `com1`) and that in a
bizarre fit of retrocomputing, remain illegal on some "modern"
computers, despite being "new technology".

Introduce some aspirational tests that suggest that we should be
able to cope with trees and indexes that contain paths that
would be illegal on the filesystem, so that we can at least diff
them.  Further ensure that checkout will not write a repository
with forbidden paths.

8 years agoMerge pull request #3617 from libgit2/cmn/extract-sig-errors
Carlos Martín Nieto [Tue, 16 Feb 2016 13:45:32 +0000 (14:45 +0100)]
Merge pull request #3617 from libgit2/cmn/extract-sig-errors

commit: expose the different kinds of errors

8 years agocommit: expose the different kinds of errors
Carlos Martín Nieto [Tue, 16 Feb 2016 13:06:48 +0000 (14:06 +0100)]
commit: expose the different kinds of errors

We should be checking whether the object we're looking up is a commit,
and we should let the caller know whether the not-found return code
comes from a bad object type or just a missing signature.

8 years agowinhttp: use an unsigned iterator
Edward Thomson [Fri, 12 Feb 2016 18:27:05 +0000 (10:27 -0800)]
winhttp: use an unsigned iterator

8 years agosubmodule: explicitly cast to the teensy time value
Edward Thomson [Fri, 12 Feb 2016 18:25:50 +0000 (10:25 -0800)]
submodule: explicitly cast to the teensy time value

8 years agoindex: explicitly cast the teeny index entry members
Edward Thomson [Fri, 12 Feb 2016 18:22:54 +0000 (10:22 -0800)]
index: explicitly cast the teeny index entry members

8 years agoindex: don't use `seek` return as an error code
Edward Thomson [Fri, 12 Feb 2016 18:11:32 +0000 (10:11 -0800)]
index: don't use `seek` return as an error code

8 years agoindex: explicitly cast new hash size to an int
Edward Thomson [Fri, 12 Feb 2016 18:03:29 +0000 (10:03 -0800)]
index: explicitly cast new hash size to an int

8 years agowin32: drop incorrect `const`ness
Edward Thomson [Fri, 12 Feb 2016 18:02:18 +0000 (10:02 -0800)]
win32: drop incorrect `const`ness

8 years agofstat: use our custom `stat`
Edward Thomson [Thu, 11 Feb 2016 23:41:07 +0000 (15:41 -0800)]
fstat: use our custom `stat`

8 years agotree: zap warnings around `size_t` vs `uint16_t`
Edward Thomson [Thu, 11 Feb 2016 22:28:31 +0000 (14:28 -0800)]
tree: zap warnings around `size_t` vs `uint16_t`

8 years agoMerge pull request #3615 from ethomson/rebase_bare
Carlos Martín Nieto [Tue, 16 Feb 2016 07:54:43 +0000 (08:54 +0100)]
Merge pull request #3615 from ethomson/rebase_bare

rebase: persist a single in-memory index

8 years agorebase: persist a single in-memory index
Edward Thomson [Mon, 15 Feb 2016 17:16:00 +0000 (17:16 +0000)]
rebase: persist a single in-memory index

When performing an in-memory rebase, keep a single index for the
duration, so that callers have the expected index lifecycle and
do not hold on to an index that is free'd out from under them.

8 years agowin32: introduce p_timeval that isn't stupid
Edward Thomson [Thu, 11 Feb 2016 20:24:21 +0000 (12:24 -0800)]
win32: introduce p_timeval that isn't stupid

Windows defines `timeval` with `long`, which we cannot
sanely cope with.  Instead, use a custom timeval struct.

8 years agoMerge pull request #3610 from ethomson/rebase_bare
Carlos Martín Nieto [Thu, 11 Feb 2016 23:55:20 +0000 (00:55 +0100)]
Merge pull request #3610 from ethomson/rebase_bare

rebase: introduce bare rebasing

8 years agoMerge pull request #3612 from arthurschreiber/arthur/fix-3173
Edward Thomson [Thu, 11 Feb 2016 23:47:01 +0000 (15:47 -0800)]
Merge pull request #3612 from arthurschreiber/arthur/fix-3173

Horrible fix for #3173.

8 years agoHorrible fix for #3173.
Arthur Schreiber [Thu, 11 Feb 2016 22:37:52 +0000 (23:37 +0100)]
Horrible fix for #3173.

8 years agocommit: don't forget the last header field
Carlos Martín Nieto [Thu, 11 Feb 2016 21:19:20 +0000 (22:19 +0100)]
commit: don't forget the last header field

When we moved the logic to handle the first one, wrong loop logic was
kept in place which meant we still finished early. But we now notice it
because we're not reading past the last LF we find.

This was not noticed before as the last field in the tested commit was
multi-line which does not trigger the early break.

8 years agoMerge pull request #3607 from pks-t/pks/coverity-improvements
Carlos Martín Nieto [Thu, 11 Feb 2016 21:16:34 +0000 (22:16 +0100)]
Merge pull request #3607 from pks-t/pks/coverity-improvements

Coverity improvements for GITERR_CHECK_ALLOC