]> git.proxmox.com Git - libgit2.git/log
libgit2.git
3 years agoNew upstream version 1.1.0+dfsg.1
Utkarsh Gupta [Sun, 6 Dec 2020 22:36:37 +0000 (04:06 +0530)]
New upstream version 1.1.0+dfsg.1

4 years agoNew upstream version 0.28.4+dfsg.1
Utkarsh Gupta [Thu, 13 Feb 2020 20:25:56 +0000 (01:55 +0530)]
New upstream version 0.28.4+dfsg.1

4 years agoNew upstream version 0.28.3+dfsg.1
Pirate Praveen [Fri, 15 Nov 2019 16:37:09 +0000 (22:07 +0530)]
New upstream version 0.28.3+dfsg.1

5 years agoNew upstream version 0.28.1+dfsg.1
Jongmin Kim [Sat, 11 May 2019 15:29:21 +0000 (00:29 +0900)]
New upstream version 0.28.1+dfsg.1

5 years agoNew upstream version 0.27.7+dfsg.1
Raju Devidas [Wed, 26 Dec 2018 20:06:29 +0000 (01:36 +0530)]
New upstream version 0.27.7+dfsg.1

5 years agoNew upstream version 0.27.4+dfsg.1
Ximin Luo [Sat, 11 Aug 2018 02:43:40 +0000 (19:43 -0700)]
New upstream version 0.27.4+dfsg.1

6 years agoNew upstream version 0.27.0+dfsg.1
Pirate Praveen [Thu, 26 Apr 2018 12:36:07 +0000 (18:06 +0530)]
New upstream version 0.27.0+dfsg.1

6 years agoDFSG changes
Russell Sim [Sat, 29 Jul 2017 16:38:08 +0000 (18:38 +0200)]
DFSG changes

Remove deps/

6 years agoImported Upstream version 0.26.0
Russell Sim [Sat, 29 Jul 2017 13:51:23 +0000 (15:51 +0200)]
Imported Upstream version 0.26.0

6 years agoCHANGELOG: document git_filter_init and GIT_FILTER_INIT
Edward Thomson [Wed, 14 Jun 2017 11:31:20 +0000 (13:31 +0200)]
CHANGELOG: document git_filter_init and GIT_FILTER_INIT

6 years agoMerge pull request #4267 from mohseenrm/master
Edward Thomson [Wed, 14 Jun 2017 08:49:28 +0000 (10:49 +0200)]
Merge pull request #4267 from mohseenrm/master

adding GIT_FILTER_VERSION to GIT_FILTER_INIT as part of convention

6 years agoMerge pull request #4268 from pks-t/pks/homebrew-dupes-deprecation
Edward Thomson [Wed, 14 Jun 2017 08:48:04 +0000 (10:48 +0200)]
Merge pull request #4268 from pks-t/pks/homebrew-dupes-deprecation

travis: replace use of deprecated homebrew/dupes tap

6 years agoMerge pull request #4269 from pks-t/pks/tests
Edward Thomson [Wed, 14 Jun 2017 08:47:55 +0000 (10:47 +0200)]
Merge pull request #4269 from pks-t/pks/tests

Test improvements

6 years agoAdding git_filter_init for initializing `git_filter` struct + unit test
Mohseen Mukaddam [Tue, 13 Jun 2017 18:05:40 +0000 (11:05 -0700)]
Adding git_filter_init for initializing `git_filter` struct + unit test

6 years agoadding GIT_FILTER_VERSION to GIT_FILTER_INIT as part of convention
Mohseen Mukaddam [Mon, 12 Jun 2017 20:40:47 +0000 (13:40 -0700)]
adding GIT_FILTER_VERSION to GIT_FILTER_INIT as part of convention

6 years agotests: odb: add more low-level backend tests
Patrick Steinhardt [Tue, 13 Jun 2017 09:10:19 +0000 (11:10 +0200)]
tests: odb: add more low-level backend tests

Introduce a new test suite "odb::backend::simple", which utilizes the
fake backend to exercise the ODB abstraction layer. While such tests
already exist for the case where multiple backends are put together, no
direct testing for functionality with a single backend exist yet.

6 years agotests: odb: implement `exists_prefix` for the fake backend
Patrick Steinhardt [Tue, 13 Jun 2017 09:39:36 +0000 (11:39 +0200)]
tests: odb: implement `exists_prefix` for the fake backend

The fake backend currently implements all reading functions except for
the `exists_prefix` one. Implement it to enable further testing of the
ODB layer.

6 years agotests: odb: use correct OID length
Patrick Steinhardt [Tue, 13 Jun 2017 09:38:59 +0000 (11:38 +0200)]
tests: odb: use correct OID length

The `search_object` function takes the OID length as one of its
parameters, where its maximum length is `GIT_OID_HEXSZ`. The `exists`
function of the fake backend used `GIT_OID_RAWSZ` though, leading to
only the first half of the OID being used when finding the correct
object.

