Commit Graph

13110 Commits

Author SHA1 Message Date
Suhaib Mujahid
f1c1458cb1 feat: Check the version in package.json 2020-05-12 10:55:14 -04:00
Edward Thomson
896abfc85f Merge pull request #5513 from libgit2/pks/tests-fix-32-bit-formatter
tests: merge: fix printf formatter on 32 bit arches
2020-05-12 11:14:10 +01:00
Patrick Steinhardt
0cf9b6668c tests: merge: fix printf formatter on 32 bit arches
We currently use `PRIuMAX` to print an integer of type `size_t` in
merge::trees::rename::cache_recomputation. While this works just fine on
64 bit arches, it doesn't on 32 bit ones. As a result, our nightly
builds on x86 and arm32 fail.

Fix the issue by using `PRIuZ` instead.
2020-05-12 11:41:44 +02:00
Edward Thomson
51a2bc4337 Merge pull request #5511 from suhaibmujahid/patch-1
Update package.json
2020-05-12 08:22:31 +01:00
Edward Thomson
045efb7b78 Merge pull request #5509 from libgit2/ethomson/assert_macros
Introduce GIT_ASSERT macros
2020-05-11 21:20:52 +01:00
Edward Thomson
31ddf16333 Merge pull request #5512 from A-Ovchinnikov-mx/patch-1
README.md: Add instructions for building in MinGW environment
2020-05-11 21:06:42 +01:00
Edward Thomson
cbae1c219d assert: allow non-int returning functions to assert
Include GIT_ASSERT_WITH_RETVAL and GIT_ASSERT_ARG_WITH_RETVAL so that
functions that do not return int (or more precisely, where `-1` would
not be an error code) can assert.

This allows functions that return, eg, NULL on an error code to do that
by passing the return value (in this example, `NULL`) as a second
parameter to the GIT_ASSERT_WITH_RETVAL functions.
2020-05-11 20:13:54 +01:00
Edward Thomson
a95096ba5f assert: optionally fall-back to assert(3)
Fall back to the system assert(3) in debug builds, which may aide
in debugging.

"Safe" assertions can be enabled in debug builds by setting
GIT_ASSERT_HARD=0.  Similarly, hard assertions can be enabled in
release builds by setting GIT_ASSERT_HARD to nonzero.
2020-05-11 20:13:54 +01:00
Edward Thomson
abe2efe1ff Introduce GIT_ASSERT macros
Provide macros to replace usages of `assert`.  A true `assert` is
punishing as a library.  Instead we should do our best to not crash.

GIT_ASSERT_ARG(x) will now assert that the given argument complies to
some format and sets an error message and returns `-1` if it does not.

GIT_ASSERT(x) is for internal usage, and available as an internal
consistency check.  It will set an error message and return `-1` in the
event of failure.
2020-05-11 20:13:54 +01:00
A-Ovchinnikov-mx
4ad363386d Update README.md
Add instructions for building libgit2 in MinGW environment
2020-05-11 19:10:11 +02:00
Suhaib Mujahid
3453c3b139 Update package.json 2020-05-11 05:14:35 -04:00
Edward Thomson
b83bc6d473 Merge pull request #5510 from phkelley/stash-to-index-crash
Fix uninitialized stack memory and NULL ptr dereference in stash_to_index
2020-05-11 09:18:36 +01:00
Philip Kelley
56c95cf6fb Fix uninitialized stack memory and NULL ptr dereference in stash_to_index
Caught by static analysis.
2020-05-10 21:44:16 -07:00
Segev Finer
d62e44cb82 checkout: Fix removing untracked files by path in subdirectories
The checkout code didn't iterate into a subdir if it didn't match the
pathspec, but since the pathspec might match files in the subdir we
should recurse into it (In contrast to gitignore handling).

Fixes #5089
2020-05-11 00:15:06 +01:00
Edward Thomson
2a1d97e6e7 Merge pull request #5378 from libgit2/ethomson/checkout_pathspecs
Honor GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH for all checkout types
2020-05-11 00:09:18 +01:00
Edward Thomson
63de21283f checkout: filter pathspecs for _all_ checkout types
We were previously applying the pathspec filter for the baseline
iterator during checkout, as well as the target tree.  This was an
oversight; in fact, we should apply the pathspec filter to _all_
checkout targets, not just trees.

