Commit Graph

3298 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
5fcfada500 cmake: document CMakeLists.txt hierarchy 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
Carlos Martín Nieto
e35b5e44aa test: add test for the behaviour of update_tips on error 2022-02-21 10:34:13 +01: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
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
d9863fc19e Merge pull request #6192 from libgit2/ethomson/sha256_preparation
SHA256: early preparation
2022-02-06 15:27:34 -05:00
Edward Thomson
9d88300a8e fetch: support oids in fetch specs 2022-02-06 15:08:35 -05:00
Edward Thomson
07264ea7b1 fetch: add a test for local fetching 2022-02-06 15:08:35 -05:00
Edward Thomson
b82d566464 oid: introduce git_oid__is_hexstr
Introduce a function that determines whether a given string is a valid
object id (40 chars of hexadigits).
2022-02-05 09:03:37 -05:00
Edward Thomson
4efd6563ca Merge pull request #6196 from libgit2/ethomson/at_revparse
revparse: support bare '@'
2022-02-03 16:39:26 -05:00
Edward Thomson
61f1e31a14 Merge pull request #6197 from libgit2/ethomson/merge_msg_conflict_comment
merge: comment conflicts lines in MERGE_MSG
2022-02-02 22:35:18 -05:00
Edward Thomson
18a477e755 Merge pull request #6195 from libgit2/ethomson/zdiff3
merge: support zdiff3 conflict styles
2022-02-02 22:35:07 -05:00
Edward Thomson
c0297d47c7 merge: comment conflicts lines in MERGE_MSG
git has started adding comment markers to its conflict lines in
MERGE_MSG.  Match that behavior.
2022-01-30 22:41:58 -05:00
Edward Thomson
add2dabb3c revparse: support bare '@'
A bare '@' revision syntax represents HEAD.  Support it as such.
2022-01-30 22:25:59 -05:00
Edward Thomson
84e1e560cf Merge branch 'boretrk/futils_mktmp' 2022-01-30 19:22:38 -05:00
Edward Thomson
aae54d5b3c Merge pull request #6138 from ccstolley/ccs_packedrefs_fast
refs: Speed up packed lookups.
2022-01-30 13:43:43 -05:00
Edward Thomson
c629d2a11c merge: support zdiff3 conflict styles 2022-01-30 09:27:29 -05:00
Edward Thomson
70d9bfa47c packbuilder: use the packfile name instead of hash
Deprecate the `git_packfile_hash` function.  Callers should use the new
`git_packfile_name` function which provides a unique packfile name.
2022-01-27 20:15:09 -05:00
Edward Thomson
d2458af7b7 indexer: use a byte array for checksum
The index's checksum is not an object ID, so we should not use the
`git_oid` type.  Use a byte array for checksum calculation and storage.

Deprecate the `git_indexer_hash` function.  Callers should use the new
`git_indexer_name` function which provides a unique packfile name.
2022-01-27 20:15:09 -05:00
Edward Thomson
11ef76a9f5 index: use a byte array for checksum
The index's checksum is not an object ID, so we should not use the
`git_oid` type.  Use a byte array for checksum calculation and storage.

Deprecate the `git_index_checksum` function without a replacement.  This
is an abstraction that callers should not care about (and indeed do not
seem to be using).

Remove the unused `git_index__changed_relative_to` function.
2022-01-27 20:15:09 -05:00
Edward Thomson
74471eefce commit_graph: tests are now commitgraph
Underscores in filenames in tests indicate a logical separation - so
`commit_graph` becomes `commit::graph`.  Rename it to `commitgraph` to
avoid this.
2022-01-27 20:15:08 -05:00
Edward Thomson
475c6eba4f win32: improve impl & tests for system path / g4w interop
We look for a Git for Windows installation to use its git config,
so that clients built on libgit2 can interoperate with the Git for
Windows CLI (and clients that are built on top of _it_).

Look for `git` both in the `PATH` and in the registry.  Use the _first_
git install in the path, and the first git install in the registry.

Look in both the `etc` dir and the architecture-specific `etc` dirs
(`mingw64/etc` and `mingw32/etc`) beneath the installation root.

Prefer the git in the `PATH` to the git location in the registry so that
users can override that.

Include more tests for this behavior.
2022-01-17 22:02:12 -05:00
Edward Thomson
925abee95b path: introduce git_fs_path_find_executable
Provide a helper function to find an executable in the current process's
PATH.
2022-01-17 22:02:12 -05:00
Edward Thomson
ecbb01f52c win32: test system paths for gvfs compatibility 2022-01-17 22:02:12 -05:00
Edward Thomson
d298059e96 Merge pull request #6167 from libgit2/ethomson/scp_urls_with_ports
Support scp style paths with ports
2022-01-17 21:41:12 -05:00
Edward Thomson
616628ddc9 Merge branch 'main' into typos 2022-01-17 21:39:35 -05:00
Edward Thomson
e02e6a5cd2 url: introduce git_net_str_is_url
We occasionally need to determine whether a given string is a URL or
something else.  (The "something else" may be a git path in a different
format, like scp formatting, which needs to be handled differently.)
2022-01-17 21:06:06 -05:00
Edward Thomson
e2bda60a52 url: introduce git_net_url_parse_scp
Provide a mechanism for parsing scp-style paths (eg
`git@github.com:libgit2/libgit2` into the url form
`ssh://git@github.com/libgit2/libgit2`.)
2022-01-17 21:06:06 -05:00
Edward Thomson
df4448f2b1 online: test with https instead of git protocol
GitHub is removing support for the unauthenticated git protocol; test
with the https protocol.
2022-01-17 21:06:06 -05:00
Peter Pettersson
8d54822269 tests: verify that futils_mktmp respects umask 2022-01-14 23:29:21 +01:00
Edward Thomson
adaa037d3a remote: test honoring configuration option
Test that we honor `http.followRedirects` when set to initial or false.
2022-01-13 21:34:21 +00:00
Edward Thomson
515daeaf4d remote: introduce follow_redirects connect option
Give callers the ability to select how to handle redirects - either
supporting redirects during the initial connection (so that, for
example, `git.example.com/repo` can redirect to `github.com/example/repo`)
or all/no redirects.  This is for compatibility with git.
2022-01-13 21:34:20 +00:00
Edward Thomson
342e55ac91 url: optionally allow off-site redirects
In redirect application logic, (optionally) allow off-site redirects.
2022-01-13 09:36:21 -05:00
Edward Thomson
9faa919902 status: don't use // ... in tests, use /* ... */ 2022-01-06 07:42:01 -05:00
Edward Thomson
ca9f6b9873 Merge remote-tracking branch 'pr/6159' 2022-01-06 07:41:27 -05:00
Edward Thomson
da5385c6cf status: don't use // ... in tests, use /* ... */ 2022-01-06 07:39:21 -05:00
Edward Thomson
db3572b730 Merge pull request #6165 from libgit2/ethomson/includeif
config: handle empty conditional in includeIf
2022-01-06 07:38:07 -05:00
Dimitris Apostolou
90df43022a Fix typos 2022-01-05 16:35:52 +02:00
Edward Thomson
83a1e614fa config: handle empty conditional in includeIf
When a config file contains `[includeIf]` (with no condition), we should
treat that as a falsey value.  This means that we should properly parse
a config value of `includeIf.path`.
2022-01-05 09:18:59 -05:00
Miguel Arroz
a3436cde9f #6154 git_status_list_new case insensitive fix 2022-01-01 15:23:00 -08:00
Miguel Arroz
ef84889189 Add rename_threshold to git_status_options. 2021-12-31 16:40:58 -08:00
Edward Thomson
942cfac129 worktree: checkout options suggestions from code review 2021-12-23 14:21:49 -06:00
punkymaniac
f9a98f9442 Fix test fail because of memory leak 2021-12-23 14:21:49 -06:00