6 years agotests: odb: have the fake backend detect ambiguous prefixes
Patrick Steinhardt [Tue, 13 Jun 2017 09:38:14 +0000 (11:38 +0200)]
tests: odb: have the fake backend detect ambiguous prefixes

In order to be able to test the ODB prefix functions, we need to be able
to detect ambiguous prefixes in case multiple objects with the same
prefix exist in the fake ODB. Extend `search_object` to detect ambiguous
queries and have callers return its error code instead of always
returning `GIT_ENOTFOUND`.

6 years agotests: core: test initialization of `git_proxy_options`
Patrick Steinhardt [Tue, 13 Jun 2017 09:08:28 +0000 (11:08 +0200)]
tests: core: test initialization of `git_proxy_options`

Initialization of the `git_proxy_options` structure is never tested
anywhere. Include it in our usual initialization test in
"core::structinit::compare".

6 years agotests: network: add missing include for `git_repository_new`
Patrick Steinhardt [Tue, 13 Jun 2017 08:29:23 +0000 (10:29 +0200)]
tests: network: add missing include for `git_repository_new`

A newly added test uses the `git_repository_new` function without the
corresponding header file being included. While this works due to the
compiler deducing the correct function signature, we should obviously
just include the function's declaration file.

6 years agocmake: disable optimization on debug builds
Patrick Steinhardt [Tue, 13 Jun 2017 09:05:09 +0000 (11:05 +0200)]
cmake: disable optimization on debug builds

While our debug builds on MSVC platforms already tune the code optimizer
to aid debugging code, all the other platforms still use the default
optimization level. This makes it hard for developers on these platforms
to actually debug code while maintaining his sanity due to optimizations
like inlined code, elided variables etc.

To help this common use case, we can simply follow the MSVC example and
turn off code optimization with "-O0" for debug builds. While it would
be preferable to instead use "-Og" supported by more modern compilers,
we cannot guarantee that this level is available on all supported
platforms.

6 years agocmake: set "-D_DEBUG" on non-Windows platforms
Patrick Steinhardt [Tue, 13 Jun 2017 09:03:38 +0000 (11:03 +0200)]
cmake: set "-D_DEBUG" on non-Windows platforms

In our code base, we have some occasions where we use the "_DEBUG"
preprocessor macro to enable additional code which should not be part of
release builds. While we define this flag on MSVC platforms, it is
guarded by the conditional `WIN32 AND NOT CYGWIN` on other platforms
since 19be3f9e6 (Improve MSVC compiler, linker flags, 2013-02-13). While
this condition can be fulfilled by the MSVC platform, it is never
encountered due to being part of the `ELSE` part of `IF (MSVC)`.

The intention of the conditional was most likely to avoid the
preprocessor macro on Cygwin platforms, but to include it on everthing
else. As such, the correct condition here would be `IF (NOT CYGWIN)`
instead. But digging a bit further, the condition is only ever used in
two places:

1. To skip the test in "core::structinit", which should also work on
   Cygwin.
2. In "src/win32/git2.rc", where it is used to set additional file
   flags. As this file is included in MSVC builds only, it cannot cause
   any harm to set "_DEBUG" on Cygwin here.

As such, we can simply drop the conditional and always set "-D_DEBUG" on
all platforms.

6 years agocmake: remove stale comment on precompiled headers
Patrick Steinhardt [Tue, 13 Jun 2017 09:08:19 +0000 (11:08 +0200)]
cmake: remove stale comment on precompiled headers

In commit 9f75a9ce7 (Turning on runtime checks when building debug under
MSVC., 2012-03-30), we introduced a comment "Precompiled headers", which
actually refers to no related commands. Seeing that the comment never
had anything to refer to, we can simply remove it here.

6 years agotravis: replace use of deprecated homebrew/dupes tap
Patrick Steinhardt [Tue, 13 Jun 2017 06:09:38 +0000 (08:09 +0200)]
travis: replace use of deprecated homebrew/dupes tap

The formulae provided by the homebrew/dupes tap are deprecated since at
least April 4, 2017, with formulae having been migrated to
homebrew/core.

Replace the deprecated reference to "homebrew/dupes/zlib" with only
"zlib".

6 years agoMerge pull request #4265 from pks-t/pks/read-prefix-tests
Edward Thomson [Mon, 12 Jun 2017 21:47:54 +0000 (22:47 +0100)]
Merge pull request #4265 from pks-t/pks/read-prefix-tests

Read prefix tests

6 years agoMerge pull request #4263 from libgit2/ethomson/config_for_inmemory_repo
Edward Thomson [Mon, 12 Jun 2017 20:23:44 +0000 (21:23 +0100)]
Merge pull request #4263 from libgit2/ethomson/config_for_inmemory_repo

Allow creation of a configuration object in an in-memory repository

6 years agoMerge pull request #4266 from libgit2/ethomson/travis-explicit-openssl
Edward Thomson [Mon, 12 Jun 2017 20:22:27 +0000 (21:22 +0100)]
Merge pull request #4266 from libgit2/ethomson/travis-explicit-openssl