Add a helper function to set the iterator pathspecs from the given
checkout pathspecs, and call it everywhere.
2020-05-10 23:47:20 +01:00
Edward Thomson
8731e1f4a1 tests::checkout: only examine test10 and test11.txt
The checkout::index::can_disable_pathspec_match test attempts to set a
path filter of `test11.txt` and `test12.txt`, but then validates that
`test10.txt` and `test11.txt` were left unmodified.  Update the test's
path filter to match the expectation.
2020-05-10 23:47:20 +01:00
Felix Lapalme
24bd12c4f9 Create test case demonstrating checkout bug w/ pathspec match disabled 2020-05-10 23:47:20 +01:00
Edward Thomson
02d27f6173 Merge pull request #5482 from pks-t/pks/coding-style
docs: add documentation for our coding style
2020-05-10 23:42:43 +01:00
Edward Thomson
d08f72ebb0 Merge pull request #5500 from phkelley/enable-control-flow-guard
MSVC: Enable Control Flow Guard (CFG)
2020-05-10 23:38:48 +01:00
Edward Thomson
898caead46 Merge pull request #5431 from libgit2/ethomson/hexdump
git__hexdump: better mimic `hexdump -C`
2020-05-10 19:03:10 +01:00
Philip Kelley
63f9fbeea5 MSVC: Enable Control Flow Guard (CFG)
This feature requires Visual Studio 2015 (MSVC_VERSION = 1900) or later. As the
minimum required CMake version is currently less than 3.7, GREATER_EQUAL is not
available to us and we must invert the result of the LESS operator.
2020-04-25 15:44:42 -07:00
Patrick Steinhardt
66137ff6ea Merge pull request #5383 from ognarb/feature/blame-ignore-whitespace
Feature: Allow blame to ignore whitespace change
2020-04-19 12:08:24 +02:00
Carl Schwan
9830ab3d25 blame: add option to ignore whitespace changes 2020-04-14 15:50:53 +02:00
Edward Thomson
918a7d1955 Merge pull request #5487 from niacat/master
deps: ntlmclient: use htobe64 on NetBSD too
2020-04-14 12:26:36 +01:00
Patrick Steinhardt
ffb6a5766d docs: add documentation for our coding style
For years, we've repeatedly had confusion about what our actual coding
style is not only for newcomers, but also across the core contributors.
This can mostly be attributed to the fact that we do not have any coding
conventions written down. This is now a thing of the past with the
introduction of a new document that gives an initial overview of our
style and most important best practices for both our C codebase as well
as for CMake.

While the proposed coding style for our C codebase should be rather
uncontroversial, the coding style for CMake might be. This can be
attributed to multiple facts. First, the CMake code base doesn't really
have any uniform coding style and is quite outdated in a lot of places.
Second, the proposed coding style actually breaks with our existing one:
we currently use all-uppercase function names and variables, but the
documented coding style says we use all-lowercase function names but
all-uppercase variables.

It's common practice in CMake to write variables in all upper-case, and
in fact all variables made available by CMake are exactly that. As
variables are case-sensitive in CMake, we cannot and shouldn't break
with this. In contrast, function calls are case insensitive, and modern
CMake always uses all-lowercase ones. I argue we should do the same to
get in line with other codebases and to reduce the likelihood of
repetitive strain injuries.

