summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Provide error on gcc < 4.1 when THREADSAFEethomson/ancient_gcc_not_threadsafeEdward Thomson2017-02-221-0/+6
| | | | | | | | 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.)
* Merge pull request #4130 from libgit2/ethomson/clar_messagesEdward Thomson2017-02-177-24/+36
|\ | | | | Improve clar messages
| * `cl_git_exec` -> `cl_git_expect`ethomson/clar_messagesEdward Thomson2017-02-174-11/+11
| |
| * tests: provide better pass/failure error messagesEdward Thomson2017-02-176-23/+35
| | | | | | | | | | | | 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.
| * p_snprintf: no need for arguments to a formatEdward Thomson2017-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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__) ```
* | Merge pull request #4092 from pks-t/pks/khash-cleanupsPatrick Steinhardt2017-02-1733-347/+610
|\ \ | |/ |/| khash cleanups
| * idxmap: remove GIT__USE_IDXMAPPatrick Steinhardt2017-02-173-23/+14
| |
| * idxmap: convert to use functions instead of macrosPatrick Steinhardt2017-02-172-43/+143
| |
| * offmap: remove GIT__USE_OFFMAP macroPatrick Steinhardt2017-02-173-6/+1
| |
| * offmap: convert to use functions instead of macrosPatrick Steinhardt2017-02-172-23/+97
| |
| * oidmap: remove GIT__USE_OIDMAP macroPatrick Steinhardt2017-02-1710-25/+7
| |
| * oidmap: convert macros to functionsPatrick Steinhardt2017-02-172-22/+115
| |
| * strmap: remove GIT__USE_STRMAP macroPatrick Steinhardt2017-02-1716-31/+1
| |
| * strmap: convert macros to functionsPatrick Steinhardt2017-02-172-27/+112
| |
| * khash: avoid using `kh_resize` directlyPatrick Steinhardt2017-02-172-6/+7
| |
| * khash: avoid using macro magic to get return addressPatrick Steinhardt2017-02-1718-37/+37
| |
| * khash: avoid using `kh_key`/`kh_val` as lvaluePatrick Steinhardt2017-02-1710-17/+20
| |
| * khash: avoid using `kh_put` directlyPatrick Steinhardt2017-02-1711-11/+17
| |
| * khash: avoid using `kh_del` directlyPatrick Steinhardt2017-02-173-4/+5
| |
| * khash: avoid using `kh_key` directlyPatrick Steinhardt2017-02-174-6/+5
| |
| * khash: avoid using `kh_val`/`kh_value` directlyPatrick Steinhardt2017-02-178-23/+23
| |
| * khash: avoid using `kh_exist` directlyPatrick Steinhardt2017-02-172-1/+2
| |
| * khash: avoid using `kh_clear` directlyPatrick Steinhardt2017-02-172-2/+2
| |
| * khash: avoid using `kh_get` directlyPatrick Steinhardt2017-02-176-12/+12
| |
| * khash: avoid using `kh_end` directlyPatrick Steinhardt2017-02-177-13/+16
| |
| * khash: use `git_map_exists` where applicablePatrick Steinhardt2017-02-175-12/+6
| |
| * khash: avoid using `kh_foreach`/`kh_foreach_value` directlyPatrick Steinhardt2017-02-176-32/+17
| |
| * khash: avoid using `kh_size` directlyPatrick Steinhardt2017-02-173-7/+7
| |
| * offmap: remove unused macro `git_offmap_insert2`Patrick Steinhardt2017-02-171-10/+0
| |
| * strmap: remove unused macro `git_strmap_insert2`Patrick Steinhardt2017-02-171-10/+0
|/
* Merge pull request #4124 from pks-t/pks/worktree-refsPatrick Steinhardt2017-02-171-4/+9
|\ | | | | refdb: catch additional per-worktree refs
| * refdb: catch additional per-worktree refsPatrick Steinhardt2017-02-151-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge pull request #4127 from Uncommon/commentEdward Thomson2017-02-161-6/+7
|\ \ | |/ |/| Minor comment fix
| * Minor comment fixDavid Catmull2017-02-161-6/+7
|/
* Merge pull request #4122 from pks-t/pks/signature-dbl-freeEdward Thomson2017-02-133-8/+13
|\ | | | | Signature cleanups
| * commit: avoid possible use-after-freePatrick Steinhardt2017-02-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * commit: clear user-provided buffersPatrick Steinhardt2017-02-132-6/+9
| | | | | | | | | | | | | | | | | | | | 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.
| * buffer: clarify how `git_buf_sanitize` handles non-NULL inputPatrick Steinhardt2017-02-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #4115 from gsaralms/users/gsaral/optionalOfsDeltaEdward Thomson2017-02-134-1/+21
|\ \ | |/ |/| Changes to provide option to turn off/on ofs_delta
| * Changes to provide option to turn off/on ofs_deltaGaurav Saral2017-02-104-1/+21
| | | | | | | | This change provides an option in git_libgit2_opt_t which can be used in git_libgit2_opts to turn off/on ofs_delta capability in libGit2
* | Merge pull request #3436 from pks-t/libgit2-worktreeEdward Thomson2017-02-1375-123/+2423
|\ \ | | | | | | Worktree implementation
| * | worktree: extract git_worktree_is_prunablePatrick Steinhardt2017-02-132-7/+35
| | |
| * | worktree: test opening worktree via gitlink, gitdir and worktreePatrick Steinhardt2017-02-131-4/+77
| | |
| * | worktree: test creating and opening submodule worktreesPatrick Steinhardt2017-02-131-0/+28
| | |
| * | worktree: test opening discovered submodule worktreesPatrick Steinhardt2017-02-131-0/+27
| | |
| * | worktree: compute workdir for worktrees opened via their gitdirPatrick Steinhardt2017-02-135-12/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When opening a worktree via the gitdir of its parent repository we fail to correctly set up the worktree's working directory. The problem here is two-fold: we first fail to see that the gitdir actually is a gitdir of a working tree and then subsequently fail to determine the working tree location from the gitdir. The first problem of not noticing a gitdir belongs to a worktree can be solved by checking for the existence of a `gitdir` file in the gitdir. This file points back to the gitlink file located in the working tree's working directory. As this file only exists for worktrees, it should be sufficient indication of the gitdir belonging to a worktree. The second problem, that is determining the location of the worktree's working directory, can then be solved by reading the `gitdir` file in the working directory's gitdir. When we now resolve relative paths and strip the final `.git` component, we have the actual worktree's working directory location.
| * | repository: rename `path_repository` and `path_gitlink`Patrick Steinhardt2017-02-1310-50/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `path_repository` variable is actually confusing to think about, as it is not always clear what the repository actually is. It may either be the path to the folder containing worktree and .git directory, the path to .git itself, a worktree or something entirely different. Actually, the intent of the variable is to hold the path to the gitdir, which is either the .git directory or the bare repository. Rename the variable to `gitdir` to avoid confusion. While at it, also rename `path_gitlink` to `gitlink` to improve consistency.
| * | repository: restrict checking out checked out branchesPatrick Steinhardt2017-02-132-0/+41
| | | | | | | | | | | | | | | | | | If a branch is already checked out in a working tree we are not allowed to check out that branch in another repository. Introduce this restriction when setting a repository's HEAD.
| * | branch: restrict branch deletion for worktreesPatrick Steinhardt2017-02-132-0/+33
| | | | | | | | | | | | | | | Restrict the ability to delete branches that are checked out in any linked repository.
| * | branch: implement `git_branch_is_checked_out`Patrick Steinhardt2017-02-132-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | Implement a new function that is able to determine if a branch is checked out in any repository connected to the current repository. In particular, this is required to check if for a given repository and branch, there exists any working tree connected to that repository that is referencing this branch.