travis: install openssl explicitly

6 years agotravis: install openssl explicitly
Edward Thomson [Mon, 12 Jun 2017 19:00:21 +0000 (20:00 +0100)]
travis: install openssl explicitly

6 years agoremote: ensure we can create an anon remote on inmemory repo
Edward Thomson [Mon, 12 Jun 2017 11:00:14 +0000 (12:00 +0100)]
remote: ensure we can create an anon remote on inmemory repo

Given a wholly in-memory repository, ensure that we can create an
anonymous remote and perform actions on it.

6 years agorepository: don't fail to create config option in inmemory repo
Edward Thomson [Mon, 12 Jun 2017 11:02:27 +0000 (12:02 +0100)]
repository: don't fail to create config option in inmemory repo

When in an in-memory repository - without a configuration file - do not
fail to create a configuration object.

6 years agorepository_item_path: return ENOTFOUND when appropriate
Edward Thomson [Mon, 12 Jun 2017 11:01:10 +0000 (12:01 +0100)]
repository_item_path: return ENOTFOUND when appropriate

Disambiguate error values: return `GIT_ENOTFOUND` when the item cannot
exist in the repository (perhaps because the repository is inmemory or
otherwise not backed by a filesystem), return `-1` when there is a hard
failure.

6 years agotests: odb: add tests with multiple backends
Patrick Steinhardt [Mon, 12 Jun 2017 14:19:45 +0000 (16:19 +0200)]
tests: odb: add tests with multiple backends

Previous to pulling out and extending the fake backend, it was quite
cumbersome to write tests for very specific scenarios regarding
backends. But as we have made it more generic, it has become much easier
to do so. As such, this commit adds multiple tests for scenarios with
multiple backends for the ODB.

The changes also include a test for a very targeted scenario. When one
backend found a matching object via `read_prefix`, but the last backend
returns `GIT_ENOTFOUND` and when object hash verification is turned off,
we fail to reset the error code to `GIT_OK`. This causes us to segfault
later on, when doing a double-free on the returned object.

6 years agotests: odb: allow passing fake objects to the fake backend
Patrick Steinhardt [Mon, 12 Jun 2017 13:43:56 +0000 (15:43 +0200)]
tests: odb: allow passing fake objects to the fake backend

Right now, the fake backend is quite restrained in the way how it
works: we pass it an OID which it is to return later as well as an error
code we want it to return. While this is sufficient for existing tests,
we can make the fake backend a little bit more generic in order to allow
us testing for additional scenarios.

To do so, we change the backend to not accept an error code and OID
which it is to return for queries, but instead a simple array of OIDs
with their respective blob contents. On each query, the fake backend
simply iterates through this array and returns the first matching
object.

6 years agotests: do not reuse OID from backend
Patrick Steinhardt [Mon, 12 Jun 2017 13:21:58 +0000 (15:21 +0200)]
tests: do not reuse OID from backend

In order to make the fake backend more useful, we want to enable it
holding multiple object references. To do so, we need to decouple it
from the single fake OID it currently holds, which we simply move up
into the calling tests.

6 years agotests: odb: move fake backend into its own file
Patrick Steinhardt [Mon, 12 Jun 2017 12:53:46 +0000 (14:53 +0200)]
tests: odb: move fake backend into its own file

The fake backend used by the test suite `odb::backend::nonrefreshing` is
useful to have some low-level tests for the ODB layer. As such, we move
the implementation into its own `backend_helpers` module.

6 years agoMerge pull request #4261 from RogerGee/fix_wait_while_ack
Edward Thomson [Mon, 12 Jun 2017 15:01:22 +0000 (16:01 +0100)]
Merge pull request #4261 from RogerGee/fix_wait_while_ack

smart_protocol: fix parsing of server ACK responses

6 years agoMerge pull request #4264 from libgit2/ethomson/read_prefix
Patrick Steinhardt [Mon, 12 Jun 2017 14:33:41 +0000 (07:33 -0700)]
Merge pull request #4264 from libgit2/ethomson/read_prefix

odb_read_prefix: reset error in backends loop

6 years agoodb_read_prefix: reset error in backends loop
Edward Thomson [Mon, 12 Jun 2017 11:56:40 +0000 (12:56 +0100)]
odb_read_prefix: reset error in backends loop

When looking for an object by prefix, we query all the backends so that
we can ensure that there is no ambiguity.  We need to reset the `error`
value between backends; otherwise the first backend may find an object
by prefix, but subsequent backends may not.  If we do not reset the
`error` value then it will remain at `GIT_ENOTFOUND` and `read_prefix_1`
will fail, despite having actually found an object.

6 years agorepository_item_path: error messages lowercased
Edward Thomson [Mon, 12 Jun 2017 10:45:09 +0000 (11:45 +0100)]
repository_item_path: error messages lowercased

6 years agoMerge pull request #4262 from libgit2/ethomson/bump-v26
Edward Thomson [Sun, 11 Jun 2017 11:32:00 +0000 (12:32 +0100)]
Merge pull request #4262 from libgit2/ethomson/bump-v26

