Git development
 help / color / mirror / Atom feed
* [PATCH 02/13] loose: avoid closing invalid fd on error path
From: Johannes Schindelin via GitGitGadget @ 2026-07-01  7:04 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Johannes Schindelin
In-Reply-To: <pull.2163.git.1782889472.gitgitgadget@gmail.com>

From: Johannes Schindelin <johannes.schindelin@gmx.de>

write_one_object() opens a file at line 186 and jumps to the
errout label on failure. The errout cleanup unconditionally calls
close(fd), but when open() itself failed, fd is -1. Calling
close(-1) is harmless on most platforms (returns EBADF) but is
undefined behavior per POSIX and can confuse fd tracking in
sanitizer builds.

Guard the close with fd >= 0.

Pointed out by Coverity.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 loose.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/loose.c b/loose.c
index 47b7f5ec38..2c6db45245 100644
--- a/loose.c
+++ b/loose.c
@@ -202,7 +202,8 @@ static int write_one_object(struct odb_source_loose *loose,
 	return 0;
 errout:
 	error_errno(_("failed to write loose object index %s"), path.buf);
-	close(fd);
+	if (fd >= 0)
+		close(fd);
 	rollback_lock_file(&lock);
 	strbuf_release(&buf);
 	strbuf_release(&path);
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH 01/13] load_one_loose_object_map(): fix resource leak
From: Johannes Schindelin via GitGitGadget @ 2026-07-01  7:04 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Johannes Schindelin
In-Reply-To: <pull.2163.git.1782889472.gitgitgadget@gmail.com>

From: Johannes Schindelin <johannes.schindelin@gmx.de>

Pointed out by Coverity.

While at it, reduce near-duplicate clean-up code at the end of the
function.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 loose.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/loose.c b/loose.c
index 0b626c1b85..47b7f5ec38 100644
--- a/loose.c
+++ b/loose.c
@@ -65,6 +65,7 @@ static int load_one_loose_object_map(struct repository *repo, struct odb_source_
 {
 	struct strbuf buf = STRBUF_INIT, path = STRBUF_INIT;
 	FILE *fp;
+	int ret = -1;
 
 	if (!loose->map)
 		loose_object_map_init(&loose->map);
@@ -98,13 +99,12 @@ static int load_one_loose_object_map(struct repository *repo, struct odb_source_
 		insert_loose_map(loose, &oid, &compat_oid);
 	}
 
-	strbuf_release(&buf);
-	strbuf_release(&path);
-	return errno ? -1 : 0;
+	ret = 0;
 err:
+	fclose(fp);
 	strbuf_release(&buf);
 	strbuf_release(&path);
-	return -1;
+	return ret;
 }
 
 int repo_read_loose_object_map(struct repository *repo)
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH 00/13] coverity: fix leaks and error paths
From: Johannes Schindelin via GitGitGadget @ 2026-07-01  7:04 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin

I wanted to whittle down the many issues reported by Coverity in the Git for
Windows project. Turns out: The vast majority of the issues are false
positives. Most of the remaining issues are in core Git proper.

This effort was forced on pause while Coverity was down from May 16
[https://web.archive.org/web/20260516152422/https://scan.coverity.com/] to
June 22
[https://web.archive.org/web/20260622182153/https://scan.coverity.com/]).

Here is a first batch of fixes for those issues.

Johannes Schindelin (13):
  load_one_loose_object_map(): fix resource leak
  loose: avoid closing invalid fd on error path
  download_https_uri_to_file(): do not leak fd upon failure
  run-command: avoid close(-1) in start_command() error paths
  run_diff_files: avoid memory leak
  line-log: avoid redundant copy that leaks in process_ranges
  dir: free allocations on parse-error paths in read_one_dir()
  submodule: fix cwd leak in get_superproject_working_tree()
  worktree: fix resource leaks when branch creation fails
  imap-send: avoid leaking the IMAP upload buffer
  reftable/table: release filter on error path
  fsmonitor: plug token-data leak on early daemon-startup failures
  mingw: make exit_process() own the process handle on all paths

 builtin/fsmonitor--daemon.c |  2 ++
 builtin/worktree.c          |  7 +++++--
 bundle-uri.c                |  2 +-
 compat/mingw.c              |  4 +---
 compat/win32/exit-process.h |  1 +
 diff-lib.c                  |  3 ++-
 dir.c                       |  9 +++++++--
 imap-send.c                 |  1 +
 line-log.c                  |  3 +--
 loose.c                     | 11 ++++++-----
 reftable/table.c            |  4 ++++
 run-command.c               |  6 +++---
 submodule.c                 |  8 ++++++--
 13 files changed, 40 insertions(+), 21 deletions(-)


base-commit: e9019fcafe0040228b8631c30f97ae1adb61bcdc
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2163%2Fdscho%2Fcoverity-fixes-leaks-and-error-paths-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2163/dscho/coverity-fixes-leaks-and-error-paths-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2163
-- 
gitgitgadget

^ permalink raw reply

* [PATCH RFC v3 2/2] Move libgit.a sources into separate "lib/" directory
From: Patrick Steinhardt @ 2026-07-01  6:59 UTC (permalink / raw)
  To: git
  Cc: brian m. carlson, Junio C Hamano, Elijah Newren, Derrick Stolee,
	SZEDER Gábor, Johannes Schindelin, Phillip Wood
In-Reply-To: <20260701-pks-libgit-in-subdir-v3-0-5e4860056094@pks.im>

The Git project is not exactly the easiest project to get started in:
it's written in C and POSIX shell, with bits of Perl, Rust and other
languages sprinkled into it. On top of that, the project has grown
somewhat organically over time, making the codebase hard to navigate.

These are problems that we're aware of, and there have been and still
are efforts to clean up some of the technical debt that is natural to
exist in a project that is more than 20 years old. Furthermore, we
provide resources to newcomers that help them out like our coding
guidelines, code of conduct or "MyFirstContribution.adoc".

But there is a rather practical problem: finding your way around in our
project's tree is not easy. Doing a directory listing in the top-level
directory will present you with more than 550 files, which makes it
extremely hard for a newcomer to figure out what files they are even
supposed to look at. This makes the onboarding experience somewhat
harder than it really needs to be. This isn't only a problem for
newcomers though, as I myself struggle to find the files I am looking
for because of the sheer number of files.

Besides the problem of discoverability it also creates a problem of
structure. It is not obvious at all which files are part of "libgit.a"
and which files are only linked into our final executables. So while we
have this split in our build systems, that split is not evident at all
in our tree.

Introduce a new "lib/" directory and move all of our sources for
"libgit.a" into it to fix these issues. It makes the split we have
evident and reduces the number of files in our top-level tree from 550
files to ~80 files.

This is still a lot of files, but it's significantly easier to navigate
already. Furthermore, we can further iterate after this step and think
about introducing a better structure for remaining files, as well.

This move does not come for free though:

  - The mass rename introduces a cutoff point in the history of every
    moved file, as tools like git-log(1) do not follow renames by
    default.

  - Any in-flight or not-yet-submitted topic that touches the moved
    files will have to be rebased, and backporting fixes across the
    boundary becomes more cumbersome as a patch can no longer apply
    cleanly to both the old and the new layout.

My own (obviously subjective and biased) take is that the tradeoff is
worth it, as these issues are a one-time cost while the benefits to
discoverability will be permanent.

Furthermore, especially the first downside is a limitation in Git
itself. We're not the first or last project to do such a mass rename. So
if our provided tools are insufficient, then we should improve them to
make the experience better for other projects, as well. Subjecting
ourselves to the same pain may even give us more incentive to eventually
improve rename following for everyone.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 .github/workflows/main.yml                         |   9 +-
 .gitmodules                                        |   2 +-
 Documentation/Makefile                             |   4 +-
 Makefile                                           | 764 ++++++++++-----------
 config.mak.uname                                   |  52 +-
 contrib/buildsystems/CMakeLists.txt                |  95 +--
 git.rc.in                                          |   2 +-
 abspath.c => lib/abspath.c                         |   0
 abspath.h => lib/abspath.h                         |   0
 add-interactive.c => lib/add-interactive.c         |   0
 add-interactive.h => lib/add-interactive.h         |   0
 add-patch.c => lib/add-patch.c                     |   0
 add-patch.h => lib/add-patch.h                     |   0
 advice.c => lib/advice.c                           |   0
 advice.h => lib/advice.h                           |   0
 alias.c => lib/alias.c                             |   0
 alias.h => lib/alias.h                             |   0
 alloc.c => lib/alloc.c                             |   0
 alloc.h => lib/alloc.h                             |   0
 apply.c => lib/apply.c                             |   0
 apply.h => lib/apply.h                             |   0
 archive-tar.c => lib/archive-tar.c                 |   0
 archive-zip.c => lib/archive-zip.c                 |   0
 archive.c => lib/archive.c                         |   0
 archive.h => lib/archive.h                         |   0
 attr.c => lib/attr.c                               |   0
 attr.h => lib/attr.h                               |   0
 banned.h => lib/banned.h                           |   0
 base85.c => lib/base85.c                           |   0
 base85.h => lib/base85.h                           |   0
 bisect.c => lib/bisect.c                           |   0
 bisect.h => lib/bisect.h                           |   0
 blame.c => lib/blame.c                             |   0
 blame.h => lib/blame.h                             |   0
 blob.c => lib/blob.c                               |   0
 blob.h => lib/blob.h                               |   0
 {block-sha1 => lib/block-sha1}/sha1.c              |   0
 {block-sha1 => lib/block-sha1}/sha1.h              |   0
 bloom.c => lib/bloom.c                             |   0
 bloom.h => lib/bloom.h                             |   0
 branch.c => lib/branch.c                           |   0
 branch.h => lib/branch.h                           |   0
 builtin.h => lib/builtin.h                         |   0
 bundle-uri.c => lib/bundle-uri.c                   |   0
 bundle-uri.h => lib/bundle-uri.h                   |   0
 bundle.c => lib/bundle.c                           |   0
 bundle.h => lib/bundle.h                           |   0
 cache-tree.c => lib/cache-tree.c                   |   0
 cache-tree.h => lib/cache-tree.h                   |   0
 cbtree.c => lib/cbtree.c                           |   0
 cbtree.h => lib/cbtree.h                           |   0
 chdir-notify.c => lib/chdir-notify.c               |   0
 chdir-notify.h => lib/chdir-notify.h               |   0
 checkout.c => lib/checkout.c                       |   0
 checkout.h => lib/checkout.h                       |   0
 chunk-format.c => lib/chunk-format.c               |   0
 chunk-format.h => lib/chunk-format.h               |   0
 color.c => lib/color.c                             |   0
 color.h => lib/color.h                             |   0
 column.c => lib/column.c                           |   0
 column.h => lib/column.h                           |   0
 combine-diff.c => lib/combine-diff.c               |   0
 commit-graph.c => lib/commit-graph.c               |   0
 commit-graph.h => lib/commit-graph.h               |   0
 commit-reach.c => lib/commit-reach.c               |   0
 commit-reach.h => lib/commit-reach.h               |   0
 commit-slab-decl.h => lib/commit-slab-decl.h       |   0
 commit-slab-impl.h => lib/commit-slab-impl.h       |   0
 commit-slab.h => lib/commit-slab.h                 |   0
 commit.c => lib/commit.c                           |   0
 commit.h => lib/commit.h                           |   0
 common-exit.c => lib/common-exit.c                 |   0
 common-init.c => lib/common-init.c                 |   0
 common-init.h => lib/common-init.h                 |   0
 {compat => lib/compat}/.gitattributes              |   0
 {compat => lib/compat}/access.c                    |   0
 {compat => lib/compat}/apple-common-crypto.h       |   0
 {compat => lib/compat}/basename.c                  |   0
 {compat => lib/compat}/bswap.h                     |   0
 {compat => lib/compat}/compiler.h                  |   0
 {compat => lib/compat}/darwin/procinfo.c           |   0
 {compat => lib/compat}/disk.h                      |   0
 {compat => lib/compat}/fileno.c                    |   0
 {compat => lib/compat}/fopen.c                     |   0
 {compat => lib/compat}/fsmonitor/fsm-darwin-gcc.h  |   0
 .../compat}/fsmonitor/fsm-health-darwin.c          |   0
 .../compat}/fsmonitor/fsm-health-linux.c           |   0
 .../compat}/fsmonitor/fsm-health-win32.c           |   0
 {compat => lib/compat}/fsmonitor/fsm-health.h      |   0
 {compat => lib/compat}/fsmonitor/fsm-ipc-unix.c    |   0
 {compat => lib/compat}/fsmonitor/fsm-ipc-win32.c   |   0
 .../compat}/fsmonitor/fsm-listen-darwin.c          |   0
 .../compat}/fsmonitor/fsm-listen-linux.c           |   0
 .../compat}/fsmonitor/fsm-listen-win32.c           |   0
 {compat => lib/compat}/fsmonitor/fsm-listen.h      |   0
 .../compat}/fsmonitor/fsm-path-utils-darwin.c      |   0
 .../compat}/fsmonitor/fsm-path-utils-linux.c       |   0
 .../compat}/fsmonitor/fsm-path-utils-win32.c       |   0
 .../compat}/fsmonitor/fsm-settings-unix.c          |   0
 .../compat}/fsmonitor/fsm-settings-win32.c         |   0
 {compat => lib/compat}/hstrerror.c                 |   0
 {compat => lib/compat}/inet_ntop.c                 |   0
 {compat => lib/compat}/inet_pton.c                 |   0
 {compat => lib/compat}/linux/procinfo.c            |   0
 {compat => lib/compat}/memmem.c                    |   0
 {compat => lib/compat}/mingw-posix.h               |   0
 {compat => lib/compat}/mingw.c                     |   0
 {compat => lib/compat}/mingw.h                     |   0
 {compat => lib/compat}/mkdir.c                     |   0
 {compat => lib/compat}/mmap.c                      |   0
 {compat => lib/compat}/msvc-posix.h                |   0
 {compat => lib/compat}/msvc.c                      |   0
 {compat => lib/compat}/msvc.h                      |   0
 {compat => lib/compat}/nonblock.c                  |   0
 {compat => lib/compat}/nonblock.h                  |   0
 {compat => lib/compat}/obstack.c                   |   0
 {compat => lib/compat}/obstack.h                   |   0
 {compat => lib/compat}/open.c                      |   0
 {compat => lib/compat}/poll/poll.c                 |   0
 {compat => lib/compat}/poll/poll.h                 |   0
 {compat => lib/compat}/posix.h                     |   0
 {compat => lib/compat}/pread.c                     |   0
 {compat => lib/compat}/precompose_utf8.c           |   0
 {compat => lib/compat}/precompose_utf8.h           |   0
 {compat => lib/compat}/qsort_s.c                   |   0
 {compat => lib/compat}/regcomp_enhanced.c          |   0
 {compat => lib/compat}/regex/regcomp.c             |   0
 {compat => lib/compat}/regex/regex.c               |   0
 {compat => lib/compat}/regex/regex.h               |   0
 {compat => lib/compat}/regex/regex_internal.c      |   0
 {compat => lib/compat}/regex/regex_internal.h      |   0
 {compat => lib/compat}/regex/regexec.c             |   0
 {compat => lib/compat}/setenv.c                    |   0
 {compat => lib/compat}/sha1-chunked.c              |   0
 {compat => lib/compat}/sha1-chunked.h              |   0
 {compat => lib/compat}/simple-ipc/ipc-shared.c     |   0
 .../compat}/simple-ipc/ipc-unix-socket.c           |   0
 {compat => lib/compat}/simple-ipc/ipc-win32.c      |   0
 {compat => lib/compat}/snprintf.c                  |   0
 {compat => lib/compat}/stat.c                      |   0
 {compat => lib/compat}/strcasestr.c                |   0
 {compat => lib/compat}/strdup.c                    |   0
 {compat => lib/compat}/strlcpy.c                   |   0
 {compat => lib/compat}/strtoimax.c                 |   0
 {compat => lib/compat}/strtoumax.c                 |   0
 {compat => lib/compat}/stub/procinfo.c             |   0
 {compat => lib/compat}/terminal.c                  |   0
 {compat => lib/compat}/terminal.h                  |   0
 {compat => lib/compat}/unsetenv.c                  |   0
 {compat => lib/compat}/vcbuild/.gitignore          |   0
 {compat => lib/compat}/vcbuild/README              |  10 +-
 {compat => lib/compat}/vcbuild/find_vs_env.bat     |   2 +-
 {compat => lib/compat}/vcbuild/include/sys/param.h |   0
 {compat => lib/compat}/vcbuild/include/sys/time.h  |   0
 {compat => lib/compat}/vcbuild/include/sys/utime.h |   0
 {compat => lib/compat}/vcbuild/include/unistd.h    |   0
 {compat => lib/compat}/vcbuild/include/utime.h     |   0
 {compat => lib/compat}/vcbuild/scripts/clink.pl    |   0
 {compat => lib/compat}/vcbuild/scripts/lib.pl      |   0
 {compat => lib/compat}/vcbuild/vcpkg_copy_dlls.bat |   0
 {compat => lib/compat}/vcbuild/vcpkg_install.bat   |   4 +-
 {compat => lib/compat}/win32.h                     |   0
 {compat => lib/compat}/win32/alloca.h              |   0
 {compat => lib/compat}/win32/dirent.c              |   0
 {compat => lib/compat}/win32/dirent.h              |   0
 {compat => lib/compat}/win32/exit-process.h        |   0
 {compat => lib/compat}/win32/flush.c               |   0
 {compat => lib/compat}/win32/git.manifest          |   0
 {compat => lib/compat}/win32/headless.c            |   0
 {compat => lib/compat}/win32/lazyload.h            |   0
 {compat => lib/compat}/win32/path-utils.c          |   0
 {compat => lib/compat}/win32/path-utils.h          |   0
 {compat => lib/compat}/win32/pthread.c             |   0
 {compat => lib/compat}/win32/pthread.h             |   0
 {compat => lib/compat}/win32/syslog.c              |   0
 {compat => lib/compat}/win32/syslog.h              |   0
 .../compat}/win32/trace2_win32_process_info.c      |   0
 {compat => lib/compat}/win32mmap.c                 |   0
 {compat => lib/compat}/winansi.c                   |   0
 {compat => lib/compat}/zlib-compat.h               |   0
 .../compiler-tricks}/not-constant.c                |   0
 config.c => lib/config.c                           |   0
 config.h => lib/config.h                           |   0
 connect.c => lib/connect.c                         |   0
 connect.h => lib/connect.h                         |   0
 connected.c => lib/connected.c                     |   0
 connected.h => lib/connected.h                     |   0
 convert.c => lib/convert.c                         |   0
 convert.h => lib/convert.h                         |   0
 copy.c => lib/copy.c                               |   0
 copy.h => lib/copy.h                               |   0
 credential.c => lib/credential.c                   |   0
 credential.h => lib/credential.h                   |   0
 csum-file.c => lib/csum-file.c                     |   0
 csum-file.h => lib/csum-file.h                     |   0
 ctype.c => lib/ctype.c                             |   0
 date.c => lib/date.c                               |   0
 date.h => lib/date.h                               |   0
 decorate.c => lib/decorate.c                       |   0
 decorate.h => lib/decorate.h                       |   0
 delta-islands.c => lib/delta-islands.c             |   0
 delta-islands.h => lib/delta-islands.h             |   0
 delta.h => lib/delta.h                             |   0
 diagnose.c => lib/diagnose.c                       |   0
 diagnose.h => lib/diagnose.h                       |   0
 diff-delta.c => lib/diff-delta.c                   |   0
 diff-lib.c => lib/diff-lib.c                       |   0
 diff-merges.c => lib/diff-merges.c                 |   0
 diff-merges.h => lib/diff-merges.h                 |   0
 diff-no-index.c => lib/diff-no-index.c             |   0
 diff.c => lib/diff.c                               |   0
 diff.h => lib/diff.h                               |   0
 diffcore-break.c => lib/diffcore-break.c           |   0
 diffcore-delta.c => lib/diffcore-delta.c           |   0
 diffcore-order.c => lib/diffcore-order.c           |   0
 diffcore-pickaxe.c => lib/diffcore-pickaxe.c       |   0
 diffcore-rename.c => lib/diffcore-rename.c         |   0
 diffcore-rotate.c => lib/diffcore-rotate.c         |   0
 diffcore.h => lib/diffcore.h                       |   0
 dir-iterator.c => lib/dir-iterator.c               |   0
 dir-iterator.h => lib/dir-iterator.h               |   0
 dir.c => lib/dir.c                                 |   0
 dir.h => lib/dir.h                                 |   0
 editor.c => lib/editor.c                           |   0
 editor.h => lib/editor.h                           |   0
 entry.c => lib/entry.c                             |   0
 entry.h => lib/entry.h                             |   0
 environment.c => lib/environment.c                 |   0
 environment.h => lib/environment.h                 |   0
 {ewah => lib/ewah}/bitmap.c                        |   0
 {ewah => lib/ewah}/ewah_bitmap.c                   |   0
 {ewah => lib/ewah}/ewah_io.c                       |   0
 {ewah => lib/ewah}/ewah_rlw.c                      |   0
 {ewah => lib/ewah}/ewok.h                          |   0
 {ewah => lib/ewah}/ewok_rlw.h                      |   0
 exec-cmd.c => lib/exec-cmd.c                       |   0
 exec-cmd.h => lib/exec-cmd.h                       |   0
 fetch-negotiator.c => lib/fetch-negotiator.c       |   0
 fetch-negotiator.h => lib/fetch-negotiator.h       |   0
 fetch-pack.c => lib/fetch-pack.c                   |   0
 fetch-pack.h => lib/fetch-pack.h                   |   0
 fmt-merge-msg.c => lib/fmt-merge-msg.c             |   0
 fmt-merge-msg.h => lib/fmt-merge-msg.h             |   0
 for-each-ref.h => lib/for-each-ref.h               |   0
 fsck.c => lib/fsck.c                               |   0
 fsck.h => lib/fsck.h                               |   0
 fsmonitor--daemon.h => lib/fsmonitor--daemon.h     |   0
 fsmonitor-ipc.c => lib/fsmonitor-ipc.c             |   0
 fsmonitor-ipc.h => lib/fsmonitor-ipc.h             |   0
 fsmonitor-ll.h => lib/fsmonitor-ll.h               |   0
 .../fsmonitor-path-utils.h                         |   0
 fsmonitor-settings.c => lib/fsmonitor-settings.c   |   0
 fsmonitor-settings.h => lib/fsmonitor-settings.h   |   0
 fsmonitor.c => lib/fsmonitor.c                     |   0
 fsmonitor.h => lib/fsmonitor.h                     |   0
 gettext.c => lib/gettext.c                         |   0
 gettext.h => lib/gettext.h                         |   0
 git-compat-util.h => lib/git-compat-util.h         |   0
 git-curl-compat.h => lib/git-curl-compat.h         |   0
 git-zlib.c => lib/git-zlib.c                       |   0
 git-zlib.h => lib/git-zlib.h                       |   0
 gpg-interface.c => lib/gpg-interface.c             |   0
 gpg-interface.h => lib/gpg-interface.h             |   0
 graph.c => lib/graph.c                             |   0
 graph.h => lib/graph.h                             |   0
 grep.c => lib/grep.c                               |   0
 grep.h => lib/grep.h                               |   0
 hash-lookup.c => lib/hash-lookup.c                 |   0
 hash-lookup.h => lib/hash-lookup.h                 |   0
 hash.c => lib/hash.c                               |   0
 hash.h => lib/hash.h                               |   0
 hashmap.c => lib/hashmap.c                         |   0
 hashmap.h => lib/hashmap.h                         |   0
 help.c => lib/help.c                               |   0
 help.h => lib/help.h                               |   0
 hex-ll.c => lib/hex-ll.c                           |   0
 hex-ll.h => lib/hex-ll.h                           |   0
 hex.c => lib/hex.c                                 |   0
 hex.h => lib/hex.h                                 |   0
 hook.c => lib/hook.c                               |   0
 hook.h => lib/hook.h                               |   0
 http-walker.c => lib/http-walker.c                 |   0
 http.c => lib/http.c                               |   0
 http.h => lib/http.h                               |   0
 ident.c => lib/ident.c                             |   0
 ident.h => lib/ident.h                             |   0
 iterator.h => lib/iterator.h                       |   0
 json-writer.c => lib/json-writer.c                 |   0
 json-writer.h => lib/json-writer.h                 |   0
 khash.h => lib/khash.h                             |   0
 kwset.c => lib/kwset.c                             |   0
 kwset.h => lib/kwset.h                             |   0
 levenshtein.c => lib/levenshtein.c                 |   0
 levenshtein.h => lib/levenshtein.h                 |   0
 line-log.c => lib/line-log.c                       |   0
 line-log.h => lib/line-log.h                       |   0
 line-range.c => lib/line-range.c                   |   0
 line-range.h => lib/line-range.h                   |   0
 linear-assignment.c => lib/linear-assignment.c     |   0
 linear-assignment.h => lib/linear-assignment.h     |   0
 .../list-objects-filter-options.c                  |   0
 .../list-objects-filter-options.h                  |   0
 list-objects-filter.c => lib/list-objects-filter.c |   0
 list-objects-filter.h => lib/list-objects-filter.h |   0
 list-objects.c => lib/list-objects.c               |   0
 list-objects.h => lib/list-objects.h               |   0
 list.h => lib/list.h                               |   0
 lockfile.c => lib/lockfile.c                       |   0
 lockfile.h => lib/lockfile.h                       |   0
 log-tree.c => lib/log-tree.c                       |   0
 log-tree.h => lib/log-tree.h                       |   0
 loose.c => lib/loose.c                             |   0
 loose.h => lib/loose.h                             |   0
 ls-refs.c => lib/ls-refs.c                         |   0
 ls-refs.h => lib/ls-refs.h                         |   0
 mailinfo.c => lib/mailinfo.c                       |   0
 mailinfo.h => lib/mailinfo.h                       |   0
 mailmap.c => lib/mailmap.c                         |   0
 mailmap.h => lib/mailmap.h                         |   0
 match-trees.c => lib/match-trees.c                 |   0
 match-trees.h => lib/match-trees.h                 |   0
 mem-pool.c => lib/mem-pool.c                       |   0
 mem-pool.h => lib/mem-pool.h                       |   0
 merge-blobs.c => lib/merge-blobs.c                 |   0
 merge-blobs.h => lib/merge-blobs.h                 |   0
 merge-ll.c => lib/merge-ll.c                       |   0
 merge-ll.h => lib/merge-ll.h                       |   0
 merge-ort-wrappers.c => lib/merge-ort-wrappers.c   |   0
 merge-ort-wrappers.h => lib/merge-ort-wrappers.h   |   0
 merge-ort.c => lib/merge-ort.c                     |   0
 merge-ort.h => lib/merge-ort.h                     |   0
 merge.c => lib/merge.c                             |   0
 merge.h => lib/merge.h                             |   0
 mergesort.h => lib/mergesort.h                     |   0
 midx-write.c => lib/midx-write.c                   |   0
 midx.c => lib/midx.c                               |   0
 midx.h => lib/midx.h                               |   0
 name-hash.c => lib/name-hash.c                     |   0
 name-hash.h => lib/name-hash.h                     |   0
 {negotiator => lib/negotiator}/default.c           |   0
 {negotiator => lib/negotiator}/default.h           |   0
 {negotiator => lib/negotiator}/noop.c              |   0
 {negotiator => lib/negotiator}/noop.h              |   0
 {negotiator => lib/negotiator}/skipping.c          |   0
 {negotiator => lib/negotiator}/skipping.h          |   0
 notes-cache.c => lib/notes-cache.c                 |   0
 notes-cache.h => lib/notes-cache.h                 |   0
 notes-merge.c => lib/notes-merge.c                 |   0
 notes-merge.h => lib/notes-merge.h                 |   0
 notes-utils.c => lib/notes-utils.c                 |   0
 notes-utils.h => lib/notes-utils.h                 |   0
 notes.c => lib/notes.c                             |   0
 notes.h => lib/notes.h                             |   0
 object-file-convert.c => lib/object-file-convert.c |   0
 object-file-convert.h => lib/object-file-convert.h |   0
 object-file.c => lib/object-file.c                 |   0
 object-file.h => lib/object-file.h                 |   0
 object-name.c => lib/object-name.c                 |   0
 object-name.h => lib/object-name.h                 |   0
 object.c => lib/object.c                           |   0
 object.h => lib/object.h                           |   0
 odb.c => lib/odb.c                                 |   0
 odb.h => lib/odb.h                                 |   0
 {odb => lib/odb}/source-files.c                    |   0
 {odb => lib/odb}/source-files.h                    |   0
 {odb => lib/odb}/source-inmemory.c                 |   0
 {odb => lib/odb}/source-inmemory.h                 |   0
 {odb => lib/odb}/source-loose.c                    |   0
 {odb => lib/odb}/source-loose.h                    |   0
 {odb => lib/odb}/source-packed.c                   |   0
 {odb => lib/odb}/source-packed.h                   |   0
 {odb => lib/odb}/source.c                          |   0
 {odb => lib/odb}/source.h                          |   0
 {odb => lib/odb}/streaming.c                       |   0
 {odb => lib/odb}/streaming.h                       |   0
 {odb => lib/odb}/transaction.c                     |   0
 {odb => lib/odb}/transaction.h                     |   0
 oid-array.c => lib/oid-array.c                     |   0
 oid-array.h => lib/oid-array.h                     |   0
 oidmap.c => lib/oidmap.c                           |   0
 oidmap.h => lib/oidmap.h                           |   0
 oidset.c => lib/oidset.c                           |   0
 oidset.h => lib/oidset.h                           |   0
 oidtree.c => lib/oidtree.c                         |   0
 oidtree.h => lib/oidtree.h                         |   0
 pack-bitmap-write.c => lib/pack-bitmap-write.c     |   0
 pack-bitmap.c => lib/pack-bitmap.c                 |   0
 pack-bitmap.h => lib/pack-bitmap.h                 |   0
 pack-check.c => lib/pack-check.c                   |   0
 pack-mtimes.c => lib/pack-mtimes.c                 |   0
 pack-mtimes.h => lib/pack-mtimes.h                 |   0
 pack-objects.c => lib/pack-objects.c               |   0
 pack-objects.h => lib/pack-objects.h               |   0
 pack-refs.c => lib/pack-refs.c                     |   0
 pack-refs.h => lib/pack-refs.h                     |   0
 pack-revindex.c => lib/pack-revindex.c             |   0
 pack-revindex.h => lib/pack-revindex.h             |   0
 pack-write.c => lib/pack-write.c                   |   0
 pack.h => lib/pack.h                               |   0
 packfile-list.c => lib/packfile-list.c             |   0
 packfile-list.h => lib/packfile-list.h             |   0
 packfile.c => lib/packfile.c                       |   0
 packfile.h => lib/packfile.h                       |   0
 pager.c => lib/pager.c                             |   0
 pager.h => lib/pager.h                             |   0
 parallel-checkout.c => lib/parallel-checkout.c     |   0
 parallel-checkout.h => lib/parallel-checkout.h     |   0
 parse-options-cb.c => lib/parse-options-cb.c       |   0
 parse-options.c => lib/parse-options.c             |   0
 parse-options.h => lib/parse-options.h             |   0
 parse.c => lib/parse.c                             |   0
 parse.h => lib/parse.h                             |   0
 patch-delta.c => lib/patch-delta.c                 |   0
 patch-ids.c => lib/patch-ids.c                     |   0
 patch-ids.h => lib/patch-ids.h                     |   0
 path-walk.c => lib/path-walk.c                     |   0
 path-walk.h => lib/path-walk.h                     |   0
 path.c => lib/path.c                               |   0
 path.h => lib/path.h                               |   0
 pathspec.c => lib/pathspec.c                       |   0
 pathspec.h => lib/pathspec.h                       |   0
 pkt-line.c => lib/pkt-line.c                       |   0
 pkt-line.h => lib/pkt-line.h                       |   0
 preload-index.c => lib/preload-index.c             |   0
 preload-index.h => lib/preload-index.h             |   0
 pretty.c => lib/pretty.c                           |   0
 pretty.h => lib/pretty.h                           |   0
 prio-queue.c => lib/prio-queue.c                   |   0
 prio-queue.h => lib/prio-queue.h                   |   0
 progress.c => lib/progress.c                       |   0
 progress.h => lib/progress.h                       |   0
 promisor-remote.c => lib/promisor-remote.c         |   0
 promisor-remote.h => lib/promisor-remote.h         |   0
 prompt.c => lib/prompt.c                           |   0
 prompt.h => lib/prompt.h                           |   0
 protocol-caps.c => lib/protocol-caps.c             |   0
 protocol-caps.h => lib/protocol-caps.h             |   0
 protocol.c => lib/protocol.c                       |   0
 protocol.h => lib/protocol.h                       |   0
 prune-packed.c => lib/prune-packed.c               |   0
 prune-packed.h => lib/prune-packed.h               |   0
 pseudo-merge.c => lib/pseudo-merge.c               |   0
 pseudo-merge.h => lib/pseudo-merge.h               |   0
 quote.c => lib/quote.c                             |   0
 quote.h => lib/quote.h                             |   0
 range-diff.c => lib/range-diff.c                   |   0
 range-diff.h => lib/range-diff.h                   |   0
 reachable.c => lib/reachable.c                     |   0
 reachable.h => lib/reachable.h                     |   0
 read-cache-ll.h => lib/read-cache-ll.h             |   0
 read-cache.c => lib/read-cache.c                   |   0
 read-cache.h => lib/read-cache.h                   |   0
 rebase-interactive.c => lib/rebase-interactive.c   |   0
 rebase-interactive.h => lib/rebase-interactive.h   |   0
 rebase.c => lib/rebase.c                           |   0
 rebase.h => lib/rebase.h                           |   0
 ref-filter.c => lib/ref-filter.c                   |   0
 ref-filter.h => lib/ref-filter.h                   |   0
 reflog-walk.c => lib/reflog-walk.c                 |   0
 reflog-walk.h => lib/reflog-walk.h                 |   0
 reflog.c => lib/reflog.c                           |   0
 reflog.h => lib/reflog.h                           |   0
 refs.c => lib/refs.c                               |   0
 refs.h => lib/refs.h                               |   0
 {refs => lib/refs}/debug.c                         |   0
 {refs => lib/refs}/files-backend.c                 |   0
 {refs => lib/refs}/iterator.c                      |   0
 {refs => lib/refs}/packed-backend.c                |   0
 {refs => lib/refs}/packed-backend.h                |   0
 {refs => lib/refs}/ref-cache.c                     |   0
 {refs => lib/refs}/ref-cache.h                     |   0
 {refs => lib/refs}/refs-internal.h                 |   0
 {refs => lib/refs}/reftable-backend.c              |   0
 refspec.c => lib/refspec.c                         |   0
 refspec.h => lib/refspec.h                         |   0
 {reftable => lib/reftable}/LICENSE                 |   0
 {reftable => lib/reftable}/basics.c                |   0
 {reftable => lib/reftable}/basics.h                |   0
 {reftable => lib/reftable}/block.c                 |   0
 {reftable => lib/reftable}/block.h                 |   0
 {reftable => lib/reftable}/blocksource.c           |   0
 {reftable => lib/reftable}/blocksource.h           |   0
 {reftable => lib/reftable}/constants.h             |   0
 {reftable => lib/reftable}/error.c                 |   0
 {reftable => lib/reftable}/fsck.c                  |   0
 {reftable => lib/reftable}/iter.c                  |   0
 {reftable => lib/reftable}/iter.h                  |   0
 {reftable => lib/reftable}/merged.c                |   0
 {reftable => lib/reftable}/merged.h                |   0
 {reftable => lib/reftable}/pq.c                    |   0
 {reftable => lib/reftable}/pq.h                    |   0
 {reftable => lib/reftable}/record.c                |   0
 {reftable => lib/reftable}/record.h                |   0
 {reftable => lib/reftable}/reftable-basics.h       |   0
 {reftable => lib/reftable}/reftable-block.h        |   0
 {reftable => lib/reftable}/reftable-blocksource.h  |   0
 {reftable => lib/reftable}/reftable-constants.h    |   0
 {reftable => lib/reftable}/reftable-error.h        |   0
 {reftable => lib/reftable}/reftable-fsck.h         |   0
 {reftable => lib/reftable}/reftable-iterator.h     |   0
 {reftable => lib/reftable}/reftable-merged.h       |   0
 {reftable => lib/reftable}/reftable-record.h       |   0
 {reftable => lib/reftable}/reftable-stack.h        |   0
 {reftable => lib/reftable}/reftable-system.h       |   0
 {reftable => lib/reftable}/reftable-table.h        |   0
 {reftable => lib/reftable}/reftable-writer.h       |   0
 {reftable => lib/reftable}/stack.c                 |   0
 {reftable => lib/reftable}/stack.h                 |   0
 {reftable => lib/reftable}/system.c                |   0
 {reftable => lib/reftable}/system.h                |   0
 {reftable => lib/reftable}/table.c                 |   0
 {reftable => lib/reftable}/table.h                 |   0
 {reftable => lib/reftable}/tree.c                  |   0
 {reftable => lib/reftable}/tree.h                  |   0
 {reftable => lib/reftable}/writer.c                |   0
 {reftable => lib/reftable}/writer.h                |   0
 remote.c => lib/remote.c                           |   0
 remote.h => lib/remote.h                           |   0
 repack-cruft.c => lib/repack-cruft.c               |   0
 repack-filtered.c => lib/repack-filtered.c         |   0
 repack-geometry.c => lib/repack-geometry.c         |   0
 repack-midx.c => lib/repack-midx.c                 |   0
 repack-promisor.c => lib/repack-promisor.c         |   0
 repack.c => lib/repack.c                           |   0
 repack.h => lib/repack.h                           |   0
 replace-object.c => lib/replace-object.c           |   0
 replace-object.h => lib/replace-object.h           |   0
 replay.c => lib/replay.c                           |   0
 replay.h => lib/replay.h                           |   0
 repo-settings.c => lib/repo-settings.c             |   0
 repo-settings.h => lib/repo-settings.h             |   0
 repository.c => lib/repository.c                   |   0
 repository.h => lib/repository.h                   |   0
 rerere.c => lib/rerere.c                           |   0
 rerere.h => lib/rerere.h                           |   0
 reset.c => lib/reset.c                             |   0
 reset.h => lib/reset.h                             |   0
 resolve-undo.c => lib/resolve-undo.c               |   0
 resolve-undo.h => lib/resolve-undo.h               |   0
 revision.c => lib/revision.c                       |   0
 revision.h => lib/revision.h                       |   0
 run-command.c => lib/run-command.c                 |   0
 run-command.h => lib/run-command.h                 |   0
 sane-ctype.h => lib/sane-ctype.h                   |   0
 send-pack.c => lib/send-pack.c                     |   0
 send-pack.h => lib/send-pack.h                     |   0
 sequencer.c => lib/sequencer.c                     |   0
 sequencer.h => lib/sequencer.h                     |   0
 serve.c => lib/serve.c                             |   0
 serve.h => lib/serve.h                             |   0
 server-info.c => lib/server-info.c                 |   0
 server-info.h => lib/server-info.h                 |   0
 setup.c => lib/setup.c                             |   0
 setup.h => lib/setup.h                             |   0
 {sha1 => lib/sha1}/openssl.h                       |   0
 .../sha1collisiondetection                         |   0
 {sha1dc => lib/sha1dc}/.gitattributes              |   0
 {sha1dc => lib/sha1dc}/LICENSE.txt                 |   0
 {sha1dc => lib/sha1dc}/sha1.c                      |   0
 {sha1dc => lib/sha1dc}/sha1.h                      |   0
 {sha1dc => lib/sha1dc}/ubc_check.c                 |   0
 {sha1dc => lib/sha1dc}/ubc_check.h                 |   0
 sha1dc_git.c => lib/sha1dc_git.c                   |   0
 sha1dc_git.h => lib/sha1dc_git.h                   |   0
 {sha256 => lib/sha256}/block/sha256.c              |   0
 {sha256 => lib/sha256}/block/sha256.h              |   0
 {sha256 => lib/sha256}/gcrypt.h                    |   0
 {sha256 => lib/sha256}/nettle.h                    |   0
 {sha256 => lib/sha256}/openssl.h                   |   0
 shallow.c => lib/shallow.c                         |   0
 shallow.h => lib/shallow.h                         |   0
 shortlog.h => lib/shortlog.h                       |   0
 sideband.c => lib/sideband.c                       |   0
 sideband.h => lib/sideband.h                       |   0
 sigchain.c => lib/sigchain.c                       |   0
 sigchain.h => lib/sigchain.h                       |   0
 simple-ipc.h => lib/simple-ipc.h                   |   0
 sparse-index.c => lib/sparse-index.c               |   0
 sparse-index.h => lib/sparse-index.h               |   0
 split-index.c => lib/split-index.c                 |   0
 split-index.h => lib/split-index.h                 |   0
 stable-qsort.c => lib/stable-qsort.c               |   0
 statinfo.c => lib/statinfo.c                       |   0
 statinfo.h => lib/statinfo.h                       |   0
 strbuf.c => lib/strbuf.c                           |   0
 strbuf.h => lib/strbuf.h                           |   0
 string-list.c => lib/string-list.c                 |   0
 string-list.h => lib/string-list.h                 |   0
 strmap.c => lib/strmap.c                           |   0
 strmap.h => lib/strmap.h                           |   0
 strvec.c => lib/strvec.c                           |   0
 strvec.h => lib/strvec.h                           |   0
 sub-process.c => lib/sub-process.c                 |   0
 sub-process.h => lib/sub-process.h                 |   0
 submodule-config.c => lib/submodule-config.c       |   0
 submodule-config.h => lib/submodule-config.h       |   0
 submodule.c => lib/submodule.c                     |   0
 submodule.h => lib/submodule.h                     |   0
 symlinks.c => lib/symlinks.c                       |   0
 symlinks.h => lib/symlinks.h                       |   0
 tag.c => lib/tag.c                                 |   0
 tag.h => lib/tag.h                                 |   0
 tar.h => lib/tar.h                                 |   0
 tempfile.c => lib/tempfile.c                       |   0
 tempfile.h => lib/tempfile.h                       |   0
 thread-utils.c => lib/thread-utils.c               |   0
 thread-utils.h => lib/thread-utils.h               |   0
 tmp-objdir.c => lib/tmp-objdir.c                   |   0
 tmp-objdir.h => lib/tmp-objdir.h                   |   0
 trace.c => lib/trace.c                             |   0
 trace.h => lib/trace.h                             |   0
 trace2.c => lib/trace2.c                           |   0
 trace2.h => lib/trace2.h                           |   0
 {trace2 => lib/trace2}/tr2_cfg.c                   |   0
 {trace2 => lib/trace2}/tr2_cfg.h                   |   0
 {trace2 => lib/trace2}/tr2_cmd_name.c              |   0
 {trace2 => lib/trace2}/tr2_cmd_name.h              |   0
 {trace2 => lib/trace2}/tr2_ctr.c                   |   0
 {trace2 => lib/trace2}/tr2_ctr.h                   |   0
 {trace2 => lib/trace2}/tr2_dst.c                   |   0
 {trace2 => lib/trace2}/tr2_dst.h                   |   0
 {trace2 => lib/trace2}/tr2_sid.c                   |   0
 {trace2 => lib/trace2}/tr2_sid.h                   |   0
 {trace2 => lib/trace2}/tr2_sysenv.c                |   0
 {trace2 => lib/trace2}/tr2_sysenv.h                |   0
 {trace2 => lib/trace2}/tr2_tbuf.c                  |   0
 {trace2 => lib/trace2}/tr2_tbuf.h                  |   0
 {trace2 => lib/trace2}/tr2_tgt.h                   |   0
 {trace2 => lib/trace2}/tr2_tgt_event.c             |   0
 {trace2 => lib/trace2}/tr2_tgt_normal.c            |   0
 {trace2 => lib/trace2}/tr2_tgt_perf.c              |   0
 {trace2 => lib/trace2}/tr2_tls.c                   |   0
 {trace2 => lib/trace2}/tr2_tls.h                   |   0
 {trace2 => lib/trace2}/tr2_tmr.c                   |   0
 {trace2 => lib/trace2}/tr2_tmr.h                   |   0
 trailer.c => lib/trailer.c                         |   0
 trailer.h => lib/trailer.h                         |   0
 transport-helper.c => lib/transport-helper.c       |   0
 transport-internal.h => lib/transport-internal.h   |   0
 transport.c => lib/transport.c                     |   0
 transport.h => lib/transport.h                     |   0
 tree-diff.c => lib/tree-diff.c                     |   0
 tree-walk.c => lib/tree-walk.c                     |   0
 tree-walk.h => lib/tree-walk.h                     |   0
 tree.c => lib/tree.c                               |   0
 tree.h => lib/tree.h                               |   0
 unicode-width.h => lib/unicode-width.h             |   0
 unix-socket.c => lib/unix-socket.c                 |   0
 unix-socket.h => lib/unix-socket.h                 |   0
 unix-stream-server.c => lib/unix-stream-server.c   |   0
 unix-stream-server.h => lib/unix-stream-server.h   |   0
 unpack-trees.c => lib/unpack-trees.c               |   0
 unpack-trees.h => lib/unpack-trees.h               |   0
 upload-pack.c => lib/upload-pack.c                 |   0
 upload-pack.h => lib/upload-pack.h                 |   0
 url.c => lib/url.c                                 |   0
 url.h => lib/url.h                                 |   0
 urlmatch.c => lib/urlmatch.c                       |   0
 urlmatch.h => lib/urlmatch.h                       |   0
 usage.c => lib/usage.c                             |   0
 userdiff.c => lib/userdiff.c                       |   0
 userdiff.h => lib/userdiff.h                       |   0
 utf8.c => lib/utf8.c                               |   0
 utf8.h => lib/utf8.h                               |   0
 varint.c => lib/varint.c                           |   0
 varint.h => lib/varint.h                           |   0
 version-def.h.in => lib/version-def.h.in           |   0
 version.c => lib/version.c                         |   0
 version.h => lib/version.h                         |   0
 versioncmp.c => lib/versioncmp.c                   |   0
 versioncmp.h => lib/versioncmp.h                   |   0
 walker.c => lib/walker.c                           |   0
 walker.h => lib/walker.h                           |   0
 wildmatch.c => lib/wildmatch.c                     |   0
 wildmatch.h => lib/wildmatch.h                     |   0
 worktree.c => lib/worktree.c                       |   0
 worktree.h => lib/worktree.h                       |   0
 wrapper.c => lib/wrapper.c                         |   0
 wrapper.h => lib/wrapper.h                         |   0
 write-or-die.c => lib/write-or-die.c               |   0
 write-or-die.h => lib/write-or-die.h               |   0
 ws.c => lib/ws.c                                   |   0
 ws.h => lib/ws.h                                   |   0
 wt-status.c => lib/wt-status.c                     |   0
 wt-status.h => lib/wt-status.h                     |   0
 xdiff-interface.c => lib/xdiff-interface.c         |   0
 xdiff-interface.h => lib/xdiff-interface.h         |   0
 {xdiff => lib/xdiff}/xdiff.h                       |   0
 {xdiff => lib/xdiff}/xdiffi.c                      |   0
 {xdiff => lib/xdiff}/xdiffi.h                      |   0
 {xdiff => lib/xdiff}/xemit.c                       |   0
 {xdiff => lib/xdiff}/xemit.h                       |   0
 {xdiff => lib/xdiff}/xhistogram.c                  |   0
 {xdiff => lib/xdiff}/xinclude.h                    |   0
 {xdiff => lib/xdiff}/xmacros.h                     |   0
 {xdiff => lib/xdiff}/xmerge.c                      |   0
 {xdiff => lib/xdiff}/xpatience.c                   |   0
 {xdiff => lib/xdiff}/xprepare.c                    |   0
 {xdiff => lib/xdiff}/xprepare.h                    |   0
 {xdiff => lib/xdiff}/xtypes.h                      |   0
 {xdiff => lib/xdiff}/xutils.c                      |   0
 {xdiff => lib/xdiff}/xutils.h                      |   0
 meson.build                                        | 700 +++++++++----------
 703 files changed, 823 insertions(+), 821 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index cf341d74db..accf456945 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -179,21 +179,22 @@ jobs:
       uses: actions/checkout@v6
       with:
         repository: 'microsoft/vcpkg'
-        path: 'compat/vcbuild/vcpkg'
+        path: 'lib/compat/vcbuild/vcpkg'
     - name: download vcpkg artifacts
       uses: git-for-windows/get-azure-pipelines-artifact@v0
       with:
         repository: git/git
         definitionId: 9
+        path: lib/compat
     - name: add msbuild to PATH
       uses: microsoft/setup-msbuild@v3
     - name: copy dlls to root
       shell: cmd
-      run: compat\vcbuild\vcpkg_copy_dlls.bat release
+      run: lib\compat\vcbuild\vcpkg_copy_dlls.bat release
     - name: generate Visual Studio solution
       shell: bash
       run: |
-        cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows \
+        cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/lib/compat/vcbuild/vcpkg/installed/x64-windows \
         -DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON
     - name: MSBuild
       run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142
@@ -201,7 +202,7 @@ jobs:
       shell: bash
       env:
         MSVC: 1
-        VCPKG_ROOT: ${{github.workspace}}\compat\vcbuild\vcpkg
+        VCPKG_ROOT: ${{github.workspace}}\lib\compat\vcbuild\vcpkg
       run: |
         mkdir -p artifacts &&
         eval "$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)"
diff --git a/.gitmodules b/.gitmodules
index cbeebdab7a..8bafb8bb49 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,4 @@
 [submodule "sha1collisiondetection"]
-	path = sha1collisiondetection
+	path = lib/sha1collisiondetection
 	url = https://github.com/cr-marcstevens/sha1collisiondetection.git
 	branch = master
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 2699f0b24a..c4fd5a5c87 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -505,10 +505,10 @@ lint-docs-man-section-order: $(LINT_DOCS_MAN_SECTION_ORDER)
 .PHONY: lint-docs-fsck-msgids
 LINT_DOCS_FSCK_MSGIDS = .build/lint-docs/fsck-msgids.ok
 $(LINT_DOCS_FSCK_MSGIDS): lint-fsck-msgids.perl
-$(LINT_DOCS_FSCK_MSGIDS): ../fsck.h fsck-msgids.adoc
+$(LINT_DOCS_FSCK_MSGIDS): ../lib/fsck.h fsck-msgids.adoc
 	$(call mkdir_p_parent_template)
 	$(QUIET_GEN)$(PERL_PATH) lint-fsck-msgids.perl \
-		../fsck.h fsck-msgids.adoc $@
+		../lib/fsck.h fsck-msgids.adoc $@
 lint-docs-fsck-msgids: $(LINT_DOCS_FSCK_MSGIDS)
 
 ## Lint: delimited sections
diff --git a/Makefile b/Makefile
index 1f3f099f5c..4afe497ab3 100644
--- a/Makefile
+++ b/Makefile
@@ -967,7 +967,7 @@ endif
 CFLAGS = -g -O2 -Wall
 LDFLAGS =
 CC_LD_DYNPATH = -Wl,-rpath,
-BASIC_CFLAGS = -I.
+BASIC_CFLAGS = -I. -Ilib
 BASIC_LDFLAGS =
 
 # library flags
@@ -992,7 +992,7 @@ SANITIZE_LEAK =
 SANITIZE_ADDRESS =
 
 # For the 'coccicheck' target
-SPATCH_INCLUDE_FLAGS = --all-includes $(addprefix -I ,compat ewah refs sha256 trace2 win32 xdiff)
+SPATCH_INCLUDE_FLAGS = --all-includes $(addprefix -I lib/,compat ewah refs sha256 trace2 win32 xdiff)
 SPATCH_FLAGS =
 SPATCH_TEST_FLAGS =
 
@@ -1083,297 +1083,297 @@ FOUND_SOURCE_FILES := $(filter-out $(GENERATED_H),$(shell $(SOURCES_CMD)))
 FOUND_C_SOURCES = $(filter %.c,$(FOUND_SOURCE_FILES))
 FOUND_H_SOURCES = $(filter %.h,$(FOUND_SOURCE_FILES))
 
-COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES) reftable/%,$(FOUND_C_SOURCES))
+COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES) lib/reftable/%,$(FOUND_C_SOURCES))
 
 LIB_H = $(FOUND_H_SOURCES)
 
-LIB_OBJS += abspath.o
-LIB_OBJS += add-interactive.o
-LIB_OBJS += add-patch.o
-LIB_OBJS += advice.o
-LIB_OBJS += alias.o
-LIB_OBJS += alloc.o
-LIB_OBJS += apply.o
-LIB_OBJS += archive-tar.o
-LIB_OBJS += archive-zip.o
-LIB_OBJS += archive.o
-LIB_OBJS += attr.o
-LIB_OBJS += base85.o
-LIB_OBJS += bisect.o
-LIB_OBJS += blame.o
-LIB_OBJS += blob.o
-LIB_OBJS += bloom.o
-LIB_OBJS += branch.o
-LIB_OBJS += bundle-uri.o
-LIB_OBJS += bundle.o
-LIB_OBJS += cache-tree.o
-LIB_OBJS += cbtree.o
-LIB_OBJS += chdir-notify.o
-LIB_OBJS += checkout.o
-LIB_OBJS += chunk-format.o
-LIB_OBJS += color.o
-LIB_OBJS += column.o
-LIB_OBJS += combine-diff.o
-LIB_OBJS += commit-graph.o
-LIB_OBJS += commit-reach.o
-LIB_OBJS += commit.o
-LIB_OBJS += common-exit.o
-LIB_OBJS += common-init.o
-LIB_OBJS += compat/nonblock.o
-LIB_OBJS += compat/obstack.o
-LIB_OBJS += compat/open.o
-LIB_OBJS += compat/terminal.o
-LIB_OBJS += compiler-tricks/not-constant.o
-LIB_OBJS += config.o
-LIB_OBJS += connect.o
-LIB_OBJS += connected.o
-LIB_OBJS += convert.o
-LIB_OBJS += copy.o
-LIB_OBJS += credential.o
-LIB_OBJS += csum-file.o
-LIB_OBJS += ctype.o
-LIB_OBJS += date.o
-LIB_OBJS += decorate.o
-LIB_OBJS += delta-islands.o
-LIB_OBJS += diagnose.o
-LIB_OBJS += diff-delta.o
-LIB_OBJS += diff-merges.o
-LIB_OBJS += diff-lib.o
-LIB_OBJS += diff-no-index.o
-LIB_OBJS += diff.o
-LIB_OBJS += diffcore-break.o
-LIB_OBJS += diffcore-delta.o
-LIB_OBJS += diffcore-order.o
-LIB_OBJS += diffcore-pickaxe.o
-LIB_OBJS += diffcore-rename.o
-LIB_OBJS += diffcore-rotate.o
-LIB_OBJS += dir-iterator.o
-LIB_OBJS += dir.o
-LIB_OBJS += editor.o
-LIB_OBJS += entry.o
-LIB_OBJS += environment.o
-LIB_OBJS += ewah/bitmap.o
-LIB_OBJS += ewah/ewah_bitmap.o
-LIB_OBJS += ewah/ewah_io.o
-LIB_OBJS += ewah/ewah_rlw.o
-LIB_OBJS += exec-cmd.o
-LIB_OBJS += fetch-negotiator.o
-LIB_OBJS += fetch-pack.o
-LIB_OBJS += fmt-merge-msg.o
-LIB_OBJS += fsck.o
-LIB_OBJS += fsmonitor.o
-LIB_OBJS += fsmonitor-ipc.o
-LIB_OBJS += fsmonitor-settings.o
-LIB_OBJS += gettext.o
-LIB_OBJS += git-zlib.o
-LIB_OBJS += gpg-interface.o
-LIB_OBJS += graph.o
-LIB_OBJS += grep.o
-LIB_OBJS += hash-lookup.o
-LIB_OBJS += hash.o
-LIB_OBJS += hashmap.o
-LIB_OBJS += help.o
-LIB_OBJS += hex.o
-LIB_OBJS += hex-ll.o
-LIB_OBJS += hook.o
-LIB_OBJS += ident.o
-LIB_OBJS += json-writer.o
-LIB_OBJS += kwset.o
-LIB_OBJS += levenshtein.o
-LIB_OBJS += line-log.o
-LIB_OBJS += line-range.o
-LIB_OBJS += linear-assignment.o
-LIB_OBJS += list-objects-filter-options.o
-LIB_OBJS += list-objects-filter.o
-LIB_OBJS += list-objects.o
-LIB_OBJS += lockfile.o
-LIB_OBJS += log-tree.o
-LIB_OBJS += loose.o
-LIB_OBJS += ls-refs.o
-LIB_OBJS += mailinfo.o
-LIB_OBJS += mailmap.o
-LIB_OBJS += match-trees.o
-LIB_OBJS += mem-pool.o
-LIB_OBJS += merge-blobs.o
-LIB_OBJS += merge-ll.o
-LIB_OBJS += merge-ort.o
-LIB_OBJS += merge-ort-wrappers.o
-LIB_OBJS += merge.o
-LIB_OBJS += midx.o
-LIB_OBJS += midx-write.o
-LIB_OBJS += name-hash.o
-LIB_OBJS += negotiator/default.o
-LIB_OBJS += negotiator/noop.o
-LIB_OBJS += negotiator/skipping.o
-LIB_OBJS += notes-cache.o
-LIB_OBJS += notes-merge.o
-LIB_OBJS += notes-utils.o
-LIB_OBJS += notes.o
-LIB_OBJS += object-file-convert.o
-LIB_OBJS += object-file.o
-LIB_OBJS += object-name.o
-LIB_OBJS += object.o
-LIB_OBJS += odb.o
-LIB_OBJS += odb/source.o
-LIB_OBJS += odb/source-files.o
-LIB_OBJS += odb/source-inmemory.o
-LIB_OBJS += odb/source-loose.o
-LIB_OBJS += odb/source-packed.o
-LIB_OBJS += odb/streaming.o
-LIB_OBJS += odb/transaction.o
-LIB_OBJS += oid-array.o
-LIB_OBJS += oidmap.o
-LIB_OBJS += oidset.o
-LIB_OBJS += oidtree.o
-LIB_OBJS += pack-bitmap-write.o
-LIB_OBJS += pack-bitmap.o
-LIB_OBJS += pack-check.o
-LIB_OBJS += pack-mtimes.o
-LIB_OBJS += pack-objects.o
-LIB_OBJS += pack-refs.o
-LIB_OBJS += pack-revindex.o
-LIB_OBJS += pack-write.o
-LIB_OBJS += packfile.o
-LIB_OBJS += packfile-list.o
-LIB_OBJS += pager.o
-LIB_OBJS += parallel-checkout.o
-LIB_OBJS += parse.o
-LIB_OBJS += parse-options-cb.o
-LIB_OBJS += parse-options.o
-LIB_OBJS += patch-delta.o
-LIB_OBJS += patch-ids.o
-LIB_OBJS += path.o
-LIB_OBJS += path-walk.o
-LIB_OBJS += pathspec.o
-LIB_OBJS += pkt-line.o
-LIB_OBJS += preload-index.o
-LIB_OBJS += pretty.o
-LIB_OBJS += prio-queue.o
-LIB_OBJS += progress.o
-LIB_OBJS += promisor-remote.o
-LIB_OBJS += prompt.o
-LIB_OBJS += protocol.o
-LIB_OBJS += protocol-caps.o
-LIB_OBJS += prune-packed.o
-LIB_OBJS += pseudo-merge.o
-LIB_OBJS += quote.o
-LIB_OBJS += range-diff.o
-LIB_OBJS += reachable.o
-LIB_OBJS += read-cache.o
-LIB_OBJS += rebase-interactive.o
-LIB_OBJS += rebase.o
-LIB_OBJS += ref-filter.o
-LIB_OBJS += reflog-walk.o
-LIB_OBJS += reflog.o
-LIB_OBJS += refs.o
-LIB_OBJS += refs/debug.o
-LIB_OBJS += refs/files-backend.o
-LIB_OBJS += refs/reftable-backend.o
-LIB_OBJS += refs/iterator.o
-LIB_OBJS += refs/packed-backend.o
-LIB_OBJS += refs/ref-cache.o
-LIB_OBJS += refspec.o
-LIB_OBJS += reftable/basics.o
-LIB_OBJS += reftable/block.o
-LIB_OBJS += reftable/blocksource.o
-LIB_OBJS += reftable/error.o
-LIB_OBJS += reftable/fsck.o
-LIB_OBJS += reftable/iter.o
-LIB_OBJS += reftable/merged.o
-LIB_OBJS += reftable/pq.o
-LIB_OBJS += reftable/record.o
-LIB_OBJS += reftable/stack.o
-LIB_OBJS += reftable/system.o
-LIB_OBJS += reftable/table.o
-LIB_OBJS += reftable/tree.o
-LIB_OBJS += reftable/writer.o
-LIB_OBJS += remote.o
-LIB_OBJS += repack.o
-LIB_OBJS += repack-cruft.o
-LIB_OBJS += repack-filtered.o
-LIB_OBJS += repack-geometry.o
-LIB_OBJS += repack-midx.o
-LIB_OBJS += repack-promisor.o
-LIB_OBJS += replace-object.o
-LIB_OBJS += replay.o
-LIB_OBJS += repo-settings.o
-LIB_OBJS += repository.o
-LIB_OBJS += rerere.o
-LIB_OBJS += reset.o
-LIB_OBJS += resolve-undo.o
-LIB_OBJS += revision.o
-LIB_OBJS += run-command.o
-LIB_OBJS += send-pack.o
-LIB_OBJS += sequencer.o
-LIB_OBJS += serve.o
-LIB_OBJS += server-info.o
-LIB_OBJS += setup.o
-LIB_OBJS += shallow.o
-LIB_OBJS += sideband.o
-LIB_OBJS += sigchain.o
-LIB_OBJS += sparse-index.o
-LIB_OBJS += split-index.o
-LIB_OBJS += stable-qsort.o
-LIB_OBJS += statinfo.o
-LIB_OBJS += strbuf.o
-LIB_OBJS += string-list.o
-LIB_OBJS += strmap.o
-LIB_OBJS += strvec.o
-LIB_OBJS += sub-process.o
-LIB_OBJS += submodule-config.o
-LIB_OBJS += submodule.o
-LIB_OBJS += symlinks.o
-LIB_OBJS += tag.o
-LIB_OBJS += tempfile.o
-LIB_OBJS += thread-utils.o
-LIB_OBJS += tmp-objdir.o
-LIB_OBJS += trace.o
-LIB_OBJS += trace2.o
-LIB_OBJS += trace2/tr2_cfg.o
-LIB_OBJS += trace2/tr2_cmd_name.o
-LIB_OBJS += trace2/tr2_ctr.o
-LIB_OBJS += trace2/tr2_dst.o
-LIB_OBJS += trace2/tr2_sid.o
-LIB_OBJS += trace2/tr2_sysenv.o
-LIB_OBJS += trace2/tr2_tbuf.o
-LIB_OBJS += trace2/tr2_tgt_event.o
-LIB_OBJS += trace2/tr2_tgt_normal.o
-LIB_OBJS += trace2/tr2_tgt_perf.o
-LIB_OBJS += trace2/tr2_tls.o
-LIB_OBJS += trace2/tr2_tmr.o
-LIB_OBJS += trailer.o
-LIB_OBJS += transport-helper.o
-LIB_OBJS += transport.o
-LIB_OBJS += tree-diff.o
-LIB_OBJS += tree-walk.o
-LIB_OBJS += tree.o
-LIB_OBJS += unpack-trees.o
-LIB_OBJS += upload-pack.o
-LIB_OBJS += url.o
-LIB_OBJS += urlmatch.o
-LIB_OBJS += usage.o
-LIB_OBJS += userdiff.o
-LIB_OBJS += utf8.o
+LIB_OBJS += lib/abspath.o
+LIB_OBJS += lib/add-interactive.o
+LIB_OBJS += lib/add-patch.o
+LIB_OBJS += lib/advice.o
+LIB_OBJS += lib/alias.o
+LIB_OBJS += lib/alloc.o
+LIB_OBJS += lib/apply.o
+LIB_OBJS += lib/archive-tar.o
+LIB_OBJS += lib/archive-zip.o
+LIB_OBJS += lib/archive.o
+LIB_OBJS += lib/attr.o
+LIB_OBJS += lib/base85.o
+LIB_OBJS += lib/bisect.o
+LIB_OBJS += lib/blame.o
+LIB_OBJS += lib/blob.o
+LIB_OBJS += lib/bloom.o
+LIB_OBJS += lib/branch.o
+LIB_OBJS += lib/bundle-uri.o
+LIB_OBJS += lib/bundle.o
+LIB_OBJS += lib/cache-tree.o
+LIB_OBJS += lib/cbtree.o
+LIB_OBJS += lib/chdir-notify.o
+LIB_OBJS += lib/checkout.o
+LIB_OBJS += lib/chunk-format.o
+LIB_OBJS += lib/color.o
+LIB_OBJS += lib/column.o
+LIB_OBJS += lib/combine-diff.o
+LIB_OBJS += lib/commit-graph.o
+LIB_OBJS += lib/commit-reach.o
+LIB_OBJS += lib/commit.o
+LIB_OBJS += lib/common-exit.o
+LIB_OBJS += lib/common-init.o
+LIB_OBJS += lib/compat/nonblock.o
+LIB_OBJS += lib/compat/obstack.o
+LIB_OBJS += lib/compat/open.o
+LIB_OBJS += lib/compat/terminal.o
+LIB_OBJS += lib/compiler-tricks/not-constant.o
+LIB_OBJS += lib/config.o
+LIB_OBJS += lib/connect.o
+LIB_OBJS += lib/connected.o
+LIB_OBJS += lib/convert.o
+LIB_OBJS += lib/copy.o
+LIB_OBJS += lib/credential.o
+LIB_OBJS += lib/csum-file.o
+LIB_OBJS += lib/ctype.o
+LIB_OBJS += lib/date.o
+LIB_OBJS += lib/decorate.o
+LIB_OBJS += lib/delta-islands.o
+LIB_OBJS += lib/diagnose.o
+LIB_OBJS += lib/diff-delta.o
+LIB_OBJS += lib/diff-merges.o
+LIB_OBJS += lib/diff-lib.o
+LIB_OBJS += lib/diff-no-index.o
+LIB_OBJS += lib/diff.o
+LIB_OBJS += lib/diffcore-break.o
+LIB_OBJS += lib/diffcore-delta.o
+LIB_OBJS += lib/diffcore-order.o
+LIB_OBJS += lib/diffcore-pickaxe.o
+LIB_OBJS += lib/diffcore-rename.o
+LIB_OBJS += lib/diffcore-rotate.o
+LIB_OBJS += lib/dir-iterator.o
+LIB_OBJS += lib/dir.o
+LIB_OBJS += lib/editor.o
+LIB_OBJS += lib/entry.o
+LIB_OBJS += lib/environment.o
+LIB_OBJS += lib/ewah/bitmap.o
+LIB_OBJS += lib/ewah/ewah_bitmap.o
+LIB_OBJS += lib/ewah/ewah_io.o
+LIB_OBJS += lib/ewah/ewah_rlw.o
+LIB_OBJS += lib/exec-cmd.o
+LIB_OBJS += lib/fetch-negotiator.o
+LIB_OBJS += lib/fetch-pack.o
+LIB_OBJS += lib/fmt-merge-msg.o
+LIB_OBJS += lib/fsck.o
+LIB_OBJS += lib/fsmonitor.o
+LIB_OBJS += lib/fsmonitor-ipc.o
+LIB_OBJS += lib/fsmonitor-settings.o
+LIB_OBJS += lib/gettext.o
+LIB_OBJS += lib/git-zlib.o
+LIB_OBJS += lib/gpg-interface.o
+LIB_OBJS += lib/graph.o
+LIB_OBJS += lib/grep.o
+LIB_OBJS += lib/hash-lookup.o
+LIB_OBJS += lib/hash.o
+LIB_OBJS += lib/hashmap.o
+LIB_OBJS += lib/help.o
+LIB_OBJS += lib/hex.o
+LIB_OBJS += lib/hex-ll.o
+LIB_OBJS += lib/hook.o
+LIB_OBJS += lib/ident.o
+LIB_OBJS += lib/json-writer.o
+LIB_OBJS += lib/kwset.o
+LIB_OBJS += lib/levenshtein.o
+LIB_OBJS += lib/line-log.o
+LIB_OBJS += lib/line-range.o
+LIB_OBJS += lib/linear-assignment.o
+LIB_OBJS += lib/list-objects-filter-options.o
+LIB_OBJS += lib/list-objects-filter.o
+LIB_OBJS += lib/list-objects.o
+LIB_OBJS += lib/lockfile.o
+LIB_OBJS += lib/log-tree.o
+LIB_OBJS += lib/loose.o
+LIB_OBJS += lib/ls-refs.o
+LIB_OBJS += lib/mailinfo.o
+LIB_OBJS += lib/mailmap.o
+LIB_OBJS += lib/match-trees.o
+LIB_OBJS += lib/mem-pool.o
+LIB_OBJS += lib/merge-blobs.o
+LIB_OBJS += lib/merge-ll.o
+LIB_OBJS += lib/merge-ort.o
+LIB_OBJS += lib/merge-ort-wrappers.o
+LIB_OBJS += lib/merge.o
+LIB_OBJS += lib/midx.o
+LIB_OBJS += lib/midx-write.o
+LIB_OBJS += lib/name-hash.o
+LIB_OBJS += lib/negotiator/default.o
+LIB_OBJS += lib/negotiator/noop.o
+LIB_OBJS += lib/negotiator/skipping.o
+LIB_OBJS += lib/notes-cache.o
+LIB_OBJS += lib/notes-merge.o
+LIB_OBJS += lib/notes-utils.o
+LIB_OBJS += lib/notes.o
+LIB_OBJS += lib/object-file-convert.o
+LIB_OBJS += lib/object-file.o
+LIB_OBJS += lib/object-name.o
+LIB_OBJS += lib/object.o
+LIB_OBJS += lib/odb.o
+LIB_OBJS += lib/odb/source.o
+LIB_OBJS += lib/odb/source-files.o
+LIB_OBJS += lib/odb/source-inmemory.o
+LIB_OBJS += lib/odb/source-loose.o
+LIB_OBJS += lib/odb/source-packed.o
+LIB_OBJS += lib/odb/streaming.o
+LIB_OBJS += lib/odb/transaction.o
+LIB_OBJS += lib/oid-array.o
+LIB_OBJS += lib/oidmap.o
+LIB_OBJS += lib/oidset.o
+LIB_OBJS += lib/oidtree.o
+LIB_OBJS += lib/pack-bitmap-write.o
+LIB_OBJS += lib/pack-bitmap.o
+LIB_OBJS += lib/pack-check.o
+LIB_OBJS += lib/pack-mtimes.o
+LIB_OBJS += lib/pack-objects.o
+LIB_OBJS += lib/pack-refs.o
+LIB_OBJS += lib/pack-revindex.o
+LIB_OBJS += lib/pack-write.o
+LIB_OBJS += lib/packfile.o
+LIB_OBJS += lib/packfile-list.o
+LIB_OBJS += lib/pager.o
+LIB_OBJS += lib/parallel-checkout.o
+LIB_OBJS += lib/parse.o
+LIB_OBJS += lib/parse-options-cb.o
+LIB_OBJS += lib/parse-options.o
+LIB_OBJS += lib/patch-delta.o
+LIB_OBJS += lib/patch-ids.o
+LIB_OBJS += lib/path.o
+LIB_OBJS += lib/path-walk.o
+LIB_OBJS += lib/pathspec.o
+LIB_OBJS += lib/pkt-line.o
+LIB_OBJS += lib/preload-index.o
+LIB_OBJS += lib/pretty.o
+LIB_OBJS += lib/prio-queue.o
+LIB_OBJS += lib/progress.o
+LIB_OBJS += lib/promisor-remote.o
+LIB_OBJS += lib/prompt.o
+LIB_OBJS += lib/protocol.o
+LIB_OBJS += lib/protocol-caps.o
+LIB_OBJS += lib/prune-packed.o
+LIB_OBJS += lib/pseudo-merge.o
+LIB_OBJS += lib/quote.o
+LIB_OBJS += lib/range-diff.o
+LIB_OBJS += lib/reachable.o
+LIB_OBJS += lib/read-cache.o
+LIB_OBJS += lib/rebase-interactive.o
+LIB_OBJS += lib/rebase.o
+LIB_OBJS += lib/ref-filter.o
+LIB_OBJS += lib/reflog-walk.o
+LIB_OBJS += lib/reflog.o
+LIB_OBJS += lib/refs.o
+LIB_OBJS += lib/refs/debug.o
+LIB_OBJS += lib/refs/files-backend.o
+LIB_OBJS += lib/refs/reftable-backend.o
+LIB_OBJS += lib/refs/iterator.o
+LIB_OBJS += lib/refs/packed-backend.o
+LIB_OBJS += lib/refs/ref-cache.o
+LIB_OBJS += lib/refspec.o
+LIB_OBJS += lib/reftable/basics.o
+LIB_OBJS += lib/reftable/block.o
+LIB_OBJS += lib/reftable/blocksource.o
+LIB_OBJS += lib/reftable/error.o
+LIB_OBJS += lib/reftable/fsck.o
+LIB_OBJS += lib/reftable/iter.o
+LIB_OBJS += lib/reftable/merged.o
+LIB_OBJS += lib/reftable/pq.o
+LIB_OBJS += lib/reftable/record.o
+LIB_OBJS += lib/reftable/stack.o
+LIB_OBJS += lib/reftable/system.o
+LIB_OBJS += lib/reftable/table.o
+LIB_OBJS += lib/reftable/tree.o
+LIB_OBJS += lib/reftable/writer.o
+LIB_OBJS += lib/remote.o
+LIB_OBJS += lib/repack.o
+LIB_OBJS += lib/repack-cruft.o
+LIB_OBJS += lib/repack-filtered.o
+LIB_OBJS += lib/repack-geometry.o
+LIB_OBJS += lib/repack-midx.o
+LIB_OBJS += lib/repack-promisor.o
+LIB_OBJS += lib/replace-object.o
+LIB_OBJS += lib/replay.o
+LIB_OBJS += lib/repo-settings.o
+LIB_OBJS += lib/repository.o
+LIB_OBJS += lib/rerere.o
+LIB_OBJS += lib/reset.o
+LIB_OBJS += lib/resolve-undo.o
+LIB_OBJS += lib/revision.o
+LIB_OBJS += lib/run-command.o
+LIB_OBJS += lib/send-pack.o
+LIB_OBJS += lib/sequencer.o
+LIB_OBJS += lib/serve.o
+LIB_OBJS += lib/server-info.o
+LIB_OBJS += lib/setup.o
+LIB_OBJS += lib/shallow.o
+LIB_OBJS += lib/sideband.o
+LIB_OBJS += lib/sigchain.o
+LIB_OBJS += lib/sparse-index.o
+LIB_OBJS += lib/split-index.o
+LIB_OBJS += lib/stable-qsort.o
+LIB_OBJS += lib/statinfo.o
+LIB_OBJS += lib/strbuf.o
+LIB_OBJS += lib/string-list.o
+LIB_OBJS += lib/strmap.o
+LIB_OBJS += lib/strvec.o
+LIB_OBJS += lib/sub-process.o
+LIB_OBJS += lib/submodule-config.o
+LIB_OBJS += lib/submodule.o
+LIB_OBJS += lib/symlinks.o
+LIB_OBJS += lib/tag.o
+LIB_OBJS += lib/tempfile.o
+LIB_OBJS += lib/thread-utils.o
+LIB_OBJS += lib/tmp-objdir.o
+LIB_OBJS += lib/trace.o
+LIB_OBJS += lib/trace2.o
+LIB_OBJS += lib/trace2/tr2_cfg.o
+LIB_OBJS += lib/trace2/tr2_cmd_name.o
+LIB_OBJS += lib/trace2/tr2_ctr.o
+LIB_OBJS += lib/trace2/tr2_dst.o
+LIB_OBJS += lib/trace2/tr2_sid.o
+LIB_OBJS += lib/trace2/tr2_sysenv.o
+LIB_OBJS += lib/trace2/tr2_tbuf.o
+LIB_OBJS += lib/trace2/tr2_tgt_event.o
+LIB_OBJS += lib/trace2/tr2_tgt_normal.o
+LIB_OBJS += lib/trace2/tr2_tgt_perf.o
+LIB_OBJS += lib/trace2/tr2_tls.o
+LIB_OBJS += lib/trace2/tr2_tmr.o
+LIB_OBJS += lib/trailer.o
+LIB_OBJS += lib/transport-helper.o
+LIB_OBJS += lib/transport.o
+LIB_OBJS += lib/tree-diff.o
+LIB_OBJS += lib/tree-walk.o
+LIB_OBJS += lib/tree.o
+LIB_OBJS += lib/unpack-trees.o
+LIB_OBJS += lib/upload-pack.o
+LIB_OBJS += lib/url.o
+LIB_OBJS += lib/urlmatch.o
+LIB_OBJS += lib/usage.o
+LIB_OBJS += lib/userdiff.o
+LIB_OBJS += lib/utf8.o
 ifdef NO_RUST
-LIB_OBJS += varint.o
-endif
-LIB_OBJS += version.o
-LIB_OBJS += versioncmp.o
-LIB_OBJS += walker.o
-LIB_OBJS += wildmatch.o
-LIB_OBJS += worktree.o
-LIB_OBJS += wrapper.o
-LIB_OBJS += write-or-die.o
-LIB_OBJS += ws.o
-LIB_OBJS += wt-status.o
-LIB_OBJS += xdiff-interface.o
-LIB_OBJS += xdiff/xdiffi.o
-LIB_OBJS += xdiff/xemit.o
-LIB_OBJS += xdiff/xhistogram.o
-LIB_OBJS += xdiff/xmerge.o
-LIB_OBJS += xdiff/xpatience.o
-LIB_OBJS += xdiff/xprepare.o
-LIB_OBJS += xdiff/xutils.o
+LIB_OBJS += lib/varint.o
+endif
+LIB_OBJS += lib/version.o
+LIB_OBJS += lib/versioncmp.o
+LIB_OBJS += lib/walker.o
+LIB_OBJS += lib/wildmatch.o
+LIB_OBJS += lib/worktree.o
+LIB_OBJS += lib/wrapper.o
+LIB_OBJS += lib/write-or-die.o
+LIB_OBJS += lib/ws.o
+LIB_OBJS += lib/wt-status.o
+LIB_OBJS += lib/xdiff-interface.o
+LIB_OBJS += lib/xdiff/xdiffi.o
+LIB_OBJS += lib/xdiff/xemit.o
+LIB_OBJS += lib/xdiff/xhistogram.o
+LIB_OBJS += lib/xdiff/xmerge.o
+LIB_OBJS += lib/xdiff/xpatience.o
+LIB_OBJS += lib/xdiff/xprepare.o
+LIB_OBJS += lib/xdiff/xutils.o
 
 BUILTIN_OBJS += builtin/add.o
 BUILTIN_OBJS += builtin/am.o
@@ -1513,13 +1513,13 @@ BUILTIN_OBJS += builtin/write-tree.o
 # files which are taken from some third-party source where we want to be
 # less strict about issues such as coding style so we don't diverge from
 # upstream unnecessarily (making merging in future changes easier).
-THIRD_PARTY_SOURCES += compat/inet_ntop.c
-THIRD_PARTY_SOURCES += compat/inet_pton.c
-THIRD_PARTY_SOURCES += compat/obstack.%
-THIRD_PARTY_SOURCES += compat/poll/%
-THIRD_PARTY_SOURCES += compat/regex/%
-THIRD_PARTY_SOURCES += sha1collisiondetection/%
-THIRD_PARTY_SOURCES += sha1dc/%
+THIRD_PARTY_SOURCES += lib/compat/inet_ntop.c
+THIRD_PARTY_SOURCES += lib/compat/inet_pton.c
+THIRD_PARTY_SOURCES += lib/compat/obstack.%
+THIRD_PARTY_SOURCES += lib/compat/poll/%
+THIRD_PARTY_SOURCES += lib/compat/regex/%
+THIRD_PARTY_SOURCES += lib/sha1collisiondetection/%
+THIRD_PARTY_SOURCES += lib/sha1dc/%
 THIRD_PARTY_SOURCES += $(UNIT_TEST_DIR)/clar/%
 THIRD_PARTY_SOURCES += $(UNIT_TEST_DIR)/clar/clar/%
 
@@ -1750,7 +1750,7 @@ endif
 
 ifdef NO_LIBGEN_H
 	COMPAT_CFLAGS += -DNO_LIBGEN_H
-	COMPAT_OBJS += compat/basename.o
+	COMPAT_OBJS += lib/compat/basename.o
 endif
 
 ifdef USE_LIBPCRE1
@@ -1816,7 +1816,7 @@ else
         endif
         ifdef USE_CURL_FOR_IMAP_SEND
 		BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
-		IMAP_SEND_BUILDDEPS = http.o
+		IMAP_SEND_BUILDDEPS = lib/http.o
 		IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
         endif
         ifndef NO_EXPAT
@@ -1937,11 +1937,11 @@ ifdef NO_NSEC
 endif
 ifdef SNPRINTF_RETURNS_BOGUS
 	COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
-	COMPAT_OBJS += compat/snprintf.o
+	COMPAT_OBJS += lib/compat/snprintf.o
 endif
 ifdef FREAD_READS_DIRECTORIES
 	COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
-	COMPAT_OBJS += compat/fopen.o
+	COMPAT_OBJS += lib/compat/fopen.o
 endif
 ifdef OPEN_RETURNS_EINTR
 	COMPAT_CFLAGS += -DOPEN_RETURNS_EINTR
@@ -1956,38 +1956,38 @@ endif
 ifdef NO_POLL
 	NO_POLL_H = YesPlease
 	NO_SYS_POLL_H = YesPlease
-	COMPAT_CFLAGS += -DNO_POLL -Icompat/poll
-	COMPAT_OBJS += compat/poll/poll.o
+	COMPAT_CFLAGS += -DNO_POLL -Ilib/compat/poll
+	COMPAT_OBJS += lib/compat/poll/poll.o
 endif
 ifdef NO_STRCASESTR
 	COMPAT_CFLAGS += -DNO_STRCASESTR
-	COMPAT_OBJS += compat/strcasestr.o
+	COMPAT_OBJS += lib/compat/strcasestr.o
 endif
 ifdef NO_STRLCPY
 	COMPAT_CFLAGS += -DNO_STRLCPY
-	COMPAT_OBJS += compat/strlcpy.o
+	COMPAT_OBJS += lib/compat/strlcpy.o
 endif
 ifdef NO_STRTOUMAX
 	COMPAT_CFLAGS += -DNO_STRTOUMAX
-	COMPAT_OBJS += compat/strtoumax.o compat/strtoimax.o
+	COMPAT_OBJS += lib/compat/strtoumax.o lib/compat/strtoimax.o
 endif
 ifdef NO_STRTOULL
 	COMPAT_CFLAGS += -DNO_STRTOULL
 endif
 ifdef NO_SETENV
 	COMPAT_CFLAGS += -DNO_SETENV
-	COMPAT_OBJS += compat/setenv.o
+	COMPAT_OBJS += lib/compat/setenv.o
 endif
 ifdef NO_MKDTEMP
 	COMPAT_CFLAGS += -DNO_MKDTEMP
 endif
 ifdef MKDIR_WO_TRAILING_SLASH
 	COMPAT_CFLAGS += -DMKDIR_WO_TRAILING_SLASH
-	COMPAT_OBJS += compat/mkdir.o
+	COMPAT_OBJS += lib/compat/mkdir.o
 endif
 ifdef NO_UNSETENV
 	COMPAT_CFLAGS += -DNO_UNSETENV
-	COMPAT_OBJS += compat/unsetenv.o
+	COMPAT_OBJS += lib/compat/unsetenv.o
 endif
 ifdef NO_SYS_SELECT_H
 	BASIC_CFLAGS += -DNO_SYS_SELECT_H
@@ -2009,11 +2009,11 @@ ifdef NO_INITGROUPS
 endif
 ifdef NO_MMAP
 	COMPAT_CFLAGS += -DNO_MMAP
-	COMPAT_OBJS += compat/mmap.o
+	COMPAT_OBJS += lib/compat/mmap.o
 else
         ifdef USE_WIN32_MMAP
 		COMPAT_CFLAGS += -DUSE_WIN32_MMAP
-		COMPAT_OBJS += compat/win32mmap.o
+		COMPAT_OBJS += lib/compat/win32mmap.o
         endif
 endif
 ifdef MMAP_PREVENTS_DELETE
@@ -2031,7 +2031,7 @@ ifdef NO_SETITIMER
 endif
 ifdef NO_PREAD
 	COMPAT_CFLAGS += -DNO_PREAD
-	COMPAT_OBJS += compat/pread.o
+	COMPAT_OBJS += lib/compat/pread.o
 endif
 ifdef NO_FAST_WORKING_DIRECTORY
 	BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
@@ -2041,7 +2041,7 @@ ifdef NO_TRUSTABLE_FILEMODE
 endif
 ifdef NEEDS_MODE_TRANSLATION
 	COMPAT_CFLAGS += -DNEEDS_MODE_TRANSLATION
-	COMPAT_OBJS += compat/stat.o
+	COMPAT_OBJS += lib/compat/stat.o
 endif
 ifdef NO_IPV6
 	BASIC_CFLAGS += -DNO_IPV6
@@ -2057,18 +2057,18 @@ else
 endif
 endif
 ifdef NO_INET_NTOP
-	LIB_OBJS += compat/inet_ntop.o
+	LIB_OBJS += lib/compat/inet_ntop.o
 	BASIC_CFLAGS += -DNO_INET_NTOP
 endif
 ifdef NO_INET_PTON
-	LIB_OBJS += compat/inet_pton.o
+	LIB_OBJS += lib/compat/inet_pton.o
 	BASIC_CFLAGS += -DNO_INET_PTON
 endif
 ifdef NO_UNIX_SOCKETS
 	BASIC_CFLAGS += -DNO_UNIX_SOCKETS
 else
-	LIB_OBJS += unix-socket.o
-	LIB_OBJS += unix-stream-server.o
+	LIB_OBJS += lib/unix-socket.o
+	LIB_OBJS += lib/unix-stream-server.o
 endif
 
 # Simple IPC requires threads and platform-specific IPC support.
@@ -2084,14 +2084,14 @@ endif
 #
 ifdef USE_WIN32_IPC
 	BASIC_CFLAGS += -DSUPPORTS_SIMPLE_IPC
-	LIB_OBJS += compat/simple-ipc/ipc-shared.o
-	LIB_OBJS += compat/simple-ipc/ipc-win32.o
+	LIB_OBJS += lib/compat/simple-ipc/ipc-shared.o
+	LIB_OBJS += lib/compat/simple-ipc/ipc-win32.o
 else
 ifndef NO_PTHREADS
 ifndef NO_UNIX_SOCKETS
 	BASIC_CFLAGS += -DSUPPORTS_SIMPLE_IPC
-	LIB_OBJS += compat/simple-ipc/ipc-shared.o
-	LIB_OBJS += compat/simple-ipc/ipc-unix-socket.o
+	LIB_OBJS += lib/compat/simple-ipc/ipc-shared.o
+	LIB_OBJS += lib/compat/simple-ipc/ipc-unix-socket.o
 endif
 endif
 endif
@@ -2126,7 +2126,7 @@ ifdef OPENSSL_SHA1
 	BASIC_CFLAGS += -DSHA1_OPENSSL
 else
 ifdef BLK_SHA1
-	LIB_OBJS += block-sha1/sha1.o
+	LIB_OBJS += lib/block-sha1/sha1.o
 	BASIC_CFLAGS += -DSHA1_BLK
 else
 ifdef APPLE_COMMON_CRYPTO_SHA1
@@ -2134,7 +2134,7 @@ ifdef APPLE_COMMON_CRYPTO_SHA1
 	BASIC_CFLAGS += -DSHA1_APPLE
 else
 	BASIC_CFLAGS += -DSHA1_DC
-	LIB_OBJS += sha1dc_git.o
+	LIB_OBJS += lib/sha1dc_git.o
 ifdef DC_SHA1_EXTERNAL
         ifdef DC_SHA1_SUBMODULE
                 ifneq ($(DC_SHA1_SUBMODULE),auto)
@@ -2145,12 +2145,12 @@ $(error Only set DC_SHA1_EXTERNAL or DC_SHA1_SUBMODULE, not both)
 	EXTLIBS += -lsha1detectcoll
 else
 ifdef DC_SHA1_SUBMODULE
-	LIB_OBJS += sha1collisiondetection/lib/sha1.o
-	LIB_OBJS += sha1collisiondetection/lib/ubc_check.o
+	LIB_OBJS += lib/sha1collisiondetection/lib/sha1.o
+	LIB_OBJS += lib/sha1collisiondetection/lib/ubc_check.o
 	BASIC_CFLAGS += -DDC_SHA1_SUBMODULE
 else
-	LIB_OBJS += sha1dc/sha1.o
-	LIB_OBJS += sha1dc/ubc_check.o
+	LIB_OBJS += lib/sha1dc/sha1.o
+	LIB_OBJS += lib/sha1dc/ubc_check.o
 endif
 	BASIC_CFLAGS += \
 		-DSHA1DC_NO_STANDARD_INCLUDES \
@@ -2170,7 +2170,7 @@ endif
 else
 ifdef BLK_SHA1_UNSAFE
 ifndef BLK_SHA1
-	LIB_OBJS += block-sha1/sha1.o
+	LIB_OBJS += lib/block-sha1/sha1.o
 	BASIC_CFLAGS += -DSHA1_BLK_UNSAFE
 endif
 else
@@ -2195,23 +2195,23 @@ ifdef GCRYPT_SHA256
 	BASIC_CFLAGS += -DSHA256_GCRYPT
 	EXTLIBS += -lgcrypt
 else
-	LIB_OBJS += sha256/block/sha256.o
+	LIB_OBJS += lib/sha256/block/sha256.o
 	BASIC_CFLAGS += -DSHA256_BLK
 endif
 endif
 endif
 
 ifdef SHA1_MAX_BLOCK_SIZE
-	LIB_OBJS += compat/sha1-chunked.o
+	LIB_OBJS += lib/compat/sha1-chunked.o
 	BASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE="$(SHA1_MAX_BLOCK_SIZE)"
 endif
 ifdef NO_HSTRERROR
 	COMPAT_CFLAGS += -DNO_HSTRERROR
-	COMPAT_OBJS += compat/hstrerror.o
+	COMPAT_OBJS += lib/compat/hstrerror.o
 endif
 ifdef NO_MEMMEM
 	COMPAT_CFLAGS += -DNO_MEMMEM
-	COMPAT_OBJS += compat/memmem.o
+	COMPAT_OBJS += lib/compat/memmem.o
 endif
 ifdef NO_GETPAGESIZE
 	COMPAT_CFLAGS += -DNO_GETPAGESIZE
@@ -2222,7 +2222,7 @@ endif
 ifdef HAVE_ISO_QSORT_S
 	COMPAT_CFLAGS += -DHAVE_ISO_QSORT_S
 else
-	COMPAT_OBJS += compat/qsort_s.o
+	COMPAT_OBJS += lib/compat/qsort_s.o
 endif
 ifdef RUNTIME_PREFIX
 	COMPAT_CFLAGS += -DRUNTIME_PREFIX
@@ -2259,12 +2259,12 @@ ifdef UNRELIABLE_FSTAT
 	BASIC_CFLAGS += -DUNRELIABLE_FSTAT
 endif
 ifdef NO_REGEX
-	COMPAT_CFLAGS += -Icompat/regex
-	COMPAT_OBJS += compat/regex/regex.o
+	COMPAT_CFLAGS += -Ilib/compat/regex
+	COMPAT_OBJS += lib/compat/regex/regex.o
 else
 ifdef USE_ENHANCED_BASIC_REGULAR_EXPRESSIONS
 	COMPAT_CFLAGS += -DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS
-	COMPAT_OBJS += compat/regcomp_enhanced.o
+	COMPAT_OBJS += lib/compat/regcomp_enhanced.o
 endif
 endif
 ifdef NATIVE_CRLF
@@ -2273,7 +2273,7 @@ endif
 
 ifdef OVERRIDE_STRDUP
 	COMPAT_CFLAGS += -DOVERRIDE_STRDUP
-	COMPAT_OBJS += compat/strdup.o
+	COMPAT_OBJS += lib/compat/strdup.o
 endif
 
 ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
@@ -2335,7 +2335,7 @@ ifneq ($(findstring openssl,$(CSPRNG_METHOD)),)
 endif
 
 ifndef HAVE_PLATFORM_PROCINFO
-	COMPAT_OBJS += compat/stub/procinfo.o
+	COMPAT_OBJS += lib/compat/stub/procinfo.o
 endif
 
 ifdef RUNTIME_PREFIX
@@ -2365,25 +2365,25 @@ endif
 
 ifdef FILENO_IS_A_MACRO
 	COMPAT_CFLAGS += -DFILENO_IS_A_MACRO
-	COMPAT_OBJS += compat/fileno.o
+	COMPAT_OBJS += lib/compat/fileno.o
 endif
 
 ifdef NEED_ACCESS_ROOT_HANDLER
 	COMPAT_CFLAGS += -DNEED_ACCESS_ROOT_HANDLER
-	COMPAT_OBJS += compat/access.o
+	COMPAT_OBJS += lib/compat/access.o
 endif
 
 ifdef FSMONITOR_DAEMON_BACKEND
 	COMPAT_CFLAGS += -DHAVE_FSMONITOR_DAEMON_BACKEND
-	COMPAT_OBJS += compat/fsmonitor/fsm-listen-$(FSMONITOR_DAEMON_BACKEND).o
-	COMPAT_OBJS += compat/fsmonitor/fsm-health-$(FSMONITOR_DAEMON_BACKEND).o
+	COMPAT_OBJS += lib/compat/fsmonitor/fsm-listen-$(FSMONITOR_DAEMON_BACKEND).o
+	COMPAT_OBJS += lib/compat/fsmonitor/fsm-health-$(FSMONITOR_DAEMON_BACKEND).o
 endif
 
 ifdef FSMONITOR_OS_SETTINGS
 	COMPAT_CFLAGS += -DHAVE_FSMONITOR_OS_SETTINGS
-	COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_OS_SETTINGS).o
-	COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_OS_SETTINGS).o
-	COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_DAEMON_BACKEND).o
+	COMPAT_OBJS += lib/compat/fsmonitor/fsm-ipc-$(FSMONITOR_OS_SETTINGS).o
+	COMPAT_OBJS += lib/compat/fsmonitor/fsm-settings-$(FSMONITOR_OS_SETTINGS).o
+	COMPAT_OBJS += lib/compat/fsmonitor/fsm-path-utils-$(FSMONITOR_DAEMON_BACKEND).o
 endif
 
 ifdef WITH_BREAKING_CHANGES
@@ -2667,9 +2667,9 @@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
 		$(filter %.o,$^) $(LIBS)
 
-help.sp help.s help.o: command-list.h
+lib/help.sp lib/help.s lib/help.o: command-list.h
 builtin/bugreport.sp builtin/bugreport.s builtin/bugreport.o: hook-list.h
-hook.sp hook.s hook.o: hook-list.h
+lib/hook.sp lib/hook.s lib/hook.o: hook-list.h
 
 builtin/help.sp builtin/help.s builtin/help.o: config-list.h GIT-PREFIX
 builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
@@ -2680,13 +2680,13 @@ builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
 PAGER_ENV_SQ = $(subst ','\'',$(PAGER_ENV))
 PAGER_ENV_CQ = "$(subst ",\",$(subst \,\\,$(PAGER_ENV)))"
 PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
-pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
+lib/pager.sp lib/pager.s lib/pager.o: EXTRA_CPPFLAGS = \
 	-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
 
-version-def.h: version-def.h.in GIT-VERSION-GEN GIT-VERSION-FILE GIT-USER-AGENT
+version-def.h: lib/version-def.h.in GIT-VERSION-GEN GIT-VERSION-FILE GIT-USER-AGENT
 	$(QUIET_GEN)$(call version_gen,"$(shell pwd)",$<,$@)
 
-version.sp version.s version.o: version-def.h
+lib/version.sp lib/version.s lib/version.o: version-def.h
 
 $(BUILT_INS): git$X
 	$(QUIET_BUILT_IN)$(RM) $@ && \
@@ -2879,7 +2879,7 @@ ifdef INCLUDE_LIBGIT_RS
 endif
 
 ifndef NO_CURL
-	OBJECTS += http.o http-walker.o remote-curl.o
+	OBJECTS += lib/http.o lib/http-walker.o remote-curl.o
 endif
 
 .PHONY: objects
@@ -2944,44 +2944,44 @@ compile_commands.json:
 	@if test -s $@+; then mv $@+ $@; else $(RM) $@+; fi
 endif
 
-exec-cmd.sp exec-cmd.s exec-cmd.o: GIT-PREFIX
-exec-cmd.sp exec-cmd.s exec-cmd.o: EXTRA_CPPFLAGS = \
+lib/exec-cmd.sp lib/exec-cmd.s lib/exec-cmd.o: GIT-PREFIX
+lib/exec-cmd.sp lib/exec-cmd.s lib/exec-cmd.o: EXTRA_CPPFLAGS = \
 	'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
 	'-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
 	'-DBINDIR="$(bindir_relative_SQ)"' \
 	'-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"'
 
-setup.sp setup.s setup.o: GIT-PREFIX
-setup.sp setup.s setup.o: EXTRA_CPPFLAGS = \
+lib/setup.sp lib/setup.s lib/setup.o: GIT-PREFIX
+lib/setup.sp lib/setup.s lib/setup.o: EXTRA_CPPFLAGS = \
 	-DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
 
-config.sp config.s config.o: GIT-PREFIX
-config.sp config.s config.o: EXTRA_CPPFLAGS = \
+lib/config.sp lib/config.s lib/config.o: GIT-PREFIX
+lib/config.sp lib/config.s lib/config.o: EXTRA_CPPFLAGS = \
 	-DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
 
-attr.sp attr.s attr.o: GIT-PREFIX
-attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
+lib/attr.sp lib/attr.s lib/attr.o: GIT-PREFIX
+lib/attr.sp lib/attr.s lib/attr.o: EXTRA_CPPFLAGS = \
 	-DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
 
-gettext.sp gettext.s gettext.o: GIT-PREFIX
-gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
+lib/gettext.sp lib/gettext.s lib/gettext.o: GIT-PREFIX
+lib/gettext.sp lib/gettext.s lib/gettext.o: EXTRA_CPPFLAGS = \
 	-DGIT_LOCALE_PATH='"$(localedir_relative_SQ)"'
 
-http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SP_EXTRA_FLAGS += \
+http-push.sp lib/http.sp lib/http-walker.sp remote-curl.sp imap-send.sp: SP_EXTRA_FLAGS += \
 	-DCURL_DISABLE_TYPECHECK
 
 pack-revindex.sp: SP_EXTRA_FLAGS += -Wno-memcpy-max-count
 
 ifdef NO_EXPAT
-http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
+lib/http-walker.sp lib/http-walker.s lib/http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
 endif
 
 ifdef NO_REGEX
-compat/regex/regex.sp compat/regex/regex.o: EXTRA_CPPFLAGS = \
+lib/compat/regex/regex.sp lib/compat/regex/regex.o: EXTRA_CPPFLAGS = \
 	-DGAWK -DNO_MBSUPPORT
 endif
 
-headless-git.o: compat/win32/headless.c GIT-CFLAGS
+headless-git.o: lib/compat/win32/headless.c GIT-CFLAGS
 	$(QUIET_CC)$(CC) $(ALL_CFLAGS) $(COMPAT_CFLAGS) \
 		-fno-stack-protector -o $@ -c -Wall -Wwrite-strings $<
 
@@ -2995,10 +2995,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(IMAP_SEND_LDFLAGS) $(LIBS)
 
-git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
+git-http-fetch$X: lib/http.o lib/http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(CURL_LIBCURL) $(LIBS)
-git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
+git-http-push$X: lib/http.o http-push.o GIT-LDFLAGS $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
 
@@ -3008,7 +3008,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
 	ln -s $< $@ 2>/dev/null || \
 	cp $< $@
 
-$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
+$(REMOTE_CURL_PRIMARY): remote-curl.o lib/http.o lib/http-walker.o GIT-LDFLAGS $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
 
@@ -3172,8 +3172,8 @@ LOCALIZED_C_CORE += builtin/clone.c
 LOCALIZED_C_CORE += builtin/index-pack.c
 LOCALIZED_C_CORE += builtin/push.c
 LOCALIZED_C_CORE += builtin/reset.c
-LOCALIZED_C_CORE += remote.c
-LOCALIZED_C_CORE += wt-status.c
+LOCALIZED_C_CORE += lib/remote.c
+LOCALIZED_C_CORE += lib/wt-status.c
 
 LOCALIZED_C_CORE_GEN_PO = $(LOCALIZED_C_CORE:%=.build/pot/po/%.po)
 
@@ -3412,18 +3412,18 @@ $(SP_OBJ): %.sp: %.c %.o $(GENERATED_H)
 .PHONY: sparse
 sparse: $(SP_OBJ)
 
-EXCEPT_HDRS := $(GENERATED_H) unicode-width.h compat/% xdiff/% $(UNIT_TEST_DIR)/clar/% $(UNIT_TEST_DIR)/clar/clar/%
+EXCEPT_HDRS := $(GENERATED_H) lib/unicode-width.h lib/compat/% lib/xdiff/% $(UNIT_TEST_DIR)/clar/% $(UNIT_TEST_DIR)/clar/clar/%
 ifndef OPENSSL_SHA1
-	EXCEPT_HDRS += sha1/openssl.h
+	EXCEPT_HDRS += lib/sha1/openssl.h
 endif
 ifndef OPENSSL_SHA256
-	EXCEPT_HDRS += sha256/openssl.h
+	EXCEPT_HDRS += lib/sha256/openssl.h
 endif
 ifndef NETTLE_SHA256
-	EXCEPT_HDRS += sha256/nettle.h
+	EXCEPT_HDRS += lib/sha256/nettle.h
 endif
 ifndef GCRYPT_SHA256
-	EXCEPT_HDRS += sha256/gcrypt.h
+	EXCEPT_HDRS += lib/sha256/gcrypt.h
 endif
 CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H))
 HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
@@ -3775,13 +3775,13 @@ GIT_ARCHIVE_EXTRA_FILES = \
 	--add-file=.dist-tmp-dir/git-gui/version
 ifdef DC_SHA1_SUBMODULE
 GIT_ARCHIVE_EXTRA_FILES += \
-	--prefix=$(GIT_TARNAME)/sha1collisiondetection/ \
-	--add-file=sha1collisiondetection/LICENSE.txt \
-	--prefix=$(GIT_TARNAME)/sha1collisiondetection/lib/ \
-	--add-file=sha1collisiondetection/lib/sha1.c \
-	--add-file=sha1collisiondetection/lib/sha1.h \
-	--add-file=sha1collisiondetection/lib/ubc_check.c \
-	--add-file=sha1collisiondetection/lib/ubc_check.h
+	--prefix=$(GIT_TARNAME)/lib/sha1collisiondetection/ \
+	--add-file=lib/sha1collisiondetection/LICENSE.txt \
+	--prefix=$(GIT_TARNAME)/lib/sha1collisiondetection/lib/ \
+	--add-file=lib/sha1collisiondetection/lib/sha1.c \
+	--add-file=lib/sha1collisiondetection/lib/sha1.h \
+	--add-file=lib/sha1collisiondetection/lib/ubc_check.c \
+	--add-file=lib/sha1collisiondetection/lib/ubc_check.h
 endif
 dist: git-archive$(X) configure
 	@$(RM) -r .dist-tmp-dir
@@ -3911,7 +3911,7 @@ ifdef MSVC
 	$(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
 	$(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
 	$(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
-	$(RM) compat/vcbuild/MSVC-DEFS-GEN
+	$(RM) lib/compat/vcbuild/MSVC-DEFS-GEN
 endif
 
 .PHONY: all install profile-clean cocciclean clean strip
diff --git a/config.mak.uname b/config.mak.uname
index 8719e09f66..7af406439e 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -21,17 +21,17 @@ ifdef MSVC
 
 	# Generate and include makefile variables that point to the
 	# currently installed set of MSVC command line tools.
-compat/vcbuild/MSVC-DEFS-GEN: compat/vcbuild/find_vs_env.bat
+lib/compat/vcbuild/MSVC-DEFS-GEN: lib/compat/vcbuild/find_vs_env.bat
 	@"$<" | tr '\\' / >"$@"
-include compat/vcbuild/MSVC-DEFS-GEN
+include lib/compat/vcbuild/MSVC-DEFS-GEN
 
 	# See if vcpkg and the vcpkg-build versions of the third-party
 	# libraries that we use are installed.  We include the result
 	# to get $(vcpkg_*) variables defined for the Makefile.
 ifeq (,$(SKIP_VCPKG))
-compat/vcbuild/VCPKG-DEFS: compat/vcbuild/vcpkg_install.bat
+lib/compat/vcbuild/VCPKG-DEFS: lib/compat/vcbuild/vcpkg_install.bat
 	@"$<"
-include compat/vcbuild/VCPKG-DEFS
+include lib/compat/vcbuild/VCPKG-DEFS
 endif
 endif
 
@@ -62,7 +62,7 @@ ifeq ($(uname_S),Linux)
 	HAVE_SYSINFO = YesPlease
 	PROCFS_EXECUTABLE_PATH = /proc/self/exe
 	HAVE_PLATFORM_PROCINFO = YesPlease
-	COMPAT_OBJS += compat/linux/procinfo.o
+	COMPAT_OBJS += lib/compat/linux/procinfo.o
 	EXTLIBS += -ldl
 	# centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7.
         ifneq ($(findstring .el7.,$(uname_R)),)
@@ -152,7 +152,7 @@ ifeq ($(uname_S),Darwin)
 	NO_MEMMEM = YesPlease
 	USE_ST_TIMESPEC = YesPlease
 	HAVE_DEV_TTY = YesPlease
-	COMPAT_OBJS += compat/precompose_utf8.o
+	COMPAT_OBJS += lib/compat/precompose_utf8.o
 	BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
 	BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
 	HAVE_BSD_SYSCTL = YesPlease
@@ -161,7 +161,7 @@ ifeq ($(uname_S),Darwin)
 	CSPRNG_METHOD = arc4random
 	USE_ENHANCED_BASIC_REGULAR_EXPRESSIONS = YesPlease
 	HAVE_PLATFORM_PROCINFO = YesPlease
-	COMPAT_OBJS += compat/darwin/procinfo.o
+	COMPAT_OBJS += lib/compat/darwin/procinfo.o
 
         ifeq ($(uname_M),arm64)
 		HOMEBREW_PREFIX = /opt/homebrew
@@ -292,7 +292,7 @@ ifeq ($(uname_O),Cygwin)
 	UNRELIABLE_FSTAT = UnfortunatelyYes
 	OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
 	MMAP_PREVENTS_DELETE = UnfortunatelyYes
-	COMPAT_OBJS += compat/win32/path-utils.o
+	COMPAT_OBJS += lib/compat/win32/path-utils.o
 	FREAD_READS_DIRECTORIES = UnfortunatelyYes
 endif
 ifeq ($(uname_S),FreeBSD)
@@ -523,17 +523,17 @@ ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))
 	ETC_GITATTRIBUTES = ../etc/gitattributes
 endif
 
-	CC = compat/vcbuild/scripts/clink.pl
-	AR = compat/vcbuild/scripts/lib.pl
+	CC = lib/compat/vcbuild/scripts/clink.pl
+	AR = lib/compat/vcbuild/scripts/lib.pl
 	CFLAGS =
-	BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
-	COMPAT_OBJS = compat/msvc.o compat/winansi.o \
-		compat/win32/flush.o \
-		compat/win32/path-utils.o \
-		compat/win32/pthread.o compat/win32/syslog.o \
-		compat/win32/trace2_win32_process_info.o \
-		compat/win32/dirent.o
-	COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
+	BASIC_CFLAGS = -nologo -I. -Ilib/compat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
+	COMPAT_OBJS = lib/compat/msvc.o lib/compat/winansi.o \
+		lib/compat/win32/flush.o \
+		lib/compat/win32/path-utils.o \
+		lib/compat/win32/pthread.o lib/compat/win32/syslog.o \
+		lib/compat/win32/trace2_win32_process_info.o \
+		lib/compat/win32/dirent.o
+	COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Ilib/compat -Ilib/compat/regex -Ilib/compat/win32 -DSTRIP_EXTENSION=\".exe\"
 	BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
 	# invalidcontinue.obj allows Git's source code to close the same file
 	# handle twice, or to access the osfhandle of an already-closed stdout
@@ -573,7 +573,7 @@ endif
 
 	EXTRA_PROGRAMS += headless-git$X
 
-compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
+lib/compat/msvc.o: lib/compat/msvc.c lib/compat/mingw.c GIT-CFLAGS
 endif
 ifeq ($(uname_S),Interix)
 	NO_INITGROUPS = YesPlease
@@ -724,14 +724,14 @@ ifeq ($(uname_S),MINGW)
 	HAVE_PLATFORM_PROCINFO = YesPlease
 	CSPRNG_METHOD = rtlgenrandom
 	BASIC_LDFLAGS += -municode
-	COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
+	COMPAT_CFLAGS += -DNOGDI -Ilib/compat -Ilib/compat/win32
 	COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
-	COMPAT_OBJS += compat/mingw.o compat/winansi.o \
-		compat/win32/trace2_win32_process_info.o \
-		compat/win32/flush.o \
-		compat/win32/path-utils.o \
-		compat/win32/pthread.o compat/win32/syslog.o \
-		compat/win32/dirent.o
+	COMPAT_OBJS += lib/compat/mingw.o lib/compat/winansi.o \
+		lib/compat/win32/trace2_win32_process_info.o \
+		lib/compat/win32/flush.o \
+		lib/compat/win32/path-utils.o \
+		lib/compat/win32/pthread.o lib/compat/win32/syslog.o \
+		lib/compat/win32/dirent.o
 	BASIC_CFLAGS += -DWIN32
 	EXTLIBS += -lws2_32
 	GITLIBS += git.res
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index a57c4b464f..446a6c889f 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -62,10 +62,10 @@ if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
 endif()
 
 if(USE_VCPKG)
-	set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg")
+	set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/lib/compat/vcbuild/vcpkg")
 	if(NOT EXISTS ${VCPKG_DIR})
 		message("Initializing vcpkg and building the Git's dependencies (this will take a while...)")
-		execute_process(COMMAND ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg_install.bat)
+		execute_process(COMMAND ${CMAKE_SOURCE_DIR}/lib/compat/vcbuild/vcpkg_install.bat)
 	endif()
 	list(APPEND CMAKE_PREFIX_PATH "${VCPKG_DIR}/installed/x64-windows")
 
@@ -194,7 +194,7 @@ else()
 	find_program(MSGFMT_EXE msgfmt)
 	if(NOT MSGFMT_EXE)
 		if(USE_VCPKG)
-			set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
+			set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/lib/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
 		endif()
 		if(NOT EXISTS ${MSGFMT_EXE})
 			message(WARNING "Text Translations won't be built")
@@ -212,13 +212,14 @@ endif()
 
 #default behaviour
 include_directories(${CMAKE_SOURCE_DIR})
+include_directories(${CMAKE_SOURCE_DIR}/lib)
 add_compile_definitions(GIT_HOST_CPU="${CMAKE_SYSTEM_PROCESSOR}")
 add_compile_definitions(SHA256_BLK INTERNAL_QSORT RUNTIME_PREFIX)
 add_compile_definitions(NO_OPENSSL SHA1_DC SHA1DC_NO_STANDARD_INCLUDES
 			SHA1DC_INIT_SAFE_HASH_DEFAULT=0
 			SHA1DC_CUSTOM_INCLUDE_SHA1_C="git-compat-util.h"
 			SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h" )
-list(APPEND compat_SOURCES sha1dc_git.c sha1dc/sha1.c sha1dc/ubc_check.c block-sha1/sha1.c sha256/block/sha256.c compat/qsort_s.c)
+list(APPEND compat_SOURCES lib/sha1dc_git.c lib/sha1dc/sha1.c lib/sha1dc/ubc_check.c lib/block-sha1/sha1.c lib/sha256/block/sha256.c lib/compat/qsort_s.c)
 
 
 add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
@@ -248,43 +249,43 @@ endif()
 #Platform Specific
 if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
 	if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
-		include_directories(${CMAKE_SOURCE_DIR}/compat/vcbuild/include)
+		include_directories(${CMAKE_SOURCE_DIR}/lib/compat/vcbuild/include)
 		add_compile_definitions(_CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
 	endif()
-	include_directories(${CMAKE_SOURCE_DIR}/compat/win32)
+	include_directories(${CMAKE_SOURCE_DIR}/lib/compat/win32)
 	add_compile_definitions(HAVE_ALLOCA_H NO_POSIX_GOODIES NATIVE_CRLF NO_UNIX_SOCKETS WIN32
 				_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=".exe"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT
 				NOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0
 				OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP
 				HAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM)
 	list(APPEND compat_SOURCES
-		compat/mingw.c
-		compat/winansi.c
-		compat/win32/flush.c
-		compat/win32/path-utils.c
-		compat/win32/pthread.c
-		compat/win32mmap.c
-		compat/win32/syslog.c
-		compat/win32/trace2_win32_process_info.c
-		compat/win32/dirent.c
-		compat/strdup.c)
+		lib/compat/mingw.c
+		lib/compat/winansi.c
+		lib/compat/win32/flush.c
+		lib/compat/win32/path-utils.c
+		lib/compat/win32/pthread.c
+		lib/compat/win32mmap.c
+		lib/compat/win32/syslog.c
+		lib/compat/win32/trace2_win32_process_info.c
+		lib/compat/win32/dirent.c
+		lib/compat/strdup.c)
 	set(NO_UNIX_SOCKETS 1)
 
 elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
 	add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
-	list(APPEND compat_SOURCES unix-socket.c unix-stream-server.c compat/linux/procinfo.c)
+	list(APPEND compat_SOURCES lib/unix-socket.c lib/unix-stream-server.c lib/compat/linux/procinfo.c)
 elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
-	list(APPEND compat_SOURCES compat/darwin/procinfo.c)
+	list(APPEND compat_SOURCES lib/compat/darwin/procinfo.c)
 endif()
 
 if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
-	list(APPEND compat_SOURCES compat/simple-ipc/ipc-shared.c compat/simple-ipc/ipc-win32.c)
+	list(APPEND compat_SOURCES lib/compat/simple-ipc/ipc-shared.c lib/compat/simple-ipc/ipc-win32.c)
 	add_compile_definitions(SUPPORTS_SIMPLE_IPC)
 	set(SUPPORTS_SIMPLE_IPC 1)
 else()
 	# Simple IPC requires both Unix sockets and pthreads on Unix-based systems.
 	if(NOT NO_UNIX_SOCKETS AND NOT NO_PTHREADS)
-		list(APPEND compat_SOURCES compat/simple-ipc/ipc-shared.c compat/simple-ipc/ipc-unix-socket.c)
+		list(APPEND compat_SOURCES lib/compat/simple-ipc/ipc-shared.c lib/compat/simple-ipc/ipc-unix-socket.c)
 		add_compile_definitions(SUPPORTS_SIMPLE_IPC)
 		set(SUPPORTS_SIMPLE_IPC 1)
 	endif()
@@ -305,13 +306,13 @@ if(SUPPORTS_SIMPLE_IPC)
 
 	if(FSMONITOR_DAEMON_BACKEND)
 		add_compile_definitions(HAVE_FSMONITOR_DAEMON_BACKEND)
-		list(APPEND compat_SOURCES compat/fsmonitor/fsm-listen-${FSMONITOR_DAEMON_BACKEND}.c)
-		list(APPEND compat_SOURCES compat/fsmonitor/fsm-health-${FSMONITOR_DAEMON_BACKEND}.c)
-		list(APPEND compat_SOURCES compat/fsmonitor/fsm-ipc-${FSMONITOR_OS_SETTINGS}.c)
-		list(APPEND compat_SOURCES compat/fsmonitor/fsm-path-utils-${FSMONITOR_DAEMON_BACKEND}.c)
+		list(APPEND compat_SOURCES lib/compat/fsmonitor/fsm-listen-${FSMONITOR_DAEMON_BACKEND}.c)
+		list(APPEND compat_SOURCES lib/compat/fsmonitor/fsm-health-${FSMONITOR_DAEMON_BACKEND}.c)
+		list(APPEND compat_SOURCES lib/compat/fsmonitor/fsm-ipc-${FSMONITOR_OS_SETTINGS}.c)
+		list(APPEND compat_SOURCES lib/compat/fsmonitor/fsm-path-utils-${FSMONITOR_DAEMON_BACKEND}.c)
 
 		add_compile_definitions(HAVE_FSMONITOR_OS_SETTINGS)
-		list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-${FSMONITOR_OS_SETTINGS}.c)
+		list(APPEND compat_SOURCES lib/compat/fsmonitor/fsm-settings-${FSMONITOR_OS_SETTINGS}.c)
 	endif()
 endif()
 
@@ -321,7 +322,7 @@ set(EXE_EXTENSION ${CMAKE_EXECUTABLE_SUFFIX})
 check_include_file(libgen.h HAVE_LIBGEN_H)
 if(NOT HAVE_LIBGEN_H)
 	add_compile_definitions(NO_LIBGEN_H)
-	list(APPEND compat_SOURCES compat/basename.c)
+	list(APPEND compat_SOURCES lib/compat/basename.c)
 endif()
 
 check_include_file(sys/sysinfo.h HAVE_SYSINFO)
@@ -394,42 +395,42 @@ foreach(f ${function_checks})
 endforeach()
 
 if(NOT HAVE_POLL_H OR NOT HAVE_SYS_POLL_H OR NOT HAVE_POLL)
-	include_directories(${CMAKE_SOURCE_DIR}/compat/poll)
+	include_directories(${CMAKE_SOURCE_DIR}/lib/compat/poll)
 	add_compile_definitions(NO_POLL)
-	list(APPEND compat_SOURCES compat/poll/poll.c)
+	list(APPEND compat_SOURCES lib/compat/poll/poll.c)
 endif()
 
 if(NOT HAVE_STRCASESTR)
-	list(APPEND compat_SOURCES compat/strcasestr.c)
+	list(APPEND compat_SOURCES lib/compat/strcasestr.c)
 endif()
 
 if(NOT HAVE_STRLCPY)
-	list(APPEND compat_SOURCES compat/strlcpy.c)
+	list(APPEND compat_SOURCES lib/compat/strlcpy.c)
 endif()
 
 if(NOT HAVE_STRTOUMAX)
-	list(APPEND compat_SOURCES compat/strtoumax.c compat/strtoimax.c)
+	list(APPEND compat_SOURCES lib/compat/strtoumax.c lib/compat/strtoimax.c)
 endif()
 
 if(NOT HAVE_SETENV)
-	list(APPEND compat_SOURCES compat/setenv.c)
+	list(APPEND compat_SOURCES lib/compat/setenv.c)
 endif()
 
 if(NOT HAVE_PREAD)
-	list(APPEND compat_SOURCES compat/pread.c)
+	list(APPEND compat_SOURCES lib/compat/pread.c)
 endif()
 
 if(NOT HAVE_MEMMEM)
-	list(APPEND compat_SOURCES compat/memmem.c)
+	list(APPEND compat_SOURCES lib/compat/memmem.c)
 endif()
 
 if(NOT WIN32)
 	if(NOT HAVE_UNSETENV)
-		list(APPEND compat_SOURCES compat/unsetenv.c)
+		list(APPEND compat_SOURCES lib/compat/unsetenv.c)
 	endif()
 
 	if(NOT HAVE_HSTRERROR)
-		list(APPEND compat_SOURCES compat/hstrerror.c)
+		list(APPEND compat_SOURCES lib/compat/hstrerror.c)
 	endif()
 endif()
 
@@ -486,7 +487,7 @@ int main(void)
 SNPRINTF_OK)
 if(NOT SNPRINTF_OK)
 	add_compile_definitions(SNPRINTF_RETURNS_BOGUS)
-	list(APPEND compat_SOURCES compat/snprintf.c)
+	list(APPEND compat_SOURCES lib/compat/snprintf.c)
 endif()
 
 check_c_source_runs("
@@ -501,7 +502,7 @@ int main(void)
 FREAD_READS_DIRECTORIES_NO)
 if(NOT FREAD_READS_DIRECTORIES_NO)
 	add_compile_definitions(FREAD_READS_DIRECTORIES)
-	list(APPEND compat_SOURCES compat/fopen.c)
+	list(APPEND compat_SOURCES lib/compat/fopen.c)
 endif()
 
 check_c_source_compiles("
@@ -516,8 +517,8 @@ int main(void)
 }"
 HAVE_REGEX)
 if(NOT HAVE_REGEX)
-	include_directories(${CMAKE_SOURCE_DIR}/compat/regex)
-	list(APPEND compat_SOURCES compat/regex/regex.c )
+	include_directories(${CMAKE_SOURCE_DIR}/lib/compat/regex)
+	list(APPEND compat_SOURCES lib/compat/regex/regex.c )
 	add_compile_definitions(NO_REGEX NO_MBSUPPORT GAWK)
 endif()
 
@@ -670,10 +671,10 @@ list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
 add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/version-def.h"
 	COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
 		"${CMAKE_SOURCE_DIR}"
-		"${CMAKE_SOURCE_DIR}/version-def.h.in"
+		"${CMAKE_SOURCE_DIR}/lib/version-def.h.in"
 		"${CMAKE_BINARY_DIR}/version-def.h"
 	DEPENDS "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
-		"${CMAKE_SOURCE_DIR}/version-def.h.in"
+		"${CMAKE_SOURCE_DIR}/lib/version-def.h.in"
 	VERBATIM)
 list(APPEND libgit_SOURCES "${CMAKE_BINARY_DIR}/version-def.h")
 
@@ -732,7 +733,7 @@ if(WIN32)
 		message(FATAL_ERROR "Unhandled compiler: ${CMAKE_C_COMPILER_ID}")
 	endif()
 
-	add_executable(headless-git ${CMAKE_SOURCE_DIR}/compat/win32/headless.c)
+	add_executable(headless-git ${CMAKE_SOURCE_DIR}/lib/compat/win32/headless.c)
 	if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
 		target_link_options(headless-git PUBLIC -municode -Wl,-subsystem,windows)
 	elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
@@ -767,15 +768,15 @@ add_executable(scalar ${CMAKE_SOURCE_DIR}/scalar.c)
 target_link_libraries(scalar common-main)
 
 if(CURL_FOUND)
-	add_library(http_obj OBJECT ${CMAKE_SOURCE_DIR}/http.c)
+	add_library(http_obj OBJECT ${CMAKE_SOURCE_DIR}/lib/http.c)
 
 	add_executable(git-imap-send ${CMAKE_SOURCE_DIR}/imap-send.c)
 	target_link_libraries(git-imap-send http_obj common-main ${CURL_LIBRARIES})
 
-	add_executable(git-http-fetch ${CMAKE_SOURCE_DIR}/http-walker.c ${CMAKE_SOURCE_DIR}/http-fetch.c)
+	add_executable(git-http-fetch ${CMAKE_SOURCE_DIR}/lib/http-walker.c ${CMAKE_SOURCE_DIR}/http-fetch.c)
 	target_link_libraries(git-http-fetch http_obj common-main ${CURL_LIBRARIES})
 
-	add_executable(git-remote-http ${CMAKE_SOURCE_DIR}/http-walker.c ${CMAKE_SOURCE_DIR}/remote-curl.c)
+	add_executable(git-remote-http ${CMAKE_SOURCE_DIR}/lib/http-walker.c ${CMAKE_SOURCE_DIR}/remote-curl.c)
 	target_link_libraries(git-remote-http http_obj common-main ${CURL_LIBRARIES} )
 
 	if(EXPAT_FOUND)
@@ -1201,7 +1202,7 @@ string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
 string(REPLACE "@WITH_BREAKING_CHANGES@" "" git_build_options "${git_build_options}")
 string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
 if(USE_VCPKG)
-	string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
+	string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../lib/compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
 endif()
 file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options})
 
diff --git a/git.rc.in b/git.rc.in
index e69444eef3..87cdefd50b 100644
--- a/git.rc.in
+++ b/git.rc.in
@@ -21,4 +21,4 @@ BEGIN
   END
 END
 
-1 RT_MANIFEST "compat/win32/git.manifest"
+1 RT_MANIFEST "lib/compat/win32/git.manifest"
diff --git a/abspath.c b/lib/abspath.c
similarity index 100%
rename from abspath.c
rename to lib/abspath.c
diff --git a/abspath.h b/lib/abspath.h
similarity index 100%
rename from abspath.h
rename to lib/abspath.h
diff --git a/add-interactive.c b/lib/add-interactive.c
similarity index 100%
rename from add-interactive.c
rename to lib/add-interactive.c
diff --git a/add-interactive.h b/lib/add-interactive.h
similarity index 100%
rename from add-interactive.h
rename to lib/add-interactive.h
diff --git a/add-patch.c b/lib/add-patch.c
similarity index 100%
rename from add-patch.c
rename to lib/add-patch.c
diff --git a/add-patch.h b/lib/add-patch.h
similarity index 100%
rename from add-patch.h
rename to lib/add-patch.h
diff --git a/advice.c b/lib/advice.c
similarity index 100%
rename from advice.c
rename to lib/advice.c
diff --git a/advice.h b/lib/advice.h
similarity index 100%
rename from advice.h
rename to lib/advice.h
diff --git a/alias.c b/lib/alias.c
similarity index 100%
rename from alias.c
rename to lib/alias.c
diff --git a/alias.h b/lib/alias.h
similarity index 100%
rename from alias.h
rename to lib/alias.h
diff --git a/alloc.c b/lib/alloc.c
similarity index 100%
rename from alloc.c
rename to lib/alloc.c
diff --git a/alloc.h b/lib/alloc.h
similarity index 100%
rename from alloc.h
rename to lib/alloc.h
diff --git a/apply.c b/lib/apply.c
similarity index 100%
rename from apply.c
rename to lib/apply.c
diff --git a/apply.h b/lib/apply.h
similarity index 100%
rename from apply.h
rename to lib/apply.h
diff --git a/archive-tar.c b/lib/archive-tar.c
similarity index 100%
rename from archive-tar.c
rename to lib/archive-tar.c
diff --git a/archive-zip.c b/lib/archive-zip.c
similarity index 100%
rename from archive-zip.c
rename to lib/archive-zip.c
diff --git a/archive.c b/lib/archive.c
similarity index 100%
rename from archive.c
rename to lib/archive.c
diff --git a/archive.h b/lib/archive.h
similarity index 100%
rename from archive.h
rename to lib/archive.h
diff --git a/attr.c b/lib/attr.c
similarity index 100%
rename from attr.c
rename to lib/attr.c
diff --git a/attr.h b/lib/attr.h
similarity index 100%
rename from attr.h
rename to lib/attr.h
diff --git a/banned.h b/lib/banned.h
similarity index 100%
rename from banned.h
rename to lib/banned.h
diff --git a/base85.c b/lib/base85.c
similarity index 100%
rename from base85.c
rename to lib/base85.c
diff --git a/base85.h b/lib/base85.h
similarity index 100%
rename from base85.h
rename to lib/base85.h
diff --git a/bisect.c b/lib/bisect.c
similarity index 100%
rename from bisect.c
rename to lib/bisect.c
diff --git a/bisect.h b/lib/bisect.h
similarity index 100%
rename from bisect.h
rename to lib/bisect.h
diff --git a/blame.c b/lib/blame.c
similarity index 100%
rename from blame.c
rename to lib/blame.c
diff --git a/blame.h b/lib/blame.h
similarity index 100%
rename from blame.h
rename to lib/blame.h
diff --git a/blob.c b/lib/blob.c
similarity index 100%
rename from blob.c
rename to lib/blob.c
diff --git a/blob.h b/lib/blob.h
similarity index 100%
rename from blob.h
rename to lib/blob.h
diff --git a/block-sha1/sha1.c b/lib/block-sha1/sha1.c
similarity index 100%
rename from block-sha1/sha1.c
rename to lib/block-sha1/sha1.c
diff --git a/block-sha1/sha1.h b/lib/block-sha1/sha1.h
similarity index 100%
rename from block-sha1/sha1.h
rename to lib/block-sha1/sha1.h
diff --git a/bloom.c b/lib/bloom.c
similarity index 100%
rename from bloom.c
rename to lib/bloom.c
diff --git a/bloom.h b/lib/bloom.h
similarity index 100%
rename from bloom.h
rename to lib/bloom.h
diff --git a/branch.c b/lib/branch.c
similarity index 100%
rename from branch.c
rename to lib/branch.c
diff --git a/branch.h b/lib/branch.h
similarity index 100%
rename from branch.h
rename to lib/branch.h
diff --git a/builtin.h b/lib/builtin.h
similarity index 100%
rename from builtin.h
rename to lib/builtin.h
diff --git a/bundle-uri.c b/lib/bundle-uri.c
similarity index 100%
rename from bundle-uri.c
rename to lib/bundle-uri.c
diff --git a/bundle-uri.h b/lib/bundle-uri.h
similarity index 100%
rename from bundle-uri.h
rename to lib/bundle-uri.h
diff --git a/bundle.c b/lib/bundle.c
similarity index 100%
rename from bundle.c
rename to lib/bundle.c
diff --git a/bundle.h b/lib/bundle.h
similarity index 100%
rename from bundle.h
rename to lib/bundle.h
diff --git a/cache-tree.c b/lib/cache-tree.c
similarity index 100%
rename from cache-tree.c
rename to lib/cache-tree.c
diff --git a/cache-tree.h b/lib/cache-tree.h
similarity index 100%
rename from cache-tree.h
rename to lib/cache-tree.h
diff --git a/cbtree.c b/lib/cbtree.c
similarity index 100%
rename from cbtree.c
rename to lib/cbtree.c
diff --git a/cbtree.h b/lib/cbtree.h
similarity index 100%
rename from cbtree.h
rename to lib/cbtree.h
diff --git a/chdir-notify.c b/lib/chdir-notify.c
similarity index 100%
rename from chdir-notify.c
rename to lib/chdir-notify.c
diff --git a/chdir-notify.h b/lib/chdir-notify.h
similarity index 100%
rename from chdir-notify.h
rename to lib/chdir-notify.h
diff --git a/checkout.c b/lib/checkout.c
similarity index 100%
rename from checkout.c
rename to lib/checkout.c
diff --git a/checkout.h b/lib/checkout.h
similarity index 100%
rename from checkout.h
rename to lib/checkout.h
diff --git a/chunk-format.c b/lib/chunk-format.c
similarity index 100%
rename from chunk-format.c
rename to lib/chunk-format.c
diff --git a/chunk-format.h b/lib/chunk-format.h
similarity index 100%
rename from chunk-format.h
rename to lib/chunk-format.h
diff --git a/color.c b/lib/color.c
similarity index 100%
rename from color.c
rename to lib/color.c
diff --git a/color.h b/lib/color.h
similarity index 100%
rename from color.h
rename to lib/color.h
diff --git a/column.c b/lib/column.c
similarity index 100%
rename from column.c
rename to lib/column.c
diff --git a/column.h b/lib/column.h
similarity index 100%
rename from column.h
rename to lib/column.h
diff --git a/combine-diff.c b/lib/combine-diff.c
similarity index 100%
rename from combine-diff.c
rename to lib/combine-diff.c
diff --git a/commit-graph.c b/lib/commit-graph.c
similarity index 100%
rename from commit-graph.c
rename to lib/commit-graph.c
diff --git a/commit-graph.h b/lib/commit-graph.h
similarity index 100%
rename from commit-graph.h
rename to lib/commit-graph.h
diff --git a/commit-reach.c b/lib/commit-reach.c
similarity index 100%
rename from commit-reach.c
rename to lib/commit-reach.c
diff --git a/commit-reach.h b/lib/commit-reach.h
similarity index 100%
rename from commit-reach.h
rename to lib/commit-reach.h
diff --git a/commit-slab-decl.h b/lib/commit-slab-decl.h
similarity index 100%
rename from commit-slab-decl.h
rename to lib/commit-slab-decl.h
diff --git a/commit-slab-impl.h b/lib/commit-slab-impl.h
similarity index 100%
rename from commit-slab-impl.h
rename to lib/commit-slab-impl.h
diff --git a/commit-slab.h b/lib/commit-slab.h
similarity index 100%
rename from commit-slab.h
rename to lib/commit-slab.h
diff --git a/commit.c b/lib/commit.c
similarity index 100%
rename from commit.c
rename to lib/commit.c
diff --git a/commit.h b/lib/commit.h
similarity index 100%
rename from commit.h
rename to lib/commit.h
diff --git a/common-exit.c b/lib/common-exit.c
similarity index 100%
rename from common-exit.c
rename to lib/common-exit.c
diff --git a/common-init.c b/lib/common-init.c
similarity index 100%
rename from common-init.c
rename to lib/common-init.c
diff --git a/common-init.h b/lib/common-init.h
similarity index 100%
rename from common-init.h
rename to lib/common-init.h
diff --git a/compat/.gitattributes b/lib/compat/.gitattributes
similarity index 100%
rename from compat/.gitattributes
rename to lib/compat/.gitattributes
diff --git a/compat/access.c b/lib/compat/access.c
similarity index 100%
rename from compat/access.c
rename to lib/compat/access.c
diff --git a/compat/apple-common-crypto.h b/lib/compat/apple-common-crypto.h
similarity index 100%
rename from compat/apple-common-crypto.h
rename to lib/compat/apple-common-crypto.h
diff --git a/compat/basename.c b/lib/compat/basename.c
similarity index 100%
rename from compat/basename.c
rename to lib/compat/basename.c
diff --git a/compat/bswap.h b/lib/compat/bswap.h
similarity index 100%
rename from compat/bswap.h
rename to lib/compat/bswap.h
diff --git a/compat/compiler.h b/lib/compat/compiler.h
similarity index 100%
rename from compat/compiler.h
rename to lib/compat/compiler.h
diff --git a/compat/darwin/procinfo.c b/lib/compat/darwin/procinfo.c
similarity index 100%
rename from compat/darwin/procinfo.c
rename to lib/compat/darwin/procinfo.c
diff --git a/compat/disk.h b/lib/compat/disk.h
similarity index 100%
rename from compat/disk.h
rename to lib/compat/disk.h
diff --git a/compat/fileno.c b/lib/compat/fileno.c
similarity index 100%
rename from compat/fileno.c
rename to lib/compat/fileno.c
diff --git a/compat/fopen.c b/lib/compat/fopen.c
similarity index 100%
rename from compat/fopen.c
rename to lib/compat/fopen.c
diff --git a/compat/fsmonitor/fsm-darwin-gcc.h b/lib/compat/fsmonitor/fsm-darwin-gcc.h
similarity index 100%
rename from compat/fsmonitor/fsm-darwin-gcc.h
rename to lib/compat/fsmonitor/fsm-darwin-gcc.h
diff --git a/compat/fsmonitor/fsm-health-darwin.c b/lib/compat/fsmonitor/fsm-health-darwin.c
similarity index 100%
rename from compat/fsmonitor/fsm-health-darwin.c
rename to lib/compat/fsmonitor/fsm-health-darwin.c
diff --git a/compat/fsmonitor/fsm-health-linux.c b/lib/compat/fsmonitor/fsm-health-linux.c
similarity index 100%
rename from compat/fsmonitor/fsm-health-linux.c
rename to lib/compat/fsmonitor/fsm-health-linux.c
diff --git a/compat/fsmonitor/fsm-health-win32.c b/lib/compat/fsmonitor/fsm-health-win32.c
similarity index 100%
rename from compat/fsmonitor/fsm-health-win32.c
rename to lib/compat/fsmonitor/fsm-health-win32.c
diff --git a/compat/fsmonitor/fsm-health.h b/lib/compat/fsmonitor/fsm-health.h
similarity index 100%
rename from compat/fsmonitor/fsm-health.h
rename to lib/compat/fsmonitor/fsm-health.h
diff --git a/compat/fsmonitor/fsm-ipc-unix.c b/lib/compat/fsmonitor/fsm-ipc-unix.c
similarity index 100%
rename from compat/fsmonitor/fsm-ipc-unix.c
rename to lib/compat/fsmonitor/fsm-ipc-unix.c
diff --git a/compat/fsmonitor/fsm-ipc-win32.c b/lib/compat/fsmonitor/fsm-ipc-win32.c
similarity index 100%
rename from compat/fsmonitor/fsm-ipc-win32.c
rename to lib/compat/fsmonitor/fsm-ipc-win32.c
diff --git a/compat/fsmonitor/fsm-listen-darwin.c b/lib/compat/fsmonitor/fsm-listen-darwin.c
similarity index 100%
rename from compat/fsmonitor/fsm-listen-darwin.c
rename to lib/compat/fsmonitor/fsm-listen-darwin.c
diff --git a/compat/fsmonitor/fsm-listen-linux.c b/lib/compat/fsmonitor/fsm-listen-linux.c
similarity index 100%
rename from compat/fsmonitor/fsm-listen-linux.c
rename to lib/compat/fsmonitor/fsm-listen-linux.c
diff --git a/compat/fsmonitor/fsm-listen-win32.c b/lib/compat/fsmonitor/fsm-listen-win32.c
similarity index 100%
rename from compat/fsmonitor/fsm-listen-win32.c
rename to lib/compat/fsmonitor/fsm-listen-win32.c
diff --git a/compat/fsmonitor/fsm-listen.h b/lib/compat/fsmonitor/fsm-listen.h
similarity index 100%
rename from compat/fsmonitor/fsm-listen.h
rename to lib/compat/fsmonitor/fsm-listen.h
diff --git a/compat/fsmonitor/fsm-path-utils-darwin.c b/lib/compat/fsmonitor/fsm-path-utils-darwin.c
similarity index 100%
rename from compat/fsmonitor/fsm-path-utils-darwin.c
rename to lib/compat/fsmonitor/fsm-path-utils-darwin.c
diff --git a/compat/fsmonitor/fsm-path-utils-linux.c b/lib/compat/fsmonitor/fsm-path-utils-linux.c
similarity index 100%
rename from compat/fsmonitor/fsm-path-utils-linux.c
rename to lib/compat/fsmonitor/fsm-path-utils-linux.c
diff --git a/compat/fsmonitor/fsm-path-utils-win32.c b/lib/compat/fsmonitor/fsm-path-utils-win32.c
similarity index 100%
rename from compat/fsmonitor/fsm-path-utils-win32.c
rename to lib/compat/fsmonitor/fsm-path-utils-win32.c
diff --git a/compat/fsmonitor/fsm-settings-unix.c b/lib/compat/fsmonitor/fsm-settings-unix.c
similarity index 100%
rename from compat/fsmonitor/fsm-settings-unix.c
rename to lib/compat/fsmonitor/fsm-settings-unix.c
diff --git a/compat/fsmonitor/fsm-settings-win32.c b/lib/compat/fsmonitor/fsm-settings-win32.c
similarity index 100%
rename from compat/fsmonitor/fsm-settings-win32.c
rename to lib/compat/fsmonitor/fsm-settings-win32.c
diff --git a/compat/hstrerror.c b/lib/compat/hstrerror.c
similarity index 100%
rename from compat/hstrerror.c
rename to lib/compat/hstrerror.c
diff --git a/compat/inet_ntop.c b/lib/compat/inet_ntop.c
similarity index 100%
rename from compat/inet_ntop.c
rename to lib/compat/inet_ntop.c
diff --git a/compat/inet_pton.c b/lib/compat/inet_pton.c
similarity index 100%
rename from compat/inet_pton.c
rename to lib/compat/inet_pton.c
diff --git a/compat/linux/procinfo.c b/lib/compat/linux/procinfo.c
similarity index 100%
rename from compat/linux/procinfo.c
rename to lib/compat/linux/procinfo.c
diff --git a/compat/memmem.c b/lib/compat/memmem.c
similarity index 100%
rename from compat/memmem.c
rename to lib/compat/memmem.c
diff --git a/compat/mingw-posix.h b/lib/compat/mingw-posix.h
similarity index 100%
rename from compat/mingw-posix.h
rename to lib/compat/mingw-posix.h
diff --git a/compat/mingw.c b/lib/compat/mingw.c
similarity index 100%
rename from compat/mingw.c
rename to lib/compat/mingw.c
diff --git a/compat/mingw.h b/lib/compat/mingw.h
similarity index 100%
rename from compat/mingw.h
rename to lib/compat/mingw.h
diff --git a/compat/mkdir.c b/lib/compat/mkdir.c
similarity index 100%
rename from compat/mkdir.c
rename to lib/compat/mkdir.c
diff --git a/compat/mmap.c b/lib/compat/mmap.c
similarity index 100%
rename from compat/mmap.c
rename to lib/compat/mmap.c
diff --git a/compat/msvc-posix.h b/lib/compat/msvc-posix.h
similarity index 100%
rename from compat/msvc-posix.h
rename to lib/compat/msvc-posix.h
diff --git a/compat/msvc.c b/lib/compat/msvc.c
similarity index 100%
rename from compat/msvc.c
rename to lib/compat/msvc.c
diff --git a/compat/msvc.h b/lib/compat/msvc.h
similarity index 100%
rename from compat/msvc.h
rename to lib/compat/msvc.h
diff --git a/compat/nonblock.c b/lib/compat/nonblock.c
similarity index 100%
rename from compat/nonblock.c
rename to lib/compat/nonblock.c
diff --git a/compat/nonblock.h b/lib/compat/nonblock.h
similarity index 100%
rename from compat/nonblock.h
rename to lib/compat/nonblock.h
diff --git a/compat/obstack.c b/lib/compat/obstack.c
similarity index 100%
rename from compat/obstack.c
rename to lib/compat/obstack.c
diff --git a/compat/obstack.h b/lib/compat/obstack.h
similarity index 100%
rename from compat/obstack.h
rename to lib/compat/obstack.h
diff --git a/compat/open.c b/lib/compat/open.c
similarity index 100%
rename from compat/open.c
rename to lib/compat/open.c
diff --git a/compat/poll/poll.c b/lib/compat/poll/poll.c
similarity index 100%
rename from compat/poll/poll.c
rename to lib/compat/poll/poll.c
diff --git a/compat/poll/poll.h b/lib/compat/poll/poll.h
similarity index 100%
rename from compat/poll/poll.h
rename to lib/compat/poll/poll.h
diff --git a/compat/posix.h b/lib/compat/posix.h
similarity index 100%
rename from compat/posix.h
rename to lib/compat/posix.h
diff --git a/compat/pread.c b/lib/compat/pread.c
similarity index 100%
rename from compat/pread.c
rename to lib/compat/pread.c
diff --git a/compat/precompose_utf8.c b/lib/compat/precompose_utf8.c
similarity index 100%
rename from compat/precompose_utf8.c
rename to lib/compat/precompose_utf8.c
diff --git a/compat/precompose_utf8.h b/lib/compat/precompose_utf8.h
similarity index 100%
rename from compat/precompose_utf8.h
rename to lib/compat/precompose_utf8.h
diff --git a/compat/qsort_s.c b/lib/compat/qsort_s.c
similarity index 100%
rename from compat/qsort_s.c
rename to lib/compat/qsort_s.c
diff --git a/compat/regcomp_enhanced.c b/lib/compat/regcomp_enhanced.c
similarity index 100%
rename from compat/regcomp_enhanced.c
rename to lib/compat/regcomp_enhanced.c
diff --git a/compat/regex/regcomp.c b/lib/compat/regex/regcomp.c
similarity index 100%
rename from compat/regex/regcomp.c
rename to lib/compat/regex/regcomp.c
diff --git a/compat/regex/regex.c b/lib/compat/regex/regex.c
similarity index 100%
rename from compat/regex/regex.c
rename to lib/compat/regex/regex.c
diff --git a/compat/regex/regex.h b/lib/compat/regex/regex.h
similarity index 100%
rename from compat/regex/regex.h
rename to lib/compat/regex/regex.h
diff --git a/compat/regex/regex_internal.c b/lib/compat/regex/regex_internal.c
similarity index 100%
rename from compat/regex/regex_internal.c
rename to lib/compat/regex/regex_internal.c
diff --git a/compat/regex/regex_internal.h b/lib/compat/regex/regex_internal.h
similarity index 100%
rename from compat/regex/regex_internal.h
rename to lib/compat/regex/regex_internal.h
diff --git a/compat/regex/regexec.c b/lib/compat/regex/regexec.c
similarity index 100%
rename from compat/regex/regexec.c
rename to lib/compat/regex/regexec.c
diff --git a/compat/setenv.c b/lib/compat/setenv.c
similarity index 100%
rename from compat/setenv.c
rename to lib/compat/setenv.c
diff --git a/compat/sha1-chunked.c b/lib/compat/sha1-chunked.c
similarity index 100%
rename from compat/sha1-chunked.c
rename to lib/compat/sha1-chunked.c
diff --git a/compat/sha1-chunked.h b/lib/compat/sha1-chunked.h
similarity index 100%
rename from compat/sha1-chunked.h
rename to lib/compat/sha1-chunked.h
diff --git a/compat/simple-ipc/ipc-shared.c b/lib/compat/simple-ipc/ipc-shared.c
similarity index 100%
rename from compat/simple-ipc/ipc-shared.c
rename to lib/compat/simple-ipc/ipc-shared.c
diff --git a/compat/simple-ipc/ipc-unix-socket.c b/lib/compat/simple-ipc/ipc-unix-socket.c
similarity index 100%
rename from compat/simple-ipc/ipc-unix-socket.c
rename to lib/compat/simple-ipc/ipc-unix-socket.c
diff --git a/compat/simple-ipc/ipc-win32.c b/lib/compat/simple-ipc/ipc-win32.c
similarity index 100%
rename from compat/simple-ipc/ipc-win32.c
rename to lib/compat/simple-ipc/ipc-win32.c
diff --git a/compat/snprintf.c b/lib/compat/snprintf.c
similarity index 100%
rename from compat/snprintf.c
rename to lib/compat/snprintf.c
diff --git a/compat/stat.c b/lib/compat/stat.c
similarity index 100%
rename from compat/stat.c
rename to lib/compat/stat.c
diff --git a/compat/strcasestr.c b/lib/compat/strcasestr.c
similarity index 100%
rename from compat/strcasestr.c
rename to lib/compat/strcasestr.c
diff --git a/compat/strdup.c b/lib/compat/strdup.c
similarity index 100%
rename from compat/strdup.c
rename to lib/compat/strdup.c
diff --git a/compat/strlcpy.c b/lib/compat/strlcpy.c
similarity index 100%
rename from compat/strlcpy.c
rename to lib/compat/strlcpy.c
diff --git a/compat/strtoimax.c b/lib/compat/strtoimax.c
similarity index 100%
rename from compat/strtoimax.c
rename to lib/compat/strtoimax.c
diff --git a/compat/strtoumax.c b/lib/compat/strtoumax.c
similarity index 100%
rename from compat/strtoumax.c
rename to lib/compat/strtoumax.c
diff --git a/compat/stub/procinfo.c b/lib/compat/stub/procinfo.c
similarity index 100%
rename from compat/stub/procinfo.c
rename to lib/compat/stub/procinfo.c
diff --git a/compat/terminal.c b/lib/compat/terminal.c
similarity index 100%
rename from compat/terminal.c
rename to lib/compat/terminal.c
diff --git a/compat/terminal.h b/lib/compat/terminal.h
similarity index 100%
rename from compat/terminal.h
rename to lib/compat/terminal.h
diff --git a/compat/unsetenv.c b/lib/compat/unsetenv.c
similarity index 100%
rename from compat/unsetenv.c
rename to lib/compat/unsetenv.c
diff --git a/compat/vcbuild/.gitignore b/lib/compat/vcbuild/.gitignore
similarity index 100%
rename from compat/vcbuild/.gitignore
rename to lib/compat/vcbuild/.gitignore
diff --git a/compat/vcbuild/README b/lib/compat/vcbuild/README
similarity index 94%
rename from compat/vcbuild/README
rename to lib/compat/vcbuild/README
index 29ec1d0f10..63ee00a4ef 100644
--- a/compat/vcbuild/README
+++ b/lib/compat/vcbuild/README
@@ -6,17 +6,17 @@ The Steps to Build Git with VS2015 or VS2017 from the command line.
    Prompt or from an SDK bash window:
 
    $ cd <repo_root>
-   $ ./compat/vcbuild/vcpkg_install.bat
+   $ ./lib/compat/vcbuild/vcpkg_install.bat
 
    The vcpkg tools and all of the third-party sources will be installed
    in this folder:
-      <repo_root>/compat/vcbuild/vcpkg/
+      <repo_root>/lib/compat/vcbuild/vcpkg/
 
    A file will be created with a set of Makefile macros pointing to a
    unified "include", "lib", and "bin" directory (release and debug) for
    all of the required packages.  This file will be included by the main
    Makefile:
-      <repo_root>/compat/vcbuild/MSVC-DEFS-GEN
+      <repo_root>/lib/compat/vcbuild/MSVC-DEFS-GEN
 
 2. OPTIONALLY copy the third-party *.dll and *.pdb files into the repo
    root to make it easier to run and debug git.exe without having to
@@ -26,8 +26,8 @@ The Steps to Build Git with VS2015 or VS2017 from the command line.
    Use ONE of the following forms which should match how you want to
    compile git.exe.
 
-   $ ./compat/vcbuild/vcpkg_copy_dlls.bat debug
-   $ ./compat/vcbuild/vcpkg_copy_dlls.bat release
+   $ ./lib/compat/vcbuild/vcpkg_copy_dlls.bat debug
+   $ ./lib/compat/vcbuild/vcpkg_copy_dlls.bat release
 
 3. Build git using MSVC from an SDK bash window using one of the
    following commands:
diff --git a/compat/vcbuild/find_vs_env.bat b/lib/compat/vcbuild/find_vs_env.bat
similarity index 98%
rename from compat/vcbuild/find_vs_env.bat
rename to lib/compat/vcbuild/find_vs_env.bat
index b35d264c0e..30e884b3d7 100644
--- a/compat/vcbuild/find_vs_env.bat
+++ b/lib/compat/vcbuild/find_vs_env.bat
@@ -25,7 +25,7 @@ REM
 REM The output of this script should be written to a make "include
 REM file" and referenced by the top-level Makefile.
 REM
-REM See "config.mak.uname" (look for compat/vcbuild/MSVC-DEFS-GEN).
+REM See "config.mak.uname" (look for lib/compat/vcbuild/MSVC-DEFS-GEN).
 REM ================================================================
 REM The provided command prompts are custom to each VS release and
 REM filled with lots of internal knowledge (such as Registry settings);
diff --git a/compat/vcbuild/include/sys/param.h b/lib/compat/vcbuild/include/sys/param.h
similarity index 100%
rename from compat/vcbuild/include/sys/param.h
rename to lib/compat/vcbuild/include/sys/param.h
diff --git a/compat/vcbuild/include/sys/time.h b/lib/compat/vcbuild/include/sys/time.h
similarity index 100%
rename from compat/vcbuild/include/sys/time.h
rename to lib/compat/vcbuild/include/sys/time.h
diff --git a/compat/vcbuild/include/sys/utime.h b/lib/compat/vcbuild/include/sys/utime.h
similarity index 100%
rename from compat/vcbuild/include/sys/utime.h
rename to lib/compat/vcbuild/include/sys/utime.h
diff --git a/compat/vcbuild/include/unistd.h b/lib/compat/vcbuild/include/unistd.h
similarity index 100%
rename from compat/vcbuild/include/unistd.h
rename to lib/compat/vcbuild/include/unistd.h
diff --git a/compat/vcbuild/include/utime.h b/lib/compat/vcbuild/include/utime.h
similarity index 100%
rename from compat/vcbuild/include/utime.h
rename to lib/compat/vcbuild/include/utime.h
diff --git a/compat/vcbuild/scripts/clink.pl b/lib/compat/vcbuild/scripts/clink.pl
similarity index 100%
rename from compat/vcbuild/scripts/clink.pl
rename to lib/compat/vcbuild/scripts/clink.pl
diff --git a/compat/vcbuild/scripts/lib.pl b/lib/compat/vcbuild/scripts/lib.pl
similarity index 100%
rename from compat/vcbuild/scripts/lib.pl
rename to lib/compat/vcbuild/scripts/lib.pl
diff --git a/compat/vcbuild/vcpkg_copy_dlls.bat b/lib/compat/vcbuild/vcpkg_copy_dlls.bat
similarity index 100%
rename from compat/vcbuild/vcpkg_copy_dlls.bat
rename to lib/compat/vcbuild/vcpkg_copy_dlls.bat
diff --git a/compat/vcbuild/vcpkg_install.bat b/lib/compat/vcbuild/vcpkg_install.bat
similarity index 95%
rename from compat/vcbuild/vcpkg_install.bat
rename to lib/compat/vcbuild/vcpkg_install.bat
index ebd0bad242..64c1b199e0 100644
--- a/compat/vcbuild/vcpkg_install.bat
+++ b/lib/compat/vcbuild/vcpkg_install.bat
@@ -5,10 +5,10 @@ REM it to build the third-party libraries that git requires when it
 REM is built using MSVC.
 REM
 REM [1] Install VCPKG.
-REM     [a] Create <root>/compat/vcbuild/vcpkg/
+REM     [a] Create <root>/lib/compat/vcbuild/vcpkg/
 REM     [b] Download "vcpkg".
 REM     [c] Compile using the currently installed version of VS.
-REM     [d] Create <root>/compat/vcbuild/vcpkg/vcpkg.exe
+REM     [d] Create <root>/lib/compat/vcbuild/vcpkg/vcpkg.exe
 REM
 REM [2] Install third-party libraries.
 REM     [a] Download each (which may also install CMAKE).
diff --git a/compat/win32.h b/lib/compat/win32.h
similarity index 100%
rename from compat/win32.h
rename to lib/compat/win32.h
diff --git a/compat/win32/alloca.h b/lib/compat/win32/alloca.h
similarity index 100%
rename from compat/win32/alloca.h
rename to lib/compat/win32/alloca.h
diff --git a/compat/win32/dirent.c b/lib/compat/win32/dirent.c
similarity index 100%
rename from compat/win32/dirent.c
rename to lib/compat/win32/dirent.c
diff --git a/compat/win32/dirent.h b/lib/compat/win32/dirent.h
similarity index 100%
rename from compat/win32/dirent.h
rename to lib/compat/win32/dirent.h
diff --git a/compat/win32/exit-process.h b/lib/compat/win32/exit-process.h
similarity index 100%
rename from compat/win32/exit-process.h
rename to lib/compat/win32/exit-process.h
diff --git a/compat/win32/flush.c b/lib/compat/win32/flush.c
similarity index 100%
rename from compat/win32/flush.c
rename to lib/compat/win32/flush.c
diff --git a/compat/win32/git.manifest b/lib/compat/win32/git.manifest
similarity index 100%
rename from compat/win32/git.manifest
rename to lib/compat/win32/git.manifest
diff --git a/compat/win32/headless.c b/lib/compat/win32/headless.c
similarity index 100%
rename from compat/win32/headless.c
rename to lib/compat/win32/headless.c
diff --git a/compat/win32/lazyload.h b/lib/compat/win32/lazyload.h
similarity index 100%
rename from compat/win32/lazyload.h
rename to lib/compat/win32/lazyload.h
diff --git a/compat/win32/path-utils.c b/lib/compat/win32/path-utils.c
similarity index 100%
rename from compat/win32/path-utils.c
rename to lib/compat/win32/path-utils.c
diff --git a/compat/win32/path-utils.h b/lib/compat/win32/path-utils.h
similarity index 100%
rename from compat/win32/path-utils.h
rename to lib/compat/win32/path-utils.h
diff --git a/compat/win32/pthread.c b/lib/compat/win32/pthread.c
similarity index 100%
rename from compat/win32/pthread.c
rename to lib/compat/win32/pthread.c
diff --git a/compat/win32/pthread.h b/lib/compat/win32/pthread.h
similarity index 100%
rename from compat/win32/pthread.h
rename to lib/compat/win32/pthread.h
diff --git a/compat/win32/syslog.c b/lib/compat/win32/syslog.c
similarity index 100%
rename from compat/win32/syslog.c
rename to lib/compat/win32/syslog.c
diff --git a/compat/win32/syslog.h b/lib/compat/win32/syslog.h
similarity index 100%
rename from compat/win32/syslog.h
rename to lib/compat/win32/syslog.h
diff --git a/compat/win32/trace2_win32_process_info.c b/lib/compat/win32/trace2_win32_process_info.c
similarity index 100%
rename from compat/win32/trace2_win32_process_info.c
rename to lib/compat/win32/trace2_win32_process_info.c
diff --git a/compat/win32mmap.c b/lib/compat/win32mmap.c
similarity index 100%
rename from compat/win32mmap.c
rename to lib/compat/win32mmap.c
diff --git a/compat/winansi.c b/lib/compat/winansi.c
similarity index 100%
rename from compat/winansi.c
rename to lib/compat/winansi.c
diff --git a/compat/zlib-compat.h b/lib/compat/zlib-compat.h
similarity index 100%
rename from compat/zlib-compat.h
rename to lib/compat/zlib-compat.h
diff --git a/compiler-tricks/not-constant.c b/lib/compiler-tricks/not-constant.c
similarity index 100%
rename from compiler-tricks/not-constant.c
rename to lib/compiler-tricks/not-constant.c
diff --git a/config.c b/lib/config.c
similarity index 100%
rename from config.c
rename to lib/config.c
diff --git a/config.h b/lib/config.h
similarity index 100%
rename from config.h
rename to lib/config.h
diff --git a/connect.c b/lib/connect.c
similarity index 100%
rename from connect.c
rename to lib/connect.c
diff --git a/connect.h b/lib/connect.h
similarity index 100%
rename from connect.h
rename to lib/connect.h
diff --git a/connected.c b/lib/connected.c
similarity index 100%
rename from connected.c
rename to lib/connected.c
diff --git a/connected.h b/lib/connected.h
similarity index 100%
rename from connected.h
rename to lib/connected.h
diff --git a/convert.c b/lib/convert.c
similarity index 100%
rename from convert.c
rename to lib/convert.c
diff --git a/convert.h b/lib/convert.h
similarity index 100%
rename from convert.h
rename to lib/convert.h
diff --git a/copy.c b/lib/copy.c
similarity index 100%
rename from copy.c
rename to lib/copy.c
diff --git a/copy.h b/lib/copy.h
similarity index 100%
rename from copy.h
rename to lib/copy.h
diff --git a/credential.c b/lib/credential.c
similarity index 100%
rename from credential.c
rename to lib/credential.c
diff --git a/credential.h b/lib/credential.h
similarity index 100%
rename from credential.h
rename to lib/credential.h
diff --git a/csum-file.c b/lib/csum-file.c
similarity index 100%
rename from csum-file.c
rename to lib/csum-file.c
diff --git a/csum-file.h b/lib/csum-file.h
similarity index 100%
rename from csum-file.h
rename to lib/csum-file.h
diff --git a/ctype.c b/lib/ctype.c
similarity index 100%
rename from ctype.c
rename to lib/ctype.c
diff --git a/date.c b/lib/date.c
similarity index 100%
rename from date.c
rename to lib/date.c
diff --git a/date.h b/lib/date.h
similarity index 100%
rename from date.h
rename to lib/date.h
diff --git a/decorate.c b/lib/decorate.c
similarity index 100%
rename from decorate.c
rename to lib/decorate.c
diff --git a/decorate.h b/lib/decorate.h
similarity index 100%
rename from decorate.h
rename to lib/decorate.h
diff --git a/delta-islands.c b/lib/delta-islands.c
similarity index 100%
rename from delta-islands.c
rename to lib/delta-islands.c
diff --git a/delta-islands.h b/lib/delta-islands.h
similarity index 100%
rename from delta-islands.h
rename to lib/delta-islands.h
diff --git a/delta.h b/lib/delta.h
similarity index 100%
rename from delta.h
rename to lib/delta.h
diff --git a/diagnose.c b/lib/diagnose.c
similarity index 100%
rename from diagnose.c
rename to lib/diagnose.c
diff --git a/diagnose.h b/lib/diagnose.h
similarity index 100%
rename from diagnose.h
rename to lib/diagnose.h
diff --git a/diff-delta.c b/lib/diff-delta.c
similarity index 100%
rename from diff-delta.c
rename to lib/diff-delta.c
diff --git a/diff-lib.c b/lib/diff-lib.c
similarity index 100%
rename from diff-lib.c
rename to lib/diff-lib.c
diff --git a/diff-merges.c b/lib/diff-merges.c
similarity index 100%
rename from diff-merges.c
rename to lib/diff-merges.c
diff --git a/diff-merges.h b/lib/diff-merges.h
similarity index 100%
rename from diff-merges.h
rename to lib/diff-merges.h
diff --git a/diff-no-index.c b/lib/diff-no-index.c
similarity index 100%
rename from diff-no-index.c
rename to lib/diff-no-index.c
diff --git a/diff.c b/lib/diff.c
similarity index 100%
rename from diff.c
rename to lib/diff.c
diff --git a/diff.h b/lib/diff.h
similarity index 100%
rename from diff.h
rename to lib/diff.h
diff --git a/diffcore-break.c b/lib/diffcore-break.c
similarity index 100%
rename from diffcore-break.c
rename to lib/diffcore-break.c
diff --git a/diffcore-delta.c b/lib/diffcore-delta.c
similarity index 100%
rename from diffcore-delta.c
rename to lib/diffcore-delta.c
diff --git a/diffcore-order.c b/lib/diffcore-order.c
similarity index 100%
rename from diffcore-order.c
rename to lib/diffcore-order.c
diff --git a/diffcore-pickaxe.c b/lib/diffcore-pickaxe.c
similarity index 100%
rename from diffcore-pickaxe.c
rename to lib/diffcore-pickaxe.c
diff --git a/diffcore-rename.c b/lib/diffcore-rename.c
similarity index 100%
rename from diffcore-rename.c
rename to lib/diffcore-rename.c
diff --git a/diffcore-rotate.c b/lib/diffcore-rotate.c
similarity index 100%
rename from diffcore-rotate.c
rename to lib/diffcore-rotate.c
diff --git a/diffcore.h b/lib/diffcore.h
similarity index 100%
rename from diffcore.h
rename to lib/diffcore.h
diff --git a/dir-iterator.c b/lib/dir-iterator.c
similarity index 100%
rename from dir-iterator.c
rename to lib/dir-iterator.c
diff --git a/dir-iterator.h b/lib/dir-iterator.h
similarity index 100%
rename from dir-iterator.h
rename to lib/dir-iterator.h
diff --git a/dir.c b/lib/dir.c
similarity index 100%
rename from dir.c
rename to lib/dir.c
diff --git a/dir.h b/lib/dir.h
similarity index 100%
rename from dir.h
rename to lib/dir.h
diff --git a/editor.c b/lib/editor.c
similarity index 100%
rename from editor.c
rename to lib/editor.c
diff --git a/editor.h b/lib/editor.h
similarity index 100%
rename from editor.h
rename to lib/editor.h
diff --git a/entry.c b/lib/entry.c
similarity index 100%
rename from entry.c
rename to lib/entry.c
diff --git a/entry.h b/lib/entry.h
similarity index 100%
rename from entry.h
rename to lib/entry.h
diff --git a/environment.c b/lib/environment.c
similarity index 100%
rename from environment.c
rename to lib/environment.c
diff --git a/environment.h b/lib/environment.h
similarity index 100%
rename from environment.h
rename to lib/environment.h
diff --git a/ewah/bitmap.c b/lib/ewah/bitmap.c
similarity index 100%
rename from ewah/bitmap.c
rename to lib/ewah/bitmap.c
diff --git a/ewah/ewah_bitmap.c b/lib/ewah/ewah_bitmap.c
similarity index 100%
rename from ewah/ewah_bitmap.c
rename to lib/ewah/ewah_bitmap.c
diff --git a/ewah/ewah_io.c b/lib/ewah/ewah_io.c
similarity index 100%
rename from ewah/ewah_io.c
rename to lib/ewah/ewah_io.c
diff --git a/ewah/ewah_rlw.c b/lib/ewah/ewah_rlw.c
similarity index 100%
rename from ewah/ewah_rlw.c
rename to lib/ewah/ewah_rlw.c
diff --git a/ewah/ewok.h b/lib/ewah/ewok.h
similarity index 100%
rename from ewah/ewok.h
rename to lib/ewah/ewok.h
diff --git a/ewah/ewok_rlw.h b/lib/ewah/ewok_rlw.h
similarity index 100%
rename from ewah/ewok_rlw.h
rename to lib/ewah/ewok_rlw.h
diff --git a/exec-cmd.c b/lib/exec-cmd.c
similarity index 100%
rename from exec-cmd.c
rename to lib/exec-cmd.c
diff --git a/exec-cmd.h b/lib/exec-cmd.h
similarity index 100%
rename from exec-cmd.h
rename to lib/exec-cmd.h
diff --git a/fetch-negotiator.c b/lib/fetch-negotiator.c
similarity index 100%
rename from fetch-negotiator.c
rename to lib/fetch-negotiator.c
diff --git a/fetch-negotiator.h b/lib/fetch-negotiator.h
similarity index 100%
rename from fetch-negotiator.h
rename to lib/fetch-negotiator.h
diff --git a/fetch-pack.c b/lib/fetch-pack.c
similarity index 100%
rename from fetch-pack.c
rename to lib/fetch-pack.c
diff --git a/fetch-pack.h b/lib/fetch-pack.h
similarity index 100%
rename from fetch-pack.h
rename to lib/fetch-pack.h
diff --git a/fmt-merge-msg.c b/lib/fmt-merge-msg.c
similarity index 100%
rename from fmt-merge-msg.c
rename to lib/fmt-merge-msg.c
diff --git a/fmt-merge-msg.h b/lib/fmt-merge-msg.h
similarity index 100%
rename from fmt-merge-msg.h
rename to lib/fmt-merge-msg.h
diff --git a/for-each-ref.h b/lib/for-each-ref.h
similarity index 100%
rename from for-each-ref.h
rename to lib/for-each-ref.h
diff --git a/fsck.c b/lib/fsck.c
similarity index 100%
rename from fsck.c
rename to lib/fsck.c
diff --git a/fsck.h b/lib/fsck.h
similarity index 100%
rename from fsck.h
rename to lib/fsck.h
diff --git a/fsmonitor--daemon.h b/lib/fsmonitor--daemon.h
similarity index 100%
rename from fsmonitor--daemon.h
rename to lib/fsmonitor--daemon.h
diff --git a/fsmonitor-ipc.c b/lib/fsmonitor-ipc.c
similarity index 100%
rename from fsmonitor-ipc.c
rename to lib/fsmonitor-ipc.c
diff --git a/fsmonitor-ipc.h b/lib/fsmonitor-ipc.h
similarity index 100%
rename from fsmonitor-ipc.h
rename to lib/fsmonitor-ipc.h
diff --git a/fsmonitor-ll.h b/lib/fsmonitor-ll.h
similarity index 100%
rename from fsmonitor-ll.h
rename to lib/fsmonitor-ll.h
diff --git a/fsmonitor-path-utils.h b/lib/fsmonitor-path-utils.h
similarity index 100%
rename from fsmonitor-path-utils.h
rename to lib/fsmonitor-path-utils.h
diff --git a/fsmonitor-settings.c b/lib/fsmonitor-settings.c
similarity index 100%
rename from fsmonitor-settings.c
rename to lib/fsmonitor-settings.c
diff --git a/fsmonitor-settings.h b/lib/fsmonitor-settings.h
similarity index 100%
rename from fsmonitor-settings.h
rename to lib/fsmonitor-settings.h
diff --git a/fsmonitor.c b/lib/fsmonitor.c
similarity index 100%
rename from fsmonitor.c
rename to lib/fsmonitor.c
diff --git a/fsmonitor.h b/lib/fsmonitor.h
similarity index 100%
rename from fsmonitor.h
rename to lib/fsmonitor.h
diff --git a/gettext.c b/lib/gettext.c
similarity index 100%
rename from gettext.c
rename to lib/gettext.c
diff --git a/gettext.h b/lib/gettext.h
similarity index 100%
rename from gettext.h
rename to lib/gettext.h
diff --git a/git-compat-util.h b/lib/git-compat-util.h
similarity index 100%
rename from git-compat-util.h
rename to lib/git-compat-util.h
diff --git a/git-curl-compat.h b/lib/git-curl-compat.h
similarity index 100%
rename from git-curl-compat.h
rename to lib/git-curl-compat.h
diff --git a/git-zlib.c b/lib/git-zlib.c
similarity index 100%
rename from git-zlib.c
rename to lib/git-zlib.c
diff --git a/git-zlib.h b/lib/git-zlib.h
similarity index 100%
rename from git-zlib.h
rename to lib/git-zlib.h
diff --git a/gpg-interface.c b/lib/gpg-interface.c
similarity index 100%
rename from gpg-interface.c
rename to lib/gpg-interface.c
diff --git a/gpg-interface.h b/lib/gpg-interface.h
similarity index 100%
rename from gpg-interface.h
rename to lib/gpg-interface.h
diff --git a/graph.c b/lib/graph.c
similarity index 100%
rename from graph.c
rename to lib/graph.c
diff --git a/graph.h b/lib/graph.h
similarity index 100%
rename from graph.h
rename to lib/graph.h
diff --git a/grep.c b/lib/grep.c
similarity index 100%
rename from grep.c
rename to lib/grep.c
diff --git a/grep.h b/lib/grep.h
similarity index 100%
rename from grep.h
rename to lib/grep.h
diff --git a/hash-lookup.c b/lib/hash-lookup.c
similarity index 100%
rename from hash-lookup.c
rename to lib/hash-lookup.c
diff --git a/hash-lookup.h b/lib/hash-lookup.h
similarity index 100%
rename from hash-lookup.h
rename to lib/hash-lookup.h
diff --git a/hash.c b/lib/hash.c
similarity index 100%
rename from hash.c
rename to lib/hash.c
diff --git a/hash.h b/lib/hash.h
similarity index 100%
rename from hash.h
rename to lib/hash.h
diff --git a/hashmap.c b/lib/hashmap.c
similarity index 100%
rename from hashmap.c
rename to lib/hashmap.c
diff --git a/hashmap.h b/lib/hashmap.h
similarity index 100%
rename from hashmap.h
rename to lib/hashmap.h
diff --git a/help.c b/lib/help.c
similarity index 100%
rename from help.c
rename to lib/help.c
diff --git a/help.h b/lib/help.h
similarity index 100%
rename from help.h
rename to lib/help.h
diff --git a/hex-ll.c b/lib/hex-ll.c
similarity index 100%
rename from hex-ll.c
rename to lib/hex-ll.c
diff --git a/hex-ll.h b/lib/hex-ll.h
similarity index 100%
rename from hex-ll.h
rename to lib/hex-ll.h
diff --git a/hex.c b/lib/hex.c
similarity index 100%
rename from hex.c
rename to lib/hex.c
diff --git a/hex.h b/lib/hex.h
similarity index 100%
rename from hex.h
rename to lib/hex.h
diff --git a/hook.c b/lib/hook.c
similarity index 100%
rename from hook.c
rename to lib/hook.c
diff --git a/hook.h b/lib/hook.h
similarity index 100%
rename from hook.h
rename to lib/hook.h
diff --git a/http-walker.c b/lib/http-walker.c
similarity index 100%
rename from http-walker.c
rename to lib/http-walker.c
diff --git a/http.c b/lib/http.c
similarity index 100%
rename from http.c
rename to lib/http.c
diff --git a/http.h b/lib/http.h
similarity index 100%
rename from http.h
rename to lib/http.h
diff --git a/ident.c b/lib/ident.c
similarity index 100%
rename from ident.c
rename to lib/ident.c
diff --git a/ident.h b/lib/ident.h
similarity index 100%
rename from ident.h
rename to lib/ident.h
diff --git a/iterator.h b/lib/iterator.h
similarity index 100%
rename from iterator.h
rename to lib/iterator.h
diff --git a/json-writer.c b/lib/json-writer.c
similarity index 100%
rename from json-writer.c
rename to lib/json-writer.c
diff --git a/json-writer.h b/lib/json-writer.h
similarity index 100%
rename from json-writer.h
rename to lib/json-writer.h
diff --git a/khash.h b/lib/khash.h
similarity index 100%
rename from khash.h
rename to lib/khash.h
diff --git a/kwset.c b/lib/kwset.c
similarity index 100%
rename from kwset.c
rename to lib/kwset.c
diff --git a/kwset.h b/lib/kwset.h
similarity index 100%
rename from kwset.h
rename to lib/kwset.h
diff --git a/levenshtein.c b/lib/levenshtein.c
similarity index 100%
rename from levenshtein.c
rename to lib/levenshtein.c
diff --git a/levenshtein.h b/lib/levenshtein.h
similarity index 100%
rename from levenshtein.h
rename to lib/levenshtein.h
diff --git a/line-log.c b/lib/line-log.c
similarity index 100%
rename from line-log.c
rename to lib/line-log.c
diff --git a/line-log.h b/lib/line-log.h
similarity index 100%
rename from line-log.h
rename to lib/line-log.h
diff --git a/line-range.c b/lib/line-range.c
similarity index 100%
rename from line-range.c
rename to lib/line-range.c
diff --git a/line-range.h b/lib/line-range.h
similarity index 100%
rename from line-range.h
rename to lib/line-range.h
diff --git a/linear-assignment.c b/lib/linear-assignment.c
similarity index 100%
rename from linear-assignment.c
rename to lib/linear-assignment.c
diff --git a/linear-assignment.h b/lib/linear-assignment.h
similarity index 100%
rename from linear-assignment.h
rename to lib/linear-assignment.h
diff --git a/list-objects-filter-options.c b/lib/list-objects-filter-options.c
similarity index 100%
rename from list-objects-filter-options.c
rename to lib/list-objects-filter-options.c
diff --git a/list-objects-filter-options.h b/lib/list-objects-filter-options.h
similarity index 100%
rename from list-objects-filter-options.h
rename to lib/list-objects-filter-options.h
diff --git a/list-objects-filter.c b/lib/list-objects-filter.c
similarity index 100%
rename from list-objects-filter.c
rename to lib/list-objects-filter.c
diff --git a/list-objects-filter.h b/lib/list-objects-filter.h
similarity index 100%
rename from list-objects-filter.h
rename to lib/list-objects-filter.h
diff --git a/list-objects.c b/lib/list-objects.c
similarity index 100%
rename from list-objects.c
rename to lib/list-objects.c
diff --git a/list-objects.h b/lib/list-objects.h
similarity index 100%
rename from list-objects.h
rename to lib/list-objects.h
diff --git a/list.h b/lib/list.h
similarity index 100%
rename from list.h
rename to lib/list.h
diff --git a/lockfile.c b/lib/lockfile.c
similarity index 100%
rename from lockfile.c
rename to lib/lockfile.c
diff --git a/lockfile.h b/lib/lockfile.h
similarity index 100%
rename from lockfile.h
rename to lib/lockfile.h
diff --git a/log-tree.c b/lib/log-tree.c
similarity index 100%
rename from log-tree.c
rename to lib/log-tree.c
diff --git a/log-tree.h b/lib/log-tree.h
similarity index 100%
rename from log-tree.h
rename to lib/log-tree.h
diff --git a/loose.c b/lib/loose.c
similarity index 100%
rename from loose.c
rename to lib/loose.c
diff --git a/loose.h b/lib/loose.h
similarity index 100%
rename from loose.h
rename to lib/loose.h
diff --git a/ls-refs.c b/lib/ls-refs.c
similarity index 100%
rename from ls-refs.c
rename to lib/ls-refs.c
diff --git a/ls-refs.h b/lib/ls-refs.h
similarity index 100%
rename from ls-refs.h
rename to lib/ls-refs.h
diff --git a/mailinfo.c b/lib/mailinfo.c
similarity index 100%
rename from mailinfo.c
rename to lib/mailinfo.c
diff --git a/mailinfo.h b/lib/mailinfo.h
similarity index 100%
rename from mailinfo.h
rename to lib/mailinfo.h
diff --git a/mailmap.c b/lib/mailmap.c
similarity index 100%
rename from mailmap.c
rename to lib/mailmap.c
diff --git a/mailmap.h b/lib/mailmap.h
similarity index 100%
rename from mailmap.h
rename to lib/mailmap.h
diff --git a/match-trees.c b/lib/match-trees.c
similarity index 100%
rename from match-trees.c
rename to lib/match-trees.c
diff --git a/match-trees.h b/lib/match-trees.h
similarity index 100%
rename from match-trees.h
rename to lib/match-trees.h
diff --git a/mem-pool.c b/lib/mem-pool.c
similarity index 100%
rename from mem-pool.c
rename to lib/mem-pool.c
diff --git a/mem-pool.h b/lib/mem-pool.h
similarity index 100%
rename from mem-pool.h
rename to lib/mem-pool.h
diff --git a/merge-blobs.c b/lib/merge-blobs.c
similarity index 100%
rename from merge-blobs.c
rename to lib/merge-blobs.c
diff --git a/merge-blobs.h b/lib/merge-blobs.h
similarity index 100%
rename from merge-blobs.h
rename to lib/merge-blobs.h
diff --git a/merge-ll.c b/lib/merge-ll.c
similarity index 100%
rename from merge-ll.c
rename to lib/merge-ll.c
diff --git a/merge-ll.h b/lib/merge-ll.h
similarity index 100%
rename from merge-ll.h
rename to lib/merge-ll.h
diff --git a/merge-ort-wrappers.c b/lib/merge-ort-wrappers.c
similarity index 100%
rename from merge-ort-wrappers.c
rename to lib/merge-ort-wrappers.c
diff --git a/merge-ort-wrappers.h b/lib/merge-ort-wrappers.h
similarity index 100%
rename from merge-ort-wrappers.h
rename to lib/merge-ort-wrappers.h
diff --git a/merge-ort.c b/lib/merge-ort.c
similarity index 100%
rename from merge-ort.c
rename to lib/merge-ort.c
diff --git a/merge-ort.h b/lib/merge-ort.h
similarity index 100%
rename from merge-ort.h
rename to lib/merge-ort.h
diff --git a/merge.c b/lib/merge.c
similarity index 100%
rename from merge.c
rename to lib/merge.c
diff --git a/merge.h b/lib/merge.h
similarity index 100%
rename from merge.h
rename to lib/merge.h
diff --git a/mergesort.h b/lib/mergesort.h
similarity index 100%
rename from mergesort.h
rename to lib/mergesort.h
diff --git a/midx-write.c b/lib/midx-write.c
similarity index 100%
rename from midx-write.c
rename to lib/midx-write.c
diff --git a/midx.c b/lib/midx.c
similarity index 100%
rename from midx.c
rename to lib/midx.c
diff --git a/midx.h b/lib/midx.h
similarity index 100%
rename from midx.h
rename to lib/midx.h
diff --git a/name-hash.c b/lib/name-hash.c
similarity index 100%
rename from name-hash.c
rename to lib/name-hash.c
diff --git a/name-hash.h b/lib/name-hash.h
similarity index 100%
rename from name-hash.h
rename to lib/name-hash.h
diff --git a/negotiator/default.c b/lib/negotiator/default.c
similarity index 100%
rename from negotiator/default.c
rename to lib/negotiator/default.c
diff --git a/negotiator/default.h b/lib/negotiator/default.h
similarity index 100%
rename from negotiator/default.h
rename to lib/negotiator/default.h
diff --git a/negotiator/noop.c b/lib/negotiator/noop.c
similarity index 100%
rename from negotiator/noop.c
rename to lib/negotiator/noop.c
diff --git a/negotiator/noop.h b/lib/negotiator/noop.h
similarity index 100%
rename from negotiator/noop.h
rename to lib/negotiator/noop.h
diff --git a/negotiator/skipping.c b/lib/negotiator/skipping.c
similarity index 100%
rename from negotiator/skipping.c
rename to lib/negotiator/skipping.c
diff --git a/negotiator/skipping.h b/lib/negotiator/skipping.h
similarity index 100%
rename from negotiator/skipping.h
rename to lib/negotiator/skipping.h
diff --git a/notes-cache.c b/lib/notes-cache.c
similarity index 100%
rename from notes-cache.c
rename to lib/notes-cache.c
diff --git a/notes-cache.h b/lib/notes-cache.h
similarity index 100%
rename from notes-cache.h
rename to lib/notes-cache.h
diff --git a/notes-merge.c b/lib/notes-merge.c
similarity index 100%
rename from notes-merge.c
rename to lib/notes-merge.c
diff --git a/notes-merge.h b/lib/notes-merge.h
similarity index 100%
rename from notes-merge.h
rename to lib/notes-merge.h
diff --git a/notes-utils.c b/lib/notes-utils.c
similarity index 100%
rename from notes-utils.c
rename to lib/notes-utils.c
diff --git a/notes-utils.h b/lib/notes-utils.h
similarity index 100%
rename from notes-utils.h
rename to lib/notes-utils.h
diff --git a/notes.c b/lib/notes.c
similarity index 100%
rename from notes.c
rename to lib/notes.c
diff --git a/notes.h b/lib/notes.h
similarity index 100%
rename from notes.h
rename to lib/notes.h
diff --git a/object-file-convert.c b/lib/object-file-convert.c
similarity index 100%
rename from object-file-convert.c
rename to lib/object-file-convert.c
diff --git a/object-file-convert.h b/lib/object-file-convert.h
similarity index 100%
rename from object-file-convert.h
rename to lib/object-file-convert.h
diff --git a/object-file.c b/lib/object-file.c
similarity index 100%
rename from object-file.c
rename to lib/object-file.c
diff --git a/object-file.h b/lib/object-file.h
similarity index 100%
rename from object-file.h
rename to lib/object-file.h
diff --git a/object-name.c b/lib/object-name.c
similarity index 100%
rename from object-name.c
rename to lib/object-name.c
diff --git a/object-name.h b/lib/object-name.h
similarity index 100%
rename from object-name.h
rename to lib/object-name.h
diff --git a/object.c b/lib/object.c
similarity index 100%
rename from object.c
rename to lib/object.c
diff --git a/object.h b/lib/object.h
similarity index 100%
rename from object.h
rename to lib/object.h
diff --git a/odb.c b/lib/odb.c
similarity index 100%
rename from odb.c
rename to lib/odb.c
diff --git a/odb.h b/lib/odb.h
similarity index 100%
rename from odb.h
rename to lib/odb.h
diff --git a/odb/source-files.c b/lib/odb/source-files.c
similarity index 100%
rename from odb/source-files.c
rename to lib/odb/source-files.c
diff --git a/odb/source-files.h b/lib/odb/source-files.h
similarity index 100%
rename from odb/source-files.h
rename to lib/odb/source-files.h
diff --git a/odb/source-inmemory.c b/lib/odb/source-inmemory.c
similarity index 100%
rename from odb/source-inmemory.c
rename to lib/odb/source-inmemory.c
diff --git a/odb/source-inmemory.h b/lib/odb/source-inmemory.h
similarity index 100%
rename from odb/source-inmemory.h
rename to lib/odb/source-inmemory.h
diff --git a/odb/source-loose.c b/lib/odb/source-loose.c
similarity index 100%
rename from odb/source-loose.c
rename to lib/odb/source-loose.c
diff --git a/odb/source-loose.h b/lib/odb/source-loose.h
similarity index 100%
rename from odb/source-loose.h
rename to lib/odb/source-loose.h
diff --git a/odb/source-packed.c b/lib/odb/source-packed.c
similarity index 100%
rename from odb/source-packed.c
rename to lib/odb/source-packed.c
diff --git a/odb/source-packed.h b/lib/odb/source-packed.h
similarity index 100%
rename from odb/source-packed.h
rename to lib/odb/source-packed.h
diff --git a/odb/source.c b/lib/odb/source.c
similarity index 100%
rename from odb/source.c
rename to lib/odb/source.c
diff --git a/odb/source.h b/lib/odb/source.h
similarity index 100%
rename from odb/source.h
rename to lib/odb/source.h
diff --git a/odb/streaming.c b/lib/odb/streaming.c
similarity index 100%
rename from odb/streaming.c
rename to lib/odb/streaming.c
diff --git a/odb/streaming.h b/lib/odb/streaming.h
similarity index 100%
rename from odb/streaming.h
rename to lib/odb/streaming.h
diff --git a/odb/transaction.c b/lib/odb/transaction.c
similarity index 100%
rename from odb/transaction.c
rename to lib/odb/transaction.c
diff --git a/odb/transaction.h b/lib/odb/transaction.h
similarity index 100%
rename from odb/transaction.h
rename to lib/odb/transaction.h
diff --git a/oid-array.c b/lib/oid-array.c
similarity index 100%
rename from oid-array.c
rename to lib/oid-array.c
diff --git a/oid-array.h b/lib/oid-array.h
similarity index 100%
rename from oid-array.h
rename to lib/oid-array.h
diff --git a/oidmap.c b/lib/oidmap.c
similarity index 100%
rename from oidmap.c
rename to lib/oidmap.c
diff --git a/oidmap.h b/lib/oidmap.h
similarity index 100%
rename from oidmap.h
rename to lib/oidmap.h
diff --git a/oidset.c b/lib/oidset.c
similarity index 100%
rename from oidset.c
rename to lib/oidset.c
diff --git a/oidset.h b/lib/oidset.h
similarity index 100%
rename from oidset.h
rename to lib/oidset.h
diff --git a/oidtree.c b/lib/oidtree.c
similarity index 100%
rename from oidtree.c
rename to lib/oidtree.c
diff --git a/oidtree.h b/lib/oidtree.h
similarity index 100%
rename from oidtree.h
rename to lib/oidtree.h
diff --git a/pack-bitmap-write.c b/lib/pack-bitmap-write.c
similarity index 100%
rename from pack-bitmap-write.c
rename to lib/pack-bitmap-write.c
diff --git a/pack-bitmap.c b/lib/pack-bitmap.c
similarity index 100%
rename from pack-bitmap.c
rename to lib/pack-bitmap.c
diff --git a/pack-bitmap.h b/lib/pack-bitmap.h
similarity index 100%
rename from pack-bitmap.h
rename to lib/pack-bitmap.h
diff --git a/pack-check.c b/lib/pack-check.c
similarity index 100%
rename from pack-check.c
rename to lib/pack-check.c
diff --git a/pack-mtimes.c b/lib/pack-mtimes.c
similarity index 100%
rename from pack-mtimes.c
rename to lib/pack-mtimes.c
diff --git a/pack-mtimes.h b/lib/pack-mtimes.h
similarity index 100%
rename from pack-mtimes.h
rename to lib/pack-mtimes.h
diff --git a/pack-objects.c b/lib/pack-objects.c
similarity index 100%
rename from pack-objects.c
rename to lib/pack-objects.c
diff --git a/pack-objects.h b/lib/pack-objects.h
similarity index 100%
rename from pack-objects.h
rename to lib/pack-objects.h
diff --git a/pack-refs.c b/lib/pack-refs.c
similarity index 100%
rename from pack-refs.c
rename to lib/pack-refs.c
diff --git a/pack-refs.h b/lib/pack-refs.h
similarity index 100%
rename from pack-refs.h
rename to lib/pack-refs.h
diff --git a/pack-revindex.c b/lib/pack-revindex.c
similarity index 100%
rename from pack-revindex.c
rename to lib/pack-revindex.c
diff --git a/pack-revindex.h b/lib/pack-revindex.h
similarity index 100%
rename from pack-revindex.h
rename to lib/pack-revindex.h
diff --git a/pack-write.c b/lib/pack-write.c
similarity index 100%
rename from pack-write.c
rename to lib/pack-write.c
diff --git a/pack.h b/lib/pack.h
similarity index 100%
rename from pack.h
rename to lib/pack.h
diff --git a/packfile-list.c b/lib/packfile-list.c
similarity index 100%
rename from packfile-list.c
rename to lib/packfile-list.c
diff --git a/packfile-list.h b/lib/packfile-list.h
similarity index 100%
rename from packfile-list.h
rename to lib/packfile-list.h
diff --git a/packfile.c b/lib/packfile.c
similarity index 100%
rename from packfile.c
rename to lib/packfile.c
diff --git a/packfile.h b/lib/packfile.h
similarity index 100%
rename from packfile.h
rename to lib/packfile.h
diff --git a/pager.c b/lib/pager.c
similarity index 100%
rename from pager.c
rename to lib/pager.c
diff --git a/pager.h b/lib/pager.h
similarity index 100%
rename from pager.h
rename to lib/pager.h
diff --git a/parallel-checkout.c b/lib/parallel-checkout.c
similarity index 100%
rename from parallel-checkout.c
rename to lib/parallel-checkout.c
diff --git a/parallel-checkout.h b/lib/parallel-checkout.h
similarity index 100%
rename from parallel-checkout.h
rename to lib/parallel-checkout.h
diff --git a/parse-options-cb.c b/lib/parse-options-cb.c
similarity index 100%
rename from parse-options-cb.c
rename to lib/parse-options-cb.c
diff --git a/parse-options.c b/lib/parse-options.c
similarity index 100%
rename from parse-options.c
rename to lib/parse-options.c
diff --git a/parse-options.h b/lib/parse-options.h
similarity index 100%
rename from parse-options.h
rename to lib/parse-options.h
diff --git a/parse.c b/lib/parse.c
similarity index 100%
rename from parse.c
rename to lib/parse.c
diff --git a/parse.h b/lib/parse.h
similarity index 100%
rename from parse.h
rename to lib/parse.h
diff --git a/patch-delta.c b/lib/patch-delta.c
similarity index 100%
rename from patch-delta.c
rename to lib/patch-delta.c
diff --git a/patch-ids.c b/lib/patch-ids.c
similarity index 100%
rename from patch-ids.c
rename to lib/patch-ids.c
diff --git a/patch-ids.h b/lib/patch-ids.h
similarity index 100%
rename from patch-ids.h
rename to lib/patch-ids.h
diff --git a/path-walk.c b/lib/path-walk.c
similarity index 100%
rename from path-walk.c
rename to lib/path-walk.c
diff --git a/path-walk.h b/lib/path-walk.h
similarity index 100%
rename from path-walk.h
rename to lib/path-walk.h
diff --git a/path.c b/lib/path.c
similarity index 100%
rename from path.c
rename to lib/path.c
diff --git a/path.h b/lib/path.h
similarity index 100%
rename from path.h
rename to lib/path.h
diff --git a/pathspec.c b/lib/pathspec.c
similarity index 100%
rename from pathspec.c
rename to lib/pathspec.c
diff --git a/pathspec.h b/lib/pathspec.h
similarity index 100%
rename from pathspec.h
rename to lib/pathspec.h
diff --git a/pkt-line.c b/lib/pkt-line.c
similarity index 100%
rename from pkt-line.c
rename to lib/pkt-line.c
diff --git a/pkt-line.h b/lib/pkt-line.h
similarity index 100%
rename from pkt-line.h
rename to lib/pkt-line.h
diff --git a/preload-index.c b/lib/preload-index.c
similarity index 100%
rename from preload-index.c
rename to lib/preload-index.c
diff --git a/preload-index.h b/lib/preload-index.h
similarity index 100%
rename from preload-index.h
rename to lib/preload-index.h
diff --git a/pretty.c b/lib/pretty.c
similarity index 100%
rename from pretty.c
rename to lib/pretty.c
diff --git a/pretty.h b/lib/pretty.h
similarity index 100%
rename from pretty.h
rename to lib/pretty.h
diff --git a/prio-queue.c b/lib/prio-queue.c
similarity index 100%
rename from prio-queue.c
rename to lib/prio-queue.c
diff --git a/prio-queue.h b/lib/prio-queue.h
similarity index 100%
rename from prio-queue.h
rename to lib/prio-queue.h
diff --git a/progress.c b/lib/progress.c
similarity index 100%
rename from progress.c
rename to lib/progress.c
diff --git a/progress.h b/lib/progress.h
similarity index 100%
rename from progress.h
rename to lib/progress.h
diff --git a/promisor-remote.c b/lib/promisor-remote.c
similarity index 100%
rename from promisor-remote.c
rename to lib/promisor-remote.c
diff --git a/promisor-remote.h b/lib/promisor-remote.h
similarity index 100%
rename from promisor-remote.h
rename to lib/promisor-remote.h
diff --git a/prompt.c b/lib/prompt.c
similarity index 100%
rename from prompt.c
rename to lib/prompt.c
diff --git a/prompt.h b/lib/prompt.h
similarity index 100%
rename from prompt.h
rename to lib/prompt.h
diff --git a/protocol-caps.c b/lib/protocol-caps.c
similarity index 100%
rename from protocol-caps.c
rename to lib/protocol-caps.c
diff --git a/protocol-caps.h b/lib/protocol-caps.h
similarity index 100%
rename from protocol-caps.h
rename to lib/protocol-caps.h
diff --git a/protocol.c b/lib/protocol.c
similarity index 100%
rename from protocol.c
rename to lib/protocol.c
diff --git a/protocol.h b/lib/protocol.h
similarity index 100%
rename from protocol.h
rename to lib/protocol.h
diff --git a/prune-packed.c b/lib/prune-packed.c
similarity index 100%
rename from prune-packed.c
rename to lib/prune-packed.c
diff --git a/prune-packed.h b/lib/prune-packed.h
similarity index 100%
rename from prune-packed.h
rename to lib/prune-packed.h
diff --git a/pseudo-merge.c b/lib/pseudo-merge.c
similarity index 100%
rename from pseudo-merge.c
rename to lib/pseudo-merge.c
diff --git a/pseudo-merge.h b/lib/pseudo-merge.h
similarity index 100%
rename from pseudo-merge.h
rename to lib/pseudo-merge.h
diff --git a/quote.c b/lib/quote.c
similarity index 100%
rename from quote.c
rename to lib/quote.c
diff --git a/quote.h b/lib/quote.h
similarity index 100%
rename from quote.h
rename to lib/quote.h
diff --git a/range-diff.c b/lib/range-diff.c
similarity index 100%
rename from range-diff.c
rename to lib/range-diff.c
diff --git a/range-diff.h b/lib/range-diff.h
similarity index 100%
rename from range-diff.h
rename to lib/range-diff.h
diff --git a/reachable.c b/lib/reachable.c
similarity index 100%
rename from reachable.c
rename to lib/reachable.c
diff --git a/reachable.h b/lib/reachable.h
similarity index 100%
rename from reachable.h
rename to lib/reachable.h
diff --git a/read-cache-ll.h b/lib/read-cache-ll.h
similarity index 100%
rename from read-cache-ll.h
rename to lib/read-cache-ll.h
diff --git a/read-cache.c b/lib/read-cache.c
similarity index 100%
rename from read-cache.c
rename to lib/read-cache.c
diff --git a/read-cache.h b/lib/read-cache.h
similarity index 100%
rename from read-cache.h
rename to lib/read-cache.h
diff --git a/rebase-interactive.c b/lib/rebase-interactive.c
similarity index 100%
rename from rebase-interactive.c
rename to lib/rebase-interactive.c
diff --git a/rebase-interactive.h b/lib/rebase-interactive.h
similarity index 100%
rename from rebase-interactive.h
rename to lib/rebase-interactive.h
diff --git a/rebase.c b/lib/rebase.c
similarity index 100%
rename from rebase.c
rename to lib/rebase.c
diff --git a/rebase.h b/lib/rebase.h
similarity index 100%
rename from rebase.h
rename to lib/rebase.h
diff --git a/ref-filter.c b/lib/ref-filter.c
similarity index 100%
rename from ref-filter.c
rename to lib/ref-filter.c
diff --git a/ref-filter.h b/lib/ref-filter.h
similarity index 100%
rename from ref-filter.h
rename to lib/ref-filter.h
diff --git a/reflog-walk.c b/lib/reflog-walk.c
similarity index 100%
rename from reflog-walk.c
rename to lib/reflog-walk.c
diff --git a/reflog-walk.h b/lib/reflog-walk.h
similarity index 100%
rename from reflog-walk.h
rename to lib/reflog-walk.h
diff --git a/reflog.c b/lib/reflog.c
similarity index 100%
rename from reflog.c
rename to lib/reflog.c
diff --git a/reflog.h b/lib/reflog.h
similarity index 100%
rename from reflog.h
rename to lib/reflog.h
diff --git a/refs.c b/lib/refs.c
similarity index 100%
rename from refs.c
rename to lib/refs.c
diff --git a/refs.h b/lib/refs.h
similarity index 100%
rename from refs.h
rename to lib/refs.h
diff --git a/refs/debug.c b/lib/refs/debug.c
similarity index 100%
rename from refs/debug.c
rename to lib/refs/debug.c
diff --git a/refs/files-backend.c b/lib/refs/files-backend.c
similarity index 100%
rename from refs/files-backend.c
rename to lib/refs/files-backend.c
diff --git a/refs/iterator.c b/lib/refs/iterator.c
similarity index 100%
rename from refs/iterator.c
rename to lib/refs/iterator.c
diff --git a/refs/packed-backend.c b/lib/refs/packed-backend.c
similarity index 100%
rename from refs/packed-backend.c
rename to lib/refs/packed-backend.c
diff --git a/refs/packed-backend.h b/lib/refs/packed-backend.h
similarity index 100%
rename from refs/packed-backend.h
rename to lib/refs/packed-backend.h
diff --git a/refs/ref-cache.c b/lib/refs/ref-cache.c
similarity index 100%
rename from refs/ref-cache.c
rename to lib/refs/ref-cache.c
diff --git a/refs/ref-cache.h b/lib/refs/ref-cache.h
similarity index 100%
rename from refs/ref-cache.h
rename to lib/refs/ref-cache.h
diff --git a/refs/refs-internal.h b/lib/refs/refs-internal.h
similarity index 100%
rename from refs/refs-internal.h
rename to lib/refs/refs-internal.h
diff --git a/refs/reftable-backend.c b/lib/refs/reftable-backend.c
similarity index 100%
rename from refs/reftable-backend.c
rename to lib/refs/reftable-backend.c
diff --git a/refspec.c b/lib/refspec.c
similarity index 100%
rename from refspec.c
rename to lib/refspec.c
diff --git a/refspec.h b/lib/refspec.h
similarity index 100%
rename from refspec.h
rename to lib/refspec.h
diff --git a/reftable/LICENSE b/lib/reftable/LICENSE
similarity index 100%
rename from reftable/LICENSE
rename to lib/reftable/LICENSE
diff --git a/reftable/basics.c b/lib/reftable/basics.c
similarity index 100%
rename from reftable/basics.c
rename to lib/reftable/basics.c
diff --git a/reftable/basics.h b/lib/reftable/basics.h
similarity index 100%
rename from reftable/basics.h
rename to lib/reftable/basics.h
diff --git a/reftable/block.c b/lib/reftable/block.c
similarity index 100%
rename from reftable/block.c
rename to lib/reftable/block.c
diff --git a/reftable/block.h b/lib/reftable/block.h
similarity index 100%
rename from reftable/block.h
rename to lib/reftable/block.h
diff --git a/reftable/blocksource.c b/lib/reftable/blocksource.c
similarity index 100%
rename from reftable/blocksource.c
rename to lib/reftable/blocksource.c
diff --git a/reftable/blocksource.h b/lib/reftable/blocksource.h
similarity index 100%
rename from reftable/blocksource.h
rename to lib/reftable/blocksource.h
diff --git a/reftable/constants.h b/lib/reftable/constants.h
similarity index 100%
rename from reftable/constants.h
rename to lib/reftable/constants.h
diff --git a/reftable/error.c b/lib/reftable/error.c
similarity index 100%
rename from reftable/error.c
rename to lib/reftable/error.c
diff --git a/reftable/fsck.c b/lib/reftable/fsck.c
similarity index 100%
rename from reftable/fsck.c
rename to lib/reftable/fsck.c
diff --git a/reftable/iter.c b/lib/reftable/iter.c
similarity index 100%
rename from reftable/iter.c
rename to lib/reftable/iter.c
diff --git a/reftable/iter.h b/lib/reftable/iter.h
similarity index 100%
rename from reftable/iter.h
rename to lib/reftable/iter.h
diff --git a/reftable/merged.c b/lib/reftable/merged.c
similarity index 100%
rename from reftable/merged.c
rename to lib/reftable/merged.c
diff --git a/reftable/merged.h b/lib/reftable/merged.h
similarity index 100%
rename from reftable/merged.h
rename to lib/reftable/merged.h
diff --git a/reftable/pq.c b/lib/reftable/pq.c
similarity index 100%
rename from reftable/pq.c
rename to lib/reftable/pq.c
diff --git a/reftable/pq.h b/lib/reftable/pq.h
similarity index 100%
rename from reftable/pq.h
rename to lib/reftable/pq.h
diff --git a/reftable/record.c b/lib/reftable/record.c
similarity index 100%
rename from reftable/record.c
rename to lib/reftable/record.c
diff --git a/reftable/record.h b/lib/reftable/record.h
similarity index 100%
rename from reftable/record.h
rename to lib/reftable/record.h
diff --git a/reftable/reftable-basics.h b/lib/reftable/reftable-basics.h
similarity index 100%
rename from reftable/reftable-basics.h
rename to lib/reftable/reftable-basics.h
diff --git a/reftable/reftable-block.h b/lib/reftable/reftable-block.h
similarity index 100%
rename from reftable/reftable-block.h
rename to lib/reftable/reftable-block.h
diff --git a/reftable/reftable-blocksource.h b/lib/reftable/reftable-blocksource.h
similarity index 100%
rename from reftable/reftable-blocksource.h
rename to lib/reftable/reftable-blocksource.h
diff --git a/reftable/reftable-constants.h b/lib/reftable/reftable-constants.h
similarity index 100%
rename from reftable/reftable-constants.h
rename to lib/reftable/reftable-constants.h
diff --git a/reftable/reftable-error.h b/lib/reftable/reftable-error.h
similarity index 100%
rename from reftable/reftable-error.h
rename to lib/reftable/reftable-error.h
diff --git a/reftable/reftable-fsck.h b/lib/reftable/reftable-fsck.h
similarity index 100%
rename from reftable/reftable-fsck.h
rename to lib/reftable/reftable-fsck.h
diff --git a/reftable/reftable-iterator.h b/lib/reftable/reftable-iterator.h
similarity index 100%
rename from reftable/reftable-iterator.h
rename to lib/reftable/reftable-iterator.h
diff --git a/reftable/reftable-merged.h b/lib/reftable/reftable-merged.h
similarity index 100%
rename from reftable/reftable-merged.h
rename to lib/reftable/reftable-merged.h
diff --git a/reftable/reftable-record.h b/lib/reftable/reftable-record.h
similarity index 100%
rename from reftable/reftable-record.h
rename to lib/reftable/reftable-record.h
diff --git a/reftable/reftable-stack.h b/lib/reftable/reftable-stack.h
similarity index 100%
rename from reftable/reftable-stack.h
rename to lib/reftable/reftable-stack.h
diff --git a/reftable/reftable-system.h b/lib/reftable/reftable-system.h
similarity index 100%
rename from reftable/reftable-system.h
rename to lib/reftable/reftable-system.h
diff --git a/reftable/reftable-table.h b/lib/reftable/reftable-table.h
similarity index 100%
rename from reftable/reftable-table.h
rename to lib/reftable/reftable-table.h
diff --git a/reftable/reftable-writer.h b/lib/reftable/reftable-writer.h
similarity index 100%
rename from reftable/reftable-writer.h
rename to lib/reftable/reftable-writer.h
diff --git a/reftable/stack.c b/lib/reftable/stack.c
similarity index 100%
rename from reftable/stack.c
rename to lib/reftable/stack.c
diff --git a/reftable/stack.h b/lib/reftable/stack.h
similarity index 100%
rename from reftable/stack.h
rename to lib/reftable/stack.h
diff --git a/reftable/system.c b/lib/reftable/system.c
similarity index 100%
rename from reftable/system.c
rename to lib/reftable/system.c
diff --git a/reftable/system.h b/lib/reftable/system.h
similarity index 100%
rename from reftable/system.h
rename to lib/reftable/system.h
diff --git a/reftable/table.c b/lib/reftable/table.c
similarity index 100%
rename from reftable/table.c
rename to lib/reftable/table.c
diff --git a/reftable/table.h b/lib/reftable/table.h
similarity index 100%
rename from reftable/table.h
rename to lib/reftable/table.h
diff --git a/reftable/tree.c b/lib/reftable/tree.c
similarity index 100%
rename from reftable/tree.c
rename to lib/reftable/tree.c
diff --git a/reftable/tree.h b/lib/reftable/tree.h
similarity index 100%
rename from reftable/tree.h
rename to lib/reftable/tree.h
diff --git a/reftable/writer.c b/lib/reftable/writer.c
similarity index 100%
rename from reftable/writer.c
rename to lib/reftable/writer.c
diff --git a/reftable/writer.h b/lib/reftable/writer.h
similarity index 100%
rename from reftable/writer.h
rename to lib/reftable/writer.h
diff --git a/remote.c b/lib/remote.c
similarity index 100%
rename from remote.c
rename to lib/remote.c
diff --git a/remote.h b/lib/remote.h
similarity index 100%
rename from remote.h
rename to lib/remote.h
diff --git a/repack-cruft.c b/lib/repack-cruft.c
similarity index 100%
rename from repack-cruft.c
rename to lib/repack-cruft.c
diff --git a/repack-filtered.c b/lib/repack-filtered.c
similarity index 100%
rename from repack-filtered.c
rename to lib/repack-filtered.c
diff --git a/repack-geometry.c b/lib/repack-geometry.c
similarity index 100%
rename from repack-geometry.c
rename to lib/repack-geometry.c
diff --git a/repack-midx.c b/lib/repack-midx.c
similarity index 100%
rename from repack-midx.c
rename to lib/repack-midx.c
diff --git a/repack-promisor.c b/lib/repack-promisor.c
similarity index 100%
rename from repack-promisor.c
rename to lib/repack-promisor.c
diff --git a/repack.c b/lib/repack.c
similarity index 100%
rename from repack.c
rename to lib/repack.c
diff --git a/repack.h b/lib/repack.h
similarity index 100%
rename from repack.h
rename to lib/repack.h
diff --git a/replace-object.c b/lib/replace-object.c
similarity index 100%
rename from replace-object.c
rename to lib/replace-object.c
diff --git a/replace-object.h b/lib/replace-object.h
similarity index 100%
rename from replace-object.h
rename to lib/replace-object.h
diff --git a/replay.c b/lib/replay.c
similarity index 100%
rename from replay.c
rename to lib/replay.c
diff --git a/replay.h b/lib/replay.h
similarity index 100%
rename from replay.h
rename to lib/replay.h
diff --git a/repo-settings.c b/lib/repo-settings.c
similarity index 100%
rename from repo-settings.c
rename to lib/repo-settings.c
diff --git a/repo-settings.h b/lib/repo-settings.h
similarity index 100%
rename from repo-settings.h
rename to lib/repo-settings.h
diff --git a/repository.c b/lib/repository.c
similarity index 100%
rename from repository.c
rename to lib/repository.c
diff --git a/repository.h b/lib/repository.h
similarity index 100%
rename from repository.h
rename to lib/repository.h
diff --git a/rerere.c b/lib/rerere.c
similarity index 100%
rename from rerere.c
rename to lib/rerere.c
diff --git a/rerere.h b/lib/rerere.h
similarity index 100%
rename from rerere.h
rename to lib/rerere.h
diff --git a/reset.c b/lib/reset.c
similarity index 100%
rename from reset.c
rename to lib/reset.c
diff --git a/reset.h b/lib/reset.h
similarity index 100%
rename from reset.h
rename to lib/reset.h
diff --git a/resolve-undo.c b/lib/resolve-undo.c
similarity index 100%
rename from resolve-undo.c
rename to lib/resolve-undo.c
diff --git a/resolve-undo.h b/lib/resolve-undo.h
similarity index 100%
rename from resolve-undo.h
rename to lib/resolve-undo.h
diff --git a/revision.c b/lib/revision.c
similarity index 100%
rename from revision.c
rename to lib/revision.c
diff --git a/revision.h b/lib/revision.h
similarity index 100%
rename from revision.h
rename to lib/revision.h
diff --git a/run-command.c b/lib/run-command.c
similarity index 100%
rename from run-command.c
rename to lib/run-command.c
diff --git a/run-command.h b/lib/run-command.h
similarity index 100%
rename from run-command.h
rename to lib/run-command.h
diff --git a/sane-ctype.h b/lib/sane-ctype.h
similarity index 100%
rename from sane-ctype.h
rename to lib/sane-ctype.h
diff --git a/send-pack.c b/lib/send-pack.c
similarity index 100%
rename from send-pack.c
rename to lib/send-pack.c
diff --git a/send-pack.h b/lib/send-pack.h
similarity index 100%
rename from send-pack.h
rename to lib/send-pack.h
diff --git a/sequencer.c b/lib/sequencer.c
similarity index 100%
rename from sequencer.c
rename to lib/sequencer.c
diff --git a/sequencer.h b/lib/sequencer.h
similarity index 100%
rename from sequencer.h
rename to lib/sequencer.h
diff --git a/serve.c b/lib/serve.c
similarity index 100%
rename from serve.c
rename to lib/serve.c
diff --git a/serve.h b/lib/serve.h
similarity index 100%
rename from serve.h
rename to lib/serve.h
diff --git a/server-info.c b/lib/server-info.c
similarity index 100%
rename from server-info.c
rename to lib/server-info.c
diff --git a/server-info.h b/lib/server-info.h
similarity index 100%
rename from server-info.h
rename to lib/server-info.h
diff --git a/setup.c b/lib/setup.c
similarity index 100%
rename from setup.c
rename to lib/setup.c
diff --git a/setup.h b/lib/setup.h
similarity index 100%
rename from setup.h
rename to lib/setup.h
diff --git a/sha1/openssl.h b/lib/sha1/openssl.h
similarity index 100%
rename from sha1/openssl.h
rename to lib/sha1/openssl.h
diff --git a/sha1collisiondetection b/lib/sha1collisiondetection
similarity index 100%
rename from sha1collisiondetection
rename to lib/sha1collisiondetection
diff --git a/sha1dc/.gitattributes b/lib/sha1dc/.gitattributes
similarity index 100%
rename from sha1dc/.gitattributes
rename to lib/sha1dc/.gitattributes
diff --git a/sha1dc/LICENSE.txt b/lib/sha1dc/LICENSE.txt
similarity index 100%
rename from sha1dc/LICENSE.txt
rename to lib/sha1dc/LICENSE.txt
diff --git a/sha1dc/sha1.c b/lib/sha1dc/sha1.c
similarity index 100%
rename from sha1dc/sha1.c
rename to lib/sha1dc/sha1.c
diff --git a/sha1dc/sha1.h b/lib/sha1dc/sha1.h
similarity index 100%
rename from sha1dc/sha1.h
rename to lib/sha1dc/sha1.h
diff --git a/sha1dc/ubc_check.c b/lib/sha1dc/ubc_check.c
similarity index 100%
rename from sha1dc/ubc_check.c
rename to lib/sha1dc/ubc_check.c
diff --git a/sha1dc/ubc_check.h b/lib/sha1dc/ubc_check.h
similarity index 100%
rename from sha1dc/ubc_check.h
rename to lib/sha1dc/ubc_check.h
diff --git a/sha1dc_git.c b/lib/sha1dc_git.c
similarity index 100%
rename from sha1dc_git.c
rename to lib/sha1dc_git.c
diff --git a/sha1dc_git.h b/lib/sha1dc_git.h
similarity index 100%
rename from sha1dc_git.h
rename to lib/sha1dc_git.h
diff --git a/sha256/block/sha256.c b/lib/sha256/block/sha256.c
similarity index 100%
rename from sha256/block/sha256.c
rename to lib/sha256/block/sha256.c
diff --git a/sha256/block/sha256.h b/lib/sha256/block/sha256.h
similarity index 100%
rename from sha256/block/sha256.h
rename to lib/sha256/block/sha256.h
diff --git a/sha256/gcrypt.h b/lib/sha256/gcrypt.h
similarity index 100%
rename from sha256/gcrypt.h
rename to lib/sha256/gcrypt.h
diff --git a/sha256/nettle.h b/lib/sha256/nettle.h
similarity index 100%
rename from sha256/nettle.h
rename to lib/sha256/nettle.h
diff --git a/sha256/openssl.h b/lib/sha256/openssl.h
similarity index 100%
rename from sha256/openssl.h
rename to lib/sha256/openssl.h
diff --git a/shallow.c b/lib/shallow.c
similarity index 100%
rename from shallow.c
rename to lib/shallow.c
diff --git a/shallow.h b/lib/shallow.h
similarity index 100%
rename from shallow.h
rename to lib/shallow.h
diff --git a/shortlog.h b/lib/shortlog.h
similarity index 100%
rename from shortlog.h
rename to lib/shortlog.h
diff --git a/sideband.c b/lib/sideband.c
similarity index 100%
rename from sideband.c
rename to lib/sideband.c
diff --git a/sideband.h b/lib/sideband.h
similarity index 100%
rename from sideband.h
rename to lib/sideband.h
diff --git a/sigchain.c b/lib/sigchain.c
similarity index 100%
rename from sigchain.c
rename to lib/sigchain.c
diff --git a/sigchain.h b/lib/sigchain.h
similarity index 100%
rename from sigchain.h
rename to lib/sigchain.h
diff --git a/simple-ipc.h b/lib/simple-ipc.h
similarity index 100%
rename from simple-ipc.h
rename to lib/simple-ipc.h
diff --git a/sparse-index.c b/lib/sparse-index.c
similarity index 100%
rename from sparse-index.c
rename to lib/sparse-index.c
diff --git a/sparse-index.h b/lib/sparse-index.h
similarity index 100%
rename from sparse-index.h
rename to lib/sparse-index.h
diff --git a/split-index.c b/lib/split-index.c
similarity index 100%
rename from split-index.c
rename to lib/split-index.c
diff --git a/split-index.h b/lib/split-index.h
similarity index 100%
rename from split-index.h
rename to lib/split-index.h
diff --git a/stable-qsort.c b/lib/stable-qsort.c
similarity index 100%
rename from stable-qsort.c
rename to lib/stable-qsort.c
diff --git a/statinfo.c b/lib/statinfo.c
similarity index 100%
rename from statinfo.c
rename to lib/statinfo.c
diff --git a/statinfo.h b/lib/statinfo.h
similarity index 100%
rename from statinfo.h
rename to lib/statinfo.h
diff --git a/strbuf.c b/lib/strbuf.c
similarity index 100%
rename from strbuf.c
rename to lib/strbuf.c
diff --git a/strbuf.h b/lib/strbuf.h
similarity index 100%
rename from strbuf.h
rename to lib/strbuf.h
diff --git a/string-list.c b/lib/string-list.c
similarity index 100%
rename from string-list.c
rename to lib/string-list.c
diff --git a/string-list.h b/lib/string-list.h
similarity index 100%
rename from string-list.h
rename to lib/string-list.h
diff --git a/strmap.c b/lib/strmap.c
similarity index 100%
rename from strmap.c
rename to lib/strmap.c
diff --git a/strmap.h b/lib/strmap.h
similarity index 100%
rename from strmap.h
rename to lib/strmap.h
diff --git a/strvec.c b/lib/strvec.c
similarity index 100%
rename from strvec.c
rename to lib/strvec.c
diff --git a/strvec.h b/lib/strvec.h
similarity index 100%
rename from strvec.h
rename to lib/strvec.h
diff --git a/sub-process.c b/lib/sub-process.c
similarity index 100%
rename from sub-process.c
rename to lib/sub-process.c
diff --git a/sub-process.h b/lib/sub-process.h
similarity index 100%
rename from sub-process.h
rename to lib/sub-process.h
diff --git a/submodule-config.c b/lib/submodule-config.c
similarity index 100%
rename from submodule-config.c
rename to lib/submodule-config.c
diff --git a/submodule-config.h b/lib/submodule-config.h
similarity index 100%
rename from submodule-config.h
rename to lib/submodule-config.h
diff --git a/submodule.c b/lib/submodule.c
similarity index 100%
rename from submodule.c
rename to lib/submodule.c
diff --git a/submodule.h b/lib/submodule.h
similarity index 100%
rename from submodule.h
rename to lib/submodule.h
diff --git a/symlinks.c b/lib/symlinks.c
similarity index 100%
rename from symlinks.c
rename to lib/symlinks.c
diff --git a/symlinks.h b/lib/symlinks.h
similarity index 100%
rename from symlinks.h
rename to lib/symlinks.h
diff --git a/tag.c b/lib/tag.c
similarity index 100%
rename from tag.c
rename to lib/tag.c
diff --git a/tag.h b/lib/tag.h
similarity index 100%
rename from tag.h
rename to lib/tag.h
diff --git a/tar.h b/lib/tar.h
similarity index 100%
rename from tar.h
rename to lib/tar.h
diff --git a/tempfile.c b/lib/tempfile.c
similarity index 100%
rename from tempfile.c
rename to lib/tempfile.c
diff --git a/tempfile.h b/lib/tempfile.h
similarity index 100%
rename from tempfile.h
rename to lib/tempfile.h
diff --git a/thread-utils.c b/lib/thread-utils.c
similarity index 100%
rename from thread-utils.c
rename to lib/thread-utils.c
diff --git a/thread-utils.h b/lib/thread-utils.h
similarity index 100%
rename from thread-utils.h
rename to lib/thread-utils.h
diff --git a/tmp-objdir.c b/lib/tmp-objdir.c
similarity index 100%
rename from tmp-objdir.c
rename to lib/tmp-objdir.c
diff --git a/tmp-objdir.h b/lib/tmp-objdir.h
similarity index 100%
rename from tmp-objdir.h
rename to lib/tmp-objdir.h
diff --git a/trace.c b/lib/trace.c
similarity index 100%
rename from trace.c
rename to lib/trace.c
diff --git a/trace.h b/lib/trace.h
similarity index 100%
rename from trace.h
rename to lib/trace.h
diff --git a/trace2.c b/lib/trace2.c
similarity index 100%
rename from trace2.c
rename to lib/trace2.c
diff --git a/trace2.h b/lib/trace2.h
similarity index 100%
rename from trace2.h
rename to lib/trace2.h
diff --git a/trace2/tr2_cfg.c b/lib/trace2/tr2_cfg.c
similarity index 100%
rename from trace2/tr2_cfg.c
rename to lib/trace2/tr2_cfg.c
diff --git a/trace2/tr2_cfg.h b/lib/trace2/tr2_cfg.h
similarity index 100%
rename from trace2/tr2_cfg.h
rename to lib/trace2/tr2_cfg.h
diff --git a/trace2/tr2_cmd_name.c b/lib/trace2/tr2_cmd_name.c
similarity index 100%
rename from trace2/tr2_cmd_name.c
rename to lib/trace2/tr2_cmd_name.c
diff --git a/trace2/tr2_cmd_name.h b/lib/trace2/tr2_cmd_name.h
similarity index 100%
rename from trace2/tr2_cmd_name.h
rename to lib/trace2/tr2_cmd_name.h
diff --git a/trace2/tr2_ctr.c b/lib/trace2/tr2_ctr.c
similarity index 100%
rename from trace2/tr2_ctr.c
rename to lib/trace2/tr2_ctr.c
diff --git a/trace2/tr2_ctr.h b/lib/trace2/tr2_ctr.h
similarity index 100%
rename from trace2/tr2_ctr.h
rename to lib/trace2/tr2_ctr.h
diff --git a/trace2/tr2_dst.c b/lib/trace2/tr2_dst.c
similarity index 100%
rename from trace2/tr2_dst.c
rename to lib/trace2/tr2_dst.c
diff --git a/trace2/tr2_dst.h b/lib/trace2/tr2_dst.h
similarity index 100%
rename from trace2/tr2_dst.h
rename to lib/trace2/tr2_dst.h
diff --git a/trace2/tr2_sid.c b/lib/trace2/tr2_sid.c
similarity index 100%
rename from trace2/tr2_sid.c
rename to lib/trace2/tr2_sid.c
diff --git a/trace2/tr2_sid.h b/lib/trace2/tr2_sid.h
similarity index 100%
rename from trace2/tr2_sid.h
rename to lib/trace2/tr2_sid.h
diff --git a/trace2/tr2_sysenv.c b/lib/trace2/tr2_sysenv.c
similarity index 100%
rename from trace2/tr2_sysenv.c
rename to lib/trace2/tr2_sysenv.c
diff --git a/trace2/tr2_sysenv.h b/lib/trace2/tr2_sysenv.h
similarity index 100%
rename from trace2/tr2_sysenv.h
rename to lib/trace2/tr2_sysenv.h
diff --git a/trace2/tr2_tbuf.c b/lib/trace2/tr2_tbuf.c
similarity index 100%
rename from trace2/tr2_tbuf.c
rename to lib/trace2/tr2_tbuf.c
diff --git a/trace2/tr2_tbuf.h b/lib/trace2/tr2_tbuf.h
similarity index 100%
rename from trace2/tr2_tbuf.h
rename to lib/trace2/tr2_tbuf.h
diff --git a/trace2/tr2_tgt.h b/lib/trace2/tr2_tgt.h
similarity index 100%
rename from trace2/tr2_tgt.h
rename to lib/trace2/tr2_tgt.h
diff --git a/trace2/tr2_tgt_event.c b/lib/trace2/tr2_tgt_event.c
similarity index 100%
rename from trace2/tr2_tgt_event.c
rename to lib/trace2/tr2_tgt_event.c
diff --git a/trace2/tr2_tgt_normal.c b/lib/trace2/tr2_tgt_normal.c
similarity index 100%
rename from trace2/tr2_tgt_normal.c
rename to lib/trace2/tr2_tgt_normal.c
diff --git a/trace2/tr2_tgt_perf.c b/lib/trace2/tr2_tgt_perf.c
similarity index 100%
rename from trace2/tr2_tgt_perf.c
rename to lib/trace2/tr2_tgt_perf.c
diff --git a/trace2/tr2_tls.c b/lib/trace2/tr2_tls.c
similarity index 100%
rename from trace2/tr2_tls.c
rename to lib/trace2/tr2_tls.c
diff --git a/trace2/tr2_tls.h b/lib/trace2/tr2_tls.h
similarity index 100%
rename from trace2/tr2_tls.h
rename to lib/trace2/tr2_tls.h
diff --git a/trace2/tr2_tmr.c b/lib/trace2/tr2_tmr.c
similarity index 100%
rename from trace2/tr2_tmr.c
rename to lib/trace2/tr2_tmr.c
diff --git a/trace2/tr2_tmr.h b/lib/trace2/tr2_tmr.h
similarity index 100%
rename from trace2/tr2_tmr.h
rename to lib/trace2/tr2_tmr.h
diff --git a/trailer.c b/lib/trailer.c
similarity index 100%
rename from trailer.c
rename to lib/trailer.c
diff --git a/trailer.h b/lib/trailer.h
similarity index 100%
rename from trailer.h
rename to lib/trailer.h
diff --git a/transport-helper.c b/lib/transport-helper.c
similarity index 100%
rename from transport-helper.c
rename to lib/transport-helper.c
diff --git a/transport-internal.h b/lib/transport-internal.h
similarity index 100%
rename from transport-internal.h
rename to lib/transport-internal.h
diff --git a/transport.c b/lib/transport.c
similarity index 100%
rename from transport.c
rename to lib/transport.c
diff --git a/transport.h b/lib/transport.h
similarity index 100%
rename from transport.h
rename to lib/transport.h
diff --git a/tree-diff.c b/lib/tree-diff.c
similarity index 100%
rename from tree-diff.c
rename to lib/tree-diff.c
diff --git a/tree-walk.c b/lib/tree-walk.c
similarity index 100%
rename from tree-walk.c
rename to lib/tree-walk.c
diff --git a/tree-walk.h b/lib/tree-walk.h
similarity index 100%
rename from tree-walk.h
rename to lib/tree-walk.h
diff --git a/tree.c b/lib/tree.c
similarity index 100%
rename from tree.c
rename to lib/tree.c
diff --git a/tree.h b/lib/tree.h
similarity index 100%
rename from tree.h
rename to lib/tree.h
diff --git a/unicode-width.h b/lib/unicode-width.h
similarity index 100%
rename from unicode-width.h
rename to lib/unicode-width.h
diff --git a/unix-socket.c b/lib/unix-socket.c
similarity index 100%
rename from unix-socket.c
rename to lib/unix-socket.c
diff --git a/unix-socket.h b/lib/unix-socket.h
similarity index 100%
rename from unix-socket.h
rename to lib/unix-socket.h
diff --git a/unix-stream-server.c b/lib/unix-stream-server.c
similarity index 100%
rename from unix-stream-server.c
rename to lib/unix-stream-server.c
diff --git a/unix-stream-server.h b/lib/unix-stream-server.h
similarity index 100%
rename from unix-stream-server.h
rename to lib/unix-stream-server.h
diff --git a/unpack-trees.c b/lib/unpack-trees.c
similarity index 100%
rename from unpack-trees.c
rename to lib/unpack-trees.c
diff --git a/unpack-trees.h b/lib/unpack-trees.h
similarity index 100%
rename from unpack-trees.h
rename to lib/unpack-trees.h
diff --git a/upload-pack.c b/lib/upload-pack.c
similarity index 100%
rename from upload-pack.c
rename to lib/upload-pack.c
diff --git a/upload-pack.h b/lib/upload-pack.h
similarity index 100%
rename from upload-pack.h
rename to lib/upload-pack.h
diff --git a/url.c b/lib/url.c
similarity index 100%
rename from url.c
rename to lib/url.c
diff --git a/url.h b/lib/url.h
similarity index 100%
rename from url.h
rename to lib/url.h
diff --git a/urlmatch.c b/lib/urlmatch.c
similarity index 100%
rename from urlmatch.c
rename to lib/urlmatch.c
diff --git a/urlmatch.h b/lib/urlmatch.h
similarity index 100%
rename from urlmatch.h
rename to lib/urlmatch.h
diff --git a/usage.c b/lib/usage.c
similarity index 100%
rename from usage.c
rename to lib/usage.c
diff --git a/userdiff.c b/lib/userdiff.c
similarity index 100%
rename from userdiff.c
rename to lib/userdiff.c
diff --git a/userdiff.h b/lib/userdiff.h
similarity index 100%
rename from userdiff.h
rename to lib/userdiff.h
diff --git a/utf8.c b/lib/utf8.c
similarity index 100%
rename from utf8.c
rename to lib/utf8.c
diff --git a/utf8.h b/lib/utf8.h
similarity index 100%
rename from utf8.h
rename to lib/utf8.h
diff --git a/varint.c b/lib/varint.c
similarity index 100%
rename from varint.c
rename to lib/varint.c
diff --git a/varint.h b/lib/varint.h
similarity index 100%
rename from varint.h
rename to lib/varint.h
diff --git a/version-def.h.in b/lib/version-def.h.in
similarity index 100%
rename from version-def.h.in
rename to lib/version-def.h.in
diff --git a/version.c b/lib/version.c
similarity index 100%
rename from version.c
rename to lib/version.c
diff --git a/version.h b/lib/version.h
similarity index 100%
rename from version.h
rename to lib/version.h
diff --git a/versioncmp.c b/lib/versioncmp.c
similarity index 100%
rename from versioncmp.c
rename to lib/versioncmp.c
diff --git a/versioncmp.h b/lib/versioncmp.h
similarity index 100%
rename from versioncmp.h
rename to lib/versioncmp.h
diff --git a/walker.c b/lib/walker.c
similarity index 100%
rename from walker.c
rename to lib/walker.c
diff --git a/walker.h b/lib/walker.h
similarity index 100%
rename from walker.h
rename to lib/walker.h
diff --git a/wildmatch.c b/lib/wildmatch.c
similarity index 100%
rename from wildmatch.c
rename to lib/wildmatch.c
diff --git a/wildmatch.h b/lib/wildmatch.h
similarity index 100%
rename from wildmatch.h
rename to lib/wildmatch.h
diff --git a/worktree.c b/lib/worktree.c
similarity index 100%
rename from worktree.c
rename to lib/worktree.c
diff --git a/worktree.h b/lib/worktree.h
similarity index 100%
rename from worktree.h
rename to lib/worktree.h
diff --git a/wrapper.c b/lib/wrapper.c
similarity index 100%
rename from wrapper.c
rename to lib/wrapper.c
diff --git a/wrapper.h b/lib/wrapper.h
similarity index 100%
rename from wrapper.h
rename to lib/wrapper.h
diff --git a/write-or-die.c b/lib/write-or-die.c
similarity index 100%
rename from write-or-die.c
rename to lib/write-or-die.c
diff --git a/write-or-die.h b/lib/write-or-die.h
similarity index 100%
rename from write-or-die.h
rename to lib/write-or-die.h
diff --git a/ws.c b/lib/ws.c
similarity index 100%
rename from ws.c
rename to lib/ws.c
diff --git a/ws.h b/lib/ws.h
similarity index 100%
rename from ws.h
rename to lib/ws.h
diff --git a/wt-status.c b/lib/wt-status.c
similarity index 100%
rename from wt-status.c
rename to lib/wt-status.c
diff --git a/wt-status.h b/lib/wt-status.h
similarity index 100%
rename from wt-status.h
rename to lib/wt-status.h
diff --git a/xdiff-interface.c b/lib/xdiff-interface.c
similarity index 100%
rename from xdiff-interface.c
rename to lib/xdiff-interface.c
diff --git a/xdiff-interface.h b/lib/xdiff-interface.h
similarity index 100%
rename from xdiff-interface.h
rename to lib/xdiff-interface.h
diff --git a/xdiff/xdiff.h b/lib/xdiff/xdiff.h
similarity index 100%
rename from xdiff/xdiff.h
rename to lib/xdiff/xdiff.h
diff --git a/xdiff/xdiffi.c b/lib/xdiff/xdiffi.c
similarity index 100%
rename from xdiff/xdiffi.c
rename to lib/xdiff/xdiffi.c
diff --git a/xdiff/xdiffi.h b/lib/xdiff/xdiffi.h
similarity index 100%
rename from xdiff/xdiffi.h
rename to lib/xdiff/xdiffi.h
diff --git a/xdiff/xemit.c b/lib/xdiff/xemit.c
similarity index 100%
rename from xdiff/xemit.c
rename to lib/xdiff/xemit.c
diff --git a/xdiff/xemit.h b/lib/xdiff/xemit.h
similarity index 100%
rename from xdiff/xemit.h
rename to lib/xdiff/xemit.h
diff --git a/xdiff/xhistogram.c b/lib/xdiff/xhistogram.c
similarity index 100%
rename from xdiff/xhistogram.c
rename to lib/xdiff/xhistogram.c
diff --git a/xdiff/xinclude.h b/lib/xdiff/xinclude.h
similarity index 100%
rename from xdiff/xinclude.h
rename to lib/xdiff/xinclude.h
diff --git a/xdiff/xmacros.h b/lib/xdiff/xmacros.h
similarity index 100%
rename from xdiff/xmacros.h
rename to lib/xdiff/xmacros.h
diff --git a/xdiff/xmerge.c b/lib/xdiff/xmerge.c
similarity index 100%
rename from xdiff/xmerge.c
rename to lib/xdiff/xmerge.c
diff --git a/xdiff/xpatience.c b/lib/xdiff/xpatience.c
similarity index 100%
rename from xdiff/xpatience.c
rename to lib/xdiff/xpatience.c
diff --git a/xdiff/xprepare.c b/lib/xdiff/xprepare.c
similarity index 100%
rename from xdiff/xprepare.c
rename to lib/xdiff/xprepare.c
diff --git a/xdiff/xprepare.h b/lib/xdiff/xprepare.h
similarity index 100%
rename from xdiff/xprepare.h
rename to lib/xdiff/xprepare.h
diff --git a/xdiff/xtypes.h b/lib/xdiff/xtypes.h
similarity index 100%
rename from xdiff/xtypes.h
rename to lib/xdiff/xtypes.h
diff --git a/xdiff/xutils.c b/lib/xdiff/xutils.c
similarity index 100%
rename from xdiff/xutils.c
rename to lib/xdiff/xutils.c
diff --git a/xdiff/xutils.h b/lib/xdiff/xutils.h
similarity index 100%
rename from xdiff/xutils.h
rename to lib/xdiff/xutils.h
diff --git a/meson.build b/meson.build
index ca235801cf..2f90bed441 100644
--- a/meson.build
+++ b/meson.build
@@ -272,293 +272,293 @@ version_gen_environment.set('GIT_VERSION', get_option('version'))
 compiler = meson.get_compiler('c')
 
 compat_sources = [
-  'compat/nonblock.c',
-  'compat/obstack.c',
-  'compat/open.c',
-  'compat/terminal.c',
+  'lib/compat/nonblock.c',
+  'lib/compat/obstack.c',
+  'lib/compat/open.c',
+  'lib/compat/terminal.c',
 ]
 
 libgit_sources = [
-  'abspath.c',
-  'add-interactive.c',
-  'add-patch.c',
-  'advice.c',
-  'alias.c',
-  'alloc.c',
-  'apply.c',
-  'archive-tar.c',
-  'archive-zip.c',
-  'archive.c',
-  'attr.c',
-  'base85.c',
-  'bisect.c',
-  'blame.c',
-  'blob.c',
-  'bloom.c',
-  'branch.c',
-  'bundle-uri.c',
-  'bundle.c',
-  'cache-tree.c',
-  'cbtree.c',
-  'chdir-notify.c',
-  'checkout.c',
-  'chunk-format.c',
-  'color.c',
-  'column.c',
-  'combine-diff.c',
-  'commit-graph.c',
-  'commit-reach.c',
-  'commit.c',
-  'common-exit.c',
-  'common-init.c',
-  'compiler-tricks/not-constant.c',
-  'config.c',
-  'connect.c',
-  'connected.c',
-  'convert.c',
-  'copy.c',
-  'credential.c',
-  'csum-file.c',
-  'ctype.c',
-  'date.c',
-  'decorate.c',
-  'delta-islands.c',
-  'diagnose.c',
-  'diff-delta.c',
-  'diff-merges.c',
-  'diff-lib.c',
-  'diff-no-index.c',
-  'diff.c',
-  'diffcore-break.c',
-  'diffcore-delta.c',
-  'diffcore-order.c',
-  'diffcore-pickaxe.c',
-  'diffcore-rename.c',
-  'diffcore-rotate.c',
-  'dir-iterator.c',
-  'dir.c',
-  'editor.c',
-  'entry.c',
-  'environment.c',
-  'ewah/bitmap.c',
-  'ewah/ewah_bitmap.c',
-  'ewah/ewah_io.c',
-  'ewah/ewah_rlw.c',
-  'exec-cmd.c',
-  'fetch-negotiator.c',
-  'fetch-pack.c',
-  'fmt-merge-msg.c',
-  'fsck.c',
-  'fsmonitor.c',
-  'fsmonitor-ipc.c',
-  'fsmonitor-settings.c',
-  'gettext.c',
-  'git-zlib.c',
-  'gpg-interface.c',
-  'graph.c',
-  'grep.c',
-  'hash-lookup.c',
-  'hash.c',
-  'hashmap.c',
-  'help.c',
-  'hex.c',
-  'hex-ll.c',
-  'hook.c',
-  'ident.c',
-  'json-writer.c',
-  'kwset.c',
-  'levenshtein.c',
-  'line-log.c',
-  'line-range.c',
-  'linear-assignment.c',
-  'list-objects-filter-options.c',
-  'list-objects-filter.c',
-  'list-objects.c',
-  'lockfile.c',
-  'log-tree.c',
-  'loose.c',
-  'ls-refs.c',
-  'mailinfo.c',
-  'mailmap.c',
-  'match-trees.c',
-  'mem-pool.c',
-  'merge-blobs.c',
-  'merge-ll.c',
-  'merge-ort.c',
-  'merge-ort-wrappers.c',
-  'merge.c',
-  'midx.c',
-  'midx-write.c',
-  'name-hash.c',
-  'negotiator/default.c',
-  'negotiator/noop.c',
-  'negotiator/skipping.c',
-  'notes-cache.c',
-  'notes-merge.c',
-  'notes-utils.c',
-  'notes.c',
-  'object-file-convert.c',
-  'object-file.c',
-  'object-name.c',
-  'object.c',
-  'odb.c',
-  'odb/source.c',
-  'odb/source-files.c',
-  'odb/source-inmemory.c',
-  'odb/source-loose.c',
-  'odb/source-packed.c',
-  'odb/streaming.c',
-  'odb/transaction.c',
-  'oid-array.c',
-  'oidmap.c',
-  'oidset.c',
-  'oidtree.c',
-  'pack-bitmap-write.c',
-  'pack-bitmap.c',
-  'pack-check.c',
-  'pack-mtimes.c',
-  'pack-objects.c',
-  'pack-refs.c',
-  'pack-revindex.c',
-  'pack-write.c',
-  'packfile.c',
-  'packfile-list.c',
-  'pager.c',
-  'parallel-checkout.c',
-  'parse.c',
-  'parse-options-cb.c',
-  'parse-options.c',
-  'patch-delta.c',
-  'patch-ids.c',
-  'path.c',
-  'path-walk.c',
-  'pathspec.c',
-  'pkt-line.c',
-  'preload-index.c',
-  'pretty.c',
-  'prio-queue.c',
-  'progress.c',
-  'promisor-remote.c',
-  'prompt.c',
-  'protocol.c',
-  'protocol-caps.c',
-  'prune-packed.c',
-  'pseudo-merge.c',
-  'quote.c',
-  'range-diff.c',
-  'reachable.c',
-  'read-cache.c',
-  'rebase-interactive.c',
-  'rebase.c',
-  'ref-filter.c',
-  'reflog-walk.c',
-  'reflog.c',
-  'refs.c',
-  'refs/debug.c',
-  'refs/files-backend.c',
-  'refs/reftable-backend.c',
-  'refs/iterator.c',
-  'refs/packed-backend.c',
-  'refs/ref-cache.c',
-  'refspec.c',
-  'reftable/basics.c',
-  'reftable/error.c',
-  'reftable/block.c',
-  'reftable/blocksource.c',
-  'reftable/fsck.c',
-  'reftable/iter.c',
-  'reftable/merged.c',
-  'reftable/pq.c',
-  'reftable/record.c',
-  'reftable/stack.c',
-  'reftable/system.c',
-  'reftable/table.c',
-  'reftable/tree.c',
-  'reftable/writer.c',
-  'remote.c',
-  'repack.c',
-  'repack-cruft.c',
-  'repack-filtered.c',
-  'repack-geometry.c',
-  'repack-midx.c',
-  'repack-promisor.c',
-  'replace-object.c',
-  'replay.c',
-  'repo-settings.c',
-  'repository.c',
-  'rerere.c',
-  'reset.c',
-  'resolve-undo.c',
-  'revision.c',
-  'run-command.c',
-  'send-pack.c',
-  'sequencer.c',
-  'serve.c',
-  'server-info.c',
-  'setup.c',
-  'shallow.c',
-  'sideband.c',
-  'sigchain.c',
-  'sparse-index.c',
-  'split-index.c',
-  'stable-qsort.c',
-  'statinfo.c',
-  'strbuf.c',
-  'string-list.c',
-  'strmap.c',
-  'strvec.c',
-  'sub-process.c',
-  'submodule-config.c',
-  'submodule.c',
-  'symlinks.c',
-  'tag.c',
-  'tempfile.c',
-  'thread-utils.c',
-  'tmp-objdir.c',
-  'trace.c',
-  'trace2.c',
-  'trace2/tr2_cfg.c',
-  'trace2/tr2_cmd_name.c',
-  'trace2/tr2_ctr.c',
-  'trace2/tr2_dst.c',
-  'trace2/tr2_sid.c',
-  'trace2/tr2_sysenv.c',
-  'trace2/tr2_tbuf.c',
-  'trace2/tr2_tgt_event.c',
-  'trace2/tr2_tgt_normal.c',
-  'trace2/tr2_tgt_perf.c',
-  'trace2/tr2_tls.c',
-  'trace2/tr2_tmr.c',
-  'trailer.c',
-  'transport-helper.c',
-  'transport.c',
-  'tree-diff.c',
-  'tree-walk.c',
-  'tree.c',
-  'unpack-trees.c',
-  'upload-pack.c',
-  'url.c',
-  'urlmatch.c',
-  'usage.c',
-  'userdiff.c',
-  'utf8.c',
-  'version.c',
-  'versioncmp.c',
-  'walker.c',
-  'wildmatch.c',
-  'worktree.c',
-  'wrapper.c',
-  'write-or-die.c',
-  'ws.c',
-  'wt-status.c',
-  'xdiff-interface.c',
-  'xdiff/xdiffi.c',
-  'xdiff/xemit.c',
-  'xdiff/xhistogram.c',
-  'xdiff/xmerge.c',
-  'xdiff/xpatience.c',
-  'xdiff/xprepare.c',
-  'xdiff/xutils.c',
+  'lib/abspath.c',
+  'lib/add-interactive.c',
+  'lib/add-patch.c',
+  'lib/advice.c',
+  'lib/alias.c',
+  'lib/alloc.c',
+  'lib/apply.c',
+  'lib/archive-tar.c',
+  'lib/archive-zip.c',
+  'lib/archive.c',
+  'lib/attr.c',
+  'lib/base85.c',
+  'lib/bisect.c',
+  'lib/blame.c',
+  'lib/blob.c',
+  'lib/bloom.c',
+  'lib/branch.c',
+  'lib/bundle-uri.c',
+  'lib/bundle.c',
+  'lib/cache-tree.c',
+  'lib/cbtree.c',
+  'lib/chdir-notify.c',
+  'lib/checkout.c',
+  'lib/chunk-format.c',
+  'lib/color.c',
+  'lib/column.c',
+  'lib/combine-diff.c',
+  'lib/commit-graph.c',
+  'lib/commit-reach.c',
+  'lib/commit.c',
+  'lib/common-exit.c',
+  'lib/common-init.c',
+  'lib/compiler-tricks/not-constant.c',
+  'lib/config.c',
+  'lib/connect.c',
+  'lib/connected.c',
+  'lib/convert.c',
+  'lib/copy.c',
+  'lib/credential.c',
+  'lib/csum-file.c',
+  'lib/ctype.c',
+  'lib/date.c',
+  'lib/decorate.c',
+  'lib/delta-islands.c',
+  'lib/diagnose.c',
+  'lib/diff-delta.c',
+  'lib/diff-merges.c',
+  'lib/diff-lib.c',
+  'lib/diff-no-index.c',
+  'lib/diff.c',
+  'lib/diffcore-break.c',
+  'lib/diffcore-delta.c',
+  'lib/diffcore-order.c',
+  'lib/diffcore-pickaxe.c',
+  'lib/diffcore-rename.c',
+  'lib/diffcore-rotate.c',
+  'lib/dir-iterator.c',
+  'lib/dir.c',
+  'lib/editor.c',
+  'lib/entry.c',
+  'lib/environment.c',
+  'lib/ewah/bitmap.c',
+  'lib/ewah/ewah_bitmap.c',
+  'lib/ewah/ewah_io.c',
+  'lib/ewah/ewah_rlw.c',
+  'lib/exec-cmd.c',
+  'lib/fetch-negotiator.c',
+  'lib/fetch-pack.c',
+  'lib/fmt-merge-msg.c',
+  'lib/fsck.c',
+  'lib/fsmonitor.c',
+  'lib/fsmonitor-ipc.c',
+  'lib/fsmonitor-settings.c',
+  'lib/gettext.c',
+  'lib/git-zlib.c',
+  'lib/gpg-interface.c',
+  'lib/graph.c',
+  'lib/grep.c',
+  'lib/hash-lookup.c',
+  'lib/hash.c',
+  'lib/hashmap.c',
+  'lib/help.c',
+  'lib/hex.c',
+  'lib/hex-ll.c',
+  'lib/hook.c',
+  'lib/ident.c',
+  'lib/json-writer.c',
+  'lib/kwset.c',
+  'lib/levenshtein.c',
+  'lib/line-log.c',
+  'lib/line-range.c',
+  'lib/linear-assignment.c',
+  'lib/list-objects-filter-options.c',
+  'lib/list-objects-filter.c',
+  'lib/list-objects.c',
+  'lib/lockfile.c',
+  'lib/log-tree.c',
+  'lib/loose.c',
+  'lib/ls-refs.c',
+  'lib/mailinfo.c',
+  'lib/mailmap.c',
+  'lib/match-trees.c',
+  'lib/mem-pool.c',
+  'lib/merge-blobs.c',
+  'lib/merge-ll.c',
+  'lib/merge-ort.c',
+  'lib/merge-ort-wrappers.c',
+  'lib/merge.c',
+  'lib/midx.c',
+  'lib/midx-write.c',
+  'lib/name-hash.c',
+  'lib/negotiator/default.c',
+  'lib/negotiator/noop.c',
+  'lib/negotiator/skipping.c',
+  'lib/notes-cache.c',
+  'lib/notes-merge.c',
+  'lib/notes-utils.c',
+  'lib/notes.c',
+  'lib/object-file-convert.c',
+  'lib/object-file.c',
+  'lib/object-name.c',
+  'lib/object.c',
+  'lib/odb.c',
+  'lib/odb/source.c',
+  'lib/odb/source-files.c',
+  'lib/odb/source-inmemory.c',
+  'lib/odb/source-loose.c',
+  'lib/odb/source-packed.c',
+  'lib/odb/streaming.c',
+  'lib/odb/transaction.c',
+  'lib/oid-array.c',
+  'lib/oidmap.c',
+  'lib/oidset.c',
+  'lib/oidtree.c',
+  'lib/pack-bitmap-write.c',
+  'lib/pack-bitmap.c',
+  'lib/pack-check.c',
+  'lib/pack-mtimes.c',
+  'lib/pack-objects.c',
+  'lib/pack-refs.c',
+  'lib/pack-revindex.c',
+  'lib/pack-write.c',
+  'lib/packfile.c',
+  'lib/packfile-list.c',
+  'lib/pager.c',
+  'lib/parallel-checkout.c',
+  'lib/parse.c',
+  'lib/parse-options-cb.c',
+  'lib/parse-options.c',
+  'lib/patch-delta.c',
+  'lib/patch-ids.c',
+  'lib/path.c',
+  'lib/path-walk.c',
+  'lib/pathspec.c',
+  'lib/pkt-line.c',
+  'lib/preload-index.c',
+  'lib/pretty.c',
+  'lib/prio-queue.c',
+  'lib/progress.c',
+  'lib/promisor-remote.c',
+  'lib/prompt.c',
+  'lib/protocol.c',
+  'lib/protocol-caps.c',
+  'lib/prune-packed.c',
+  'lib/pseudo-merge.c',
+  'lib/quote.c',
+  'lib/range-diff.c',
+  'lib/reachable.c',
+  'lib/read-cache.c',
+  'lib/rebase-interactive.c',
+  'lib/rebase.c',
+  'lib/ref-filter.c',
+  'lib/reflog-walk.c',
+  'lib/reflog.c',
+  'lib/refs.c',
+  'lib/refs/debug.c',
+  'lib/refs/files-backend.c',
+  'lib/refs/reftable-backend.c',
+  'lib/refs/iterator.c',
+  'lib/refs/packed-backend.c',
+  'lib/refs/ref-cache.c',
+  'lib/refspec.c',
+  'lib/reftable/basics.c',
+  'lib/reftable/error.c',
+  'lib/reftable/block.c',
+  'lib/reftable/blocksource.c',
+  'lib/reftable/fsck.c',
+  'lib/reftable/iter.c',
+  'lib/reftable/merged.c',
+  'lib/reftable/pq.c',
+  'lib/reftable/record.c',
+  'lib/reftable/stack.c',
+  'lib/reftable/system.c',
+  'lib/reftable/table.c',
+  'lib/reftable/tree.c',
+  'lib/reftable/writer.c',
+  'lib/remote.c',
+  'lib/repack.c',
+  'lib/repack-cruft.c',
+  'lib/repack-filtered.c',
+  'lib/repack-geometry.c',
+  'lib/repack-midx.c',
+  'lib/repack-promisor.c',
+  'lib/replace-object.c',
+  'lib/replay.c',
+  'lib/repo-settings.c',
+  'lib/repository.c',
+  'lib/rerere.c',
+  'lib/reset.c',
+  'lib/resolve-undo.c',
+  'lib/revision.c',
+  'lib/run-command.c',
+  'lib/send-pack.c',
+  'lib/sequencer.c',
+  'lib/serve.c',
+  'lib/server-info.c',
+  'lib/setup.c',
+  'lib/shallow.c',
+  'lib/sideband.c',
+  'lib/sigchain.c',
+  'lib/sparse-index.c',
+  'lib/split-index.c',
+  'lib/stable-qsort.c',
+  'lib/statinfo.c',
+  'lib/strbuf.c',
+  'lib/string-list.c',
+  'lib/strmap.c',
+  'lib/strvec.c',
+  'lib/sub-process.c',
+  'lib/submodule-config.c',
+  'lib/submodule.c',
+  'lib/symlinks.c',
+  'lib/tag.c',
+  'lib/tempfile.c',
+  'lib/thread-utils.c',
+  'lib/tmp-objdir.c',
+  'lib/trace.c',
+  'lib/trace2.c',
+  'lib/trace2/tr2_cfg.c',
+  'lib/trace2/tr2_cmd_name.c',
+  'lib/trace2/tr2_ctr.c',
+  'lib/trace2/tr2_dst.c',
+  'lib/trace2/tr2_sid.c',
+  'lib/trace2/tr2_sysenv.c',
+  'lib/trace2/tr2_tbuf.c',
+  'lib/trace2/tr2_tgt_event.c',
+  'lib/trace2/tr2_tgt_normal.c',
+  'lib/trace2/tr2_tgt_perf.c',
+  'lib/trace2/tr2_tls.c',
+  'lib/trace2/tr2_tmr.c',
+  'lib/trailer.c',
+  'lib/transport-helper.c',
+  'lib/transport.c',
+  'lib/tree-diff.c',
+  'lib/tree-walk.c',
+  'lib/tree.c',
+  'lib/unpack-trees.c',
+  'lib/upload-pack.c',
+  'lib/url.c',
+  'lib/urlmatch.c',
+  'lib/usage.c',
+  'lib/userdiff.c',
+  'lib/utf8.c',
+  'lib/version.c',
+  'lib/versioncmp.c',
+  'lib/walker.c',
+  'lib/wildmatch.c',
+  'lib/worktree.c',
+  'lib/wrapper.c',
+  'lib/write-or-die.c',
+  'lib/ws.c',
+  'lib/wt-status.c',
+  'lib/xdiff-interface.c',
+  'lib/xdiff/xdiffi.c',
+  'lib/xdiff/xemit.c',
+  'lib/xdiff/xhistogram.c',
+  'lib/xdiff/xmerge.c',
+  'lib/xdiff/xpatience.c',
+  'lib/xdiff/xprepare.c',
+  'lib/xdiff/xutils.c',
 ]
 
 libgit_sources += custom_target(
@@ -713,17 +713,16 @@ builtin_sources = [
 ]
 
 third_party_excludes = [
-  ':!contrib',
-  ':!compat/inet_ntop.c',
-  ':!compat/inet_pton.c',
-  ':!compat/obstack.*',
-  ':!compat/poll',
-  ':!compat/regex',
-  ':!sha1collisiondetection',
-  ':!sha1dc',
+  ':!lib/contrib',
+  ':!lib/compat/inet_ntop.c',
+  ':!lib/compat/inet_pton.c',
+  ':!lib/compat/obstack.*',
+  ':!lib/compat/poll',
+  ':!lib/compat/regex',
+  ':!lib/sha1collisiondetection',
+  ':!lib/sha1dc',
   ':!t/unit-tests/clar',
   ':!t/t[0-9][0-9][0-9][0-9]*',
-  ':!xdiff',
 ]
 
 headers_to_check = []
@@ -840,7 +839,7 @@ if help_format_opt != 'man'
     libgit_c_args += '-DDEFAULT_HELP_FORMAT="' + help_format_opt + '"'
 endif
 
-libgit_include_directories = [ '.' ]
+libgit_include_directories = [ 'lib' ]
 libgit_dependencies = [ ]
 
 # Treat any warning level above 1 the same as we treat DEVELOPER=1 in our
@@ -1189,8 +1188,8 @@ endif
 
 if not has_poll_h and not has_sys_poll_h
   libgit_c_args += '-DNO_POLL'
-  compat_sources += 'compat/poll/poll.c'
-  libgit_include_directories += 'compat/poll'
+  compat_sources += 'lib/compat/poll/poll.c'
+  libgit_include_directories += 'lib/compat/poll'
 endif
 
 if not compiler.has_header('inttypes.h')
@@ -1205,7 +1204,7 @@ endif
 # implementation to threat things like drive prefixes specially.
 if host_machine.system() == 'windows' or not compiler.has_header('libgen.h')
   libgit_c_args += '-DNO_LIBGEN_H'
-  compat_sources += 'compat/basename.c'
+  compat_sources += 'lib/compat/basename.c'
 endif
 
 if compiler.has_header('paths.h')
@@ -1235,7 +1234,7 @@ if host_machine.system() != 'windows'
   foreach symbol : ['inet_ntop', 'inet_pton', 'hstrerror']
     if not compiler.has_function(symbol, dependencies: networking_dependencies)
       libgit_c_args += '-DNO_' + symbol.to_upper()
-      compat_sources += 'compat/' + symbol + '.c'
+      compat_sources += 'lib/compat/' + symbol + '.c'
     endif
   endforeach
 endif
@@ -1267,8 +1266,8 @@ endif
 
 if compiler.has_function('socket', dependencies: networking_dependencies)
   libgit_sources += [
-    'unix-socket.c',
-    'unix-stream-server.c',
+    'lib/unix-socket.c',
+    'lib/unix-stream-server.c',
   ]
   build_options_config.set('NO_UNIX_SOCKETS', '')
 else
@@ -1277,7 +1276,7 @@ else
 endif
 
 if host_machine.system() == 'darwin'
-  compat_sources += 'compat/precompose_utf8.c'
+  compat_sources += 'lib/compat/precompose_utf8.c'
   libgit_c_args += '-DPRECOMPOSE_UNICODE'
   libgit_c_args += '-DPROTECT_HFS_DEFAULT'
 endif
@@ -1285,17 +1284,17 @@ endif
 # Configure general compatibility wrappers.
 if host_machine.system() == 'cygwin'
   compat_sources += [
-    'compat/win32/path-utils.c',
+    'lib/compat/win32/path-utils.c',
   ]
 elif host_machine.system() == 'windows'
   compat_sources += [
-    'compat/winansi.c',
-    'compat/win32/dirent.c',
-    'compat/win32/flush.c',
-    'compat/win32/path-utils.c',
-    'compat/win32/pthread.c',
-    'compat/win32/syslog.c',
-    'compat/win32mmap.c',
+    'lib/compat/winansi.c',
+    'lib/compat/win32/dirent.c',
+    'lib/compat/win32/flush.c',
+    'lib/compat/win32/path-utils.c',
+    'lib/compat/win32/pthread.c',
+    'lib/compat/win32/syslog.c',
+    'lib/compat/win32mmap.c',
   ]
 
   libgit_c_args += [
@@ -1311,23 +1310,23 @@ elif host_machine.system() == 'windows'
   ]
 
   libgit_dependencies += compiler.find_library('ntdll')
-  libgit_include_directories += 'compat/win32'
+  libgit_include_directories += 'lib/compat/win32'
   if compiler.get_id() == 'msvc'
-    libgit_include_directories += 'compat/vcbuild/include'
-    compat_sources += 'compat/msvc.c'
+    libgit_include_directories += 'lib/compat/vcbuild/include'
+    compat_sources += 'lib/compat/msvc.c'
   else
-    compat_sources += 'compat/mingw.c'
+    compat_sources += 'lib/compat/mingw.c'
   endif
 endif
 
 if host_machine.system() == 'linux'
-  compat_sources += 'compat/linux/procinfo.c'
+  compat_sources += 'lib/compat/linux/procinfo.c'
 elif host_machine.system() == 'windows'
-  compat_sources += 'compat/win32/trace2_win32_process_info.c'
+  compat_sources += 'lib/compat/win32/trace2_win32_process_info.c'
 elif host_machine.system() == 'darwin'
-  compat_sources += 'compat/darwin/procinfo.c'
+  compat_sources += 'lib/compat/darwin/procinfo.c'
 else
-  compat_sources += 'compat/stub/procinfo.c'
+  compat_sources += 'lib/compat/stub/procinfo.c'
 endif
 
 if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
@@ -1341,14 +1340,14 @@ endif
 # Configure the simple-ipc subsystem required fro the fsmonitor.
 if host_machine.system() == 'windows'
   compat_sources += [
-    'compat/simple-ipc/ipc-shared.c',
-    'compat/simple-ipc/ipc-win32.c',
+    'lib/compat/simple-ipc/ipc-shared.c',
+    'lib/compat/simple-ipc/ipc-win32.c',
   ]
   libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
 else
   compat_sources += [
-    'compat/simple-ipc/ipc-shared.c',
-    'compat/simple-ipc/ipc-unix-socket.c',
+    'lib/compat/simple-ipc/ipc-shared.c',
+    'lib/compat/simple-ipc/ipc-unix-socket.c',
   ]
   libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
 endif
@@ -1372,11 +1371,11 @@ if fsmonitor_backend != ''
   libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
 
   compat_sources += [
-    'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
-    'compat/fsmonitor/fsm-ipc-' + fsmonitor_os + '.c',
-    'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
-    'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
-    'compat/fsmonitor/fsm-settings-' + fsmonitor_os + '.c',
+    'lib/compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
+    'lib/compat/fsmonitor/fsm-ipc-' + fsmonitor_os + '.c',
+    'lib/compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
+    'lib/compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
+    'lib/compat/fsmonitor/fsm-settings-' + fsmonitor_os + '.c',
   ]
 endif
 build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
@@ -1387,7 +1386,7 @@ if not get_option('b_sanitize').contains('address') and get_option('regex').allo
 
   if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
     libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
-    compat_sources += 'compat/regcomp_enhanced.c'
+    compat_sources += 'lib/compat/regcomp_enhanced.c'
   endif
 elif not get_option('regex').enabled()
   libgit_c_args += [
@@ -1396,13 +1395,13 @@ elif not get_option('regex').enabled()
     '-DNO_MBSUPPORT',
   ]
   build_options_config.set('NO_REGEX', '1')
-  compat_sources += 'compat/regex/regex.c'
-  libgit_include_directories += 'compat/regex'
+  compat_sources += 'lib/compat/regex/regex.c'
+  libgit_include_directories += 'lib/compat/regex'
 else
     error('Native regex support requested but not found')
 endif
 
-# setitimer and friends are provided by compat/mingw.c.
+# setitimer and friends are provided by lib/compat/mingw.c.
 if host_machine.system() != 'windows'
   if not compiler.compiles('''
     #include <sys/time.h>
@@ -1460,7 +1459,7 @@ else
 
   if get_option('b_sanitize').contains('address') or get_option('b_sanitize').contains('leak')
     libgit_c_args += '-DNO_MMAP'
-    compat_sources += 'compat/mmap.c'
+    compat_sources += 'lib/compat/mmap.c'
   else
     checkfuncs += { 'mmap': ['mmap.c'] }
   endif
@@ -1470,7 +1469,7 @@ foreach func, impls : checkfuncs
   if not compiler.has_function(func)
     libgit_c_args += '-DNO_' + func.to_upper()
     foreach impl : impls
-      compat_sources += 'compat/' + impl
+      compat_sources += 'lib/compat/' + impl
     endforeach
   endif
 endforeach
@@ -1481,13 +1480,13 @@ endif
 
 if not compiler.has_function('strdup')
   libgit_c_args += '-DOVERRIDE_STRDUP'
-  compat_sources += 'compat/strdup.c'
+  compat_sources += 'lib/compat/strdup.c'
 endif
 
 if not compiler.has_function('qsort')
   libgit_c_args += '-DINTERNAL_QSORT'
 endif
-compat_sources += 'compat/qsort_s.c'
+compat_sources += 'lib/compat/qsort_s.c'
 
 if compiler.has_function('getdelim')
   libgit_c_args += '-DHAVE_GETDELIM'
@@ -1543,7 +1542,7 @@ if meson.can_run_host_binaries() and compiler.run('''
   }
 ''', name: 'fread reads directories').returncode() == 0
   libgit_c_args += '-DFREAD_READS_DIRECTORIES'
-  compat_sources += 'compat/fopen.c'
+  compat_sources += 'lib/compat/fopen.c'
 endif
 
 if not meson.is_cross_build() and fs.exists('/dev/tty')
@@ -1596,9 +1595,9 @@ if sha1_backend == 'sha1dc'
   libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h"'
 
   libgit_sources += [
-    'sha1dc_git.c',
-    'sha1dc/sha1.c',
-    'sha1dc/ubc_check.c',
+    'lib/sha1dc_git.c',
+    'lib/sha1dc/sha1.c',
+    'lib/sha1dc/ubc_check.c',
   ]
 endif
 if sha1_backend == 'CommonCrypto' or sha1_unsafe_backend == 'CommonCrypto'
@@ -1631,7 +1630,7 @@ if sha1_backend == 'block' or sha1_unsafe_backend == 'block'
     libgit_c_args += '-DSHA1_BLK_UNSAFE'
   endif
 
-  libgit_sources += 'block-sha1/sha1.c'
+  libgit_sources += 'lib/block-sha1/sha1.c'
 endif
 
 if sha256_backend == 'openssl'
@@ -1647,7 +1646,7 @@ elif sha256_backend == 'gcrypt'
   libgit_c_args += '-DSHA256_GCRYPT'
 elif sha256_backend == 'block'
   libgit_c_args += '-DSHA256_BLK'
-  libgit_sources += 'sha256/block/sha256.c'
+  libgit_sources += 'lib/sha256/block/sha256.c'
 else
   error('Unhandled SHA256 backend ' + sha256_backend)
 endif
@@ -1752,7 +1751,7 @@ version_def_h = custom_target(
     '@INPUT@',
     '@OUTPUT@',
   ],
-  input: meson.current_source_dir() / 'version-def.h.in',
+  input: meson.current_source_dir() / 'lib/version-def.h.in',
   output: 'version-def.h',
   # Depend on GIT-VERSION-FILE so that we don't always try to rebuild this
   # target for the same commit.
@@ -1771,7 +1770,7 @@ if rust_option.allowed()
   endif
 else
   libgit_sources += [
-    'varint.c',
+    'lib/varint.c',
   ]
 endif
 
@@ -1894,8 +1893,8 @@ bin_wrappers += executable('scalar',
 if curl.found()
   libgit_curl = declare_dependency(
     sources: [
-      'http.c',
-      'http-walker.c',
+      'lib/http.c',
+      'lib/http-walker.c',
     ],
     dependencies: [libgit_commonmain, curl],
   )
@@ -2199,21 +2198,21 @@ if get_option('docs') != []
 endif
 
 exclude_from_check_headers = [
-  'compat/',
-  'unicode-width.h',
+  'lib/compat/',
+  'lib/unicode-width.h',
 ]
 
 if sha1_backend != 'openssl'
-  exclude_from_check_headers += 'sha1/openssl.h'
+  exclude_from_check_headers += 'lib/sha1/openssl.h'
 endif
 if sha256_backend != 'openssl'
-  exclude_from_check_headers += 'sha256/openssl.h'
+  exclude_from_check_headers += 'lib/sha256/openssl.h'
 endif
 if sha256_backend != 'nettle'
-  exclude_from_check_headers += 'sha256/nettle.h'
+  exclude_from_check_headers += 'lib/sha256/nettle.h'
 endif
 if sha256_backend != 'gcrypt'
-  exclude_from_check_headers += 'sha256/gcrypt.h'
+  exclude_from_check_headers += 'lib/sha256/gcrypt.h'
 endif
 
 if headers_to_check.length() != 0 and compiler.get_argument_syntax() == 'gcc'
@@ -2248,6 +2247,7 @@ if headers_to_check.length() != 0 and compiler.get_argument_syntax() == 'gcc'
         compiler.cmd_array(),
         libgit_c_args,
         '-I', meson.project_source_root(),
+        '-I', meson.project_source_root() / 'lib',
         '-I', meson.project_source_root() / 't/unit-tests',
         '-o', '/dev/null',
         '-c', '-xc',

-- 
2.55.0.795.g602f6c329a.dirty


^ permalink raw reply related

* [PATCH RFC v3 1/2] t/helper: prepare "test-example-tap.c" for introduction of "lib/"
From: Patrick Steinhardt @ 2026-07-01  6:59 UTC (permalink / raw)
  To: git
  Cc: brian m. carlson, Junio C Hamano, Elijah Newren, Derrick Stolee,
	SZEDER Gábor, Johannes Schindelin, Phillip Wood
In-Reply-To: <20260701-pks-libgit-in-subdir-v3-0-5e4860056094@pks.im>

In the next commit we're about to introduce a new "lib/" directory and
move all of our files into it. With this split the compiler won't be
able to find one of the includes in "test-example-tap.c" anymore. Adjust
it to a relative include to prepare for this change.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/helper/test-example-tap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/helper/test-example-tap.c b/t/helper/test-example-tap.c
index 998a1f0b42..50d46669d1 100644
--- a/t/helper/test-example-tap.c
+++ b/t/helper/test-example-tap.c
@@ -1,5 +1,5 @@
 #include "test-tool.h"
-#include "t/unit-tests/test-lib.h"
+#include "../unit-tests/test-lib.h"
 
 /*
  * The purpose of this "unit test" is to verify a few invariants of the unit

-- 
2.55.0.795.g602f6c329a.dirty


^ permalink raw reply related

* [PATCH RFC v3 0/2] Move libgit.a sources into separate "lib/" directory
From: Patrick Steinhardt @ 2026-07-01  6:59 UTC (permalink / raw)
  To: git
  Cc: brian m. carlson, Junio C Hamano, Elijah Newren, Derrick Stolee,
	SZEDER Gábor, Johannes Schindelin, Phillip Wood
In-Reply-To: <20260416-pks-libgit-in-subdir-v1-0-03afc731df55@pks.im>

Hi,

this small patch series follows up on a discussion we had two years ago
during the Git Contributor's Summit in Berlin.

I'm fully aware that this will likely result in some discussion, which
is why I have labelled this as RFC. I'd be fine with a result of "let's
not do it" if we cannot agree on this step, but I think that the current
layout hurts discoverability quite a bit. Not only for newcomers, but
I'm also struggling with it quite frequently.

I also intentionally decided to send this close to the upcoming release
so that the series can be merged early in the next release cycle if we
were to agree on it.

I've tested this patch series with both GitLab [1] and GitHub [2].

Changes in v3:
  - Explicitly point out the downsides of doing this mass-rename. Please
    let me know in case any arguments are missing there.
  - Apply Dscho's fixup patch.
  - Link to v2: https://patch.msgid.link/20260622-pks-libgit-in-subdir-v2-0-cb946c51ee7b@pks.im

Changes in v2:
  - Feedback on v1 was generally positive, and we're close to the next
    release again. So I've decided to rebase the patch series and send
    v2 out before the quiet pre-release phase kicks off. The series is
    thus built on top of 8d96f09e92 (Merge branch
    'js/objects-larger-than-4gb-on-windows', 2026-06-19) with
    ps/odb-source-packed at 1bba3c035d (odb/source-packed: drop pointer
    to "files" parent source, 2026-06-17) merged into it.
  - Fix a couple of instances I missed to update in Meson.
  - Link to v1: https://patch.msgid.link/20260416-pks-libgit-in-subdir-v1-0-03afc731df55@pks.im

Thanks!

Patrick

[1]: https://gitlab.com/gitlab-org/git/-/merge_requests/544
[2]: https://github.com/git/git/pull/2271

---
Patrick Steinhardt (2):
      t/helper: prepare "test-example-tap.c" for introduction of "lib/"
      Move libgit.a sources into separate "lib/" directory

 .github/workflows/main.yml                         |   9 +-
 .gitmodules                                        |   2 +-
 Documentation/Makefile                             |   4 +-
 Makefile                                           | 764 ++++++++++-----------
 config.mak.uname                                   |  52 +-
 contrib/buildsystems/CMakeLists.txt                |  95 +--
 git.rc.in                                          |   2 +-
 abspath.c => lib/abspath.c                         |   0
 abspath.h => lib/abspath.h                         |   0
 add-interactive.c => lib/add-interactive.c         |   0
 add-interactive.h => lib/add-interactive.h         |   0
 add-patch.c => lib/add-patch.c                     |   0
 add-patch.h => lib/add-patch.h                     |   0
 advice.c => lib/advice.c                           |   0
 advice.h => lib/advice.h                           |   0
 alias.c => lib/alias.c                             |   0
 alias.h => lib/alias.h                             |   0
 alloc.c => lib/alloc.c                             |   0
 alloc.h => lib/alloc.h                             |   0
 apply.c => lib/apply.c                             |   0
 apply.h => lib/apply.h                             |   0
 archive-tar.c => lib/archive-tar.c                 |   0
 archive-zip.c => lib/archive-zip.c                 |   0
 archive.c => lib/archive.c                         |   0
 archive.h => lib/archive.h                         |   0
 attr.c => lib/attr.c                               |   0
 attr.h => lib/attr.h                               |   0
 banned.h => lib/banned.h                           |   0
 base85.c => lib/base85.c                           |   0
 base85.h => lib/base85.h                           |   0
 bisect.c => lib/bisect.c                           |   0
 bisect.h => lib/bisect.h                           |   0
 blame.c => lib/blame.c                             |   0
 blame.h => lib/blame.h                             |   0
 blob.c => lib/blob.c                               |   0
 blob.h => lib/blob.h                               |   0
 {block-sha1 => lib/block-sha1}/sha1.c              |   0
 {block-sha1 => lib/block-sha1}/sha1.h              |   0
 bloom.c => lib/bloom.c                             |   0
 bloom.h => lib/bloom.h                             |   0
 branch.c => lib/branch.c                           |   0
 branch.h => lib/branch.h                           |   0
 builtin.h => lib/builtin.h                         |   0
 bundle-uri.c => lib/bundle-uri.c                   |   0
 bundle-uri.h => lib/bundle-uri.h                   |   0
 bundle.c => lib/bundle.c                           |   0
 bundle.h => lib/bundle.h                           |   0
 cache-tree.c => lib/cache-tree.c                   |   0
 cache-tree.h => lib/cache-tree.h                   |   0
 cbtree.c => lib/cbtree.c                           |   0
 cbtree.h => lib/cbtree.h                           |   0
 chdir-notify.c => lib/chdir-notify.c               |   0
 chdir-notify.h => lib/chdir-notify.h               |   0
 checkout.c => lib/checkout.c                       |   0
 checkout.h => lib/checkout.h                       |   0
 chunk-format.c => lib/chunk-format.c               |   0
 chunk-format.h => lib/chunk-format.h               |   0
 color.c => lib/color.c                             |   0
 color.h => lib/color.h                             |   0
 column.c => lib/column.c                           |   0
 column.h => lib/column.h                           |   0
 combine-diff.c => lib/combine-diff.c               |   0
 commit-graph.c => lib/commit-graph.c               |   0
 commit-graph.h => lib/commit-graph.h               |   0
 commit-reach.c => lib/commit-reach.c               |   0
 commit-reach.h => lib/commit-reach.h               |   0
 commit-slab-decl.h => lib/commit-slab-decl.h       |   0
 commit-slab-impl.h => lib/commit-slab-impl.h       |   0
 commit-slab.h => lib/commit-slab.h                 |   0
 commit.c => lib/commit.c                           |   0
 commit.h => lib/commit.h                           |   0
 common-exit.c => lib/common-exit.c                 |   0
 common-init.c => lib/common-init.c                 |   0
 common-init.h => lib/common-init.h                 |   0
 {compat => lib/compat}/.gitattributes              |   0
 {compat => lib/compat}/access.c                    |   0
 {compat => lib/compat}/apple-common-crypto.h       |   0
 {compat => lib/compat}/basename.c                  |   0
 {compat => lib/compat}/bswap.h                     |   0
 {compat => lib/compat}/compiler.h                  |   0
 {compat => lib/compat}/darwin/procinfo.c           |   0
 {compat => lib/compat}/disk.h                      |   0
 {compat => lib/compat}/fileno.c                    |   0
 {compat => lib/compat}/fopen.c                     |   0
 {compat => lib/compat}/fsmonitor/fsm-darwin-gcc.h  |   0
 .../compat}/fsmonitor/fsm-health-darwin.c          |   0
 .../compat}/fsmonitor/fsm-health-linux.c           |   0
 .../compat}/fsmonitor/fsm-health-win32.c           |   0
 {compat => lib/compat}/fsmonitor/fsm-health.h      |   0
 {compat => lib/compat}/fsmonitor/fsm-ipc-unix.c    |   0
 {compat => lib/compat}/fsmonitor/fsm-ipc-win32.c   |   0
 .../compat}/fsmonitor/fsm-listen-darwin.c          |   0
 .../compat}/fsmonitor/fsm-listen-linux.c           |   0
 .../compat}/fsmonitor/fsm-listen-win32.c           |   0
 {compat => lib/compat}/fsmonitor/fsm-listen.h      |   0
 .../compat}/fsmonitor/fsm-path-utils-darwin.c      |   0
 .../compat}/fsmonitor/fsm-path-utils-linux.c       |   0
 .../compat}/fsmonitor/fsm-path-utils-win32.c       |   0
 .../compat}/fsmonitor/fsm-settings-unix.c          |   0
 .../compat}/fsmonitor/fsm-settings-win32.c         |   0
 {compat => lib/compat}/hstrerror.c                 |   0
 {compat => lib/compat}/inet_ntop.c                 |   0
 {compat => lib/compat}/inet_pton.c                 |   0
 {compat => lib/compat}/linux/procinfo.c            |   0
 {compat => lib/compat}/memmem.c                    |   0
 {compat => lib/compat}/mingw-posix.h               |   0
 {compat => lib/compat}/mingw.c                     |   0
 {compat => lib/compat}/mingw.h                     |   0
 {compat => lib/compat}/mkdir.c                     |   0
 {compat => lib/compat}/mmap.c                      |   0
 {compat => lib/compat}/msvc-posix.h                |   0
 {compat => lib/compat}/msvc.c                      |   0
 {compat => lib/compat}/msvc.h                      |   0
 {compat => lib/compat}/nonblock.c                  |   0
 {compat => lib/compat}/nonblock.h                  |   0
 {compat => lib/compat}/obstack.c                   |   0
 {compat => lib/compat}/obstack.h                   |   0
 {compat => lib/compat}/open.c                      |   0
 {compat => lib/compat}/poll/poll.c                 |   0
 {compat => lib/compat}/poll/poll.h                 |   0
 {compat => lib/compat}/posix.h                     |   0
 {compat => lib/compat}/pread.c                     |   0
 {compat => lib/compat}/precompose_utf8.c           |   0
 {compat => lib/compat}/precompose_utf8.h           |   0
 {compat => lib/compat}/qsort_s.c                   |   0
 {compat => lib/compat}/regcomp_enhanced.c          |   0
 {compat => lib/compat}/regex/regcomp.c             |   0
 {compat => lib/compat}/regex/regex.c               |   0
 {compat => lib/compat}/regex/regex.h               |   0
 {compat => lib/compat}/regex/regex_internal.c      |   0
 {compat => lib/compat}/regex/regex_internal.h      |   0
 {compat => lib/compat}/regex/regexec.c             |   0
 {compat => lib/compat}/setenv.c                    |   0
 {compat => lib/compat}/sha1-chunked.c              |   0
 {compat => lib/compat}/sha1-chunked.h              |   0
 {compat => lib/compat}/simple-ipc/ipc-shared.c     |   0
 .../compat}/simple-ipc/ipc-unix-socket.c           |   0
 {compat => lib/compat}/simple-ipc/ipc-win32.c      |   0
 {compat => lib/compat}/snprintf.c                  |   0
 {compat => lib/compat}/stat.c                      |   0
 {compat => lib/compat}/strcasestr.c                |   0
 {compat => lib/compat}/strdup.c                    |   0
 {compat => lib/compat}/strlcpy.c                   |   0
 {compat => lib/compat}/strtoimax.c                 |   0
 {compat => lib/compat}/strtoumax.c                 |   0
 {compat => lib/compat}/stub/procinfo.c             |   0
 {compat => lib/compat}/terminal.c                  |   0
 {compat => lib/compat}/terminal.h                  |   0
 {compat => lib/compat}/unsetenv.c                  |   0
 {compat => lib/compat}/vcbuild/.gitignore          |   0
 {compat => lib/compat}/vcbuild/README              |  10 +-
 {compat => lib/compat}/vcbuild/find_vs_env.bat     |   2 +-
 {compat => lib/compat}/vcbuild/include/sys/param.h |   0
 {compat => lib/compat}/vcbuild/include/sys/time.h  |   0
 {compat => lib/compat}/vcbuild/include/sys/utime.h |   0
 {compat => lib/compat}/vcbuild/include/unistd.h    |   0
 {compat => lib/compat}/vcbuild/include/utime.h     |   0
 {compat => lib/compat}/vcbuild/scripts/clink.pl    |   0
 {compat => lib/compat}/vcbuild/scripts/lib.pl      |   0
 {compat => lib/compat}/vcbuild/vcpkg_copy_dlls.bat |   0
 {compat => lib/compat}/vcbuild/vcpkg_install.bat   |   4 +-
 {compat => lib/compat}/win32.h                     |   0
 {compat => lib/compat}/win32/alloca.h              |   0
 {compat => lib/compat}/win32/dirent.c              |   0
 {compat => lib/compat}/win32/dirent.h              |   0
 {compat => lib/compat}/win32/exit-process.h        |   0
 {compat => lib/compat}/win32/flush.c               |   0
 {compat => lib/compat}/win32/git.manifest          |   0
 {compat => lib/compat}/win32/headless.c            |   0
 {compat => lib/compat}/win32/lazyload.h            |   0
 {compat => lib/compat}/win32/path-utils.c          |   0
 {compat => lib/compat}/win32/path-utils.h          |   0
 {compat => lib/compat}/win32/pthread.c             |   0
 {compat => lib/compat}/win32/pthread.h             |   0
 {compat => lib/compat}/win32/syslog.c              |   0
 {compat => lib/compat}/win32/syslog.h              |   0
 .../compat}/win32/trace2_win32_process_info.c      |   0
 {compat => lib/compat}/win32mmap.c                 |   0
 {compat => lib/compat}/winansi.c                   |   0
 {compat => lib/compat}/zlib-compat.h               |   0
 .../compiler-tricks}/not-constant.c                |   0
 config.c => lib/config.c                           |   0
 config.h => lib/config.h                           |   0
 connect.c => lib/connect.c                         |   0
 connect.h => lib/connect.h                         |   0
 connected.c => lib/connected.c                     |   0
 connected.h => lib/connected.h                     |   0
 convert.c => lib/convert.c                         |   0
 convert.h => lib/convert.h                         |   0
 copy.c => lib/copy.c                               |   0
 copy.h => lib/copy.h                               |   0
 credential.c => lib/credential.c                   |   0
 credential.h => lib/credential.h                   |   0
 csum-file.c => lib/csum-file.c                     |   0
 csum-file.h => lib/csum-file.h                     |   0
 ctype.c => lib/ctype.c                             |   0
 date.c => lib/date.c                               |   0
 date.h => lib/date.h                               |   0
 decorate.c => lib/decorate.c                       |   0
 decorate.h => lib/decorate.h                       |   0
 delta-islands.c => lib/delta-islands.c             |   0
 delta-islands.h => lib/delta-islands.h             |   0
 delta.h => lib/delta.h                             |   0
 diagnose.c => lib/diagnose.c                       |   0
 diagnose.h => lib/diagnose.h                       |   0
 diff-delta.c => lib/diff-delta.c                   |   0
 diff-lib.c => lib/diff-lib.c                       |   0
 diff-merges.c => lib/diff-merges.c                 |   0
 diff-merges.h => lib/diff-merges.h                 |   0
 diff-no-index.c => lib/diff-no-index.c             |   0
 diff.c => lib/diff.c                               |   0
 diff.h => lib/diff.h                               |   0
 diffcore-break.c => lib/diffcore-break.c           |   0
 diffcore-delta.c => lib/diffcore-delta.c           |   0
 diffcore-order.c => lib/diffcore-order.c           |   0
 diffcore-pickaxe.c => lib/diffcore-pickaxe.c       |   0
 diffcore-rename.c => lib/diffcore-rename.c         |   0
 diffcore-rotate.c => lib/diffcore-rotate.c         |   0
 diffcore.h => lib/diffcore.h                       |   0
 dir-iterator.c => lib/dir-iterator.c               |   0
 dir-iterator.h => lib/dir-iterator.h               |   0
 dir.c => lib/dir.c                                 |   0
 dir.h => lib/dir.h                                 |   0
 editor.c => lib/editor.c                           |   0
 editor.h => lib/editor.h                           |   0
 entry.c => lib/entry.c                             |   0
 entry.h => lib/entry.h                             |   0
 environment.c => lib/environment.c                 |   0
 environment.h => lib/environment.h                 |   0
 {ewah => lib/ewah}/bitmap.c                        |   0
 {ewah => lib/ewah}/ewah_bitmap.c                   |   0
 {ewah => lib/ewah}/ewah_io.c                       |   0
 {ewah => lib/ewah}/ewah_rlw.c                      |   0
 {ewah => lib/ewah}/ewok.h                          |   0
 {ewah => lib/ewah}/ewok_rlw.h                      |   0
 exec-cmd.c => lib/exec-cmd.c                       |   0
 exec-cmd.h => lib/exec-cmd.h                       |   0
 fetch-negotiator.c => lib/fetch-negotiator.c       |   0
 fetch-negotiator.h => lib/fetch-negotiator.h       |   0
 fetch-pack.c => lib/fetch-pack.c                   |   0
 fetch-pack.h => lib/fetch-pack.h                   |   0
 fmt-merge-msg.c => lib/fmt-merge-msg.c             |   0
 fmt-merge-msg.h => lib/fmt-merge-msg.h             |   0
 for-each-ref.h => lib/for-each-ref.h               |   0
 fsck.c => lib/fsck.c                               |   0
 fsck.h => lib/fsck.h                               |   0
 fsmonitor--daemon.h => lib/fsmonitor--daemon.h     |   0
 fsmonitor-ipc.c => lib/fsmonitor-ipc.c             |   0
 fsmonitor-ipc.h => lib/fsmonitor-ipc.h             |   0
 fsmonitor-ll.h => lib/fsmonitor-ll.h               |   0
 .../fsmonitor-path-utils.h                         |   0
 fsmonitor-settings.c => lib/fsmonitor-settings.c   |   0
 fsmonitor-settings.h => lib/fsmonitor-settings.h   |   0
 fsmonitor.c => lib/fsmonitor.c                     |   0
 fsmonitor.h => lib/fsmonitor.h                     |   0
 gettext.c => lib/gettext.c                         |   0
 gettext.h => lib/gettext.h                         |   0
 git-compat-util.h => lib/git-compat-util.h         |   0
 git-curl-compat.h => lib/git-curl-compat.h         |   0
 git-zlib.c => lib/git-zlib.c                       |   0
 git-zlib.h => lib/git-zlib.h                       |   0
 gpg-interface.c => lib/gpg-interface.c             |   0
 gpg-interface.h => lib/gpg-interface.h             |   0
 graph.c => lib/graph.c                             |   0
 graph.h => lib/graph.h                             |   0
 grep.c => lib/grep.c                               |   0
 grep.h => lib/grep.h                               |   0
 hash-lookup.c => lib/hash-lookup.c                 |   0
 hash-lookup.h => lib/hash-lookup.h                 |   0
 hash.c => lib/hash.c                               |   0
 hash.h => lib/hash.h                               |   0
 hashmap.c => lib/hashmap.c                         |   0
 hashmap.h => lib/hashmap.h                         |   0
 help.c => lib/help.c                               |   0
 help.h => lib/help.h                               |   0
 hex-ll.c => lib/hex-ll.c                           |   0
 hex-ll.h => lib/hex-ll.h                           |   0
 hex.c => lib/hex.c                                 |   0
 hex.h => lib/hex.h                                 |   0
 hook.c => lib/hook.c                               |   0
 hook.h => lib/hook.h                               |   0
 http-walker.c => lib/http-walker.c                 |   0
 http.c => lib/http.c                               |   0
 http.h => lib/http.h                               |   0
 ident.c => lib/ident.c                             |   0
 ident.h => lib/ident.h                             |   0
 iterator.h => lib/iterator.h                       |   0
 json-writer.c => lib/json-writer.c                 |   0
 json-writer.h => lib/json-writer.h                 |   0
 khash.h => lib/khash.h                             |   0
 kwset.c => lib/kwset.c                             |   0
 kwset.h => lib/kwset.h                             |   0
 levenshtein.c => lib/levenshtein.c                 |   0
 levenshtein.h => lib/levenshtein.h                 |   0
 line-log.c => lib/line-log.c                       |   0
 line-log.h => lib/line-log.h                       |   0
 line-range.c => lib/line-range.c                   |   0
 line-range.h => lib/line-range.h                   |   0
 linear-assignment.c => lib/linear-assignment.c     |   0
 linear-assignment.h => lib/linear-assignment.h     |   0
 .../list-objects-filter-options.c                  |   0
 .../list-objects-filter-options.h                  |   0
 list-objects-filter.c => lib/list-objects-filter.c |   0
 list-objects-filter.h => lib/list-objects-filter.h |   0
 list-objects.c => lib/list-objects.c               |   0
 list-objects.h => lib/list-objects.h               |   0
 list.h => lib/list.h                               |   0
 lockfile.c => lib/lockfile.c                       |   0
 lockfile.h => lib/lockfile.h                       |   0
 log-tree.c => lib/log-tree.c                       |   0
 log-tree.h => lib/log-tree.h                       |   0
 loose.c => lib/loose.c                             |   0
 loose.h => lib/loose.h                             |   0
 ls-refs.c => lib/ls-refs.c                         |   0
 ls-refs.h => lib/ls-refs.h                         |   0
 mailinfo.c => lib/mailinfo.c                       |   0
 mailinfo.h => lib/mailinfo.h                       |   0
 mailmap.c => lib/mailmap.c                         |   0
 mailmap.h => lib/mailmap.h                         |   0
 match-trees.c => lib/match-trees.c                 |   0
 match-trees.h => lib/match-trees.h                 |   0
 mem-pool.c => lib/mem-pool.c                       |   0
 mem-pool.h => lib/mem-pool.h                       |   0
 merge-blobs.c => lib/merge-blobs.c                 |   0
 merge-blobs.h => lib/merge-blobs.h                 |   0
 merge-ll.c => lib/merge-ll.c                       |   0
 merge-ll.h => lib/merge-ll.h                       |   0
 merge-ort-wrappers.c => lib/merge-ort-wrappers.c   |   0
 merge-ort-wrappers.h => lib/merge-ort-wrappers.h   |   0
 merge-ort.c => lib/merge-ort.c                     |   0
 merge-ort.h => lib/merge-ort.h                     |   0
 merge.c => lib/merge.c                             |   0
 merge.h => lib/merge.h                             |   0
 mergesort.h => lib/mergesort.h                     |   0
 midx-write.c => lib/midx-write.c                   |   0
 midx.c => lib/midx.c                               |   0
 midx.h => lib/midx.h                               |   0
 name-hash.c => lib/name-hash.c                     |   0
 name-hash.h => lib/name-hash.h                     |   0
 {negotiator => lib/negotiator}/default.c           |   0
 {negotiator => lib/negotiator}/default.h           |   0
 {negotiator => lib/negotiator}/noop.c              |   0
 {negotiator => lib/negotiator}/noop.h              |   0
 {negotiator => lib/negotiator}/skipping.c          |   0
 {negotiator => lib/negotiator}/skipping.h          |   0
 notes-cache.c => lib/notes-cache.c                 |   0
 notes-cache.h => lib/notes-cache.h                 |   0
 notes-merge.c => lib/notes-merge.c                 |   0
 notes-merge.h => lib/notes-merge.h                 |   0
 notes-utils.c => lib/notes-utils.c                 |   0
 notes-utils.h => lib/notes-utils.h                 |   0
 notes.c => lib/notes.c                             |   0
 notes.h => lib/notes.h                             |   0
 object-file-convert.c => lib/object-file-convert.c |   0
 object-file-convert.h => lib/object-file-convert.h |   0
 object-file.c => lib/object-file.c                 |   0
 object-file.h => lib/object-file.h                 |   0
 object-name.c => lib/object-name.c                 |   0
 object-name.h => lib/object-name.h                 |   0
 object.c => lib/object.c                           |   0
 object.h => lib/object.h                           |   0
 odb.c => lib/odb.c                                 |   0
 odb.h => lib/odb.h                                 |   0
 {odb => lib/odb}/source-files.c                    |   0
 {odb => lib/odb}/source-files.h                    |   0
 {odb => lib/odb}/source-inmemory.c                 |   0
 {odb => lib/odb}/source-inmemory.h                 |   0
 {odb => lib/odb}/source-loose.c                    |   0
 {odb => lib/odb}/source-loose.h                    |   0
 {odb => lib/odb}/source-packed.c                   |   0
 {odb => lib/odb}/source-packed.h                   |   0
 {odb => lib/odb}/source.c                          |   0
 {odb => lib/odb}/source.h                          |   0
 {odb => lib/odb}/streaming.c                       |   0
 {odb => lib/odb}/streaming.h                       |   0
 {odb => lib/odb}/transaction.c                     |   0
 {odb => lib/odb}/transaction.h                     |   0
 oid-array.c => lib/oid-array.c                     |   0
 oid-array.h => lib/oid-array.h                     |   0
 oidmap.c => lib/oidmap.c                           |   0
 oidmap.h => lib/oidmap.h                           |   0
 oidset.c => lib/oidset.c                           |   0
 oidset.h => lib/oidset.h                           |   0
 oidtree.c => lib/oidtree.c                         |   0
 oidtree.h => lib/oidtree.h                         |   0
 pack-bitmap-write.c => lib/pack-bitmap-write.c     |   0
 pack-bitmap.c => lib/pack-bitmap.c                 |   0
 pack-bitmap.h => lib/pack-bitmap.h                 |   0
 pack-check.c => lib/pack-check.c                   |   0
 pack-mtimes.c => lib/pack-mtimes.c                 |   0
 pack-mtimes.h => lib/pack-mtimes.h                 |   0
 pack-objects.c => lib/pack-objects.c               |   0
 pack-objects.h => lib/pack-objects.h               |   0
 pack-refs.c => lib/pack-refs.c                     |   0
 pack-refs.h => lib/pack-refs.h                     |   0
 pack-revindex.c => lib/pack-revindex.c             |   0
 pack-revindex.h => lib/pack-revindex.h             |   0
 pack-write.c => lib/pack-write.c                   |   0
 pack.h => lib/pack.h                               |   0
 packfile-list.c => lib/packfile-list.c             |   0
 packfile-list.h => lib/packfile-list.h             |   0
 packfile.c => lib/packfile.c                       |   0
 packfile.h => lib/packfile.h                       |   0
 pager.c => lib/pager.c                             |   0
 pager.h => lib/pager.h                             |   0
 parallel-checkout.c => lib/parallel-checkout.c     |   0
 parallel-checkout.h => lib/parallel-checkout.h     |   0
 parse-options-cb.c => lib/parse-options-cb.c       |   0
 parse-options.c => lib/parse-options.c             |   0
 parse-options.h => lib/parse-options.h             |   0
 parse.c => lib/parse.c                             |   0
 parse.h => lib/parse.h                             |   0
 patch-delta.c => lib/patch-delta.c                 |   0
 patch-ids.c => lib/patch-ids.c                     |   0
 patch-ids.h => lib/patch-ids.h                     |   0
 path-walk.c => lib/path-walk.c                     |   0
 path-walk.h => lib/path-walk.h                     |   0
 path.c => lib/path.c                               |   0
 path.h => lib/path.h                               |   0
 pathspec.c => lib/pathspec.c                       |   0
 pathspec.h => lib/pathspec.h                       |   0
 pkt-line.c => lib/pkt-line.c                       |   0
 pkt-line.h => lib/pkt-line.h                       |   0
 preload-index.c => lib/preload-index.c             |   0
 preload-index.h => lib/preload-index.h             |   0
 pretty.c => lib/pretty.c                           |   0
 pretty.h => lib/pretty.h                           |   0
 prio-queue.c => lib/prio-queue.c                   |   0
 prio-queue.h => lib/prio-queue.h                   |   0
 progress.c => lib/progress.c                       |   0
 progress.h => lib/progress.h                       |   0
 promisor-remote.c => lib/promisor-remote.c         |   0
 promisor-remote.h => lib/promisor-remote.h         |   0
 prompt.c => lib/prompt.c                           |   0
 prompt.h => lib/prompt.h                           |   0
 protocol-caps.c => lib/protocol-caps.c             |   0
 protocol-caps.h => lib/protocol-caps.h             |   0
 protocol.c => lib/protocol.c                       |   0
 protocol.h => lib/protocol.h                       |   0
 prune-packed.c => lib/prune-packed.c               |   0
 prune-packed.h => lib/prune-packed.h               |   0
 pseudo-merge.c => lib/pseudo-merge.c               |   0
 pseudo-merge.h => lib/pseudo-merge.h               |   0
 quote.c => lib/quote.c                             |   0
 quote.h => lib/quote.h                             |   0
 range-diff.c => lib/range-diff.c                   |   0
 range-diff.h => lib/range-diff.h                   |   0
 reachable.c => lib/reachable.c                     |   0
 reachable.h => lib/reachable.h                     |   0
 read-cache-ll.h => lib/read-cache-ll.h             |   0
 read-cache.c => lib/read-cache.c                   |   0
 read-cache.h => lib/read-cache.h                   |   0
 rebase-interactive.c => lib/rebase-interactive.c   |   0
 rebase-interactive.h => lib/rebase-interactive.h   |   0
 rebase.c => lib/rebase.c                           |   0
 rebase.h => lib/rebase.h                           |   0
 ref-filter.c => lib/ref-filter.c                   |   0
 ref-filter.h => lib/ref-filter.h                   |   0
 reflog-walk.c => lib/reflog-walk.c                 |   0
 reflog-walk.h => lib/reflog-walk.h                 |   0
 reflog.c => lib/reflog.c                           |   0
 reflog.h => lib/reflog.h                           |   0
 refs.c => lib/refs.c                               |   0
 refs.h => lib/refs.h                               |   0
 {refs => lib/refs}/debug.c                         |   0
 {refs => lib/refs}/files-backend.c                 |   0
 {refs => lib/refs}/iterator.c                      |   0
 {refs => lib/refs}/packed-backend.c                |   0
 {refs => lib/refs}/packed-backend.h                |   0
 {refs => lib/refs}/ref-cache.c                     |   0
 {refs => lib/refs}/ref-cache.h                     |   0
 {refs => lib/refs}/refs-internal.h                 |   0
 {refs => lib/refs}/reftable-backend.c              |   0
 refspec.c => lib/refspec.c                         |   0
 refspec.h => lib/refspec.h                         |   0
 {reftable => lib/reftable}/LICENSE                 |   0
 {reftable => lib/reftable}/basics.c                |   0
 {reftable => lib/reftable}/basics.h                |   0
 {reftable => lib/reftable}/block.c                 |   0
 {reftable => lib/reftable}/block.h                 |   0
 {reftable => lib/reftable}/blocksource.c           |   0
 {reftable => lib/reftable}/blocksource.h           |   0
 {reftable => lib/reftable}/constants.h             |   0
 {reftable => lib/reftable}/error.c                 |   0
 {reftable => lib/reftable}/fsck.c                  |   0
 {reftable => lib/reftable}/iter.c                  |   0
 {reftable => lib/reftable}/iter.h                  |   0
 {reftable => lib/reftable}/merged.c                |   0
 {reftable => lib/reftable}/merged.h                |   0
 {reftable => lib/reftable}/pq.c                    |   0
 {reftable => lib/reftable}/pq.h                    |   0
 {reftable => lib/reftable}/record.c                |   0
 {reftable => lib/reftable}/record.h                |   0
 {reftable => lib/reftable}/reftable-basics.h       |   0
 {reftable => lib/reftable}/reftable-block.h        |   0
 {reftable => lib/reftable}/reftable-blocksource.h  |   0
 {reftable => lib/reftable}/reftable-constants.h    |   0
 {reftable => lib/reftable}/reftable-error.h        |   0
 {reftable => lib/reftable}/reftable-fsck.h         |   0
 {reftable => lib/reftable}/reftable-iterator.h     |   0
 {reftable => lib/reftable}/reftable-merged.h       |   0
 {reftable => lib/reftable}/reftable-record.h       |   0
 {reftable => lib/reftable}/reftable-stack.h        |   0
 {reftable => lib/reftable}/reftable-system.h       |   0
 {reftable => lib/reftable}/reftable-table.h        |   0
 {reftable => lib/reftable}/reftable-writer.h       |   0
 {reftable => lib/reftable}/stack.c                 |   0
 {reftable => lib/reftable}/stack.h                 |   0
 {reftable => lib/reftable}/system.c                |   0
 {reftable => lib/reftable}/system.h                |   0
 {reftable => lib/reftable}/table.c                 |   0
 {reftable => lib/reftable}/table.h                 |   0
 {reftable => lib/reftable}/tree.c                  |   0
 {reftable => lib/reftable}/tree.h                  |   0
 {reftable => lib/reftable}/writer.c                |   0
 {reftable => lib/reftable}/writer.h                |   0
 remote.c => lib/remote.c                           |   0
 remote.h => lib/remote.h                           |   0
 repack-cruft.c => lib/repack-cruft.c               |   0
 repack-filtered.c => lib/repack-filtered.c         |   0
 repack-geometry.c => lib/repack-geometry.c         |   0
 repack-midx.c => lib/repack-midx.c                 |   0
 repack-promisor.c => lib/repack-promisor.c         |   0
 repack.c => lib/repack.c                           |   0
 repack.h => lib/repack.h                           |   0
 replace-object.c => lib/replace-object.c           |   0
 replace-object.h => lib/replace-object.h           |   0
 replay.c => lib/replay.c                           |   0
 replay.h => lib/replay.h                           |   0
 repo-settings.c => lib/repo-settings.c             |   0
 repo-settings.h => lib/repo-settings.h             |   0
 repository.c => lib/repository.c                   |   0
 repository.h => lib/repository.h                   |   0
 rerere.c => lib/rerere.c                           |   0
 rerere.h => lib/rerere.h                           |   0
 reset.c => lib/reset.c                             |   0
 reset.h => lib/reset.h                             |   0
 resolve-undo.c => lib/resolve-undo.c               |   0
 resolve-undo.h => lib/resolve-undo.h               |   0
 revision.c => lib/revision.c                       |   0
 revision.h => lib/revision.h                       |   0
 run-command.c => lib/run-command.c                 |   0
 run-command.h => lib/run-command.h                 |   0
 sane-ctype.h => lib/sane-ctype.h                   |   0
 send-pack.c => lib/send-pack.c                     |   0
 send-pack.h => lib/send-pack.h                     |   0
 sequencer.c => lib/sequencer.c                     |   0
 sequencer.h => lib/sequencer.h                     |   0
 serve.c => lib/serve.c                             |   0
 serve.h => lib/serve.h                             |   0
 server-info.c => lib/server-info.c                 |   0
 server-info.h => lib/server-info.h                 |   0
 setup.c => lib/setup.c                             |   0
 setup.h => lib/setup.h                             |   0
 {sha1 => lib/sha1}/openssl.h                       |   0
 .../sha1collisiondetection                         |   0
 {sha1dc => lib/sha1dc}/.gitattributes              |   0
 {sha1dc => lib/sha1dc}/LICENSE.txt                 |   0
 {sha1dc => lib/sha1dc}/sha1.c                      |   0
 {sha1dc => lib/sha1dc}/sha1.h                      |   0
 {sha1dc => lib/sha1dc}/ubc_check.c                 |   0
 {sha1dc => lib/sha1dc}/ubc_check.h                 |   0
 sha1dc_git.c => lib/sha1dc_git.c                   |   0
 sha1dc_git.h => lib/sha1dc_git.h                   |   0
 {sha256 => lib/sha256}/block/sha256.c              |   0
 {sha256 => lib/sha256}/block/sha256.h              |   0
 {sha256 => lib/sha256}/gcrypt.h                    |   0
 {sha256 => lib/sha256}/nettle.h                    |   0
 {sha256 => lib/sha256}/openssl.h                   |   0
 shallow.c => lib/shallow.c                         |   0
 shallow.h => lib/shallow.h                         |   0
 shortlog.h => lib/shortlog.h                       |   0
 sideband.c => lib/sideband.c                       |   0
 sideband.h => lib/sideband.h                       |   0
 sigchain.c => lib/sigchain.c                       |   0
 sigchain.h => lib/sigchain.h                       |   0
 simple-ipc.h => lib/simple-ipc.h                   |   0
 sparse-index.c => lib/sparse-index.c               |   0
 sparse-index.h => lib/sparse-index.h               |   0
 split-index.c => lib/split-index.c                 |   0
 split-index.h => lib/split-index.h                 |   0
 stable-qsort.c => lib/stable-qsort.c               |   0
 statinfo.c => lib/statinfo.c                       |   0
 statinfo.h => lib/statinfo.h                       |   0
 strbuf.c => lib/strbuf.c                           |   0
 strbuf.h => lib/strbuf.h                           |   0
 string-list.c => lib/string-list.c                 |   0
 string-list.h => lib/string-list.h                 |   0
 strmap.c => lib/strmap.c                           |   0
 strmap.h => lib/strmap.h                           |   0
 strvec.c => lib/strvec.c                           |   0
 strvec.h => lib/strvec.h                           |   0
 sub-process.c => lib/sub-process.c                 |   0
 sub-process.h => lib/sub-process.h                 |   0
 submodule-config.c => lib/submodule-config.c       |   0
 submodule-config.h => lib/submodule-config.h       |   0
 submodule.c => lib/submodule.c                     |   0
 submodule.h => lib/submodule.h                     |   0
 symlinks.c => lib/symlinks.c                       |   0
 symlinks.h => lib/symlinks.h                       |   0
 tag.c => lib/tag.c                                 |   0
 tag.h => lib/tag.h                                 |   0
 tar.h => lib/tar.h                                 |   0
 tempfile.c => lib/tempfile.c                       |   0
 tempfile.h => lib/tempfile.h                       |   0
 thread-utils.c => lib/thread-utils.c               |   0
 thread-utils.h => lib/thread-utils.h               |   0
 tmp-objdir.c => lib/tmp-objdir.c                   |   0
 tmp-objdir.h => lib/tmp-objdir.h                   |   0
 trace.c => lib/trace.c                             |   0
 trace.h => lib/trace.h                             |   0
 trace2.c => lib/trace2.c                           |   0
 trace2.h => lib/trace2.h                           |   0
 {trace2 => lib/trace2}/tr2_cfg.c                   |   0
 {trace2 => lib/trace2}/tr2_cfg.h                   |   0
 {trace2 => lib/trace2}/tr2_cmd_name.c              |   0
 {trace2 => lib/trace2}/tr2_cmd_name.h              |   0
 {trace2 => lib/trace2}/tr2_ctr.c                   |   0
 {trace2 => lib/trace2}/tr2_ctr.h                   |   0
 {trace2 => lib/trace2}/tr2_dst.c                   |   0
 {trace2 => lib/trace2}/tr2_dst.h                   |   0
 {trace2 => lib/trace2}/tr2_sid.c                   |   0
 {trace2 => lib/trace2}/tr2_sid.h                   |   0
 {trace2 => lib/trace2}/tr2_sysenv.c                |   0
 {trace2 => lib/trace2}/tr2_sysenv.h                |   0
 {trace2 => lib/trace2}/tr2_tbuf.c                  |   0
 {trace2 => lib/trace2}/tr2_tbuf.h                  |   0
 {trace2 => lib/trace2}/tr2_tgt.h                   |   0
 {trace2 => lib/trace2}/tr2_tgt_event.c             |   0
 {trace2 => lib/trace2}/tr2_tgt_normal.c            |   0
 {trace2 => lib/trace2}/tr2_tgt_perf.c              |   0
 {trace2 => lib/trace2}/tr2_tls.c                   |   0
 {trace2 => lib/trace2}/tr2_tls.h                   |   0
 {trace2 => lib/trace2}/tr2_tmr.c                   |   0
 {trace2 => lib/trace2}/tr2_tmr.h                   |   0
 trailer.c => lib/trailer.c                         |   0
 trailer.h => lib/trailer.h                         |   0
 transport-helper.c => lib/transport-helper.c       |   0
 transport-internal.h => lib/transport-internal.h   |   0
 transport.c => lib/transport.c                     |   0
 transport.h => lib/transport.h                     |   0
 tree-diff.c => lib/tree-diff.c                     |   0
 tree-walk.c => lib/tree-walk.c                     |   0
 tree-walk.h => lib/tree-walk.h                     |   0
 tree.c => lib/tree.c                               |   0
 tree.h => lib/tree.h                               |   0
 unicode-width.h => lib/unicode-width.h             |   0
 unix-socket.c => lib/unix-socket.c                 |   0
 unix-socket.h => lib/unix-socket.h                 |   0
 unix-stream-server.c => lib/unix-stream-server.c   |   0
 unix-stream-server.h => lib/unix-stream-server.h   |   0
 unpack-trees.c => lib/unpack-trees.c               |   0
 unpack-trees.h => lib/unpack-trees.h               |   0
 upload-pack.c => lib/upload-pack.c                 |   0
 upload-pack.h => lib/upload-pack.h                 |   0
 url.c => lib/url.c                                 |   0
 url.h => lib/url.h                                 |   0
 urlmatch.c => lib/urlmatch.c                       |   0
 urlmatch.h => lib/urlmatch.h                       |   0
 usage.c => lib/usage.c                             |   0
 userdiff.c => lib/userdiff.c                       |   0
 userdiff.h => lib/userdiff.h                       |   0
 utf8.c => lib/utf8.c                               |   0
 utf8.h => lib/utf8.h                               |   0
 varint.c => lib/varint.c                           |   0
 varint.h => lib/varint.h                           |   0
 version-def.h.in => lib/version-def.h.in           |   0
 version.c => lib/version.c                         |   0
 version.h => lib/version.h                         |   0
 versioncmp.c => lib/versioncmp.c                   |   0
 versioncmp.h => lib/versioncmp.h                   |   0
 walker.c => lib/walker.c                           |   0
 walker.h => lib/walker.h                           |   0
 wildmatch.c => lib/wildmatch.c                     |   0
 wildmatch.h => lib/wildmatch.h                     |   0
 worktree.c => lib/worktree.c                       |   0
 worktree.h => lib/worktree.h                       |   0
 wrapper.c => lib/wrapper.c                         |   0
 wrapper.h => lib/wrapper.h                         |   0
 write-or-die.c => lib/write-or-die.c               |   0
 write-or-die.h => lib/write-or-die.h               |   0
 ws.c => lib/ws.c                                   |   0
 ws.h => lib/ws.h                                   |   0
 wt-status.c => lib/wt-status.c                     |   0
 wt-status.h => lib/wt-status.h                     |   0
 xdiff-interface.c => lib/xdiff-interface.c         |   0
 xdiff-interface.h => lib/xdiff-interface.h         |   0
 {xdiff => lib/xdiff}/xdiff.h                       |   0
 {xdiff => lib/xdiff}/xdiffi.c                      |   0
 {xdiff => lib/xdiff}/xdiffi.h                      |   0
 {xdiff => lib/xdiff}/xemit.c                       |   0
 {xdiff => lib/xdiff}/xemit.h                       |   0
 {xdiff => lib/xdiff}/xhistogram.c                  |   0
 {xdiff => lib/xdiff}/xinclude.h                    |   0
 {xdiff => lib/xdiff}/xmacros.h                     |   0
 {xdiff => lib/xdiff}/xmerge.c                      |   0
 {xdiff => lib/xdiff}/xpatience.c                   |   0
 {xdiff => lib/xdiff}/xprepare.c                    |   0
 {xdiff => lib/xdiff}/xprepare.h                    |   0
 {xdiff => lib/xdiff}/xtypes.h                      |   0
 {xdiff => lib/xdiff}/xutils.c                      |   0
 {xdiff => lib/xdiff}/xutils.h                      |   0
 meson.build                                        | 700 +++++++++----------
 t/helper/test-example-tap.c                        |   2 +-
 704 files changed, 824 insertions(+), 822 deletions(-)

Range-diff versus v2:

1:  67b5b03240 = 1:  d0f7d75054 t/helper: prepare "test-example-tap.c" for introduction of "lib/"
2:  77512405b6 ! 2:  ae1aba0a5b Move libgit.a sources into separate "lib/" directory
    @@ Commit message
     
         These are problems that we're aware of, and there have been and still
         are efforts to clean up some of the technical debt that is natural to
    -    exist an a project that is more than 20 years old. Furthermore, we
    +    exist in a project that is more than 20 years old. Furthermore, we
         provide resources to newcomers that help them out like our coding
         guidelines, code of conduct or "MyFirstContribution.adoc".
     
    @@ Commit message
         already. Furthermore, we can further iterate after this step and think
         about introducing a better structure for remaining files, as well.
     
    +    This move does not come for free though:
    +
    +      - The mass rename introduces a cutoff point in the history of every
    +        moved file, as tools like git-log(1) do not follow renames by
    +        default.
    +
    +      - Any in-flight or not-yet-submitted topic that touches the moved
    +        files will have to be rebased, and backporting fixes across the
    +        boundary becomes more cumbersome as a patch can no longer apply
    +        cleanly to both the old and the new layout.
    +
    +    My own (obviously subjective and biased) take is that the tradeoff is
    +    worth it, as these issues are a one-time cost while the benefits to
    +    discoverability will be permanent.
    +
    +    Furthermore, especially the first downside is a limitation in Git
    +    itself. We're not the first or last project to do such a mass rename. So
    +    if our provided tools are insufficient, then we should improve them to
    +    make the experience better for other projects, as well. Subjecting
    +    ourselves to the same pain may even give us more incentive to eventually
    +    improve rename following for everyone.
    +
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
      ## .github/workflows/main.yml ##
    @@ .github/workflows/main.yml: jobs:
          - name: download vcpkg artifacts
            uses: git-for-windows/get-azure-pipelines-artifact@v0
            with:
    -@@ .github/workflows/main.yml: jobs:
    +         repository: git/git
    +         definitionId: 9
    ++        path: lib/compat
    +     - name: add msbuild to PATH
            uses: microsoft/setup-msbuild@v3
          - name: copy dlls to root
            shell: cmd

---
base-commit: 0309c6da48e2f94a72c9cee6e95ac6a1d0d2c965
change-id: 20260415-pks-libgit-in-subdir-d8eec849cd48


^ permalink raw reply

* Re: [PATCH 0/3] fixing expensive http test timeouts
From: Patrick Steinhardt @ 2026-07-01  6:56 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, Michael Montalbo, git
In-Reply-To: <xmqq8q7vsukl.fsf@gitster.g>

On Tue, Jun 30, 2026 at 12:21:30PM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> 
> > The pipelines of the official mirror can be found at [1]. We might for
> > example add something like the below patch to our README.md to make it
> > more discoverable.
> >
> > Patrick
> >
> > [1]: https://gitlab.com/git-scm/git/-/pipelines
> >
> > diff --git a/README.md b/README.md
> > index d87bca1b8c..9ad77fdf7e 100644
> > --- a/README.md
> > +++ b/README.md
> > @@ -1,4 +1,5 @@
> > -[![Build status](https://github.com/git/git/workflows/CI/badge.svg)](https://github.com/git/git/actions?query=branch%3Amaster+event%3Apush)
> > +[![GitHub build status](https://github.com/git/git/workflows/CI/badge.svg)](https://github.com/git/git/actions?query=branch%3Amaster+event%3Apush)
> > +[![GitLab build status](https://gitlab.com/git-scm/git/badges/master/pipeline.svg)](https://gitlab.com/git-scm/git/-/pipelines?ref=master)
> >  
> >  Git - fast, scalable, distributed revision control system
> >  =========================================================
> 
> Oh, nice.  We of course do not want to be heavily involved in
> advertising offerings by commercial entities but I think these two
> sites deserve one line each for their continued service to the
> community ;-)

Okay, I'll send a patch then. Thanks!

Patrick

^ permalink raw reply

* Re: [PATCH RFC v2 2/2] Move libgit.a sources into separate "lib/" directory
From: Patrick Steinhardt @ 2026-07-01  6:55 UTC (permalink / raw)
  To: SZEDER Gábor
  Cc: git, brian m. carlson, Junio C Hamano, Elijah Newren,
	Derrick Stolee, Phillip Wood
In-Reply-To: <aj9wcFEb6oCRnfn2@szeder.dev>

On Sat, Jun 27, 2026 at 08:40:48AM +0200, SZEDER Gábor wrote:
> On Mon, Jun 22, 2026 at 12:38:22PM +0200, Patrick Steinhardt wrote:
> > The Git project is not exactly the easiest project to get started in:
> > it's written in C and POSIX shell, with bits of Perl, Rust and other
> > languages sprinkled into it. On top of that, the project has grown
> > somewhat organically over time, making the codebase hard to navigate.
> > 
> > These are problems that we're aware of, and there have been and still
> > are efforts to clean up some of the technical debt that is natural to
> > exist an a project that is more than 20 years old. Furthermore, we
> > provide resources to newcomers that help them out like our coding
> > guidelines, code of conduct or "MyFirstContribution.adoc".
> > 
> > But there is a rather practical problem: finding your way around in our
> > project's tree is not easy. Doing a directory listing in the top-level
> > directory will present you with more than 550 files, which makes it
> > extremely hard for a newcomer to figure out what files they are even
> > supposed to look at. This makes the onboarding experience somewhat
> > harder than it really needs to be. This isn't only a problem for
> > newcomers though, as I myself struggle to find the files I am looking
> > for because of the sheer number of files.
> > 
> > Besides the problem of discoverability it also creates a problem of
> > structure. It is not obvious at all which files are part of "libgit.a"
> > and which files are only linked into our final executables. So while we
> > have this split in our build systems, that split is not evident at all
> > in our tree.
> > 
> > Introduce a new "lib/" directory and move all of our sources for
> > "libgit.a" into it to fix these issues. It makes the split we have
> > evident and reduces the number of files in our top-level tree from 550
> > files to ~80 files.
> > 
> > This is still a lot of files, but it's significantly easier to navigate
> > already. Furthermore, we can further iterate after this step and think
> > about introducing a better structure for remaining files, as well.
> 
> Please also discuss the drawbacks of this proposal, and try to argue
> convincingly that the benefits outweigh the drawbacks.

This is overall a subjective change, so there is no "right" or "wrong".
The reason why I think the pain is ultimately worth it is that it's a
one-time cost for a permanent improvement in discoverability. And that
improvement is especially helpful for newcomers, who already have a hard
time navigating the code base.

> I, for one, see myself being rather annoyed by regular 'git log
> lib/foo.c' stopping at the rename barrier, and by the limitations of
> '--follow'.

Right. As mentioned in a parallel subthread, I think this is a
deficiency in Git itself which we are in the best position to fix. If it
is proving to be painful, then it might even help to subject ourselves
to the same pain that other projects that do larger renames experience.
So it might motivate us to improve this area.

In any case, I'll amend these thoughts to the commit message, thanks!

Patrick

^ permalink raw reply

* Re: [PATCH RFC v2 2/2] Move libgit.a sources into separate "lib/" directory
From: Patrick Steinhardt @ 2026-07-01  6:54 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: git, brian m. carlson, Junio C Hamano, Elijah Newren,
	Derrick Stolee, Phillip Wood
In-Reply-To: <32bb1cf6-1e37-dc0c-dfb2-e78a30763342@gmx.de>

On Fri, Jun 26, 2026 at 06:01:49PM +0200, Johannes Schindelin wrote:
> Hi Patrick,
> 
> On Mon, 22 Jun 2026, Patrick Steinhardt wrote:
> 
> > diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
> > index cf341d74db..a8402babd9 100644
> > --- a/.github/workflows/main.yml
> > +++ b/.github/workflows/main.yml
> > @@ -179,7 +179,7 @@ jobs:
> >        uses: actions/checkout@v6
> >        with:
> >          repository: 'microsoft/vcpkg'
> > -        path: 'compat/vcbuild/vcpkg'
> > +        path: 'lib/compat/vcbuild/vcpkg'
> >      - name: download vcpkg artifacts
> >        uses: git-for-windows/get-azure-pipelines-artifact@v0
> >        with:
> 
> Please also adopt:

Thanks, will do!

Patrick

^ permalink raw reply

* [PATCH 3/3] line-log: drop extra copy of range with bloom filters
From: Jeff King @ 2026-07-01  6:42 UTC (permalink / raw)
  To: git; +Cc: Patrick Steinhardt
In-Reply-To: <20260701063538.GA2579765@coredump.intra.peff.net>

When line_log_process_ranges_arbitrary_commit() finds out from a Bloom
filter that a commit didn't touch the path in question, it can quickly
pass its range on to the parent commit.

It does so by making a copy of the range, and passing that copy to
add_line_range(). But add_line_range() already makes its own copy
(either directly, or by merging with an existing range for that parent).
So the copy we make is leaked.

We can plug the leak by just passing our range directly, without the
extra copy.

The bug goes back to f32dde8c12 (line-log: integrate with changed-path
Bloom filters, 2020-05-11). We didn't notice because the test suite
never explicitly combines these features! You can observe it by building
with SANITIZE=leak and running t4211 with some extra flags:

  GIT_TEST_COMMIT_GRAPH=1 \
  GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1 \
  ./t4211-line-log.sh

It would probably be useful to have some more targeted test coverage of
these features together. But I don't think there's much point in just
blindly copying the existing tests and adding bloom-filter support. We
already do that via the linux-TEST-vars CI job. We just don't run the
leak-checking build with those flags (so if there were a correctness
problem, we'd have noticed, just not a leak).

So I think we'd benefit from somebody clueful thinking about the
interaction of these features and testing the corner cases. But for the
purposes of this leak fix, I think we can just rely on the recipe above
(and consider running an extra leak-test job with more TEST-vars set).

Signed-off-by: Jeff King <peff@peff.net>
---
 line-log.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/line-log.c b/line-log.c
index 5fc75ae275..0179f138f7 100644
--- a/line-log.c
+++ b/line-log.c
@@ -1141,8 +1141,7 @@ int line_log_process_ranges_arbitrary_commit(struct rev_info *rev, struct commit
 
 	if (range) {
 		if (commit->parents && !bloom_filter_check(rev, commit, range)) {
-			struct line_log_data *prange = line_log_data_copy(range);
-			add_line_range(rev, commit->parents->item, prange);
+			add_line_range(rev, commit->parents->item, range);
 			clear_commit_line_range(rev, commit);
 		} else if (commit->parents && commit->parents->next)
 			changed = process_ranges_merge_commit(rev, commit, range);
-- 
2.55.0.394.gcf1c5597d2

^ permalink raw reply related

* [PATCH 2/3] revision: avoid leaking bloom keyvecs with multiple traversals
From: Jeff King @ 2026-07-01  6:40 UTC (permalink / raw)
  To: git; +Cc: Patrick Steinhardt
In-Reply-To: <20260701063538.GA2579765@coredump.intra.peff.net>

In prepare_revision_walk(), we convert the pruning pathspecs into
bloom-filter "keyvecs" via prepare_to_use_bloom_filter(). This allocates
memory which is then freed eventually by release_revisions(), via
release_revisions_bloom_keyvecs().

But there's one case where we leak. If a caller uses the same rev_info
for multiple walks, calling prepare_revision_walk() multiple times, then
subsequent calls will overwrite the earlier keyvecs, leaking them. This
can happen with "git show foo bar", which does a separate no-walk
traversal for "foo" and "bar". Building with SANITIZE=leak and running
the test suite like:

  GIT_TEST_COMMIT_GRAPH=1 \
  GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1 \
  ./t4013-diff-various.sh

will trigger a complaint from LSan. It does not happen without those
extra flags because we don't store on-disk bloom filters by default, and
thus we optimize out the keyvec computation.

We can fix the leak by discarding the old entries before generating new
ones.

There's an alternative fix, which is that prepare_to_use_bloom_filter()
could notice that we already have keyvec entries and just reuse them.
But this is less safe; the keyvec depends on the pruning pathspec, and
we don't know if that has changed.

I think it would _probably_ work in practice, since any caller using a
rev_info for multiple traversals is probably doing so with the same
pathspec. But it would also create a very subtle bug if that assumption
is violated. So we'll do the safer thing here, and generate fresh keyvec
entries for each traversal. The efficiency difference is probably not
noticeable, and this is what was happening already (we just weren't
bothering to free the old ones!).

Signed-off-by: Jeff King <peff@peff.net>
---
 revision.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/revision.c b/revision.c
index e91d7e1f11..0ef9d895f0 100644
--- a/revision.c
+++ b/revision.c
@@ -707,6 +707,8 @@ static int convert_pathspec_to_bloom_keyvec(struct bloom_keyvec **out,
 
 static void prepare_to_use_bloom_filter(struct rev_info *revs)
 {
+	release_revisions_bloom_keyvecs(revs);
+
 	if (!revs->commits)
 		return;
 
-- 
2.55.0.394.gcf1c5597d2


^ permalink raw reply related

* [PATCH 1/3] bloom: make bloom-filter slab initialization idempotent
From: Jeff King @ 2026-07-01  6:39 UTC (permalink / raw)
  To: git; +Cc: Patrick Steinhardt
In-Reply-To: <20260701063538.GA2579765@coredump.intra.peff.net>

Before using any of the commit-graph bloom-filter code, somebody needs
to call init_bloom_filters(). This initializes the commit-slab we use
for storing filter information. But we don't want to call it twice
(without a matching deinit call in the middle), since it overwrites the
existing slab pointers, leaking the old values.

Usually this init call is done lazily by parse_commit_graph() when we
read a graph file that contains bloom data. But this can lead to some
oddities:

  1. We may call parse_commit_graph() multiple times when we have a
     split commit graph. I think this doesn't produce any user-visible
     bug, because we parse all of the files back-to-back. So even though
     we call init_bloom_filters() multiple times, we never look up any
     commits in between, so the slab is always empty and initializing it
     again happens to do nothing. This is a little sketchy to rely on,
     though.

  2. We call init_bloom_filters() directly in the "test-tool bloom"
     helper so we can call get_or_compute_bloom_filter(). Normally this
     is OK, as there is no bloom data in the on-disk graph file. But if
     you build with SANITIZE=leak and run:

       GIT_TEST_COMMIT_GRAPH=1 \
       GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1 \
       ./t0095-bloom.sh

     there's a leak that happens like this:

       a. Our direct init_bloom_filters() sets up the slab.

       b. In get_or_compute_bloom_filter() we look in the slab for a
	  cached entry. We won't find anything yet, but since we don't
	  use the read-only "peek" accessor (since we'll fill in the
	  entry if not present), this actually populates the slab with
	  an allocated chunk.

       c. Now we look for an entry in the graph files. So we have to
	  load them and end up in parse_commit_graph(), which calls
	  init_bloom_filters() again. That trashes our existing slab
	  allocation, which is now leaked.

  3. There's a similar case in write_commit_graph(), which calls
     init_bloom_filters() before get_or_compute_bloom_filter(). I think
     this code path is lucky to avoid the leak because it reads the
     graph files first, then calls its init_bloom_filters(), and then
     starts filling in entries. So even though it has the same overwrite
     problem, we'd never actually allocate any slab entries between
     overwrites.

The easiest solution here is just to make initialization of the slab
idempotent using an extra flag.

We could actually get away without using the extra flag, for example by
checking whether bloom_filters.stride has been set. But it's probably
better to avoid being too intimate with the commit-slab details.
Likewise we don't actually need to re-initialize after a deinit call;
the slab-clearing function leaves things in a usable state. But it
seemed less surprising to pair the init/deinit calls explicitly.

I suspect this could all be cleaned up a bit more, but it's tricky. The
only function which uses the slab is get_or_compute_bloom_filter(), so
it would be much simpler if it just lazy-initialized the slab itself.
But I think there is a subtle dependency here: we usually only
initialize the slab when we find a graph file that has bloom entries. So
if we were to lose that signal, then even repos without on-disk bloom
data would start trying to populate the slab, wasting memory that will
never get entries filled in from the disk. So we'd need some other way
of signaling "it is worth considering bloom entries at all".

This patch takes a smaller and more direct route to just dealing with
the potential leak issue.

Signed-off-by: Jeff King <peff@peff.net>
---
 bloom.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/bloom.c b/bloom.c
index a805ac0c29..c98d1672ad 100644
--- a/bloom.c
+++ b/bloom.c
@@ -16,6 +16,7 @@
 define_commit_slab(bloom_filter_slab, struct bloom_filter);
 
 static struct bloom_filter_slab bloom_filters;
+static int bloom_filter_slab_initialized;
 
 struct pathmap_hash_entry {
     struct hashmap_entry entry;
@@ -263,7 +264,10 @@ void add_key_to_filter(const struct bloom_key *key,
 
 void init_bloom_filters(void)
 {
+	if (bloom_filter_slab_initialized)
+		return;
 	init_bloom_filter_slab(&bloom_filters);
+	bloom_filter_slab_initialized = 1;
 }
 
 static void free_one_bloom_filter(struct bloom_filter *filter)
@@ -276,6 +280,7 @@ static void free_one_bloom_filter(struct bloom_filter *filter)
 void deinit_bloom_filters(void)
 {
 	deep_clear_bloom_filter_slab(&bloom_filters, free_one_bloom_filter);
+	bloom_filter_slab_initialized = 0;
 }
 
 struct bloom_keyvec *bloom_keyvec_new(const char *path, size_t len,
-- 
2.55.0.394.gcf1c5597d2


^ permalink raw reply related

* [PATCH 0/3] bloom-related leak fixes
From: Jeff King @ 2026-07-01  6:35 UTC (permalink / raw)
  To: git; +Cc: Patrick Steinhardt

Here are a few small leak fixes that only show up when you run the test
suite with GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1.

Combined with the commit-graph leak-fix here:

  https://lore.kernel.org/git/20260630064301.GB3733961@coredump.intra.peff.net/

and Kaartic's pending fix from this thread:

  https://lore.kernel.org/git/20260614141600.620272-1-kaartic.sivaraam@gmail.com/

This will fix most of the leaks we'd see if we ran linux-TEST-vars jobs
with leak-checking. There are a few more related to building with
openssl for sha1, but I'll tackle those separately.

  [1/3]: bloom: make bloom-filter slab initialization idempotent
  [2/3]: revision: avoid leaking bloom keyvecs with multiple traversals
  [3/3]: line-log: drop extra copy of range with bloom filters

 bloom.c    | 5 +++++
 line-log.c | 3 +--
 revision.c | 2 ++
 3 files changed, 8 insertions(+), 2 deletions(-)

-Peff

^ permalink raw reply

* Re: [PATCH 02/13] setup: mark bogus worktree in `apply_repository_format()`
From: Patrick Steinhardt @ 2026-07-01  6:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <xmqqh5mjsx4o.fsf@gitster.g>

On Tue, Jun 30, 2026 at 11:26:15AM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> 
> > +		 * we have to exlicitly unset the configuration.
> 
> explicitly (will amend while queuing).

Thanks, fixed locally, as well.

Patrick

^ permalink raw reply

* Re: weird quadratic reftable behavior, was: Re: [PATCH 3/3] t5551: pack refs after creating many tags
From: Patrick Steinhardt @ 2026-07-01  6:17 UTC (permalink / raw)
  To: Jeff King; +Cc: Michael Montalbo, git, Junio C Hamano
In-Reply-To: <20260630235850.GB3759976@coredump.intra.peff.net>

On Tue, Jun 30, 2026 at 07:58:50PM -0400, Jeff King wrote:
> On Tue, Jun 30, 2026 at 07:47:02PM -0400, Jeff King wrote:
> 
> > There was one other oddity I didn't quite resolve. You may notice the
> > gross reftable.orig stuff in hyperfine. I originally wrote this as:
> > 
> >     git for-each-ref --format="delete %(refname)" | git update-ref --stdin
> > 
> > but for some reason that causes the subsequent update-ref to loop
> > infinitely on merged_iter_next_entry(). It does so reliably, but I can't
> > reproduce it outside of hyperfine. Super weird, and I'm sure I'm missing
> > something obvious.
> 
> Ah, maybe not infinite, but probably quadratic. The key is that you have
> to delete a lot of refs and then try to insert them again. So with this
> script:
> 
>   nr=$1; shift
>   rm -rf .git
>   
>   git init --ref-format=reftable
>   blob=$(echo foo | git hash-object -w --stdin)
>   seq -f "create refs/tags/foo-%g $blob" $nr >input
>   git update-ref --stdin <input
>   git for-each-ref --format="delete %(refname)" | git update-ref --stdin
>   time git update-ref --stdin <input
> 
> I get results like this:
> 
>   nr   | runtime
>   ------------
>   1000 | 0.125s
>   2000 | 0.454s
>   4000 | 1.811s
>   8000 | 7.091s
> 
> So for every doubling of the input size, the runtime quadruples. I guess
> it is iterating through some deleted tombstone entries, but I'm not sure
> why.
> 
> That's probably a more interesting and productive performance problem to
> work on than micro-optimizing out the last few microseconds of writing. :)

This is a known issue, I think [1].

The problem here is the tombstoning: when you delete all references,
chances are that they are not truly gone but that every reference is
just tombstoned. The problem with this is that reading refs may now take
signifciantly more time as we cannot just say "this stack is empty".
Instead, we need to figure out that it is empty by processing all the
tombstones, and that takes a lot of time.

I remember that I did some digging back then and improved the status quo
quite significantly by optimizing `refs_verify_refname_available()`. I'm
sure there are more opportunities for optimization here though -- I have
a feeling that we for example exhaust the merged iterator until its end
when searching for a specific refname, where we could easily abort once
the observed tombstone name sorts lexicographically after the needle.

But eventually I decided to not care too much about this edge case, as
it seems very specific to this artificial benchmark scenario. Which of
course doesn't mean that it's not worth doing, I just had bigger fish to
fry and didn't get around to it yet.

Patrick

[1]: <Z602dzQggtDdcgCX@tapette.crustytoothpaste.net>

^ permalink raw reply

* Re: [PATCH 00/11] sequencer: do not record dropped commits as rewritten
From: Uwe Kleine-König @ 2026-07-01  6:00 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Phillip Wood, git, Konstantin Ryabitsev
In-Reply-To: <xmqqpl17rec3.fsf@gitster.g>

[-- Attachment #1: Type: text/plain, Size: 1767 bytes --]

Hello,

On Tue, Jun 30, 2026 at 12:57:32PM -0700, Junio C Hamano wrote:
> A tangent (I Cc'ed Konstantin for this), but
> 
>     $ b4 am -o- '<cover.1782833268.git.phillip.wood@dunelm.org.uk>' >b4am.mbx
> 
> failed to produce a usable mailbox.  It somehow did not think [2/11]
> existed.

FTR: The mail is on lore.kernel.org.

Also to yield a usable mailbox my patch shouldn't be included.

> I manually examined the References and In-Reply-To headers
> of that particular message and compared them with those from other
> messages but did not find anything suspicious X-<.


> 
> I have a bunch of typofixes queued on top of these 11 patches (made
> with "git commit --fixup reword:<sha1>"); please double check when
> you reroll after seeing more substantial reviews than mere typofixes,
> possibly from others.
> 
> Thanks.
> 
> 
> Here is the transcript of failed b4 am invocation.
> ---- >8 ----
> Looking up https://lore.kernel.org/all/cover.1782833268.git.phillip.wood@dunelm.org.uk/
> Grabbing thread from lore.kernel.org/all/cover.1782833268.git.phillip.wood@dunelm.org.uk/t.mbox.gz
> Analyzing 17 messages in the thread
> WARNING: duplicate messages found at index 1
>    Subject 1: sequencer: Skip copying notes for commits that disappear during rebase
>    Subject 2: t3400: restore coverage for note copying with apply backend
>   2 is not a reply... assume additional patch

I think here is the origin of the problem. It guesses that the t3400
should be added, and it takes the place of Phillip's second patch.

>   ERROR: missing [12/2]!

This is irritating, I would have expected "[2/12]" here?

	b4 am --no-parent cover.1782833268.git.phillip.wood@dunelm.org.uk

works fine for me.

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply

* weird quadratic reftable behavior, was: Re: [PATCH 3/3] t5551: pack refs after creating many tags
From: Jeff King @ 2026-06-30 23:58 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: Michael Montalbo, git, Junio C Hamano
In-Reply-To: <20260630234702.GA3759976@coredump.intra.peff.net>

On Tue, Jun 30, 2026 at 07:47:02PM -0400, Jeff King wrote:

> There was one other oddity I didn't quite resolve. You may notice the
> gross reftable.orig stuff in hyperfine. I originally wrote this as:
> 
>     git for-each-ref --format="delete %(refname)" | git update-ref --stdin
> 
> but for some reason that causes the subsequent update-ref to loop
> infinitely on merged_iter_next_entry(). It does so reliably, but I can't
> reproduce it outside of hyperfine. Super weird, and I'm sure I'm missing
> something obvious.

Ah, maybe not infinite, but probably quadratic. The key is that you have
to delete a lot of refs and then try to insert them again. So with this
script:

  nr=$1; shift
  rm -rf .git
  
  git init --ref-format=reftable
  blob=$(echo foo | git hash-object -w --stdin)
  seq -f "create refs/tags/foo-%g $blob" $nr >input
  git update-ref --stdin <input
  git for-each-ref --format="delete %(refname)" | git update-ref --stdin
  time git update-ref --stdin <input

I get results like this:

  nr   | runtime
  ------------
  1000 | 0.125s
  2000 | 0.454s
  4000 | 1.811s
  8000 | 7.091s

So for every doubling of the input size, the runtime quadruples. I guess
it is iterating through some deleted tombstone entries, but I'm not sure
why.

That's probably a more interesting and productive performance problem to
work on than micro-optimizing out the last few microseconds of writing. :)

-Peff

^ permalink raw reply

* Re: [PATCH 3/3] t5551: pack refs after creating many tags
From: Jeff King @ 2026-06-30 23:47 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: Michael Montalbo, git, Junio C Hamano
In-Reply-To: <akOG0oMu2KTqqyW7@pks.im>

On Tue, Jun 30, 2026 at 11:05:22AM +0200, Patrick Steinhardt wrote:

> > We make 2000 fstat, which strace claims takes 85% of the time. I suspect
> > this is over-emphasized because strace inherently makes syscalls slow,
> > but running with perf also highlights it as a non-trivial cost.
> 
> Yeah, this rings a bell. If I remember correctly, this is because we
> call `refs_resolve_ref_unsafe()` to verify whether the target already
> exists. And as that function is generic, it wasn't easy to optimize it
> by reusing the already-loaded reftable stack.

I think it's similar to that. I dug down and got some actual performance
numbers below for eliminating the fstat() calls, with the conclusion
that it's probably not worth spending too much time digging into it. But
details below for completeness.

I was wrong to say fstat() before, it's a regular stat(). The
interesting backtrace is:

  #0  __GI___stat64 (file=0x555555ab0bf0 "/home/peff/tmp/.git/reftable/tables.list", buf=0x7fffffffd630)
      at ../sysdeps/unix/sysv/linux/stat64.c:29
  #1  0x0000555555832ad6 in stack_uptodate (st=0x555555ab0ae0) at reftable/stack.c:575
  #2  0x0000555555832c5c in reftable_stack_reload (st=0x555555ab0ae0) at reftable/stack.c:625
  #3  0x000055555581f690 in backend_for (out=0x7fffffffd798, store=0x555555ab0900,
      refname=0x555555aae178 "refs/tags/foo-1", rewritten_ref=0x7fffffffd780, reload=1) at refs/reftable-backend.c:283
  #4  0x0000555555824957 in reftable_be_reflog_exists (ref_store=0x555555ab0900,
      refname=0x555555aae178 "refs/tags/foo-1") at refs/reftable-backend.c:2266
  #5  0x000055555581393a in refs_reflog_exists (refs=0x555555ab0900, refname=0x555555aae178 "refs/tags/foo-1")
      at refs.c:2995
  #6  0x000055555581f730 in should_write_log (refs=0x555555ab0900, refname=0x555555aae178 "refs/tags/foo-1")
      at refs/reftable-backend.c:301
  #7  0x00005555558224df in write_transaction_table (writer=0x5555569abe30, cb_data=0x5555569ab820)
      at refs/reftable-backend.c:1511
  #8  0x000055555583354d in reftable_addition_add (add=0x5555569ab050,
      write_table=0x5555558220f0 <write_transaction_table>, arg=0x5555569ab820) at reftable/stack.c:902
  #9  0x0000555555822b2b in reftable_be_transaction_finish (ref_store=0x555555ab0900, transaction=0x555555ab0c80,
      err=0x7fffffffdbc0) at refs/reftable-backend.c:1633
  #10 0x0000555555813161 in ref_transaction_commit (transaction=0x555555ab0c80, err=0x7fffffffdbc0) at refs.c:2769
  #11 0x00005555556956c9 in update_refs_stdin (flags=0) at builtin/update-ref.c:789

So we are asking about reflogs for each ref under the "only reflog if a
log already exists" rule. Which means we can easily disable it by
setting core.logallrefupdates to "always", giving us a way to measure
the impact. So we can try:

  git init --ref-format=reftable
  blob=$(echo foo | git hash-object -w --stdin)
  seq -f "create refs/tags/foo-%g $blob" 50000 >input
  cp -a .git/reftable reftable.orig
  hyperfine \
  	-p 'rm -rf .git/reftable; cp -a reftable.orig .git/reftable' \
  	-L config true,always \
  	'git -c core.logallrefupdates={config} update-ref --stdin <input'

which yields:

  Benchmark 1: git -c core.logallrefupdates=true update-ref --stdin <input
    Time (mean ± σ):     128.8 ms ±   1.5 ms    [User: 97.1 ms, System: 31.7 ms]
    Range (min … max):   126.4 ms … 131.3 ms    23 runs
  
  Benchmark 2: git -c core.logallrefupdates=always update-ref --stdin <input
    Time (mean ± σ):     195.2 ms ±   1.7 ms    [User: 182.1 ms, System: 13.0 ms]
    Range (min … max):   191.9 ms … 197.6 ms    15 runs

So we saved all of those stat() calls, but writing the actual reflog
entries adds much more cost!

Sadly there is no "never" option for core.logallrefupdates. I hacked one
in and the result took ~96ms to run. So that tells us the cost of the
stat() checks: around 25% of the runtime.

Which is a big-ish percentage, but a small absolute number. It's 0.64us
per ref. Perhaps not worrying about too much.

The other interesting thing I noticed is that we seem to write() entries
individually with no buffering. Probably we could get an easy speedup
for big cases like this by using stdio in the fd_writer abstraction.
We're again pinching pennies to some degree, but I expect we may be able
to drop the 120ms case down to 60ms or so (just guessing based on the
extra reflog writes adding ~70ms).

There was one other oddity I didn't quite resolve. You may notice the
gross reftable.orig stuff in hyperfine. I originally wrote this as:

    git for-each-ref --format="delete %(refname)" | git update-ref --stdin

but for some reason that causes the subsequent update-ref to loop
infinitely on merged_iter_next_entry(). It does so reliably, but I can't
reproduce it outside of hyperfine. Super weird, and I'm sure I'm missing
something obvious.

-Peff

^ permalink raw reply

* Re: git-blame vs. abbrev
From: René Scharfe @ 2026-06-30 21:38 UTC (permalink / raw)
  To: Junio C Hamano, Laszlo Ersek; +Cc: git
In-Reply-To: <xmqqy0fvreps.fsf@gitster.g>

On 6/30/26 9:49 PM, Junio C Hamano wrote:
> Laszlo Ersek <laszlo.ersek@posteo.net> writes:
> 
>> Hi,
>>
>> when git-blame is passed the "-b" option ("Show blank SHA-1 for boundary 
>> commits"), shouldn't git-blame *stop* reserving a commit hash nibble for 
>> the caret that otherwise marks boundary commits?
>>
>> More directly, I find it inconvenient that git-blame shows commit hashes 
>> that are one nibble longer (13) than my "core.abbrev" (12) setting; 
> 
> Just for the sake of aesthetics, I agree that when we are not
> showing the boundary mark, it would make sense not to reserve one
> column that we know we will never use.
Here's a patch to reserve a column only if marks are actually shown.

I strongly suspect that any line can only have a single mark, but I
didn't bother checking and proving whether that's actually true; the
new code should be able to handle multiple marks just fine.

Misses tests.

René


---
 builtin/blame.c | 61 ++++++++++++++++++++++++++++++++++---------------
 1 file changed, 42 insertions(+), 19 deletions(-)

diff --git a/builtin/blame.c b/builtin/blame.c
index ffbd3ce5c5..0e747a43f2 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -453,6 +453,39 @@ static void determine_line_heat(struct commit_info *ci, const char **dest_color)
 	*dest_color = colorfield[i].col;
 }
 
+static size_t handle_marks(const struct blame_entry *ent, int opt, bool print)
+{
+	size_t len = 0;
+
+	if ((ent->suspect->commit->object.flags & UNINTERESTING) &&
+	    !blank_boundary && !(opt & OUTPUT_ANNOTATE_COMPAT)) {
+		if (print)
+			putchar('^');
+		len++;
+	}
+	if (mark_unblamable_lines && ent->unblamable) {
+		if (print)
+			putchar('*');
+		len++;
+	}
+	if (mark_ignored_lines && ent->ignored) {
+		if (print)
+			putchar('?');
+		len++;
+	}
+	return len;
+}
+
+static size_t print_marks(const struct blame_entry *ent, int opt)
+{
+	return handle_marks(ent, opt, true);
+}
+
+static size_t count_marks(const struct blame_entry *ent, int opt)
+{
+	return handle_marks(ent, opt, false);
+}
+
 static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent,
 		       int opt, struct blame_entry *prev_ent)
 {
@@ -499,23 +532,10 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent,
 		if (color)
 			fputs(color, stdout);
 
-		if (suspect->commit->object.flags & UNINTERESTING) {
-			if (blank_boundary) {
-				memset(hex, ' ', strlen(hex));
-			} else if (!(opt & OUTPUT_ANNOTATE_COMPAT)) {
-				length--;
-				putchar('^');
-			}
-		}
-
-		if (mark_unblamable_lines && ent->unblamable) {
-			length--;
-			putchar('*');
-		}
-		if (mark_ignored_lines && ent->ignored) {
-			length--;
-			putchar('?');
-		}
+		if ((suspect->commit->object.flags & UNINTERESTING) &&
+		    blank_boundary)
+			memset(hex, ' ', strlen(hex));
+		length -= print_marks(ent, opt);
 
 		printf("%.*s", (int)(length < GIT_MAX_HEXSZ ? length : GIT_MAX_HEXSZ), hex);
 		if (opt & OUTPUT_ANNOTATE_COMPAT) {
@@ -647,11 +667,15 @@ static void find_alignment(struct blame_scoreboard *sb, int *option)
 	struct blame_entry *e;
 	int compute_auto_abbrev = (abbrev < 0);
 	int auto_abbrev = DEFAULT_ABBREV;
+	size_t max_marks_count = 0;
 
 	for (e = sb->ent; e; e = e->next) {
 		struct blame_origin *suspect = e->suspect;
 		int num;
+		size_t marks_count = count_marks(e, *option);
 
+		if (max_marks_count < marks_count)
+			max_marks_count = marks_count;
 		if (compute_auto_abbrev)
 			auto_abbrev = update_auto_abbrev(auto_abbrev, suspect);
 		if (strcmp(suspect->path, sb->path))
@@ -685,8 +709,7 @@ static void find_alignment(struct blame_scoreboard *sb, int *option)
 	max_score_digits = decimal_width(largest_score);
 
 	if (compute_auto_abbrev)
-		/* one more abbrev length is needed for the boundary commit */
-		abbrev = auto_abbrev + 1;
+		abbrev = auto_abbrev + max_marks_count;
 }
 
 static void sanity_check_on_fail(struct blame_scoreboard *sb, int baa)
-- 
2.54.0


^ permalink raw reply related

* Re: git-blame vs. abbrev
From: Junio C Hamano @ 2026-06-30 21:24 UTC (permalink / raw)
  To: Laszlo Ersek; +Cc: git
In-Reply-To: <7df1312b-c5d0-462a-a03f-9f07e7338de1@posteo.net>

Laszlo Ersek <laszlo.ersek@posteo.net> writes:

>> ... the same object, I suspect you wouldn't even notice that the
>> hexadecimal digits you see on the screen have one digit longer than
>> usual ;-).
>
> That's it precisely! :) I do *not* notice that the hash from git-blame
> has one more hexadecimal character than the central abbrev setting; so I
> just go ahead and blindly cut n' paste it, using the mouse, from the
> terminal, to the editor search box ...

Which means that there does not need any configuration variable to
trigger the new behaviour to protect your workflow from breaking, I
think, and instead we can just go ahead with the "-b then no extra
column for '^'" change, right? ;-)

^ permalink raw reply

* Re: [PATCH v4 0/2] prio-queue: fold lazy_queue into prio_queue for automatic get+put fusion
From: Kristofer Karlsson @ 2026-06-30 21:16 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Kristofer Karlsson via GitGitGadget, git, René Scharfe
In-Reply-To: <xmqqh5mjrbgq.fsf@gitster.g>

On Tue, 30 Jun 2026 at 22:59, Junio C Hamano <gitster@pobox.com> wrote:
>
> So, this is the "other" topic that we would want to merge first
> before the kk/prio-queue-cascade-sift topic.  This round looks good
> to me.

I want to acknowledge that I was too vague in my previous message[1],
I should be more explicit when referencing patch series.

If this gets promoted I will revisit the other series [1] to either verify
that it still gives a relevant boost or if it should be dropped -- both would be
good outcomes.

Thanks for looking at it again,
Kristofer

[1] https://lore.kernel.org/git/CAL71e4MYNiScZjTwkApjDAjRh2LM0_SP59h5HCTywV-Pua03tw@mail.gmail.com/

^ permalink raw reply

* Re: [PATCH v4 0/2] prio-queue: fold lazy_queue into prio_queue for automatic get+put fusion
From: Junio C Hamano @ 2026-06-30 20:59 UTC (permalink / raw)
  To: Kristofer Karlsson via GitGitGadget
  Cc: git, René Scharfe, Kristofer Karlsson
In-Reply-To: <pull.2140.v4.git.1780945851.gitgitgadget@gmail.com>

"Kristofer Karlsson via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> Rene's lazy_queue wrapper in describe.c was a clever optimization -- by
> deferring the get, a following put becomes a simple replace, avoiding a full
> remove-rebalance-insert cycle.
>
> It turns out this pattern is so common in git's traversal code that it makes
> sense to fold it into prio_queue itself. Gets and puts are interleaved in
> virtually every commit walk, so the fusion is essentially always a win.
>
> This is mostly a code simplification -- three callers had independently
> reimplemented the same optimization, and they all collapse to plain get+put
> now. The 1.7-2.7% speedup on traversal-heavy workloads is a nice bonus.
>
> More details and benchmark numbers in the commit message.
>
> Related to but independent of the cascade sift-down work in
> kk/prio-queue-cascade-sift -- the two can land in either order.
>
> Changes in v4:
>
>  * Thanks Junio for review, applied all suggestions.
>
>  * Renamed .nr_internal to .nr_
>
>  * Restored flush_get() as a static inline helper instead of inlining the
>    flush logic into get() and peek().
>
>  * Guard empty-queue check with nr_ <= get_pending.
>
>  * Flipped commit order: the rename/accessor commit is now first, and the
>    behavioral fusion change is second. This was partly messy -- the first
>    rename commit introduces some ugly intermediate code (e.g. describe.c's
>    prio_queue_for_each with a skip variable) that gets cleaned up in commit
>    2 when the lazy get makes it unnecessary.

So, this is the "other" topic that we would want to merge first
before the kk/prio-queue-cascade-sift topic.  This round looks good
to me.

Thanks.

^ permalink raw reply

* Re: git-blame vs. abbrev
From: Laszlo Ersek @ 2026-06-30 20:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <xmqqy0fvreps.fsf@gitster.g>

On 6/30/26 21:49, Junio C Hamano wrote:
> Laszlo Ersek <laszlo.ersek@posteo.net> writes:
>
>> Hi,
>>
>> when git-blame is passed the "-b" option ("Show blank SHA-1 for
>> boundary commits"), shouldn't git-blame *stop* reserving a commit
>> hash nibble for the caret that otherwise marks boundary commits?
>>
>> More directly, I find it inconvenient that git-blame shows commit
>> hashes that are one nibble longer (13) than my "core.abbrev" (12)
>> setting; that makes cutting and pasting commit hashes from the
>> git-blame output into a git-rebase TODO list cumbersome.
>
> I never knew that the parser in rebase did not want to see a longer
> abbreviation; shouldn't it take 16 hexadecimal abbreviation from the
> result of letting the user edit the list, even if it initially gave
> 12 hexadecimal abbreviation, as long as these extra 4 hexdigits do
> not break the commit object name?  That is a more serious usability
> bug that needs to be fixed, if it is the case, I would think.

Ugh, I'm very sorry; I failed to describe my problem precisely. When I
wrote "cutting and pasting commit hashes from the git-blame output into
a git-rebase TODO list", I actually meant pasting the commit hash from
git-blame into the *search box* of the editor that keeps the git-rebase
TODO list open.

Basically I want to fix up a line of code in a patch in a longer patch
set, but don't know off-hand which patch in the set introduces that line
of code. So git-blame gives me a commit hash, and subsequently, I run
git-rebase, would like to jump to the TODO line with that commit hash,
and change the action from "pick" to "edit". And this *lookup* is what
fails, because the hash from git-blame is 13 nibbles long, but the
hashes in the git-rebase TODO list are 12 nibbles long. I always have to
remember to remove the last nibble in the search box; otherwise, there
is no match.

> FWIW, even if your core.abbrev says you want 12, if two objects share
> the same 12 hexdigits as the prefix, you do end up getting 13 or more,

Indeed, but that does not matter in practice (to me anyway); a 12-nibble
prefix length suffices for very large projects, and if ever there were a
collision, I'd just increase the length permanently to 13 nibbles. The
specific length is not relevant; agreement between git-blame's output
and everything else dealing with commit hashes in git is what I'd like
very much.

> so a parser that insists on exact 12 hexdigits sounds like a bug.
>
Apologies again, that (implied) bug existed only between my chair and
keyboard. :)

> Just for the sake of aesthetics, I agree that when we are not showing
> the boundary mark, it would make sense not to reserve one column that
> we know we will never use.  But unless there is a mistaken parser that
> insists on 12 hexdigits when 13 hexdigits you give uniquely identify
> the same object, I suspect you wouldn't even notice that the
> hexadecimal digits you see on the screen have one digit longer than
> usual ;-).

That's it precisely! :) I do *not* notice that the hash from git-blame
has one more hexadecimal character than the central abbrev setting; so I
just go ahead and blindly cut n' paste it, using the mouse, from the
terminal, to the editor search box that's displaying the git-rebase TODO
list. And then I don't understand why the lookup fails (until I realize
that I have forgotten, yet again, to strip the last nibble from the
commit hash coming from git-blame).

Once again, sorry about misstating the problem / use case!

Laszlo

^ permalink raw reply

* Re: [PATCH v1] config: fix case-insensitive match for old-style [section.subsection]
From: Junio C Hamano @ 2026-06-30 20:12 UTC (permalink / raw)
  To: RISHAV DEWAN; +Cc: git, Johannes Schindelin
In-Reply-To: <20260630124850.2498-1-rishavdewan10@gmail.com>

RISHAV DEWAN <rishavdewan10@gmail.com> writes:

Thanks.

Although this was originally CC'ed to me, according to "git blame",
most of the code involved in the "bug" (i.e., matches() and its
caller) seems to be work by Dscho around 2018, so I'll redirect this
review in that direction ;-0.

> When writing to an old-style "[section.subsection]" header, the
> config file parser always folds the subsection to lower case
> (get_base_var() lowercases unconditionally), while the key given on
> the command line keeps whatever case the caller typed
> (do_parse_config_key() deliberately leaves the subsection segment
> untouched). matches() compared these two forms with a plain strcmp(),
> so a caller passing an upper-cased subsection (e.g. 'git config
> section.Subsection.key value2' against a file containing
> '[section.subsection]') never matched the existing key and a
> duplicate line was appended instead of replacing the value. This was
> a known, documented limitation (see the now-removed BUGS section of
> git-config.adoc).
>
> Track whether the currently active section was parsed case-
> insensitively (old-style) or case-sensitively (new-style, quoted) in
> struct config_store_data, and have matches() use that information to
> compare the subsection segment of the key accordingly, instead of an
> unconditional case-sensitive strcmp().
>
> Signed-off-by: RISHAV DEWAN <rishavdewan10@gmail.com>
> ---
>  Documentation/git-config.adoc | 21 ---------------------
>  config.c                      | 18 +++++++++++++++++-
>  t/t1300-config.sh             |  2 --
>  3 files changed, 17 insertions(+), 24 deletions(-)
>
> diff --git a/Documentation/git-config.adoc b/Documentation/git-config.adoc
> index 57af010ade..11dfd802b4 100644
> --- a/Documentation/git-config.adoc
> +++ b/Documentation/git-config.adoc
> @@ -634,27 +634,6 @@ http.sslverify false
>  
>  include::config.adoc[]
>  
> -BUGS
> -----
> -When using the deprecated `[section.subsection]` syntax, changing a value
> -will result in adding a multi-line key instead of a change, if the subsection
> -is given with at least one uppercase character. For example when the config
> -looks like
> -
> ---------
> -  [section.subsection]
> -    key = value1
> ---------
> -
> -and running `git config section.Subsection.key value2` will result in
> -
> ---------
> -  [section.subsection]
> -    key = value1
> -    key = value2
> ---------
> -
> -
>  GIT
>  ---
>  Part of the linkgit:git[1] suite
> diff --git a/config.c b/config.c
> index 6a0de86e3a..7f086fcd75 100644
> --- a/config.c
> +++ b/config.c
> @@ -2594,6 +2594,7 @@ struct config_store_data {
>  	} *parsed;
>  	unsigned int parsed_nr, parsed_alloc, *seen, seen_nr, seen_alloc;
>  	unsigned int key_seen:1, section_seen:1, is_keys_section:1;
> +	unsigned int subsection_case_sensitive:1;
>  };
>  #define CONFIG_STORE_INIT { 0 }
>  
> @@ -2613,7 +2614,21 @@ static void config_store_data_clear(struct config_store_data *store)
>  static int matches(const char *key, const char *value,
>  		   const struct config_store_data *store)
>  {
> -	if (strcmp(key, store->key))
> +	/*
> +	 * The subsection part of "key" (key[0..store->baselen)) was parsed
> +	 * out of the config file using the case sensitivity of whichever
> +	 * section header it came from (see store_aux_event()): old-style
> +	 * "[section.subsection]" headers are folded to lower case while
> +	 * parsing, so they must be compared case-insensitively against
> +	 * store->key, which preserves whatever case the caller passed on
> +	 * the command line. New-style "[section "Subsection"]" headers keep
> +	 * their case, so they need an exact, case-sensitive comparison.
> +	 */
> +	int (*cmpfn)(const char *, const char *, size_t) =
> +		store->subsection_case_sensitive ? strncasecmp : strncmp;
> +
> +	if (cmpfn(key, store->key, store->baselen) ||
> +	    strcmp(key + store->baselen, store->key + store->baselen))
>  		return 0; /* not ours */
>  	if (store->fixed_value && value)
>  		return !strcmp(store->fixed_value, value);
> @@ -2654,6 +2669,7 @@ static int store_aux_event(enum config_event_t type, size_t begin, size_t end,
>  			!cmpfn(cs->var.buf, store->key, store->baselen);
>  		if (store->is_keys_section) {
>  			store->section_seen = 1;
> +			store->subsection_case_sensitive = cs->subsection_case_sensitive;
>  			ALLOC_GROW(store->seen, store->seen_nr + 1,
>  				   store->seen_alloc);
>  			store->seen[store->seen_nr] = store->parsed_nr;
> diff --git a/t/t1300-config.sh b/t/t1300-config.sh
> index 87ca11a127..eaa3b83990 100755
> --- a/t/t1300-config.sh
> +++ b/t/t1300-config.sh
> @@ -1499,7 +1499,6 @@ test_expect_success 'old-fashioned settings are case insensitive' '
>  	EOF
>  	q_to_tab >testConfig_expect <<-EOF &&
>  	[V.A]
> -	r = value1
>  	Qr = value2
>  	EOF
>  	git config -f testConfig_actual "V.A.r" value2 &&
> @@ -1511,7 +1510,6 @@ test_expect_success 'old-fashioned settings are case insensitive' '
>  	EOF
>  	q_to_tab >testConfig_expect <<-EOF &&
>  	[V.A]
> -	r = value1
>  	Qr = value2
>  	EOF
>  	git config -f testConfig_actual "v.A.r" value2 &&

^ permalink raw reply

* Re: [PATCH 00/11] sequencer: do not record dropped commits as rewritten
From: Junio C Hamano @ 2026-06-30 19:57 UTC (permalink / raw)
  To: Phillip Wood; +Cc: git, Uwe Kleine-König, Konstantin Ryabitsev
In-Reply-To: <cover.1782833268.git.phillip.wood@dunelm.org.uk>

Phillip Wood <phillip.wood123@gmail.com> writes:

> On 19/06/2026 11:13, Phillip Wood wrote:
>> I'm happy to take this forward and try and fix at least some of the
>> other bugs I've listed above. Uwe - if I don't cc you on some patches
>> within the next couple of weeks please feel free to send a reminder.
>
> Here is the first batch that fixes the same problem as Uwe's patch. I've
> taken a slightly different approach that uses the return value from
> do_pick_commit() to signal that a commit was dropped rather than
> adding another function argument. That involves a number of preparatory
> patches, but they are hopefully reasonably small and easy to follow.
>
> If a commit gets dropped because its changes are already upstream
> then we should not record it as rewritten. As well as confusing any
> post-rewrite hooks this means we end up copying the notes from the
> dropped commit to the commit that was picked immediately before the
> one that was dropped.
>
> This series is structured as follows:
>
> Patch 1 restores some test coverage that was lost when the default
> rebase backend was changed.
>
> Patch 2 moves a function so it can be called without a forward
> declaration in Patch 11.
>
> Patches 3 & 4 fix the return value of do_pick_commit() when an external
> command fails (this is in preparation for patch 10).
>
> Patches 5-9 try and simplify the control flow in pick_one_commit()
> in preparation for patch 10.
>
> Patch 10 changes the return type of do_pick_commit() to an enum.
>
> Patch 11 adds a new member to the enum from patch 10 for commits that
> are dropped when they become empty and uses that to stop them from
> being recorded as rewritten.
>
> Base-Commit: 6c3d7b73556db708feb3b16232fab1efc4353428
> Published-As: https://github.com/phillipwood/git/releases/tag/pw%2Frebase-drop-notes-with-commit%2Fv1
> View-Changes-At: https://github.com/phillipwood/git/compare/6c3d7b735...26551f268
> Fetch-It-Via: git fetch https://github.com/phillipwood/git pw/rebase-drop-notes-with-commit/v1

Thanks.

A tangent (I Cc'ed Konstantin for this), but

    $ b4 am -o- '<cover.1782833268.git.phillip.wood@dunelm.org.uk>' >b4am.mbx

failed to produce a usable mailbox.  It somehow did not think [2/11]
existed.  I manually examined the References and In-Reply-To headers
of that particular message and compared them with those from other
messages but did not find anything suspicious X-<.

I have a bunch of typofixes queued on top of these 11 patches (made
with "git commit --fixup reword:<sha1>"); please double check when
you reroll after seeing more substantial reviews than mere typofixes,
possibly from others.

Thanks.


Here is the transcript of failed b4 am invocation.
---- >8 ----
Looking up https://lore.kernel.org/all/cover.1782833268.git.phillip.wood@dunelm.org.uk/
Grabbing thread from lore.kernel.org/all/cover.1782833268.git.phillip.wood@dunelm.org.uk/t.mbox.gz
Analyzing 17 messages in the thread
WARNING: duplicate messages found at index 1
   Subject 1: sequencer: Skip copying notes for commits that disappear during rebase
   Subject 2: t3400: restore coverage for note copying with apply backend
  2 is not a reply... assume additional patch
Looking for additional code-review trailers on lore.kernel.org
Analyzing 0 code-review messages
Checking attestation on all messages, may take a moment...
---
  ✗ [PATCH] sequencer: Skip copying notes for commits that disappear during rebase
    ✗ No key: openpgp/u.kleine-koenig@baylibre.com
    ✗ BADSIG: DKIM/baylibre.com
  ✓ [PATCH 1/11] t3400: restore coverage for note copying with apply backend
    ✓ Signed: DKIM/gmail.com
  ✓ [PATCH 3/11] sequencer: be more careful with external merge
    ✓ Signed: DKIM/gmail.com
  ✓ [PATCH 4/11] sequencer: never reschedule on failed commit
    ✓ Signed: DKIM/gmail.com
  ✓ [PATCH 5/11] sequencer: remove unnecessary "or" in pick_one_commit()
    ✓ Signed: DKIM/gmail.com
  ✓ [PATCH 6/11] sequencer: simplify handing of fixup with conflicts
    ✓ Signed: DKIM/gmail.com
  ✓ [PATCH 7/11] sequencer: remove unnecessary condition in pick_one_commit()
    ✓ Signed: DKIM/gmail.com
  ✓ [PATCH 8/11] sequencer: simplify pick_one_commit()
    ✓ Signed: DKIM/gmail.com
  ✓ [PATCH 9/11] sequencer: return early from pick_one_commit() on success
    ✓ Signed: DKIM/gmail.com
  ✓ [PATCH 10/11] sequencer: use an enum to represent result of picking a commit
    ✓ Signed: DKIM/gmail.com
  ✓ [PATCH 11/11] sequencer: do not record dropped commits as rewritten
    ✓ Signed: DKIM/gmail.com
  ERROR: missing [12/2]!
---
Total patches: 11
---
WARNING: Thread incomplete!
 Link: https://patch.msgid.link/cover.1782833268.git.phillip.wood@dunelm.org.uk
:

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox