Commit Graph

14464 Commits

Author SHA1 Message Date
Edward Thomson
e6d93612e8 refactor: move utility tests into util 2022-02-22 22:07:45 -05:00
Edward Thomson
2b09b5d7a0 refactor: move headertest into separate test folder 2022-02-22 22:07:45 -05:00
Edward Thomson
25bc84fb8f refactor: move clar into separate directory 2022-02-22 22:07:45 -05:00
Edward Thomson
3344fddc97 refactor: tests is now tests/libgit2
Like we want to separate libgit2 and utility source code, we want to
separate libgit2 and utility tests.  Start by moving all the tests into
libgit2.
2022-02-22 22:07:45 -05:00
Edward Thomson
91ba089663 cmake: rename git2internal target to libgit2
The `git2internal` target is actually the git library; call it such so
that IDE users have visibility into it.
2022-02-22 22:07:44 -05:00
Edward Thomson
d7b49ed442 cmake: remove unnecessary xcode hack 2022-02-22 22:07:44 -05:00
Edward Thomson
5fcfada500 cmake: document CMakeLists.txt hierarchy 2022-02-22 22:07:44 -05:00
Edward Thomson
c3b7ace9cf refactor: make util an object library
Instead of simply including the utility files directly, make them a
cmake object library for easy reusability between other projects within
libgit2.

Now the top-level `src` is responsible for platform selection, while the
next-level `libgit2` and `util` configurations are responsible for
identifying what objects they include.
2022-02-22 22:07:44 -05:00
Edward Thomson
ef4ab29883 refactor: src is now src/libgit2 2022-02-22 22:07:44 -05:00
Edward Thomson
49e180c862 errors: expose git_error_set
The `git_error_set` function is useful for callers who implement
backends and advanced callbacks.  Expose it.
2022-02-22 22:07:44 -05:00
Edward Thomson
c716b9f295 odb: initialize object before use
Newer gcc is complaining about `object` being potentially not
initialized; initialize it.
2022-02-22 22:07:44 -05:00
Edward Thomson
eca9e1cfec Merge pull request #6228 from libgit2/ethomson/win32_systemdirs
win32: `find_system_dirs` does not return `GIT_ENOTFOUND`
2022-02-22 07:17:12 -05:00
Edward Thomson
f45121edd1 win32: find_system_dirs does not return GIT_ENOTFOUND
Allow for no Git for Windows installation.  When there is no GfW found
in the path or registry, `git_win32__find_system_dirs` would return a
`GIT_ENOTFOUND`.  Callers were not expecting this.  Since this is no
error, we simply return `0` so that callers can move on with their
lives.
2022-02-21 16:13:52 +00:00
Edward Thomson
1551b1f02b Merge pull request #6226 from libgit2/cmn/update-tips-error
remote: do store the update_tips callback error value
2022-02-21 09:06:56 -05:00
Carlos Martín Nieto
e35b5e44aa test: add test for the behaviour of update_tips on error 2022-02-21 10:34:13 +01:00
Carlos Martín Nieto
15860aa0b2 remote: do store the update_tips callback error value
We use `git_error_set_after_callback_function` to determine whether
`update_tips` returned an error but do not store its return value making us
think it always returns 0.

