]> git.proxmox.com Git - libgit2.git/log
libgit2.git
7 years agoMerge pull request #4169 from csware/absolute-symlink
Patrick Steinhardt [Mon, 20 Mar 2017 11:16:18 +0000 (12:16 +0100)]
Merge pull request #4169 from csware/absolute-symlink

7 years agotests: filebuf: test writing to symlink with absolute paths
Patrick Steinhardt [Mon, 20 Mar 2017 11:11:05 +0000 (12:11 +0100)]
tests: filebuf: test writing to symlink with absolute paths

7 years agofilebuf: fix resolving absolute symlinks
Sven Strickroth2 [Mon, 20 Mar 2017 10:21:00 +0000 (11:21 +0100)]
filebuf: fix resolving absolute symlinks

The symlink destination is always concatenated to the original path. Fix
this by using `git_buf_sets` instead of `git_buf_puts`.

7 years agoMerge pull request #4160 from pks-t/pks/diff-fixes
Patrick Steinhardt [Mon, 20 Mar 2017 10:06:23 +0000 (11:06 +0100)]
Merge pull request #4160 from pks-t/pks/diff-fixes

Diff fixes

7 years agoMerge pull request #4162 from pks-t/pks/merge-source-fixes
Patrick Steinhardt [Mon, 20 Mar 2017 10:05:03 +0000 (11:05 +0100)]
Merge pull request #4162 from pks-t/pks/merge-source-fixes

merge_driver: fix const-correctness for source getters

7 years agoMerge pull request #4161 from pks-t/pks/submodule-index-fix
Edward Thomson [Wed, 15 Mar 2017 15:03:45 +0000 (15:03 +0000)]
Merge pull request #4161 from pks-t/pks/submodule-index-fix

submodule: catch when submodule is not staged on update

7 years agomerge_driver: fix const-correctness for source getters
Patrick Steinhardt [Wed, 15 Mar 2017 10:46:15 +0000 (11:46 +0100)]
merge_driver: fix const-correctness for source getters

7 years agoMerge branch 'gumenikav/merge_driver_source_info'
Patrick Steinhardt [Wed, 15 Mar 2017 07:20:26 +0000 (08:20 +0100)]
Merge branch 'gumenikav/merge_driver_source_info'

7 years agomerge_driver: add unresolved getters for git_merge_driver_source
Gumenik Alexandr [Mon, 6 Mar 2017 09:30:31 +0000 (12:30 +0300)]
merge_driver: add unresolved getters for git_merge_driver_source

7 years agoMerge pull request #4146 from pks-t/pks/winhttp-errors
Patrick Steinhardt [Tue, 14 Mar 2017 14:04:18 +0000 (15:04 +0100)]
Merge pull request #4146 from pks-t/pks/winhttp-errors

winhttp: disambiguate error messages when sending requests

7 years agosubmodule: catch when submodule is not staged on update
Patrick Steinhardt [Tue, 14 Mar 2017 13:53:32 +0000 (14:53 +0100)]
submodule: catch when submodule is not staged on update

When calling `git_submodule_update` on a submodule, we have to retrieve
the ID of the submodule entry in the index. If the function is called on
a submodule which is only partly initialized, the submodule entry may
not be added to the index yet. This leads to an assert when trying to
look up the blob later on.

Fix the issue by checking if the index actually holds the submodule's
ID and erroring out if it does not.

7 years agodiff_parse: correctly set options for parsed diffs
Patrick Steinhardt [Tue, 14 Mar 2017 10:01:19 +0000 (11:01 +0100)]
diff_parse: correctly set options for parsed diffs

The function `diff_parsed_alloc` allocates and initializes a
`git_diff_parsed` structure. This structure also contains diff options.
While we initialize its flags, we fail to do a real initialization of
its values. This bites us when we want to actually use the generated
diff as we do not se the option's version field, which is required to
operate correctly.

Fix the issue by executing `git_diff_init_options` on the embedded
struct.

7 years agopatch_parse: fix parsing minimal trailing diff line
Patrick Steinhardt [Tue, 14 Mar 2017 08:39:37 +0000 (09:39 +0100)]
patch_parse: fix parsing minimal trailing diff line

In a diff, the shortest possible hunk with a modification (that is, no
deletion) results from a file with only one line with a single character
which is removed. Thus the following hunk

    @@ -1 +1 @@
    -a
    +

is the shortest valid hunk modifying a line. The function parsing the
hunk body though assumes that there must always be at least 4 bytes
present to make up a valid hunk, which is obviously wrong in this case.
The absolute minimum number of bytes required for a modification is
actually 2 bytes, that is the "+" and the following newline. Note: if
there is no trailing newline, the assumption will not be offended as the
diff will have a line "\ No trailing newline" at its end.

This patch fixes the issue by lowering the amount of bytes required.

7 years agopatch_generate: move `git_diff_foreach` to diff.c
Patrick Steinhardt [Tue, 14 Mar 2017 12:06:25 +0000 (13:06 +0100)]
patch_generate: move `git_diff_foreach` to diff.c

Now that the `git_diff_foreach` function does not depend on internals of
the `git_patch_generated` structure anymore, we can easily move it to
the actual diff code.

7 years agopatch_generate: fix `git_diff_foreach` only working with generated diffs
Patrick Steinhardt [Tue, 14 Mar 2017 09:37:47 +0000 (10:37 +0100)]
patch_generate: fix `git_diff_foreach` only working with generated diffs

The current logic of `git_diff_foreach` makes the assumption that all
diffs passed in are actually derived from generated diffs. With these
assumptions we try to derive the actual diff by inspecting either the
working directory files or blobs of a repository. This obviously cannot
work for diffs parsed from a file, where we do not necessarily have a
repository at hand.

Since the introduced split of parsed and generated patches, there are
multiple functions which help us to handle patches generically, being
indifferent from where they stem from. Use these functions and remove
the old logic specific to generated patches. This allows re-using the
same code for invoking the callbacks on the deltas.

7 years agopatch_generate: remove duplicated logic
Patrick Steinhardt [Tue, 14 Mar 2017 09:01:56 +0000 (10:01 +0100)]
patch_generate: remove duplicated logic

Under the existing logic, we try to load patch contents differently,
depending on whether the patch files stem from the working directory or
not. But actually, the executed code paths are completely equal to each
other -- so we were always the code despite the condition.

Remove the condition altogether and conflate both code paths.

8 years agoMerge pull request #4157 from adamniedzielski/4099-git-sort-time-uninteresting
Carlos Martín Nieto [Sat, 11 Mar 2017 18:52:05 +0000 (19:52 +0100)]
Merge pull request #4157 from adamniedzielski/4099-git-sort-time-uninteresting

Skip uninteresting commits in revwalk timesort iterator

8 years agoMerge pull request #4156 from libgit2/ethomson/readbuffer_dont_hash
Carlos Martín Nieto [Sat, 11 Mar 2017 18:09:27 +0000 (19:09 +0100)]
Merge pull request #4156 from libgit2/ethomson/readbuffer_dont_hash

git_futils_readbuffer: don't compute sha-1

8 years agoMerge pull request #4151 from novalis/dturner/rebase-submodule-untracked
Edward Thomson [Thu, 9 Mar 2017 16:32:38 +0000 (16:32 +0000)]
Merge pull request #4151 from novalis/dturner/rebase-submodule-untracked

rebase: ignore untracked files in submodules

8 years agoSkip uninteresting commits in revwalk timesort iterator
Adam Niedzielski [Thu, 9 Mar 2017 13:01:10 +0000 (14:01 +0100)]
Skip uninteresting commits in revwalk timesort iterator

Fixes #4099

8 years agogit_futils_readbuffer: don't compute sha-1
Edward Thomson [Thu, 9 Mar 2017 12:26:23 +0000 (12:26 +0000)]
git_futils_readbuffer: don't compute sha-1

Don't compute the sha-1 in `git_futils_readbuffer_updated` unless the
checksum was requested.  This means that `git_futils_readbuffer` will
not calculate the checksum unnecessarily.

8 years agoMerge pull request #4154 from libgit2/ethomson/namespaces
Edward Thomson [Mon, 6 Mar 2017 15:53:57 +0000 (15:53 +0000)]
Merge pull request #4154 from libgit2/ethomson/namespaces

Support namespaced references again

8 years agorefdb_fs: honor the namespace
Edward Thomson [Mon, 6 Mar 2017 13:14:47 +0000 (13:14 +0000)]
refdb_fs: honor the namespace

8 years agorefs::namespace: add namespace tests
Edward Thomson [Mon, 6 Mar 2017 13:13:47 +0000 (13:13 +0000)]
refs::namespace: add namespace tests

These simple tests only ensure that we enforce the existence of a
namespace; these mirror the rugged tests, they are not exhaustive.

8 years agorebase: ignore untracked files in submodules
David Turner [Fri, 3 Mar 2017 18:27:47 +0000 (13:27 -0500)]
rebase: ignore untracked files in submodules

An untracked file in a submodule should not prevent a rebase from
starting.  Even if the submodule's SHA is changed, and that file would
conflict with a new tracked file, it's still OK to start the rebase
and discover the conflict later.

Signed-off-by: David Turner <dturner@twosigma.com>
8 years agoMerge pull request #4150 from libgit2/ethomson/freshen_trees
Carlos Martín Nieto [Fri, 3 Mar 2017 15:12:12 +0000 (16:12 +0100)]
Merge pull request #4150 from libgit2/ethomson/freshen_trees

git_commit_create: freshen tree objects in commit

8 years agogit_commit_create: freshen tree objects in commit
Edward Thomson [Fri, 3 Mar 2017 13:26:29 +0000 (13:26 +0000)]
git_commit_create: freshen tree objects in commit

Freshen the tree object that a commit points to during commit time.

8 years agoMerge pull request #4136 from libgit2/ethomson/sha1dc
Carlos Martín Nieto [Fri, 3 Mar 2017 11:36:36 +0000 (12:36 +0100)]
Merge pull request #4136 from libgit2/ethomson/sha1dc

Introduce (optional) SHA1 collision attack detection

8 years agocmake: drop unset `SHA1_TYPE`
Edward Thomson [Thu, 2 Mar 2017 20:56:47 +0000 (20:56 +0000)]
cmake: drop unset `SHA1_TYPE`

We never set `SHA1_TYPE` to `builtin`.  Don't bother testing for it.

8 years agohash: test for sha1 collision attack detection
Edward Thomson [Fri, 24 Feb 2017 14:14:56 +0000 (14:14 +0000)]
hash: test for sha1 collision attack detection

8 years agohash: include sha1collisiondetection
Edward Thomson [Fri, 24 Feb 2017 13:34:01 +0000 (13:34 +0000)]
hash: include sha1collisiondetection

Include the SHA1 collision attack detection library from
https://github.com/cr-marcstevens/sha1collisiondetection

8 years agohash: rename implementation selection constants
Edward Thomson [Fri, 24 Feb 2017 13:03:15 +0000 (13:03 +0000)]
hash: rename implementation selection constants

8 years agoMerge pull request #4148 from pks-t/pks/fix-haiku-builds
Patrick Steinhardt [Wed, 1 Mar 2017 13:51:39 +0000 (14:51 +0100)]
Merge pull request #4148 from pks-t/pks/fix-haiku-builds

cmake: only enable supported compiler warning flags

8 years agocmake: only enable supported compiler warning flags
Patrick Steinhardt [Wed, 1 Mar 2017 12:58:15 +0000 (13:58 +0100)]
cmake: only enable supported compiler warning flags

We currently unconditionally enable the "-Wall" and "-Wextra" flags.
Some platforms rely on compilers which do not support these flags,
though. One of these platforms is Haiku, which does not support
"-Wextra" due to being stuck on GCC version 2.

