Log

Author Commit Date CI Message
Patrick Steinhardt 883eeb5f 2017-05-02T12:35:59 worktree: switch over worktree pruning to an opts structure The current signature of `git_worktree_prune` accepts a flags field to alter its behavior. This is not as flexible as we'd like it to be when we want to enable passing additional options in the future. As the function has not been part of any release yet, we are still free to alter its current signature. This commit does so by using our usual pattern of an options structure, which is easily extendable without breaking the API.
Patrick Steinhardt 8264a30f 2017-05-02T10:11:28 worktree: support creating locked worktrees When creating a new worktree, we do have a potential race with us creating the worktree and another process trying to delete the same worktree as it is being created. As such, the upstream git project has introduced a flag `git worktree add --locked`, which will cause the newly created worktree to be locked immediately after its creation. This mitigates the race condition. We want to be able to mirror the same behavior. As such, a new flag `locked` is added to the options structure of `git_worktree_add` which allows the user to enable this behavior.
Patrick Steinhardt a7aa73a5 2017-05-02T10:02:36 worktree: introduce git_worktree_add options The `git_worktree_add` function currently accepts only a path and name for the new work tree. As we may want to expand these parameters in future versions without adding additional parameters to the function for every option, this commit introduces our typical pattern of an options struct. Right now, this structure is still empty, which will change with the next commit.
Edward Thomson 7df580fa 2017-04-28T11:58:49 Merge pull request #4191 from pks-t/pks/wt-ref-renames Branch renames with worktrees
Edward Thomson 6cf25a39 2017-04-26T09:09:53 Merge pull request #4219 from pks-t/pks/socket-stream-addrinfo-loop socket_stream: continue to next addrinfo on socket creation failure
Edward Thomson cecd41fb 2017-04-26T09:08:51 Merge pull request #4217 from pks-t/pks/readonly-cfg-backend Honor read-only flag when writing to config backends
Patrick Steinhardt 954e06a8 2017-04-26T12:09:57 socket_stream: continue to next addrinfo on socket creation failure When connecting to a remote via socket stream, we first use getaddrinfo to obtain the possible connection methods followed by creating and connecting the socket. But when creating the socket, we error out as soon as we get an invalid socket instead of trying out other address hints returned by addrinfo. Fix this by continuing on invalid socket instead of returning an error. This fixes connection establishment with musl libc.
Patrick Steinhardt 2a7086fa 2017-04-25T13:23:04 tests: config: verify functionality with read-only backends
Patrick Steinhardt 95f29fb3 2017-04-25T12:40:13 config: skip r/o backends when writing Configuration backends have a readonly-flag which is currently used to distinguish configuration snapshots. But somewhat unexpectedly, we do not use the flag to prevent writing to a readonly backend but happily proceed to do so. This commit modifies logic to also honor the readonly flag for configuration setters. We will now traverse through all backends and pick the first one which is not marked as read-only whenever we want to write new configuration.
Edward Thomson 7f75eeaf 2017-04-25T07:10:33 Merge pull request #4215 from pks-t/pks/diff-stack-free diff_parse: free object instead of its pointer
Patrick Steinhardt 64244131 2017-04-25T12:59:48 config_file: add missing include for `git_config_backend` The config_file.h header provides some inline declarations accessing the `git_config_backend`, but misses its declaration. Add the missing include for "git2/sys/config.h" to add it.
Patrick Steinhardt 1cb30b1b 2017-04-25T09:48:59 diff_parse: free object instead of its pointer In e7330016a (diff_parse: check return value of `git_diff_init_options`, 2017-03-20), we've introduced an error check whether we're able to correctly initialize the diff options. This simple commit actually introduced a segfault in that we now try to free the pointer to the allocated diff in an error case, instead of the allocated diff itself. This commit fixes the issue.
Patrick Steinhardt 0d2f6824 2017-04-21T15:39:03 Merge pull request #4210 from pks-t/pks/misc-fixes Misc fixes
Patrick Steinhardt 13c275ab 2017-04-21T07:49:08 tests: threads::diff: fix warning for unused variable The threads::diff test suite has a static variable `_retries`, which is used on Windows platforms only. As it is unused on other systems, the compiler throws a warning there. Fix the warning by wrapping the declaration in an ifdef.
Patrick Steinhardt f4d1592c 2017-04-21T07:09:59 global: fix typo in `git_libgit2_init` description
Carlos Martín Nieto 8d89e409 2017-04-17T17:19:03 Merge pull request #4192 from libgit2/ethomson/win32_posix Refactor some of the win32 POSIX emulation
Edward Thomson 86536c7e 2017-04-17T15:40:03 win32: `remediation` not `cleanup` The `remediation` function is run in the retry loop in order to attempt to fix any problems that the prior run encountered. There is nothing "cleaned up". Clarify the name.
Edward Thomson f9d3b0d0 2017-04-12T09:21:26 Merge pull request #4201 from pks-t/pks/fileops-fd-leak fileops: fix leaking fd in `mmap_ro_file`
Patrick Steinhardt 38b6e700 2017-04-12T08:09:08 fileops: fix leaking fd in `mmap_ro_file` When the `git_futils_mmap_ro_file` function encounters an error after the file has been opened, it will do a simple returns. Instead, we should close the opened file descriptor to avoid a leak. This commit fixes the issue.
Edward Thomson d476d024 2017-04-11T19:18:05 Merge pull request #4196 from pks-t/pks/filter-segfault filter: only close filter if it's been initialized correctly
Edward Thomson a5781e2a 2017-04-11T19:17:11 Merge pull request #4195 from pks-t/pks/openssl-1.1 Fix building against OpenSSL v1.1
Edward Thomson 1262963a 2017-04-11T19:10:28 Merge pull request #4198 from pks-t/pks/git-compat README: document our relation to changes in upstream
Patrick Steinhardt 19a04f67 2017-04-10T12:01:28 README: document our relation to changes in upstream libgit2 is a mere consumer of changes which are trickling down from the upstream git.git project. This commit documents the ramifications caused by this relation.
Patrick Steinhardt 88520151 2017-04-07T13:02:50 openssl_stream: use new initialization function on OpenSSL version >=1.1 Previous to OpenSSL version 1.1, the user had to initialize at least the error strings as well as the SSL algorithms by himself. OpenSSL version 1.1 instead provides a new function `OPENSSL_init_ssl`, which handles initialization of all subsystems. As the new API call will by default load error strings and initialize the SSL algorithms, we can safely replace these calls when compiling against version 1.1 or later. This fixes a compiler error when compiling against OpenSSL version 1.1 which has been built without stubs for deprecated syntax.
Patrick Steinhardt 29081c2f 2017-04-07T12:54:33 openssl_stream: remove locking initialization on OpenSSL version >=1.1 Up to version 1.0, OpenSSL required us to provide a callback which implements a locking mechanism. Due to problems in the API design though this mechanism was inherently broken, especially regarding that the locking callback cannot report errors in an obvious way. Due to this shortcoming, the locking initialization has been completely removed in OpenSSL version 1.1. As the library has also been refactored to not make any use of these callback functions, we can safely remove all initialization of the locking subsystem if compiling against OpenSSL version 1.1 or higher. This fixes a compilation error when compiling against OpenSSL version 1.1 which has been built without stubs for deprecated syntax.
Patrick Steinhardt cf07db2f 2017-04-07T16:05:10 filter: only close filter if it's been initialized correctly In the function `git_filter_list_stream_data`, we initialize, write and subesquently close the stream which should receive content processed by the filter. While we skip writing to the stream if its initialization failed, we still try to close it unconditionally -- even if the initialization failed, where the stream might not be set at all, leading us to segfault. Semantics in this code is not really clear. The function handling the same logic for files instead of data seems to do the right thing here in only closing the stream when initialization succeeded. When stepping back a bit, this is only reasonable: if a stream cannot be initialized, the caller would not expect it to be closed again. So actually, both callers of `stream_list_init` fail to do so. The data streaming function will always close the stream and the file streaming function will not close the stream if writing to it has failed. The fix is thus two-fold: - callers of `stream_list_init` now close the stream iff it has been initialized - `stream_list_init` now closes the lastly initialized stream if the current stream in the chain failed to initialize Add a test which segfaulted previous to these changes.
Edward Thomson e572b631 2017-04-07T09:03:56 Merge pull request #4183 from pks-t/pks/coverity Coverity
Edward Thomson 44998cdb 2017-04-07T09:02:54 Merge pull request #4193 from pks-t/pks/libdir pkgconfig: fix handling of prefixes containing whitespaces
Patrick Steinhardt 22436f29 2017-04-05T14:39:05 pkgconfig: fix handling of prefixes containing whitespaces Our libgit2.pc.in file is quoting the `libdir` variable in our declared "Libs:" line. The intention is to handle whitespaces here, but pkgconfig already does so by automatically escaping whitespace with backslashes. The correct thing to do is to instead quote the prefix, as this is the one which is being substituted by CMake upon installation. As both libdir and includedir will be expanded to "${prefix}/lib" and "${prefix}/include", respectively, pkgconfig will also correctly escape whitespaces. Note that this will actually break when a user manually wants to override libdir and includedir with a path containing whitespace. But actually, this cannot be helped, as always quoting these variables will actuall break the common case of being prefixed with "${prefix}". So we just bail out here and declare this as unsupported out of the box.
Patrick Steinhardt 74511aa2 2017-04-04T18:44:29 repository: add function to iterate over all HEADs While we already provide functions to get the current repository's HEAD, it is quite involved to iterate over HEADs of both the repository and all linked work trees. This commit implements a function `git_repository_foreach_head`, which accepts a callback which is then called for all HEAD files.
Patrick Steinhardt 3e84aa50 2017-04-05T13:47:09 repository: get worktree HEAD via `git_reference__read_head` The functions `git_repository_head_for_worktree` and `git_repository_detached_head_for_worktree` both implement their own logic to read the HEAD reference file. Use the new function `git_reference__read_head` instead to unify the code paths.
Patrick Steinhardt 2a485dab 2017-04-04T18:55:57 refs: update worktree HEADs when renaming branches Whenever we rename a branch, we update the repository's symbolic HEAD reference if it currently points to the branch that is to be renamed. But with the introduction of worktrees, we also have to iterate over all HEADs of linked worktrees to adjust them. Do so.
Patrick Steinhardt 38fc5ab0 2017-04-04T18:44:43 branch: use `foreach_head` to see if a branch is checked out Previously, we have extracted the logic to find and iterate over all HEADs of a repository. Use this function in `git_branch_is_checked_out`.
Patrick Steinhardt 987f5659 2017-04-04T17:12:22 repository: extract function to get path to a file in a work tree The function `read_worktree_head` has the logic embedded to construct the path to `HEAD` in the work tree's git directory, which is quite useful for other callers. Extract the logic into its own function to make it reusable by others.
Patrick Steinhardt 8242cc1a 2017-04-04T18:18:45 repository: set error message if trying to set HEAD to a checked out one If trying to set the HEAD of a repository to another reference, we have to check whether this reference is already checked out in another linked work tree. If it is, we will refuse setting the HEAD and return an error, but do not set a meaningful error message. Add one.
Patrick Steinhardt 5b65ac25 2017-04-05T10:43:18 refs: implement function to read references from file Currently, we only provide functions to read references directly from a repository's reference store via e.g. `git_reference_lookup`. But in some cases, we may want to read files not connected to the current repository, e.g. when looking up HEAD of connected work trees. This commit implements `git_reference__read_head`, which will read out and allocate a reference at an arbitrary path.
Patrick Steinhardt 60297256 2017-04-04T16:12:27 tests: worktree::refs: convert spaces to tabs
Edward Thomson 48f09c6c 2017-04-05T11:59:03 win32: only set `git_win32__retries` where it exists
Edward Thomson 89d403cc 2017-04-05T09:50:12 win32: enable `p_utimes` for readonly files Instead of failing to set the timestamp of a read-only file (like any object file), set it writable temporarily to update the timestamp.
Patrick Steinhardt 9daba9f4 2017-03-28T10:12:23 fileops: do not overwrite correct error message on mmap When executing `git_futils_mmap_ro_file`, we first try to guess whether the file is mmapable at all. Part of this check is whether the file is too large to be mmaped, which can be true on systems with 32 bit `size_t` types. The check is performed by first getting the file size wtih `git_futils_filesize` and then checking whether the returned size can be represented as `size_t`, returning an error if so. While this test also catches the case where the function returned an error (as `-1` is not representable by `size_t`), we will set the misleading error message "file too large to mmap". But in fact, a negative return value from `git_futils_filesize` will be caused by the inability to fstat the file. Fix the error message by handling negative return values separately and not overwriting the error message in that case.
Patrick Steinhardt 756138e4 2017-03-28T09:15:53 blame_git: check return value of `git__calloc` We do not check the return value of `git__calloc`, which may return `NULL` in out-of-memory situations. Fix the error by using `GITERR_CHECK_ALLOC`.
Patrick Steinhardt a76d7502 2017-03-28T09:12:34 path: short-circuit `git_path_apply_relative` on error Short-circuit the call to `git_path_resolve_relative` in case `git_buf_joinpath` returns an error. While this does not fix any immediate errors, the resulting code is easier to read and handles potential new error conditions raised by `git_buf_joinpath`.
Patrick Steinhardt cffd616a 2017-03-28T09:08:41 path: handle error returned by `git_buf_joinpath` In the `_check_dir_contents` function, we first allocate memory for joining the directory and subdirectory together and afterwards use `git_buf_joinpath`. While this function in fact should not fail as memory is already allocated, err on the safe side and check for returned errors.
Patrick Steinhardt 4467aeac 2017-03-28T09:00:48 config_file: handle errors other than OOM while parsing section headers The current code in `parse_section_header_ext` is only prepared to properly handle out-of-memory conditions for the `git_buf` structure. While very unlikely and probably caused by a programming error, it is also possible to run into error conditions other than out-of-memory previous to reaching the actual parsing loop. In these cases, we will run into undefined behavior as the `rpos` variable is only initialized after these triggerable errors, but we use it in the cleanup-routine. Fix the issue by unifying the function's cleanup code with an `end_error` section, which will not use the `rpos` variable.
Edward Thomson 7ece9065 2017-04-03T23:07:16 win32: make posix emulation retries configurable POSIX emulation retries should be configurable so that tests can disable them. In particular, maniacally threading tests may end up trying to open locked files and need retries, which will slow continuous integration tests significantly.
Edward Thomson 1069ad3c 2017-04-03T23:05:53 win32: do not inherit file descriptors
Sven Strickroth d5e6ca1e 2017-01-14T18:39:32 Allow to configure default file share mode for opening files This can prevent FILE_SHARED_VIOLATIONS when used in tools such as TortoiseGit TGitCache and FILE_SHARE_DELETE, because files can be opened w/o being locked any more. Signed-off-by: Sven Strickroth <email@cs-ware.de>
Edward Thomson dbacbf78 2017-04-03T13:31:39 Merge pull request #4188 from rcjsuen/patch-1 Correct non-existent file references in `odb.h`
Remy Suen a12796dd 2017-04-02T23:05:48 Correct typos that reference a non-existing file There are references to odb_backends.h when the file is actually named odb_backend.h and in the sys folder.
Sven Strickroth 92d5a637 2017-01-14T17:15:50 win32: deduplicate code: use p_open in p_creat Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth ef5cfcdb 2017-01-14T18:20:59 win32: use CreateFile in p_open Signed-off-by: Sven Strickroth <email@cs-ware.de>
Edward Thomson fbc6910f 2017-04-01T13:25:14 win32: teach p_open about do_with_retries
Edward Thomson a0f67e4a 2017-04-01T13:19:51 win32: teach p_unlink about do_with_retries
Edward Thomson 8a4e1513 2017-04-01T00:23:03 win32: make p_rename use do_with_retries
Edward Thomson cc8d9a29 2017-04-01T10:44:17 win32: introduce `do_with_retries` macro Provide a macro that will allow us to run a function with posix-like return values multiple times in a retry loop, with an optional cleanup function called between invocations.
Edward Thomson dcaa9099 2017-03-29T23:54:47 win32: map windows error codes to errno Introduce mapping from windows error codes to errno values. This allows us to replace our calls to the Windows posix emulation functions with calls to the Win32 APIs for more fine-grained control over the emulation. These mappings match the Windows CRT's mappings for its posix emulation as they were described to me.
Edward Thomson fcb322f5 2017-03-31T23:39:33 Merge remote-tracking branch 'origin/pr/3790' into win32_posix
Edward Thomson caf7a7a6 2017-03-28T15:16:34 Merge pull request #4182 from pks-t/pks/treebuilder git_treebuilder_write_with_buffer refactorings
Patrick Steinhardt 06abbb7f 2017-03-27T13:14:48 treebuilder: exit early if running OOM in `write_with_buffer` While writing the tree inside of a buffer, we check whether the buffer runs out of memory after each tree entry. While we set the error code as soon as we detect the OOM situation, we happily proceed iterating over the entries. This is not useful at all, as we will try to write into the buffer repeatedly, which cannot work. Fix this by exiting as soon as we are OOM.
Patrick Steinhardt 8d1e71f5 2017-03-27T13:14:05 treebuilder: remove shadowing variable in `write_with_buffer` The `git_tree_entry *entry` variable is defined twice inside of this function. While this is not a problem currently, remove the shadowing variable to avoid future confusion.
Patrick Steinhardt 4f9327fa 2017-03-27T13:11:38 treebuilder: fix memory leaks in `write_with_buffer` While we detect errors in `git_treebuilder_write_with_buffer`, we just exit directly instead of freeing allocated memory. Fix this by remembering error codes and skipping forward to the function's cleanup code.
Patrick Steinhardt a25df009 2017-03-28T08:38:24 Merge pull request #4180 from pks-t/pks/pass-blame-fix Fix memory leaks
Patrick Steinhardt fbdf2a79 2017-03-24T09:26:31 worktree: unconditionally free the worktree's name
Patrick Steinhardt 4004d68f 2017-03-24T08:36:12 blame_git: remove spuriuous goto The recent addition of an error code to `pass_whole_blame` in ff8d2eb15 (blame_git: check return value of object lookup, 2017-03-20) introduced a spurious goto. Remove it.
Patrick Steinhardt 1d39a603 2017-03-24T08:26:33 Merge pull request #4175 from libgit2/ethomson/dont_trunc_and_excl git_futils: don't O_EXCL and O_TRUNC
Carlos Martín Nieto fa86a095 2017-03-23T20:45:28 Merge pull request #4178 from libgit2/ethomson/enfasten_sha1 sha1dc: perf improvements from upstream
Edward Thomson d6729635 2017-03-23T17:25:11 sha1dc: `SHA1DCUpdate` now takes a `size_t`
Edward Thomson 69873685 2017-03-23T09:49:09 Merge branch 'pr/3957'
Edward Thomson b53d834f 2017-03-23T09:46:22 merge: indentation fixup
Edward Thomson 6ad091dc 2017-03-23T09:33:09 Merge pull request #4176 from libgit2/ethomson/3872 inet_pton: don't assume addr families don't exist
Edward Thomson c9efa995 2017-03-23T09:16:24 sha1dc: perf improvements from upstream Update SHA-1 collision detection code (cr-marcstevens/sha1collisiondetection) to master to include performance improvements.
Edward Thomson f623cf89 2017-03-22T20:32:55 Merge pull request #4163 from pks-t/pks/submodules-with-worktrees Worktree fixes
Edward Thomson 6fd6c678 2017-03-22T20:29:22 Merge pull request #4030 from libgit2/ethomson/fsync fsync all the things
Edward Thomson 7e53e8ce 2017-03-22T20:26:52 Merge pull request #4167 from pks-t/pks/ci-fixes Coverity fixes
Edward Thomson 69d0b460 2017-03-22T20:22:45 Merge pull request #4172 from rcjsuen/patch-1 Fix the documentation for git_cred_acquire_cb
Edward Thomson 983979fa 2017-03-22T19:52:38 inet_pton: don't assume addr families don't exist Address family 5 might exist on some crazy system like Haiku. Use `INT_MAX-1` as an unsupported address family.
Edward Thomson 4a26915d 2017-03-22T19:48:50 git_futils: don't O_EXCL and O_TRUNC `O_EXCL` and `O_TRUNC` are mutually exclusive flags to open(2); you can't truncate a file if you're asserting that it can't exist in the first place. Drop `O_TRUNC`.
Remy Suen 84b4e573 2017-03-22T06:08:24 Use proper documentation tags git_cred_acquire_cb isn't using the standard @param and @return tags. This is causing the generated documentation to not be formatted properly.
Patrick Steinhardt e7330016 2017-03-20T12:38:28 diff_parse: check return value of `git_diff_init_options`
Patrick Steinhardt 723bdf48 2017-03-20T09:35:23 patch_parse: check if advancing over header newline succeeds While parsing patch header lines, we iterate over each line and check if the line has trailing garbage. What we do not check though is that the line is actually a line ending with a trailing newline. Fix this by checking the return code of `parse_advance_expected_str`.
Patrick Steinhardt 8d452448 2017-03-20T09:34:59 odb_pack: initialize `git_rawobj` structure The `pack_entry_find_prefix` function receives a `git_rawobj` structure as argument. While the function first initializes the structure to a sensible state, Coverity is unable to correctly detect this, resulting in a warning. Fix this warning by initializing the object to all-zeroes before passing it to the function.
Patrick Steinhardt 2cf48e13 2017-03-20T09:34:41 config_file: check if section header buffer runs out of memory While parsing section headers, we use a buffer to store the actual section name. We do not check though if the buffer runs out of memory at any stage. Do so.
Patrick Steinhardt ff8d2eb1 2017-03-20T09:34:25 blame_git: check return value of object lookup The function `pass_whole_blame` performs an object lookup but does not check if the lookup actually succeeds. Convert the function to return an error code and check for it in the calling function.
Edward Thomson 33ea4aae 2017-03-21T13:41:24 Merge pull request #4139 from richardipsum/readme-running-tests README: Mention how to run tests
Patrick Steinhardt c6217973 2017-03-20T14:32:57 Merge pull request #4171 from rcjsuen/patch-1 Fix typo in remote.h API
Remy Suen 12b7394c 2017-03-20T22:30:37 Fix typo in remote.h API
Patrick Steinhardt dd0b1e8c 2017-03-20T09:13:25 openssl_stream: fix releasing OpenSSL locks The OpenSSL library may require multiple locks to work correctly, where it is the caller's responsibility to initialize and release the locks. While we correctly initialized up to `n` locks, as determined by `CRYPTO_num_locks`, we were repeatedly freeing the same mutex in our shutdown procedure. Fix the issue by freeing locks at the correct index.
Edward Thomson 1d50f955 2017-03-20T11:29:27 Merge pull request #4166 from pks-t/pks/map-free-fix Remove `map_free` macros
Patrick Steinhardt 31059923 2017-03-20T12:16:18 Merge pull request #4169 from csware/absolute-symlink
Patrick Steinhardt c10ce7c2 2017-03-20T12:11:05 tests: filebuf: test writing to symlink with absolute paths
Sven Strickroth2 86a8cd9f 2017-03-20T11:21:00 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`.
Patrick Steinhardt e30a6ee3 2017-03-20T11:06:23 Merge pull request #4160 from pks-t/pks/diff-fixes Diff fixes
Patrick Steinhardt 44b3b9fe 2017-03-20T11:05:03 Merge pull request #4162 from pks-t/pks/merge-source-fixes merge_driver: fix const-correctness for source getters
Patrick Steinhardt 94af9155 2017-03-20T09:01:18 map: remove `*map_free` macros The `map_free` functions were not implemented as functions but instead as macros which also set the map to NULL. While this is most certainly sensible in most cases, we should prefer the more obvious behavior, namingly leaving the map pointer intact. Furthermore, this macro has been refactored incorrectly during the map-refactorings: the two statements are not actually grouped together by a `do { ... } while (0)` block, as it is required for macros to match the behavior of functions more closely. This has led to at least one subtle nesting error in `pack-objects.c`. The following code block ``` if (pb->object_ix) git_oidmap_free(pb->object_ix); ``` would be expanded to ``` if (pb->object_ix) git_oidmap__free(pb->object_ix); pb->object_ix = NULL; ``` which is not what one woudl expect. While it is not a bug here as it would simply become a no-op, the wrong implementation could lead to bugs in other occasions. Fix this by simply removing the macro altogether and replacing it with real function calls. This leaves the burden of setting the pointer to NULL afterwards to the caller, but this is actually expected and behaves like other `free` functions.
Patrick Steinhardt 77c8ee74 2017-03-20T08:59:30 checkout: fix double-free of checkout_data's mkdir_map We currently call `git_strmap_free` on `checkout_data.mkdir_map` in the `checkout_data_clear` function. The only thing protecting us from a double-free is that the `git_strmap_free` function is in fact not a function, but a macro that also sets the map to NULL. Remove the second call to `git_strmap_free` and explicitly set the map member to NULL.
Patrick Steinhardt b0c9bc92 2017-03-15T13:38:54 submodule: resolve URLs relative to main worktree It is possible to specify submodule URLs relative to the repository location. E.g. having a submodule with URL "../submodule" will look for the submodule at "repo/../submodule". With the introduction of worktrees, though, we cannot simply resolve the URL relative to the repository location itself. If the repository for which a URL is to be resolved is a working tree, we have to resolve the URL relative to the parent's repository path. Otherwise, the URL would change depending on where the working tree is located. Fix this by special-casing when we have a working tree while getting the URL base.
Patrick Steinhardt 097f0105 2017-03-17T08:54:53 refdb: create references in commondir References for a repository are usually created inside of its gitdir. When using worktrees, though, these references are not to be created inside the worktree gitdir, but instead inside the gitdir of its parent repository, which is the commondir. Like this, branches will still be available after the worktree itself has been deleted. The filesystem refdb currently still creates new references inside of the gitdir. Fix this and have it create references in commondir.
Patrick Steinhardt 8f154be3 2017-03-17T08:13:59 worktree: write resolved paths into link files The three link files "worktree/.git", ".git/worktrees/<name>/commondir" and ".git/worktrees/<name>/gitdir" should always contain absolute and resolved paths. Adjust the logic creating new worktrees to first use `git_path_prettify_dir` before writing out these files, so that paths are resolved first.
Patrick Steinhardt 7cf7a407 2017-03-17T08:06:49 worktree: rename variable in `git_worktree_add`
Patrick Steinhardt 9dcc79bc 2017-03-15T16:35:43 worktree: use fully qualified reference name for created HEAD When creating a new worktree, we have to set up the initial data structures. Next to others, this also includes the HEAD pseudo-ref. We currently set it to the worktree respectively branch name, which is actually not fully qualified. Use the fully qualified branch name instead.