Update version number to 0.26

6 years agoUpdate version number to v0.26
Edward Thomson [Sun, 11 Jun 2017 11:23:34 +0000 (12:23 +0100)]
Update version number to v0.26

6 years agochangelog: add some final 0.26 changes
Edward Thomson [Sun, 11 Jun 2017 11:21:23 +0000 (12:21 +0100)]
changelog: add some final 0.26 changes

6 years agoMerge pull request #4254 from pks-t/pks/changelog-v0.26
Edward Thomson [Sun, 11 Jun 2017 09:58:35 +0000 (10:58 +0100)]
Merge pull request #4254 from pks-t/pks/changelog-v0.26

CHANGELOG: add various changes introduced since v0.25

6 years agoMerge pull request #4088 from chescock/packfile-name-using-complete-hash
Edward Thomson [Sun, 11 Jun 2017 09:37:46 +0000 (10:37 +0100)]
Merge pull request #4088 from chescock/packfile-name-using-complete-hash

Ensure packfiles with different contents have different names

6 years agoMerge pull request #4260 from libgit2/ethomson/forced_checkout_2
Edward Thomson [Sun, 11 Jun 2017 08:54:04 +0000 (09:54 +0100)]
Merge pull request #4260 from libgit2/ethomson/forced_checkout_2

Update to forced checkout and untracked files

6 years agogit_futils_rmdir: only allow `EBUSY` when asked
Edward Thomson [Sat, 10 Jun 2017 17:46:35 +0000 (18:46 +0100)]
git_futils_rmdir: only allow `EBUSY` when asked

Only ignore `EBUSY` from `rmdir` when the `GIT_RMDIR_SKIP_NONEMPTY` bit
is set.

6 years agocheckout: cope with untracked files in directory deletion
Edward Thomson [Thu, 8 Jun 2017 21:23:53 +0000 (22:23 +0100)]
checkout: cope with untracked files in directory deletion

When deleting a directory during checkout, do not simply delete the
directory, since there may be untracked files.  Instead, go into
the iterator and examine each file.

In the original code (the code with the faulty assumption), we look to
see if there's an index entry beneath the directory that we want to
remove.   Eg, it looks to see if we have a workdir entry foo and an
index entry foo/bar.txt. If this is not the case, then the working
directory must have precious files in that directory. This part is okay.
The part that's not okay is if there is an index entry foo/bar.txt. It
just blows away the whole damned directory.

That's not cool.

Instead, by simply pushing the directory itself onto the stack and
iterating each entry, we will deal with the files one by one - whether
they're in the index (and can be force removed) or not (and are
precious).

The original code was a bad optimization, assuming that we didn't need
to git_iterator_advance_into if there was any index entry in the folder.
That's wrong - we could have optimized this iff all folder entries are
in the index.

Instead, we need to simply dig into the directory and analyze its
entries.

6 years agocheckout: do not delete directories with untracked entries
Patrick Steinhardt [Wed, 15 Feb 2017 13:05:10 +0000 (14:05 +0100)]
checkout: do not delete directories with untracked entries

If the `GIT_CHECKOUT_FORCE` flag is given to any of the `git_checkout`
invocations, we remove files which were previously staged. But while
doing so, we unfortunately also remove unstaged files in a directory
which contains at least one staged file, resulting in potential data
loss.

This commit adds two tests to verify behavior.

6 years agosmart_protocol: fix parsing of server ACK responses
Roger Gee [Sat, 10 Jun 2017 16:46:09 +0000 (11:46 -0500)]
smart_protocol: fix parsing of server ACK responses

Fix ACK parsing in wait_while_ack() internal function. This patch
handles the case where multi_ack_detailed mode sends 'ready' ACKs. The
existing functionality would bail out too early, thus causing the
processing of the ensuing packfile to fail if/when 'ready' ACKs were
sent.

6 years agoCHANGELOG: add various changes introduced since v0.25
Patrick Steinhardt [Wed, 7 Jun 2017 06:32:41 +0000 (08:32 +0200)]
CHANGELOG: add various changes introduced since v0.25

6 years agoMerge pull request #4259 from pks-t/pks/fsync-option-rename
Edward Thomson [Thu, 8 Jun 2017 20:54:30 +0000 (22:54 +0200)]
Merge pull request #4259 from pks-t/pks/fsync-option-rename

settings: rename `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`

6 years agosettings: rename `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`
Patrick Steinhardt [Thu, 8 Jun 2017 19:40:18 +0000 (21:40 +0200)]
settings: rename `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`

Initially, the setting has been solely used to enable the use of
`fsync()` when creating objects. Since then, the use has been extended
to also cover references and index files. As the option is not yet part
of any release, we can still correct this by renaming the option to
something more sensible, indicating not only correlation to objects.

This commit renames the option to `GIT_OPT_ENABLE_FSYNC_GITDIR`. We also
move the variable from the object to repository source code.