Fix builds on such platforms by adding these flags only if supported by
the compiler.

8 years agoMerge pull request #4145 from pks-t/pks/refs-create-memleak
Patrick Steinhardt [Wed, 1 Mar 2017 07:45:48 +0000 (08:45 +0100)]
Merge pull request #4145 from pks-t/pks/refs-create-memleak

tests: refs::create: fix memory leak

8 years agowinhttp: disambiguate error messages when sending requests
Patrick Steinhardt [Wed, 1 Mar 2017 06:58:40 +0000 (07:58 +0100)]
winhttp: disambiguate error messages when sending requests

8 years agotests: refs::create: fix memory leak
Patrick Steinhardt [Wed, 1 Mar 2017 06:45:14 +0000 (07:45 +0100)]
tests: refs::create: fix memory leak

8 years agoMerge pull request #4143 from richardipsum/issue-4094
Patrick Steinhardt [Wed, 1 Mar 2017 06:35:44 +0000 (07:35 +0100)]
Merge pull request #4143 from richardipsum/issue-4094

Fix: make reflog include "(merge)" for merge commits

8 years agoAdd test for inclusion of (merge) in reflog
Richard Ipsum [Tue, 28 Feb 2017 22:22:02 +0000 (22:22 +0000)]
Add test for inclusion of (merge) in reflog

This test ensures that the string '(merge)' is included in the reflog
when a merge commit is made.

8 years agoFix: make reflog include "(merge)" for merge commits
Richard Ipsum [Sun, 26 Feb 2017 13:34:13 +0000 (13:34 +0000)]
Fix: make reflog include "(merge)" for merge commits

This fixes issue #4094

8 years agoMerge pull request #4138 from richardipsum/symbolic-create-arbitrary-tgt-test
Edward Thomson [Sun, 26 Feb 2017 16:12:30 +0000 (16:12 +0000)]
Merge pull request #4138 from richardipsum/symbolic-create-arbitrary-tgt-test

tests: Add create__symbolic_with_arbitrary_content

8 years agoMerge pull request #4142 from pblesi/patch-1
Edward Thomson [Sun, 26 Feb 2017 16:08:00 +0000 (16:08 +0000)]
Merge pull request #4142 from pblesi/patch-1

Fix minor typos in CONVENTIONS.md

8 years agoMerge pull request #4141 from kainjow/patch-2
Edward Thomson [Sun, 26 Feb 2017 16:01:32 +0000 (16:01 +0000)]
Merge pull request #4141 from kainjow/patch-2

Fix inet_pton tests triggering an assert in Haiku

8 years agoFix minor typos in CONVENTIONS.md
Patrick Blesi [Sun, 26 Feb 2017 05:09:42 +0000 (23:09 -0600)]
Fix minor typos in CONVENTIONS.md

8 years agoFix inet_pton tests triggering an assert in Haiku
Kevin Wojniak [Sat, 25 Feb 2017 18:21:59 +0000 (10:21 -0800)]
Fix inet_pton tests triggering an assert in Haiku

Haiku will assert in a nightly build if the "dst" input to inet_pton() is NULL.

8 years agoWhitespace and style fixes
Richard Ipsum [Sat, 25 Feb 2017 14:17:10 +0000 (14:17 +0000)]
Whitespace and style fixes

Use C style comments as per style guide,
and fix mismatching indentation.

8 years agotests: Add create__symbolic_with_arbitrary_content
Richard Ipsum [Sun, 22 Jan 2017 00:21:30 +0000 (00:21 +0000)]
tests: Add create__symbolic_with_arbitrary_content

This test ensures that it's possible to create a symbolic ref that
has arbitrary data as its target. It also ensures it's possible
to obtain the target of that symbolic reference from the git_reference
object.

8 years agoMerge pull request #4137 from libgit2/ethomson/appveyor
Edward Thomson [Sat, 25 Feb 2017 12:45:14 +0000 (12:45 +0000)]
Merge pull request #4137 from libgit2/ethomson/appveyor