Fix it by adding the common patter of storing it inside the `if` when calling it.
2022-02-21 10:03:06 +01:00
Edward Thomson
83f2a20eb7 Merge pull request #6220 from libgit2/ethomson/version
meta: update version number to v1.5.0-alpha
2022-02-18 09:30:18 -05:00
Edward Thomson
899fd4c5e2 Merge pull request #6223 from libgit2/ethomson/xdiff
xdiff: use xdl_free not free
2022-02-18 09:30:05 -05:00
Edward Thomson
1afad26e1d Merge pull request #6219 from apnadkarni/patch-2
Free parent and ref in lg2_commit before returning.
2022-02-18 08:51:24 -05:00
Edward Thomson
4646f1e3f1 Merge pull request #6217 from mgorny/sys-httpparser
cmake: Fix package name for system http-parser
2022-02-18 08:50:53 -05:00
Edward Thomson
b722c45d16 xdiff: use xdl_free not free
We've added a lovely abstraction layer in xdiff so that it can call our
allocation functions.  But it also needs to call our free functions.  We
missed some `free` calls in `xmerge.c`.  Update them to use `xdl_free`.
Without this, we will pass a pointer allocated with a custom allocator
to the system free function.  💣
2022-02-17 14:14:51 -05:00
Edward Thomson
b152b0300e meta: document version information for libgit2 2022-02-14 10:27:48 -05:00
Edward Thomson
056fe4be05 meta: provide an accessor for prerelease info 2022-02-14 07:13:05 -05:00
Edward Thomson
ae74d5ac41 meta: update version number to v1.5.0-alpha
Update the version number in main to v1.5.0-alpha.  This helps people
understand that the main builds are not part of the v1.4.0 release
train.

We use "alpha" to indicate builds out of main (or nightlies) as semver
v2 requires the prerelease component is compared lexicographically.
Thus, our "beta" and "rc" releases should follow.
2022-02-14 07:01:43 -05:00
Ashok P. Nadkarni
aab7c0babc Free parent and ref in lg2_commit before returning. 2022-02-14 13:57:07 +05:30
Michał Górny
8bc9eda779 cmake: Fix package name for system http-parser
Fix building against system http-parser library by fixing
the find_package() argument.  It seems to have been accidentally changed
from HTTPParser to HTTP_Parser in de178d36f, effectively making
the build against system library fail to find it:

```
CMake Warning at cmake/SelectHTTPParser.cmake:3 (find_package):
  By not providing "FindHTTP_Parser.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "HTTP_Parser", but CMake did not find one.

  Could not find a package configuration file provided by "HTTP_Parser" with
  any of the following names:

    HTTP_ParserConfig.cmake
    http_parser-config.cmake

  Add the installation prefix of "HTTP_Parser" to CMAKE_PREFIX_PATH or set
  "HTTP_Parser_DIR" to a directory containing one of the above files.  If
  "HTTP_Parser" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  src/CMakeLists.txt:97 (include)

CMake Error at cmake/SelectHTTPParser.cmake:11 (message):
  http-parser support was requested but not found
Call Stack (most recent call first):
  src/CMakeLists.txt:97 (include)
```
2022-02-13 21:23:56 +01:00
Edward Thomson
c8450561d4 Merge pull request #6216 from libgit2/ethomson/readme
meta: show build status for v1.3 and v1.4 branches
2022-02-13 11:55:17 -05:00
Edward Thomson
9c9405df21 meta: show build status for v1.3 and v1.4 branches 2022-02-13 11:19:39 -05:00
Edward Thomson
1d5b9bd86d Merge pull request #6214 from libgit2/ethomson/v1.4
libgit2 v1.4
v1.4.0
2022-02-13 11:05:40 -05:00
Edward Thomson
bafd044fd9 v1.4: update the changelog 2022-02-13 10:07:49 -05:00
Edward Thomson
5c949d1faf v1.4: update version numbers 2022-02-13 10:06:15 -05:00
Edward Thomson
5f66aa264a Merge pull request #6212 from apnadkarni/patch-1
Fix crashes in example programs on Windows (sprintf_s not compatible with snprintf)
2022-02-13 09:16:09 -05:00
apnadkarni
77ef1a6e14 Update common.h 2022-02-13 14:11:46 +05:30
Edward Thomson
4c88b9d375 release.yml: use sentence case for everything 2022-02-12 21:29:43 -05:00
Edward Thomson
aded938e00 Merge pull request #6204 from boretrk/merge_flags
merge: fix overlap between GIT_MERGE_FILE_FAVOR__CONFLICTED and GIT_MERGE_FILE_SIMPLIFY_ALNUM
2022-02-12 21:23:01 -05:00
Edward Thomson
d99b4019e1 Merge pull request #6211 from libgit2/ethomson/release_config
meta: add a release configuration file
2022-02-12 14:20:47 -05:00
Edward Thomson
416f7cb347 Merge pull request #6208 from jorio/fix-stale-filesize-crash
diff_file: fix crash if size of diffed file changes in workdir
2022-02-12 10:38:08 -05:00
Edward Thomson
e3aad1dea0 meta: add a release configuration file
Let's let GitHub handle our release notes as much as possible:
https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
2022-02-12 10:27:12 -05:00
Edward Thomson
4467bd66ce Merge pull request #6207 from libgit2/ethomson/prng
mktmp: improve our temp file creation
2022-02-12 09:09:17 -05:00
Edward Thomson
0fbf62cd20 merge: make the internal flags public
We made the flags that enable recursive merge internal, on the
assumption that nobody would want them and they're hard to reason about.
(Giving people an option that nobody wants is just extra noise.)