So especially for CMake, the proposed coding style says something we
don't have yet. I'm fine with that, as the document explicitly says that
it's what we want to have and not what we have right now.
2020-04-05 19:46:08 +02:00
nia
465e10ce18 deps: ntlmclient: use htobe64 on NetBSD too 2020-04-05 18:33:14 +01:00
Patrick Steinhardt
e9b0cfc006 Merge pull request #5485 from libgit2/ethomson/sysdir_unused
sysdir: remove unused git_sysdir_get_str
2020-04-05 13:24:13 +02:00
Edward Thomson
b6f18db917 sysdir: remove unused git_sysdir_get_str 2020-04-05 11:16:29 +01:00
Patrick Steinhardt
e56d48be21 Merge pull request #5483 from xSetech/master
Fix typo causing removal of symbol 'git_worktree_prune_init_options'
2020-04-05 12:07:17 +02:00
Seth Junot
ce2ab78f04 Fix typo causing removal of symbol 'git_worktree_prune_init_options'
Commit 0b5ba0d replaced this function with an "option_init"
equivallent, but misspelled the replacement function. As a result, this
symbol has been missing from libgit2.so ever since.
2020-04-04 16:45:22 -07:00
Patrick Steinhardt
ad341eb720 Merge pull request #5425 from lhchavez/fix-get-delta-base
pack: Improve error handling for get_delta_base()
2020-04-04 13:40:14 +02:00
Patrick Steinhardt
5a1ec7abf6 Merge pull request #5480 from libgit2/ethomson/coverity
repo::open: ensure we can open the repository
2020-04-04 13:37:13 +02:00
Patrick Steinhardt
7d9b1f0766 Merge pull request #5421 from petersalomonsen/examples-fixes-and-additions
examples: additions and fixes
2020-04-04 13:36:24 +02:00
Patrick Steinhardt
966db47d2f Merge pull request #5477 from pks-t/pks/rename-detection-negative-caches
merge: cache negative cache results for similarity metrics
2020-04-04 13:21:02 +02:00
Edward Thomson
cb0cfc5acb repo::open: ensure we can open the repository
Update the test cases to check the `git_repository_open` return code.
2020-04-03 09:33:22 +01:00
Peter Salomonsen
dc2beb7e2d examples: additions and fixes
add example for git commit
fix example for git add
add example for git push
2020-04-02 18:39:37 +02:00
lhchavez
4d4c8e0a3d Re-adding the "delta offset is zero" error case 2020-04-02 07:34:55 -07:00
Patrick Steinhardt
dfd7fcc41c Merge pull request #5388 from bk2204/repo-format-v1
Handle repository format v1
2020-04-02 13:26:13 +02:00
Patrick Steinhardt
e129917129 Merge pull request #5440 from pks-t/pks/cmake-streamlining
CMake: backend selection streamlining
2020-04-02 13:13:52 +02:00
Edward Thomson
b8eec0b2ee Merge pull request #5461 from pks-t/pks/refdb-fs-unused-header
refdb_fs: remove unused header file
2020-04-01 22:22:38 +01:00
Edward Thomson
5d37128db1 git__hexdump: better mimic hexdump -C 2020-04-01 21:59:37 +01:00
lhchavez
ba59a4a2cc Making get_delta_base() conform to the general error-handling pattern
This makes get_delta_base() return the error code as the return value
and the delta base as an out-parameter.
2020-04-01 12:37:53 -07:00
lhchavez
f327372504 pack: Improve error handling for get_delta_base()
This change moves the responsibility of setting the error upon failures
of get_delta_base() to get_delta_base() instead of its callers. That
way, the caller chan always check if the return value is negative and
mark the whole operation as an error instead of using garbage values,
which can lead to crashes if the .pack files are malformed.
2020-04-01 12:27:24 -07:00
Edward Thomson
1c7fb21246 Merge pull request #5466 from pks-t/pks/patch-modechange-with-rename
patch: correctly handle mode changes for renames
2020-04-01 20:00:24 +01:00
Edward Thomson
85533f374b Merge pull request #5474 from pks-t/pks/gitignore-cleanup
gitignore: clean up patterns from old times
2020-04-01 19:59:31 +01:00
Edward Thomson
2662da482e Merge pull request #5478 from pks-t/pks/readme-ci-update
README.md: update build matrix to reflect our latest releases
2020-04-01 18:03:39 +01:00
Patrick Steinhardt
541de51516 cmake: streamline backend detection
We're currently doing unnecessary work to auto-detect backends even if
the functionality is disabled altogether. Let's fix this by removing the
extraneous FOO_BACKEND variables, instead letting auto-detection modify
the variable itself.
2020-04-01 17:36:13 +02:00
Patrick Steinhardt
7a6c4122a3 README.md: update build matrix to reflect our latest releases 2020-04-01 16:15:38 +02:00
Patrick Steinhardt
7d3c7057f0 Merge pull request #5471 from pks-t/pks/v1.0
Release v1.0
v1.0.0
2020-04-01 15:49:12 +02:00