appveyor: don't rewrite the system mingw

8 years agoappveyor: don't rewrite system mingw
Edward Thomson [Fri, 24 Feb 2017 17:37:00 +0000 (17:37 +0000)]
appveyor: don't rewrite system mingw

Download mingw-w64 into our build directory and execute it there, don't
try to overwrite the system's mingw.

8 years agoappveyor: always build the 'appveyor' branch
Edward Thomson [Fri, 24 Feb 2017 17:38:42 +0000 (17:38 +0000)]
appveyor: always build the 'appveyor' branch

The 'appveyor' branch is useful for testing AppVeyor builds.

8 years agoMerge pull request #4133 from stinb/khash-cleanup-regression
Patrick Steinhardt [Fri, 24 Feb 2017 07:51:50 +0000 (08:51 +0100)]
Merge pull request #4133 from stinb/khash-cleanup-regression

fix regression from #4092

8 years agopack: fix looping over cache entries
Jason Haslam [Wed, 22 Feb 2017 16:29:00 +0000 (09:29 -0700)]
pack: fix looping over cache entries

Fixes a regression from #4092. This is a crash on 32-bit and I assume that
it doesn't do the right thing on 64-bit either. MSVC emits a warning for this,
but of course, it's easy to get lost among all of the similar 'possible loss
of data' warnings.

8 years agoMerge pull request #4131 from pks-t/pks/attrcache-cleanups
Carlos Martín Nieto [Wed, 22 Feb 2017 15:30:57 +0000 (16:30 +0100)]
Merge pull request #4131 from pks-t/pks/attrcache-cleanups

Attrcache cleanups

8 years agoMerge pull request #4135 from libgit2/ethomson/ancient_gcc_not_threadsafe
Carlos Martín Nieto [Wed, 22 Feb 2017 15:17:54 +0000 (16:17 +0100)]
Merge pull request #4135 from libgit2/ethomson/ancient_gcc_not_threadsafe

Provide error on gcc < 4.1 when THREADSAFE

8 years agoProvide error on gcc < 4.1 when THREADSAFE
Edward Thomson [Wed, 22 Feb 2017 10:34:19 +0000 (10:34 +0000)]
Provide error on gcc < 4.1 when THREADSAFE

Provide a descriptive error message when compiling THREADSAFE on gcc
versions < 4.1.  We require the atomic primitives (eg
`__sync_synchronize`) that were introduced in that version.

(Note, clang setes `__GNUC__` but appears to set its version > 4.1.)

8 years agoattrcache: remove useless `do_init` indirection
Patrick Steinhardt [Tue, 21 Feb 2017 14:14:04 +0000 (15:14 +0100)]
attrcache: remove useless `do_init` indirection

Remove useless indirection from `git_attr_cache__init` to
`git_attr_cache__do_init`. The difference is that the
`git_attr_cache__init` macro first checks if the cache is already
initialized and, if so, not call `git_attr_cache__do_init`. But
actually, `git_attr_cache__do_init` already does the same thing and
returns immediately if the cache is already initialized.

Remove the indirection.

8 years agoattrcache: replace existing file entry with `git__swap`
Patrick Steinhardt [Tue, 21 Feb 2017 10:52:15 +0000 (11:52 +0100)]
attrcache: replace existing file entry with `git__swap`

When doing an upsert of a file, we used to use `git__compare_and_swap`,
comparing the entry's file which is to be replaced with itself. This can
be more easily formulated by using `git__swap`, which unconditionally
replaces the value.

8 years agoattrcache: do not lock/unlock the mutex directly
Patrick Steinhardt [Tue, 21 Feb 2017 10:43:32 +0000 (11:43 +0100)]
attrcache: do not lock/unlock the mutex directly

Improve encapsulation by not referencing the attrcache mutex directly
but instead using the `attr_cache_lock` and `attr_cache_unlock`
functions.

8 years agoMerge pull request #4130 from libgit2/ethomson/clar_messages
Edward Thomson [Fri, 17 Feb 2017 16:32:14 +0000 (16:32 +0000)]
Merge pull request #4130 from libgit2/ethomson/clar_messages

Improve clar messages

8 years ago`cl_git_exec` -> `cl_git_expect`
Edward Thomson [Fri, 17 Feb 2017 13:01:49 +0000 (13:01 +0000)]
`cl_git_exec` -> `cl_git_expect`

8 years agotests: provide better pass/failure error messages
Edward Thomson [Fri, 17 Feb 2017 12:13:35 +0000 (12:13 +0000)]
tests: provide better pass/failure error messages

Provide more detailed messages when conditions pass or fail
unexpectedly.  In particular, this provides the error messages when a
test fails with a different error code than was expected.

8 years agop_snprintf: no need for arguments to a format
Edward Thomson [Fri, 17 Feb 2017 12:10:19 +0000 (12:10 +0000)]
p_snprintf: no need for arguments to a format

`snprintf` requires a _format_ but does not require _arguments_ to the
format.  eg: `snprintf(buf, 42, "hi")` is perfectly legal.  Expand the
macro to match.

Without this, `p_sprintf(buf, 42, "hi")` errors with:

```
error: expected expression
                p_snprintf(msg, 42, "hi");
                ^
src/unix/posix.h:53:34: note: expanded from macro 'p_snprintf'
                                 ^
/usr/include/secure/_stdio.h:57:73: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str),
__VA_ARGS__)
```

8 years agoMerge pull request #4092 from pks-t/pks/khash-cleanups
Patrick Steinhardt [Fri, 17 Feb 2017 11:41:05 +0000 (12:41 +0100)]
Merge pull request #4092 from pks-t/pks/khash-cleanups

khash cleanups

8 years agoidxmap: remove GIT__USE_IDXMAP
Patrick Steinhardt [Thu, 2 Feb 2017 12:09:32 +0000 (13:09 +0100)]
idxmap: remove GIT__USE_IDXMAP

8 years agoidxmap: convert to use functions instead of macros
Patrick Steinhardt [Thu, 2 Feb 2017 11:20:17 +0000 (12:20 +0100)]
idxmap: convert to use functions instead of macros

8 years agooffmap: remove GIT__USE_OFFMAP macro
Patrick Steinhardt [Thu, 2 Feb 2017 10:58:48 +0000 (11:58 +0100)]
offmap: remove GIT__USE_OFFMAP macro

8 years agooffmap: convert to use functions instead of macros
Patrick Steinhardt [Thu, 2 Feb 2017 10:57:31 +0000 (11:57 +0100)]
offmap: convert to use functions instead of macros

8 years agooidmap: remove GIT__USE_OIDMAP macro
Patrick Steinhardt [Fri, 27 Jan 2017 14:23:15 +0000 (15:23 +0100)]
oidmap: remove GIT__USE_OIDMAP macro

8 years agooidmap: convert macros to functions
Patrick Steinhardt [Fri, 27 Jan 2017 13:53:23 +0000 (14:53 +0100)]
oidmap: convert macros to functions

8 years agostrmap: remove GIT__USE_STRMAP macro
Patrick Steinhardt [Fri, 27 Jan 2017 13:32:23 +0000 (14:32 +0100)]
strmap: remove GIT__USE_STRMAP macro

8 years agostrmap: convert macros to functions
Patrick Steinhardt [Fri, 27 Jan 2017 13:13:49 +0000 (14:13 +0100)]
strmap: convert macros to functions

8 years agokhash: avoid using `kh_resize` directly
Patrick Steinhardt [Thu, 2 Feb 2017 12:08:52 +0000 (13:08 +0100)]
khash: avoid using `kh_resize` directly

8 years agokhash: avoid using macro magic to get return address
Patrick Steinhardt [Fri, 27 Jan 2017 13:20:24 +0000 (14:20 +0100)]
khash: avoid using macro magic to get return address

8 years agokhash: avoid using `kh_key`/`kh_val` as lvalue
Patrick Steinhardt [Fri, 27 Jan 2017 13:05:10 +0000 (14:05 +0100)]
khash: avoid using `kh_key`/`kh_val` as lvalue