6 years agoMerge pull request #4255 from pks-t/pks/buffer-grow-errors
Edward Thomson [Thu, 8 Jun 2017 12:22:24 +0000 (14:22 +0200)]
Merge pull request #4255 from pks-t/pks/buffer-grow-errors

Buffer growing cleanups

6 years agoMerge pull request #4253 from pks-t/pks/cov-fixes
Edward Thomson [Thu, 8 Jun 2017 11:56:22 +0000 (13:56 +0200)]
Merge pull request #4253 from pks-t/pks/cov-fixes

Coverity fixes

6 years agorefdb_fs: be explicit about using null-OID if we cannot resolve ref
Patrick Steinhardt [Tue, 6 Jun 2017 13:02:23 +0000 (15:02 +0200)]
refdb_fs: be explicit about using null-OID if we cannot resolve ref

6 years agopath: only set dotgit flags when configs were read
Patrick Steinhardt [Tue, 6 Jun 2017 12:57:31 +0000 (14:57 +0200)]
path: only set dotgit flags when configs were read

6 years agoworktree: use `git__free` instead of `free`
Patrick Steinhardt [Tue, 6 Jun 2017 12:54:48 +0000 (14:54 +0200)]
worktree: use `git__free` instead of `free`

6 years agorefs: properly report errors from `update_wt_heads`
Patrick Steinhardt [Tue, 6 Jun 2017 12:54:19 +0000 (14:54 +0200)]
refs: properly report errors from `update_wt_heads`

6 years agofileops: check return value of `git_path_dirname`
Patrick Steinhardt [Tue, 6 Jun 2017 12:53:45 +0000 (14:53 +0200)]
fileops: check return value of `git_path_dirname`

6 years agobuffer: use `git_buf_init` with length
Patrick Steinhardt [Wed, 7 Jun 2017 08:20:44 +0000 (10:20 +0200)]
buffer: use `git_buf_init` with length

The `git_buf_init` function has an optional length parameter, which will
cause the buffer to be initialized and allocated in one step. This can
be used instead of static initialization with `GIT_BUF_INIT` followed by
a `git_buf_grow`. This patch does so for two functions where it is
applicable.

6 years agobuffer: return errors for `git_buf_init` and `git_buf_attach`
Patrick Steinhardt [Wed, 7 Jun 2017 07:56:31 +0000 (09:56 +0200)]
buffer: return errors for `git_buf_init` and `git_buf_attach`

Both the `git_buf_init` and `git_buf_attach` functions may call
`git_buf_grow` in case they were given an allocation length as
parameter. As such, it is possible for these functions to fail when we
run out of memory. While it won't probably be used anytime soon, it does
indeed make sense to also record this fact by returning an error code
from both functions. As they belong to the internal API only, this
change does not break our interface.

6 years agobuffer: consistently use `ENSURE_SIZE` to grow buffers on-demand
Patrick Steinhardt [Wed, 7 Jun 2017 07:50:54 +0000 (09:50 +0200)]
buffer: consistently use `ENSURE_SIZE` to grow buffers on-demand

The `ENSURE_SIZE` macro can be used to grow a buffer if its currently
allocated size does not suffice a required target size. While most of
the code already uses this macro, the `git_buf_join` and `git_buf_join3`
functions do not yet use it. Due to the macro first checking whether we
have to grow the buffer at all, this has the benefit of saving a
function call when it is not needed. While this is nice to have, it will
probably not matter at all performance-wise -- instead, this only serves
for consistency across the code.

6 years agobuffer: fix `ENSURE_SIZE` macro referencing wrong variable
Patrick Steinhardt [Thu, 8 Jun 2017 09:52:32 +0000 (11:52 +0200)]
buffer: fix `ENSURE_SIZE` macro referencing wrong variable

While the `ENSURE_SIZE` macro gets a reference to both the buffer that
is to be resized and a new size, we were not consistently referencing
the passed buffer, but instead a variable `buf`, which is not passed in.
Funnily enough, we never noticed because our buffers seem to always be
named `buf` whenever the macro was being used.

Fix the macro by always using the passed-in buffer. While at it, add
braces around all mentions of passed-in variables as should be done with
macros to avoid subtle errors.

Found-by: Edward Thompson
6 years agobuffer: rely on `GITERR_OOM` set by `git_buf_try_grow`
Patrick Steinhardt [Wed, 7 Jun 2017 08:05:54 +0000 (10:05 +0200)]
buffer: rely on `GITERR_OOM` set by `git_buf_try_grow`

The function `git_buf_try_grow` consistently calls `giterr_set_oom`
whenever growing the buffer fails due to insufficient memory being
available. So in fact, we do not have to do this ourselves when a call
to any buffer-growing function has failed due to an OOM situation. But
we still do so in two functions, which this patch cleans up.

6 years agoMerge pull request #4258 from pks-t/pks/sha1dc-update
Edward Thomson [Thu, 8 Jun 2017 08:55:47 +0000 (10:55 +0200)]
Merge pull request #4258 from pks-t/pks/sha1dc-update

SHA1DC update

6 years agosha1dc: do not use standard includes
Patrick Steinhardt [Wed, 7 Jun 2017 12:59:38 +0000 (14:59 +0200)]
sha1dc: do not use standard includes

The updated SHA1DC library allows us to use custom includes instead of
using standard includes. Due to requirements with cross-platform, we
provide some custom system includes files like for example the
"stdint.h" file on Win32. Because of this, we want to make sure to avoid
breaking cross-platform compatibility when SHA1DC is enabled.

To use the new mechanism, we can simply define
`SHA1DC_NO_STANDARD_INCLUDES`. Furthermore, we can specify custom
include files via two defines, which we now use to include our
"common.h" header.

6 years agosha1dc: update to fix errors with endianess and unaligned access
Patrick Steinhardt [Wed, 7 Jun 2017 12:50:16 +0000 (14:50 +0200)]
sha1dc: update to fix errors with endianess and unaligned access

This updates our version of SHA1DC to e139984 (Merge pull request #35
from lidl/master, 2017-05-30).

6 years agoMerge pull request #4236 from pks-t/pks/index-v4-fixes
Edward Thomson [Wed, 7 Jun 2017 12:42:12 +0000 (14:42 +0200)]
Merge pull request #4236 from pks-t/pks/index-v4-fixes

Fix path computations for compressed index entries

6 years agoMerge pull request #4256 from libgit2/ethomson/unc_tests
Edward Thomson [Wed, 7 Jun 2017 11:56:22 +0000 (13:56 +0200)]
Merge pull request #4256 from libgit2/ethomson/unc_tests

(Temporarily) disable UNC tests

6 years agoctest: temporarily disable UNC path tests
Edward Thomson [Wed, 7 Jun 2017 09:54:48 +0000 (10:54 +0100)]
ctest: temporarily disable UNC path tests

(Temporarily) disable UNC path tests to work around AppVeyor issues.

6 years agoMerge pull request #4251 from Keruspe/master
Patrick Steinhardt [Wed, 7 Jun 2017 05:38:06 +0000 (07:38 +0200)]
Merge pull request #4251 from Keruspe/master

Fix build with libressl

6 years agoopenssl_stream: fix building with libressl
Marc-Antoine Perennou [Mon, 5 Jun 2017 08:11:20 +0000 (10:11 +0200)]
openssl_stream: fix building with libressl

OpenSSL v1.1 has introduced a new way of initializing the library
without having to call various functions of different subsystems. In
libgit2, we have been adapting to that change with 88520151f
(openssl_stream: use new initialization function on OpenSSL version
>=1.1, 2017-04-07), where we added an #ifdef depending on the OpenSSL
version. This change broke building with libressl, though, which has not
changed its API in the same way.

Fix the issue by expanding the #ifdef condition to use the old way of
initializing with libressl.

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
6 years agotests: index::version: improve write test for index v4
Patrick Steinhardt [Fri, 19 May 2017 11:04:32 +0000 (13:04 +0200)]
tests: index::version: improve write test for index v4

The current write test does not trigger some edge-cases in the index
version 4 path compression code. Rewrite the test to start off the an
empty standard repository, creating index entries with interesting paths
itself. This allows for more fine-grained control over checked paths.
Furthermore, we now also verify that entry paths are actually
reconstructed correctly.

6 years agotests: index::version: verify we write compressed index entries
Patrick Steinhardt [Fri, 19 May 2017 10:45:48 +0000 (12:45 +0200)]
tests: index::version: verify we write compressed index entries

While we do have a test which checks whether a written index of version
4 has the correct version set, we do not check whether this actually
enables path compression for index entries. This commit adds a new test
by adding a number of index entries with equal path prefixes to the
index and subsequently flushing that to disk. With suffix compression
enabled by index version 4, only the last few bytes of these paths will
actually have to be written to the index, saving a lot of disk space.
For the test, differences are about an order of magnitude, allowing us
to easily verify without taking a deeper look at actual on-disk
contents.

6 years agotests: index::version: add test to read index version v4
Patrick Steinhardt [Fri, 12 May 2017 08:04:42 +0000 (10:04 +0200)]
tests: index::version: add test to read index version v4

While we have a simple test to determine whether we can write an index
of version 4, we never verified that we are able to read this kind of
index (and in fact, we were not able to do so). Add a new repository
which has an index of version 4. This repository is then read from a new
test.

6 years agotests: index::version: move up cleanup function
Patrick Steinhardt [Fri, 12 May 2017 07:09:07 +0000 (09:09 +0200)]
tests: index::version: move up cleanup function

The init and cleanup functions for test suites are usually prepended to
our actual tests. The index::version test suite does not adhere to this
stile. Fix this.

6 years agoindex: verify we have enough space left when writing index entries
Patrick Steinhardt [Fri, 19 May 2017 12:06:15 +0000 (14:06 +0200)]
index: verify we have enough space left when writing index entries

