summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * cmake: fix up source and binary directory pathsPatrick Steinhardt2017-08-161-9/+12
| | | | | | | | | | | | | | | | | | | | | | There are quite some uses of the variables "${CMAKE_CURRENT_SOURCE_DIR}" and "${CMAKE_CURRENT_BINARY_DIR}" where they are not appropriate. Convert these sites to instead use the variables "${CMAKE_SOURCE_DIR}" and "${CMAKE_BINARY_DIR}", which instead point to the project's root directory. This will ease splitting up the library build instructions into its own subdirectory.
| * cmake: move zlib build instructions into subdirectoryPatrick Steinhardt2017-08-162-3/+7
| | | | | | | | | | Extract code required to build the zlib library into its own CMakeLists.txt, which is included as required.
| * cmake: move http-parser build instructions into subdirectoryPatrick Steinhardt2017-08-162-2/+6
| | | | | | | | | | Extract code required to build the http-parser library into its own CMakeLists.txt, which is included as required.
| * cmake: move regex build instructions into subdirectoryPatrick Steinhardt2017-08-162-3/+6
| | | | | | | | | | Extract code required to build the regex library into its own CMakeLists.txt, which is included as required.
| * cmake: move winhttp build instructions into subdirectoryPatrick Steinhardt2017-08-162-28/+33
| | | | | | | | | | Extract code required to build the winhttp library into its own CMakeLists.txt, which is included as required.
| * cmake: define WIN_RC with other platform sourcesPatrick Steinhardt2017-08-161-2/+5
| | | | | | | | | | This makes splitting up the library build instructions later on more obvious and easier to achieve.
| * cmake: find dependencies after setting build flagsPatrick Steinhardt2017-08-161-157/+158
| | | | | | | | | | This makes splitting up the library build instructions later on more obvious and easier to achieve.
| * cmake: move definition of Win32 flags togetherPatrick Steinhardt2017-08-161-4/+3
| | | | | | | | | | This makes splitting up the library build instructions later on more obvious and easier to achieve.
| * cmake: inline TARGET_OS_LIBRARIES functionPatrick Steinhardt2017-08-161-27/+21
| | | | | | | | | | | | | | | | | | Previous to keeping track of libraries and linking directories via variables, we had two call sites of the `TARGET_OS_LIBRARIES` function to avoid duplicating knowledge on required operating system library dependencies. But as the libgit2_clar target now re-uses defined variables to link against these libraries, we can simply inline the function.
| * cmake: keep track of libraries and includes via listsPatrick Steinhardt2017-08-163-40/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Later on, we will move detection of required libraries, library directories as well as include directories into a separate CMakeLists.txt file inside of the source directory. Obviously, we want to avoid duplication here regarding these parameters. To prepare for the split, put the parameters into three variables LIBGIT2_LIBS, LIBGIT2_LIBDIRS and LIBGIT2_INCLUDES, tracking the required libraries, linking directory as well as include directories. These variables can later be exported into the parent scope from inside of the source build instructions, making them readily available for the other subdirectories.
| * cmake: use absolute path to depsPatrick Steinhardt2017-08-161-10/+10
| | | | | | | | | | | | | | | | When refering to files and directories inside of the top-level "deps/" directory, we're being inconsistent in using relative or absolute paths. To enable splitting out parts of the top-level CMakeLists.txt into an own file in the "src/" directory, consistently switch over to use absolute paths to avoid errors when converting.
| * cmake: move regcomp and futimens checks to "features.h"Patrick Steinhardt2017-08-163-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | In our CMakeLists.txt, we have to check multiple functions in order to determine if we have to use our own or whether we can use the platform-provided one. For two of these functions, namely `regcomp_l()` and `futimens`, the defined macro is actually used inside of the header file "src/unix/posix.h". As such, these macros are not only required by the library, but also by our test suite, which is makes use of internal headers. To prepare for the CMakeLists.txt split, move these two defines inside of the "features.h" header.
| * cmake: move defines into "features.h" headerPatrick Steinhardt2017-08-165-30/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a future commit, we will split out the build instructions for our library directory and move them into a subdirectory. One of the benefits is fixing scoping issues, where e.g. defines do not leak to build targets where they do not belong to. But unfortunately, this does also pose the problem of how to propagate some defines which are required by both the library and the test suite. One way would be to create another variable keeping track of all added defines and declare it inside of the parent scope. While this is the most obvious and simplest way of going ahead, it is kind of unfortunate. The main reason to not use this is that these defines become implicit dependencies between the build targets. By simply observing a define inside of the CMakeLists.txt file, one cannot reason whether this define is only required by the current target or whether it is required by different targets, as well. Another approach would be to use an internal header file keeping track of all defines shared between targets. While configuring the library, we will set various variables and let CMake configure the file, adding or removing defines based on what has been configured. Like this, one can easily keep track of the current environment by simply inspecting the header file. Furthermore, these dependencies are becoming clear inside the CMakeLists.txt, as instead of simply adding a define, we now call e.g. `SET(GIT_THREADSAFE 1)`. Having this header file though requires us to make sure it is always included before any "#ifdef"-preprocessor checks are executed. As we have already refactored code to always include the "common.h" header file before any statement inside of a file, this becomes easy: just make sure "common.h" includes the new "features.h" header file first.
| * cmake: create separate CMakeLists.txt for testsPatrick Steinhardt2017-08-162-64/+67
| | | | | | | | | | | | | | | | | | | | | | | | Our CMakeLists.txt is very unwieldy in its current size, spanning more than 700 lines of code. Furthermore, it has several issues regarding scoping, where for example some defines, includes, etc. from our test suite are also applied to our normal library code. To fix this, we can separate out build instructions for our tests and move them into their own CMakeLists.txt in the "tests" directory. This reduced complexity of the root CMakeLists.txt file and fixes the issues regarding leaking build context from tests into the library.
| * cmake: create own precompiled headers for testsPatrick Steinhardt2017-08-163-0/+10
| | | | | | | | | | | | | | | | | | As soon as we split up our CMakeBuild.txt build instructions, we will be unable to simply link against the git2 library's precompiled header from other targets. To avoid this future breakage, create a new precompiled header for our test suite. Next to being compatible with the split, this enables us to also include additional files like the clar headers, which may help speeding up compilation of the test suite.
| * cmake: create object library targetPatrick Steinhardt2017-08-161-8/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we're compiling our library code twice, once as part of the libgit2 library and once for the libgit2_clar executable. Since CMake 2.8.8, there exists a new library type OBJECT, which represents an intermediate target which can then subsequently be used when linking several targets against the same set of objects. Use an OBJECT library to create an internal library for linking. This new target is only used on CMake v2.8.8 or newer. As CMake 3.0 changed the way how generator expressions are evaluated when accessing properties, we need to enable CMake policy 0051 to keep `IDE_SPLIT_SOURCES` functioning.
| * cmake: remove unused variable "CLAR_RESOURCES"Patrick Steinhardt2017-08-161-2/+0
| | | | | | | | | | | | | | | | | | | | Once upon a time, the `CLAR_RESOURCES` variable was intended to set the `CLAR_RESOURCES` define. But actually, the define uses a wrong variable name by accident, hinting that its value cannot actually be used at all, as it is empty. Searching through the code base confirms the guess that the define is not used at all. Remove both the variable and definition.
| * cmake: try to detect threads libraryPatrick Steinhardt2017-08-161-0/+1
|/ | | | | | | | | | | | While we already make use of the variable `${CMAKE_THREAD_LIBS_INIT}`, it is actually undefined due to us never including the "FindThreads" module in the CMakeLists.txt. It is rather curious as to why this has never triggered any error up to now, but it does in fact result in linking errors on some Unix platforms as soon as we split up our build instructions into multiple files. Fix the issue now to avoid future breakage by including the "FindThreads" module.
* Merge pull request #4288 from pks-t/pks/include-fixupsEdward Thomson2017-08-15238-254/+614
|\ | | | | Include fixups
| * Make sure to always include "common.h" firstPatrick Steinhardt2017-07-03235-143/+437
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
| * Add missing license headersPatrick Steinhardt2017-07-037-0/+49
| | | | | | | | | | Some implementation files were missing the license headers. This commit adds them.
| * Fix missing include for header filesPatrick Steinhardt2017-07-039-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | Some of our header files are not included at all by any of their implementing counter-parts. Including them inside of these files leads to some compile errors mostly due to unknown types because of missing includes. But there's also one case where a declared function does not match the implementation's prototype. Fix all these errors by fixing up the prototype and adding missing includes. This is preparatory work for fixing up missing includes in the implementation files.
| * zlib: include "git2/types.h" instead of "common.h"Patrick Steinhardt2017-07-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The zlib dependency includes "common.h" inside of the "zconf.h" header to make available some type declarations like e.g. git_off_t. Including the "common.h" header does pull in quite a lot of other headers though, which are not required at all. Instead, we can just include our public "git2/types.h" header, which is much more limited in its scope but still provides everything required for "zconf.h". This fix eases the transition later on to use a separate "features.h" header instead of defines. As we have to generate the "features.h" header, we put it in the build directory and add an include directory. As we are splitting out building of dependencies into subdirectories, this would mean that the zlib dependency needs to be aware of the parent project's build directory, which is unfortunate. By including "git2/types.h", we avoid this problem.
| * win32: fix circular include deps with w32_crtdbgPatrick Steinhardt2017-06-303-107/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current order of declarations and includes between "common.h" and "w32_crtdbg_stacktrace.h" is rather complicated. Both header files make use of things defined in the other one and are thus circularly dependent on each other. This makes it currently impossible to compile the "w32_crtdbg_stacktrace.c" file when including "common.h" inside of "w32_crtdbg_stacktrace.h". We can disentangle the mess by moving declaration of the inline crtdbg functions into the "w32_crtdbg_stacktrace.h" file and adding additional includes inside of it, such that all required functions are available to it. This allows us to break the dependency cycle.
* | Merge pull request #4330 from alpha0010/patch-1Edward Thomson2017-08-141-6/+6
|\ \ | | | | | | Docs: Fix inline comments for git_diff_hunk
| * | Docs: Fix inline comments for git_diff_hunkAlpha2017-08-111-6/+6
| | |
* | | Merge pull request #4328 from libgit2/peff/hashcmp-is-memcmpEdward Thomson2017-08-141-8/+1
|\ \ \ | | | | | | | | oid: use memcmp in git_oid__hashcmp
| * | | oid: use memcmp in git_oid__hashcmppeff/hashcmp-is-memcmpJeff King2017-08-091-8/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The open-coded version was inherited from git.git. But it turns out it was based on an older version of glibc, whose memcmp was not very optimized. Modern glibc does much better, and some compilers (like gcc 7) can even inline the memcmp into a series of multi-byte xors. Upstream is switching to using memcmp in git/git@0b006014c87f400bd9a86267ed30fd3e7b383884.
* | | Merge pull request #4327 from libgit2/peff/drop-sha1-entry-posEdward Thomson2017-08-143-224/+0
|\ \ \ | | | | | | | | sha1_lookup: drop sha1_entry_pos function
| * | | sha1_lookup: drop sha1_entry_pos functionpeff/drop-sha1-entry-posJeff King2017-08-093-224/+0
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was pulled over from git.git, and is an experiment in making binary-searching lists of sha1s faster. It was never compiled by default (nor was it used upstream by default without a special environment variable). Unfortunately, it is actually slower in practice, and upstream is planning to drop it in git/git@f1068efefe6dd3beaa89484db5e2db730b094e0b (which has some timing results). It's worth doing the same here for simplicity.
* | | Merge pull request #4326 from libgit2/peff/binary-search-do-whileEdward Thomson2017-08-141-2/+2
|\ \ \ | |/ / |/| | sha1_position: convert do-while to while
| * | sha1_position: convert do-while to whilepeff/binary-search-do-whileJeff King2017-08-091-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | If we enter the sha1_position() function with "lo == hi", we have no elements. But the do-while loop means that we'll enter the loop body once anyway, picking "mi" at that same value and comparing nonsense to our desired key. This is unlikely to match in practice, but we still shouldn't be looking at the memory in the first place. This bug is inherited from git.git; it was fixed there in e01580cfe01526ec2c4eb4899f776a82ade7e0e1.
* | Merge pull request #4304 from pks-t/pks/patch-buffersEdward Thomson2017-07-312-4/+4
|\ \ | | | | | | patch_generate: represent buffers as void pointers
| * | patch_generate: represent buffers as void pointersPatrick Steinhardt2017-07-102-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pointers to general data should usually be used as a void pointer such that it is possible to hand in variables of a different pointer type without the need to cast. This is the same when creating patches from buffers, where the buffers may contain arbitrary data. Instead of requiring the caller to care whether his buffer is e.g. `char *` or `unsigned char *`, we should instead just accept a `void *`. This is also consistent in how we tread other types like for example `git_blob`, which also just has a void pointer as its raw contents.
* | | Merge pull request #4323 from libgit2/ethomson/remove_sys_remote_hEdward Thomson2017-07-311-16/+0
|\ \ \ | | | | | | | | Remove unused 'sys/remote.h' header
| * | | Remove unused 'sys/remote.h' headerethomson/remove_sys_remote_hEdward Thomson2017-07-311-16/+0
| | | |
* | | | Merge branch '4233'Edward Thomson2017-07-315-13/+137
|\ \ \ \ | |/ / / |/| | |
| * | | changelog: update to reflect `detached` api nameEdward Thomson2017-07-311-1/+1
| | | |
| * | | remote: test creating and fetching detached remotesPatrick Steinhardt2017-05-051-0/+38
| | | |
| * | | tests: online::remotes: add defines for URL and refspecPatrick Steinhardt2017-05-051-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | The repository URL is duplicated several times and can be de-duplicated like this. Furthermore, exchange the static refspec variable with a define to reduce BSS size.
| * | | remote: add function to create detached remotesEric Myhre2017-05-054-7/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now it is only possible to create remotes from a repository. While this is probably the most common use-case, there are commands which make sense even without a repository, e.g. the equivalence of `git ls-remote`. Add a new function `git_remote_create_detached`, which simply accepts a URL.
| * | | remote: reject various actions for detached remotesPatrick Steinhardt2017-05-052-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There are only few actions which actually make sense for a detached remote, like e.g. `git_remote_ls`, `git_remote_prune`. For all the other actions, we have to report an error when the remote has no repository attached to it. This commit does so and implements some tests.
| * | | remote: improve error message if no URL is setPatrick Steinhardt2017-05-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current error message when connecting to a remote when no URL is set is missing information on whether it is missing a fetch or push URL. Furthermore, it results in undefined behavior when using a remote without name. Fix both issues.
* | | | Merge pull request #4320 from pks-t/pks/rebase-submodule-assertsEdward Thomson2017-07-281-7/+7
|\ \ \ \ | | | | | | | | | | tests: rebase::submodule: verify initialization method calls
| * | | | tests: rebase::submodule: verify initialization method callsPatrick Steinhardt2017-07-281-7/+7
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some return codes for functions which may fail are not being checked in `test_rebase_submodule__initialize`. This may lead us to not notice errors when initializing the environment and would possibly result in either memory corruption or segfaults as soon as any of the initialization steps fails. Fix this by wrapping these function calls into `cl_git_pass`.
* | | | Merge pull request #4275 from tiennou/fix-rebase-submodule-testEdward Thomson2017-07-273-7/+36
|\ \ \ \ | | | | | | | | | | tests: rewrite rebase-submodule .gitmodule file
| * | | | tests: fix the rebase-submodule testEtienne Samson2017-07-252-7/+36
| | | | |
| * | | | Remove invalid submoduleEtienne Samson2017-07-201-0/+0
| | | | | | | | | | | | | | | Fixes #4274
* | | | | Merge pull request #4314 from pks-t/pks/timsortEdward Thomson2017-07-261-1/+0
|\ \ \ \ \ | | | | | | | | | | | | tsort: remove idempotent conditional assignment
| * | | | | tsort: remove idempotent conditional assignmentPatrick Steinhardt2017-07-211-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The conditional `run < minrun` can never be true directly after assigning `run = minrun`. Remove it to avoid confusion.