8 years agokhash: avoid using `kh_put` directly
Patrick Steinhardt [Wed, 25 Jan 2017 14:31:12 +0000 (15:31 +0100)]
khash: avoid using `kh_put` directly

8 years agokhash: avoid using `kh_del` directly
Patrick Steinhardt [Wed, 25 Jan 2017 13:41:17 +0000 (14:41 +0100)]
khash: avoid using `kh_del` directly

8 years agokhash: avoid using `kh_key` directly
Patrick Steinhardt [Wed, 25 Jan 2017 13:32:23 +0000 (14:32 +0100)]
khash: avoid using `kh_key` directly

8 years agokhash: avoid using `kh_val`/`kh_value` directly
Patrick Steinhardt [Wed, 25 Jan 2017 13:26:58 +0000 (14:26 +0100)]
khash: avoid using `kh_val`/`kh_value` directly

8 years agokhash: avoid using `kh_exist` directly
Patrick Steinhardt [Wed, 25 Jan 2017 13:20:56 +0000 (14:20 +0100)]
khash: avoid using `kh_exist` directly

8 years agokhash: avoid using `kh_clear` directly
Patrick Steinhardt [Wed, 25 Jan 2017 13:16:35 +0000 (14:16 +0100)]
khash: avoid using `kh_clear` directly

8 years agokhash: avoid using `kh_get` directly
Patrick Steinhardt [Wed, 25 Jan 2017 13:14:32 +0000 (14:14 +0100)]
khash: avoid using `kh_get` directly

8 years agokhash: avoid using `kh_end` directly
Patrick Steinhardt [Wed, 25 Jan 2017 13:14:12 +0000 (14:14 +0100)]
khash: avoid using `kh_end` directly

8 years agokhash: use `git_map_exists` where applicable
Patrick Steinhardt [Wed, 25 Jan 2017 13:11:42 +0000 (14:11 +0100)]
khash: use `git_map_exists` where applicable

8 years agokhash: avoid using `kh_foreach`/`kh_foreach_value` directly
Patrick Steinhardt [Wed, 25 Jan 2017 13:09:17 +0000 (14:09 +0100)]
khash: avoid using `kh_foreach`/`kh_foreach_value` directly

8 years agokhash: avoid using `kh_size` directly
Patrick Steinhardt [Wed, 25 Jan 2017 13:05:24 +0000 (14:05 +0100)]
khash: avoid using `kh_size` directly

8 years agooffmap: remove unused macro `git_offmap_insert2`
Patrick Steinhardt [Fri, 27 Jan 2017 13:15:45 +0000 (14:15 +0100)]
offmap: remove unused macro `git_offmap_insert2`

8 years agostrmap: remove unused macro `git_strmap_insert2`
Patrick Steinhardt [Wed, 25 Jan 2017 13:12:13 +0000 (14:12 +0100)]
strmap: remove unused macro `git_strmap_insert2`

8 years agoMerge pull request #4124 from pks-t/pks/worktree-refs
Patrick Steinhardt [Fri, 17 Feb 2017 10:14:53 +0000 (11:14 +0100)]
Merge pull request #4124 from pks-t/pks/worktree-refs

refdb: catch additional per-worktree refs

8 years agoMerge pull request #4127 from Uncommon/comment
Edward Thomson [Thu, 16 Feb 2017 22:30:33 +0000 (22:30 +0000)]
Merge pull request #4127 from Uncommon/comment

Minor comment fix

8 years agoMinor comment fix
David Catmull [Thu, 16 Feb 2017 15:40:49 +0000 (08:40 -0700)]
Minor comment fix

8 years agorefdb: catch additional per-worktree refs
Patrick Steinhardt [Tue, 14 Feb 2017 10:13:32 +0000 (11:13 +0100)]
refdb: catch additional per-worktree refs