In our code writing index entries, we carry around a `disk_size`
representing how much memory we have in total and pass this value to
`git_encode_varint` to do bounds checks. This does not make much sense,
as at the time when passing on this variable it is already out of date.
Fix this by subtracting used memory from `disk_size` as we go along.
Furthermore, assert we've actually got enough space left to do the final
path memcpy.

6 years agoindex: fix shared prefix computation when writing index entry
Patrick Steinhardt [Fri, 19 May 2017 11:49:34 +0000 (13:49 +0200)]
index: fix shared prefix computation when writing index entry

When using compressed index entries, each entry's path is preceded by a
varint encoding how long the shared prefix with the previous index entry
actually is. We currently encode a length of `(path_len - same_len)`,
which is doubly wrong. First, `path_len` is already set to `path_len -
same_len` previously. Second, we want to encode the shared prefix rather
than the un-shared suffix length.

Fix this by using `same_len` as the varint value instead.

6 years agoindex: also sanity check entry size with compressed entries
Patrick Steinhardt [Fri, 19 May 2017 11:39:05 +0000 (13:39 +0200)]
index: also sanity check entry size with compressed entries

We have a check in place whether the index has enough data left for the
required footer after reading an index entry, but this was only used for
uncompressed entries. Move the check down a bit so that it is executed
for both compressed and uncompressed index entries.

6 years agoindex: remove file-scope entry size macros
Patrick Steinhardt [Fri, 19 May 2017 12:22:35 +0000 (14:22 +0200)]
index: remove file-scope entry size macros

All index entry size computations are now performed in
`index_entry_size`. As such, we do not need the file-scope macros for
computing these sizes anymore. Remove them and move the `entry_size`
macro into the `index_entry_size` function.

6 years agoindex: don't right-pad paths when writing compressed entries
Patrick Steinhardt [Fri, 19 May 2017 11:59:53 +0000 (13:59 +0200)]
index: don't right-pad paths when writing compressed entries

Our code to write index entries to disk does not check whether the
entry that is to be written should use prefix compression for the path.
As such, we were overallocating memory and added bogus right-padding
into the resulting index entries. As there is no padding allowed in the
index version 4 format, this should actually result in an invalid index.

Fix this by re-using the newly extracted `index_entry_size` function.

6 years agoindex: move index entry size computation into its own function
Patrick Steinhardt [Fri, 19 May 2017 11:38:34 +0000 (13:38 +0200)]
index: move index entry size computation into its own function

Create a new function `index_entry_size` which encapsulates the logic to
calculate how much space is needed for an index entry, whether it is
simple/extended or compressed/uncompressed. This can later be re-used by
our code writing index entries.

6 years agoindex: set last written index entry in foreach-entry-loop
Patrick Steinhardt [Fri, 19 May 2017 10:35:21 +0000 (12:35 +0200)]
index: set last written index entry in foreach-entry-loop

The last written disk entry is currently being written inside of the
function `write_disk_entry`. Make behavior a bit more obviously by
instead setting it inside of `write_entries` while iterating all
entries.

6 years agoindex: set last entry when reading compressed entries
Patrick Steinhardt [Fri, 12 May 2017 08:01:43 +0000 (10:01 +0200)]
index: set last entry when reading compressed entries

To calculate the path of a compressed index entry, we need to know the
preceding entry's path. While we do actually set the first predecessor
correctly to "", we fail to update this while reading the entries.

Fix the issue by updating `last` inside of the loop. Previously, we've
been passing a double-pointer to `read_entry`, which it didn't update.
As it is more obvious to update the pointer inside the loop itself,
though, we can simply convert it to a normal pointer.

6 years agoindex: fix confusion with shared prefix in compressed path names
Patrick Steinhardt [Wed, 10 May 2017 12:27:12 +0000 (14:27 +0200)]
index: fix confusion with shared prefix in compressed path names

The index version 4 introduced compressed path names for the entries.
From the git.git index-format documentation:

    At the beginning of an entry, an integer N in the variable width
    encoding [...] is stored, followed by a NUL-terminated string S.
    Removing N bytes from the end of the path name for the previous
    entry, and replacing it with the string S yields the path name for
    this entry.

But instead of stripping N bytes from the previous path's string and
using the remaining prefix, we were instead simply concatenating the
previous path with the current entry path, which is obviously wrong.

Fix the issue by correctly copying the first N bytes of the previous
entry only and concatenating the result with our current entry's path.

6 years agovarint: fix computation for remaining buffer space
Patrick Steinhardt [Mon, 22 May 2017 10:53:44 +0000 (12:53 +0200)]
varint: fix computation for remaining buffer space

When encoding varints to a buffer, we want to remain sure that the
required buffer space does not exceed what is actually available. Our
current check does not do the right thing, though, in that it does not
honor that our `pos` variable counts the position down instead of up. As
such, we will require too much memory for small varints and not enough
memory for big varints.

Fix the issue by correctly calculating the required size as
`(sizeof(varint) - pos)`. Add a test which failed before.