However, it made it hard for _us_ to reason about.  There's no good
reason to keep it private, let's just make it public and push that
cognitive load onto our poor users.  But they should expect it, they're
dealing with git, after all.
2022-02-12 08:46:55 -05:00
Edward Thomson
d2ce981ffc diff: fail generation if a file changes size
When we know that we know a file's size, and the file's size changes,
fail.
2022-02-12 07:00:49 -05:00
Edward Thomson
359240b674 diff: indicate when the file size is "valid"
When we know the file size (because we're producing it from a working
directory iterator, or an index with an up-to-date cache) then set a
flag indicating as such.  This removes the ambiguity about a 0 file
size, which could indicate that a file exists and is 0 bytes, or that we
haven't read it yet.
2022-02-12 06:59:09 -05:00
Edward Thomson
e86e81c5d9 oid: make empty tree id global
Move the empty tree ID into a global space so that it can be generally
used.
2022-02-12 06:58:05 -05:00
Edward Thomson
e1415dc3fa diff_file: test empty workdir file grows after obtaining a diff
This test was also provided by @jorio
https://github.com/libgit2/libgit2/pull/6208#issuecomment-1034072050
2022-02-11 22:46:54 -05:00
Iliyas Jorio
9aade20b4e diff_file: test workdir file becomes empty after obtaining a diff 2022-02-11 22:46:54 -05:00
Iliyas Jorio
3bac68ff05 diff_file: Apply suggestions from code review
Skip new_file_size non-zero test, custom error message if file changed in workdir

Co-authored-by: Edward Thomson <ethomson@github.com>
2022-02-11 22:46:54 -05:00
Iliyas Jorio
0a0cd67dcb diff_file: fix crash if size of diffed file changes in workdir
"diff_file_content_load_workdir_file()" maps a file from the workdir
into memory. It uses git_diff_file.size to determine the size of the
memory mapping.

If this value goes stale, the mmaped area would be sized incorrectly.
This could occur if an external program changes the contents of the
file after libgit2 had cached its size. This used to segfault if the
file becomes smaller (mmaped area too large).

This patch causes diff_file_content_load_workdir_file to fail without
crashing if it detects that the file size has changed.
2022-02-11 22:46:54 -05:00
Edward Thomson
1d811f0eb9 Merge pull request #6203 from libgit2/ethomson/fetch_by_oid
Fetch by object id
2022-02-11 07:14:54 -05:00
Edward Thomson
b933c14a92 util: remove p_mktemp / p_mkstemp
We have our own temporary file creation function now in
`git_futils_mktmp`, remove the others since they may be terrible on some
platforms.
2022-02-09 09:41:22 -05:00
Edward Thomson
97fade4f19 fs_path: use new mktmp to query unicode support 2022-02-09 09:41:22 -05:00