The upstream git.git project currently identifies all references inside
of `refs/bisect/` as well as `HEAD` as per-worktree references. This is
already incorrect and is currently being fixed by an in-flight topic
[1]. The new behavior will be to match all pseudo-references outside of
the `refs/` hierarchy as well as `refs/bisect/`.

Our current behavior is to mark a selection of pseudo-references as
per-worktree, only. This matches more pseudo-references than current
git, but forgets about `refs/bisect/`. Adjust behavior to match the
in-flight topic, that is classify the following references as
per-worktree:

- everything outside of `refs/`
- everything inside of `refs/bisect/`

[1]: <20170213152011.12050-1-pclouds@gmail.com>

8 years agoMerge pull request #4122 from pks-t/pks/signature-dbl-free
Edward Thomson [Mon, 13 Feb 2017 14:38:12 +0000 (14:38 +0000)]
Merge pull request #4122 from pks-t/pks/signature-dbl-free

Signature cleanups

8 years agocommit: avoid possible use-after-free
Patrick Steinhardt [Mon, 13 Feb 2017 12:46:17 +0000 (13:46 +0100)]
commit: avoid possible use-after-free

When extracting a commit's signature, we first free the object and only
afterwards put its signature contents into the result buffer. This works
in most cases - the free'd object will normally be cached anyway, so we
only end up decrementing its reference count without actually freeing
its contents. But in some more exotic setups, where caching is disabled,
this can definitly be a problem, as we might be the only instance
currently holding a reference to this object.

Fix this issue by first extracting the contents and freeing the object
afterwards only.

8 years agocommit: clear user-provided buffers
Patrick Steinhardt [Mon, 13 Feb 2017 12:42:16 +0000 (13:42 +0100)]
commit: clear user-provided buffers

The functions `git_commit_header_field` and
`git_commit_extract_signature` both receive buffers used to hand back
the results to the user. While these functions called `git_buf_sanitize`
on these buffers, this is not the right thing to do, as it will simply
initialize or zero-terminate passed buffers. As we want to overwrite
contents, we instead have to call `git_buf_clear` to completely reset
them.

8 years agoMerge pull request #4115 from gsaralms/users/gsaral/optionalOfsDelta
Edward Thomson [Mon, 13 Feb 2017 12:46:00 +0000 (12:46 +0000)]
Merge pull request #4115 from gsaralms/users/gsaral/optionalOfsDelta

Changes to provide option to turn off/on ofs_delta

8 years agobuffer: clarify how `git_buf_sanitize` handles non-NULL input
Patrick Steinhardt [Mon, 13 Feb 2017 12:31:37 +0000 (13:31 +0100)]
buffer: clarify how `git_buf_sanitize` handles non-NULL input

When `git_buf_sanitize` gets called, it converts a buffer with NULL
content to be correctly initialized. This is done by pointing it to
`git_buf__initbuf`. While the method's documentation states this
clearly, it may also lead to the conclusion that it will do the same to
buffers which do _not_ have NULL contents.

Clarify behavior when passing a buffer with non-NULL contents, where
`git_buf_sanitize` will ensure that the contents are `\0`-terminated.

8 years agoMerge pull request #3436 from pks-t/libgit2-worktree
Edward Thomson [Mon, 13 Feb 2017 11:10:49 +0000 (11:10 +0000)]
Merge pull request #3436 from pks-t/libgit2-worktree

Worktree implementation

8 years agoworktree: extract git_worktree_is_prunable
Patrick Steinhardt [Fri, 3 Feb 2017 12:52:23 +0000 (13:52 +0100)]
worktree: extract git_worktree_is_prunable

8 years agoworktree: test opening worktree via gitlink, gitdir and worktree
Patrick Steinhardt [Wed, 9 Nov 2016 13:18:22 +0000 (14:18 +0100)]
worktree: test opening worktree via gitlink, gitdir and worktree

8 years agoworktree: test creating and opening submodule worktrees
Patrick Steinhardt [Tue, 8 Nov 2016 11:13:59 +0000 (12:13 +0100)]
worktree: test creating and opening submodule worktrees