6 years agoMerge branch 'pr/4228'
Edward Thomson [Sun, 4 Jun 2017 21:46:07 +0000 (22:46 +0100)]
Merge branch 'pr/4228'

6 years agoworktree: upgrade lock to an int
Edward Thomson [Sun, 4 Jun 2017 21:44:30 +0000 (22:44 +0100)]
worktree: upgrade lock to an int

6 years agoMerge pull request #4239 from roblg/toplevel-dir-ignore-fix
Edward Thomson [Sun, 4 Jun 2017 17:35:39 +0000 (19:35 +0200)]
Merge pull request #4239 from roblg/toplevel-dir-ignore-fix

Fix issue with directory glob ignore in subdirectories

6 years agoMerge pull request #4243 from pks-t/pks/submodule-workdir
Edward Thomson [Sun, 4 Jun 2017 17:03:07 +0000 (19:03 +0200)]
Merge pull request #4243 from pks-t/pks/submodule-workdir

Submodule working directory

6 years agoMerge pull request #4179 from libgit2/ethomson/expand_tilde
Carlos Martín Nieto [Sat, 20 May 2017 15:18:07 +0000 (17:18 +0200)]
Merge pull request #4179 from libgit2/ethomson/expand_tilde

Introduce home directory expansion function for config files, attribute files

6 years agoMerge pull request #4097 from implausible/fix/auto-detect-proxy-callbacks
Carlos Martín Nieto [Sat, 20 May 2017 12:18:32 +0000 (14:18 +0200)]
Merge pull request #4097 from implausible/fix/auto-detect-proxy-callbacks

Fix proxy auto detect not utilizing callbacks

6 years agoMerge pull request #4174 from libgit2/ethomson/set_head_to_tag
Carlos Martín Nieto [Sat, 20 May 2017 12:17:36 +0000 (14:17 +0200)]
Merge pull request #4174 from libgit2/ethomson/set_head_to_tag

git_repository_set_head: use tag name in reflog

6 years agoMerge pull request #4231 from wabain/open-revrange
Carlos Martín Nieto [Sat, 20 May 2017 12:13:27 +0000 (14:13 +0200)]
Merge pull request #4231 from wabain/open-revrange

revparse: support open-ended ranges

7 years agoindexer: name pack files after trailer hash
Chris Hescock [Wed, 11 Jan 2017 15:39:59 +0000 (10:39 -0500)]
indexer: name pack files after trailer hash

Upstream git.git has changed the way how packfiles are named.
Previously, they were using a hash of the contained object's OIDs, which
has then been changed to use the hash of the complete packfile instead.
See 1190a1acf (pack-objects: name pack files after trailer hash,
2013-12-05) in the git.git repository for more information on this
change.

This commit changes our logic to match the behavior of core git.

7 years agorepository: make check if repo is a worktree more strict
Patrick Steinhardt [Fri, 19 May 2017 07:21:17 +0000 (09:21 +0200)]
repository: make check if repo is a worktree more strict

To determine if a repository is a worktree or not, we currently check
for the existence of a "gitdir" file inside of the repository's gitdir.
While this is sufficient for non-broken repositories, we have at least
one case of a subtly broken repository where there exists a gitdir file
inside of a gitmodule. This will cause us to misidentify the submodule
as a worktree.

While this is not really a fault of ours, we can do better here by
observing that a repository can only ever be a worktree iff its common
directory and dotgit directory are different. This allows us to make our
check whether a repo is a worktree or not more strict by doing a simple
string comparison of these two directories. This will also allow us to
do the right thing in the above case of a broken repository, as for
submodules these directories will be the same. At the same time, this
allows us to skip the `stat` check for the "gitdir" file for most
repositories.

7 years agorepository: factor out worktree check
Patrick Steinhardt [Fri, 19 May 2017 06:59:46 +0000 (08:59 +0200)]
repository: factor out worktree check

The check whether a repository is a worktree or not is currently done
inside of `git_repository_open_ext`. As we want to extend this function
later on, pull it out into its own function `repo_is_worktree` to ease
working on it.

7 years agorepository: improve parameter names for `find_repo`
Patrick Steinhardt [Fri, 19 May 2017 06:38:47 +0000 (08:38 +0200)]
repository: improve parameter names for `find_repo`

The out-parameters of `find_repo` containing found paths of a repository
are a tad confusing, as they are not as obvious as they could be. Rename
them like following to ease reading the code:

- `repo_path` -> `gitdir_path`
- `parent_path` -> `workdir_path`
- `link_path` -> `gitlink_path`
- `common_path` -> `commondir_path`

7 years agorepository: clear out-parameter instead of freeing it
Patrick Steinhardt [Fri, 19 May 2017 06:34:32 +0000 (08:34 +0200)]
repository: clear out-parameter instead of freeing it

The `path` out-parameter of `find_repo` is being sanitized initially
such that we do not try to append to existing content. The sanitization
is done via `git_buf_free`, though, which forces us to needlessly
reallocate the buffer later in the function. Fix this by using
`git_buf_clear` instead.