]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 years agofsm-health-win32: add polling framework to monitor daemon health
Jeff Hostetler [Thu, 26 May 2022 21:47:11 +0000 (21:47 +0000)] 
fsm-health-win32: add polling framework to monitor daemon health

Extend the Windows version of the "health" thread to periodically
inspect the system and shutdown if warranted.

This commit updates the thread's wait loop to use a timeout and
defines a (currently empty) table of functions to poll the system.

A later commit will add functions to the table to actually
inspect the system.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: stub in health thread
Jeff Hostetler [Thu, 26 May 2022 21:47:10 +0000 (21:47 +0000)] 
fsmonitor--daemon: stub in health thread

Create another thread to watch over the daemon process and
automatically shut it down if necessary.

This commit creates the basic framework for a "health" thread
to monitor the daemon and/or the file system.  Later commits
will add platform-specific code to do the actual work.

The "health" thread is intended to monitor conditions that
would be difficult to track inside the IPC thread pool and/or
the file system listener threads.  For example, when there are
file system events outside of the watched worktree root or if
we want to have an idle-timeout auto-shutdown feature.

This commit creates the health thread itself, defines the thread-proc
and sets up the thread's event loop.  It integrates this new thread
into the existing IPC and Listener thread models.

This commit defines the API to the platform-specific code where all of
the monitoring will actually happen.

The platform-specific code for MacOS is just stubs.  Meaning that the
health thread will immediately exit on MacOS, but that is OK and
expected.  Future work can define MacOS-specific monitoring.

The platform-specific code for Windows sets up enough of the
WaitForMultipleObjects() machinery to watch for system and/or custom
events.  Currently, the set of wait handles only includes our custom
shutdown event (sent from our other theads).  Later commits in this
series will extend the set of wait handles to monitor other
conditions.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: rename listener thread related variables
Jeff Hostetler [Thu, 26 May 2022 21:47:09 +0000 (21:47 +0000)] 
fsmonitor--daemon: rename listener thread related variables

Rename platform-specific listener thread related variables
and data types as we prepare to add another backend thread
type.

[] `struct fsmonitor_daemon_backend_data` becomes `struct fsm_listen_data`
[] `state->backend_data` becomes `state->listen_data`
[] `state->error_code` becomes `state->listen_error_code`

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: prepare for adding health thread
Jeff Hostetler [Thu, 26 May 2022 21:47:08 +0000 (21:47 +0000)] 
fsmonitor--daemon: prepare for adding health thread

Refactor daemon thread startup to make it easier to start
a third thread class to monitor the health of the daemon.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: cd out of worktree root
Jeff Hostetler [Thu, 26 May 2022 21:47:07 +0000 (21:47 +0000)] 
fsmonitor--daemon: cd out of worktree root

Teach the fsmonitor--daemon to CD outside of the worktree
before starting up.

The common Git startup mechanism causes the CWD of the daemon process
to be in the root of the worktree.  On Windows, this causes the daemon
process to hold a locked handle on the CWD and prevents other
processes from moving or deleting the worktree while the daemon is
running.

CD to HOME before entering main event loops.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsm-listen-darwin: ignore FSEvents caused by xattr changes on macOS
Jeff Hostetler [Thu, 26 May 2022 21:47:06 +0000 (21:47 +0000)] 
fsm-listen-darwin: ignore FSEvents caused by xattr changes on macOS

Ignore FSEvents resulting from `xattr` changes.  Git does not care about
xattr's or changes to xattr's, so don't waste time collecting these
events in the daemon nor transmitting them to clients.

Various security tools add xattrs to files and/or directories, such as
to mark them as having been downloaded.  We should ignore these events
since it doesn't affect the content of the file/directory or the normal
meta-data that Git cares about.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agounpack-trees: initialize fsmonitor_has_run_once in o->result
Jeff Hostetler [Thu, 26 May 2022 21:47:05 +0000 (21:47 +0000)] 
unpack-trees: initialize fsmonitor_has_run_once in o->result

Initialize `o->result.fsmonitor_has_run_once` based upon value
in `o->src_index->fsmonitor_has_run_once` to prevent a second
fsmonitor query during the tree traversal and possibly getting
a skewed view of the working directory.

The checkout code has already talked to the fsmonitor and the
traversal is updating the index as it traverses, so there is
no need to query the fsmonitor.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor-settings: NTFS and FAT32 on MacOS are incompatible
Jeff Hostetler [Thu, 26 May 2022 21:47:04 +0000 (21:47 +0000)] 
fsmonitor-settings: NTFS and FAT32 on MacOS are incompatible

On MacOS mark repos on NTFS or FAT32 volumes as incompatible.

The builtin FSMonitor used Unix domain sockets on MacOS for IPC
with clients.  These sockets are kept in the .git directory.
Unix sockets are not supported by NTFS and FAT32, so the daemon
cannot start up.

Test for this during our compatibility checking so that client
commands do not keep trying to start the daemon.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor-settings: remote repos on Windows are incompatible
Jeff Hostetler [Thu, 26 May 2022 21:47:03 +0000 (21:47 +0000)] 
fsmonitor-settings: remote repos on Windows are incompatible

Teach Git to detect remote working directories on Windows and mark them as
incompatible with FSMonitor.

With this `git fsmonitor--daemon run` will error out with a message like it
does for bare repos.

Client commands, such as `git status`, will not attempt to start the daemon.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor-settings: remote repos on macOS are incompatible
Jeff Hostetler [Thu, 26 May 2022 21:47:02 +0000 (21:47 +0000)] 
fsmonitor-settings: remote repos on macOS are incompatible

Teach Git to detect remote working directories on macOS and mark them as
incompatible with FSMonitor.

With this, `git fsmonitor--daemon run` will error out with a message
like it does for bare repos.

Client commands, like `git status`, will not attempt to start the daemon.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor-settings: stub in macOS-specific incompatibility checking
Jeff Hostetler [Thu, 26 May 2022 21:47:01 +0000 (21:47 +0000)] 
fsmonitor-settings: stub in macOS-specific incompatibility checking

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor-settings: VFS for Git virtual repos are incompatible
Jeff Hostetler [Thu, 26 May 2022 21:47:00 +0000 (21:47 +0000)] 
fsmonitor-settings: VFS for Git virtual repos are incompatible

VFS for Git virtual repositories are incompatible with FSMonitor.

VFS for Git is a downstream fork of Git.  It contains its own custom
file system watcher that is aware of the virtualization.  If a working
directory is being managed by VFS for Git, we should not try to watch
it because we may get incomplete results.

We do not know anything about how VFS for Git works, but we do
know that VFS for Git working directories contain a well-defined
config setting.  If it is set, mark the working directory as
incompatible.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor-settings: stub in Win32-specific incompatibility checking
Jeff Hostetler [Thu, 26 May 2022 21:46:59 +0000 (21:46 +0000)] 
fsmonitor-settings: stub in Win32-specific incompatibility checking

Extend generic incompatibility checkout with platform-specific
mechanism.  Stub in Win32 version.

In the existing fsmonitor-settings code we have a way to mark
types of repos as incompatible with fsmonitor (whether via the
hook and IPC APIs).  For example, we do this for bare repos,
since there are no files to watch.

Extend this exclusion mechanism for platform-specific reasons.
This commit just creates the framework and adds a stub for Win32.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor-settings: bare repos are incompatible with FSMonitor
Jeff Hostetler [Thu, 26 May 2022 21:46:58 +0000 (21:46 +0000)] 
fsmonitor-settings: bare repos are incompatible with FSMonitor

Bare repos do not have a worktree, so there is nothing for the
daemon watch.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/helper/fsmonitor-client: create stress test
Jeff Hostetler [Thu, 26 May 2022 21:46:57 +0000 (21:46 +0000)] 
t/helper/fsmonitor-client: create stress test

Create a stress test to hammer on the fsmonitor daemon.
Create a client-side thread pool of n threads and have
each of them make m requests as fast as they can.

We do not currently inspect the contents of the response.
We're only interested in placing a heavy request load on
the daemon.

This test is useful for interactive testing and various
experimentation.  For example, to place additional load
on the daemon while another test is running.  We currently
do not have a test script that actually uses this helper.
We might add such a test in the future.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot7527: test FSMonitor on repos with Unicode root paths
Jeff Hostetler [Thu, 26 May 2022 21:46:56 +0000 (21:46 +0000)] 
t7527: test FSMonitor on repos with Unicode root paths

Create some test repos with UTF8 characters in the pathname of the
root directory and verify that the builtin FSMonitor can watch them.

This test is mainly for Windows where we need to avoid `*A()`
routines.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsm-listen-win32: handle shortnames
Jeff Hostetler [Thu, 26 May 2022 21:46:55 +0000 (21:46 +0000)] 
fsm-listen-win32: handle shortnames

Teach FSMonitor daemon on Windows to recognize shortname paths as
aliases of normal longname paths.  FSMonitor clients, such as `git
status`, should receive the longname spelling of changed files (when
possible).

Sometimes we receive FS events using the shortname, such as when a CMD
shell runs "RENAME GIT~1 FOO" or "RMDIR GIT~1".  The FS notification
arrives using whatever combination of long and shortnames were used by
the other process.  (Shortnames do seem to be case normalized,
however.)

Use Windows GetLongPathNameW() to try to map the pathname spelling in
the notification event into the normalized longname spelling.  (This
can fail if the file/directory is deleted, moved, or renamed, because
we are asking the FS for the mapping in response to the event and
after it has already happened, but we try.)

Special case the shortname spelling of ".git" to avoid under-reporting
these events.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jh/builtin-fsmonitor-part2' into jh/builtin-fsmonitor-part3
Junio C Hamano [Fri, 25 Mar 2022 23:05:52 +0000 (16:05 -0700)] 
Merge branch 'jh/builtin-fsmonitor-part2' into jh/builtin-fsmonitor-part3

* jh/builtin-fsmonitor-part2: (150 commits)
  t7527: test status with untracked-cache and fsmonitor--daemon
  fsmonitor: force update index after large responses
  fsmonitor--daemon: use a cookie file to sync with file system
  fsmonitor--daemon: periodically truncate list of modified files
  t/perf/p7519: add fsmonitor--daemon test cases
  t/perf/p7519: speed up test on Windows
  t/perf/p7519: fix coding style
  t/helper/test-chmtime: skip directories on Windows
  t/perf: avoid copying builtin fsmonitor files into test repo
  t7527: create test for fsmonitor--daemon
  t/helper/fsmonitor-client: create IPC client to talk to FSMonitor Daemon
  help: include fsmonitor--daemon feature flag in version info
  fsmonitor--daemon: implement handle_client callback
  compat/fsmonitor/fsm-listen-darwin: implement FSEvent listener on MacOS
  compat/fsmonitor/fsm-listen-darwin: add MacOS header files for FSEvent
  compat/fsmonitor/fsm-listen-win32: implement FSMonitor backend on Windows
  fsmonitor--daemon: create token-based changed path cache
  fsmonitor--daemon: define token-ids
  fsmonitor--daemon: add pathname classification
  fsmonitor--daemon: implement 'start' command
  ...

2 years agot7527: test status with untracked-cache and fsmonitor--daemon
Jeff Hostetler [Fri, 25 Mar 2022 18:03:13 +0000 (18:03 +0000)] 
t7527: test status with untracked-cache and fsmonitor--daemon

Create 2x2 test matrix with the untracked-cache and fsmonitor--daemon
features and a series of edits and verify that status output is
identical.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor: force update index after large responses
Jeff Hostetler [Fri, 25 Mar 2022 18:03:12 +0000 (18:03 +0000)] 
fsmonitor: force update index after large responses

Measure the time taken to apply the FSMonitor query result
to the index and the untracked-cache.

Set the `FSMONITOR_CHANGED` bit on `istate->cache_changed` when
FSMonitor returns a very large repsonse to ensure that the index is
written to disk.

Normally, when the FSMonitor response includes a tracked file, the
index is always updated.  Similarly, the index might be updated when
the response alters the untracked-cache (when enabled).  However, in
cases where neither of those cause the index to be considered changed,
the FSMonitor response is wasted.  Subsequent Git commands will make
requests with the same token and receive the same response.

If that response is very large, performance may suffer.  It would be
more efficient to force update the index now (and the token in the
index extension) in order to reduce the size of the response received
by future commands.

This was observed on Windows after a large checkout.  On Windows, the
kernel emits events for the files that are changed as they are
changed.  However, it might delay events for the containing
directories until the system is more idle (or someone scans the
directory (so it seems)).  The first status following a checkout would
get the list of files.  The subsequent status commands would get the
list of directories as the events trickled out.  But they would never
catch up because the token was not advanced because the index wasn't
updated.

This list of directories caused `wt_status_collect_untracked()` to
unnecessarily spend time actually scanning them during each command.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: use a cookie file to sync with file system
Jeff Hostetler [Fri, 25 Mar 2022 18:03:11 +0000 (18:03 +0000)] 
fsmonitor--daemon: use a cookie file to sync with file system

Teach fsmonitor--daemon client threads to create a cookie file
inside the .git directory and then wait until FS events for the
cookie are observed by the FS listener thread.

This helps address the racy nature of file system events by
blocking the client response until the kernel has drained any
event backlog.

This is especially important on MacOS where kernel events are
only issued with a limited frequency.  See the `latency` argument
of `FSeventStreamCreate()`.  The kernel only signals every `latency`
seconds, but does not guarantee that the kernel queue is completely
drained, so we may have to wait more than one interval.  If we
increase the latency, the system is more likely to drop events.
We avoid these issues by having each client thread create a unique
cookie file and then wait until it is seen in the event stream.

Co-authored-by: Kevin Willford <Kevin.Willford@microsoft.com>
Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: periodically truncate list of modified files
Jeff Hostetler [Fri, 25 Mar 2022 18:03:10 +0000 (18:03 +0000)] 
fsmonitor--daemon: periodically truncate list of modified files

Teach fsmonitor--daemon to periodically truncate the list of
modified files to save some memory.

Clients will ask for the set of changes relative to a token that they
found in the FSMN index extension in the index.  (This token is like a
point in time, but different).  Clients will then update the index to
contain the response token (so that subsequent commands will be
relative to this new token).

Therefore, the daemon can gradually truncate the in-memory list of
changed paths as they become obsolete (older than the previous token).
Since we may have multiple clients making concurrent requests with a
skew of tokens and clients may be racing to the talk to the daemon,
we lazily truncate the list.

We introduce a 5 minute delay and truncate batches 5 minutes after
they are considered obsolete.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/perf/p7519: add fsmonitor--daemon test cases
Jeff Hostetler [Fri, 25 Mar 2022 18:03:09 +0000 (18:03 +0000)] 
t/perf/p7519: add fsmonitor--daemon test cases

Repeat all of the fsmonitor perf tests using `git fsmonitor--daemon` and
the "Simple IPC" interface.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/perf/p7519: speed up test on Windows
Jeff Hostetler [Fri, 25 Mar 2022 18:03:08 +0000 (18:03 +0000)] 
t/perf/p7519: speed up test on Windows

Change p7519 to use `test_seq` and `xargs` rather than a `for` loop
to touch thousands of files.  This takes minutes off of test runs
on Windows because of process creation overhead.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/perf/p7519: fix coding style
Jeff Hostetler [Fri, 25 Mar 2022 18:03:07 +0000 (18:03 +0000)] 
t/perf/p7519: fix coding style

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/helper/test-chmtime: skip directories on Windows
Jeff Hostetler [Fri, 25 Mar 2022 18:03:06 +0000 (18:03 +0000)] 
t/helper/test-chmtime: skip directories on Windows

Teach `test-tool.exe chmtime` to ignore errors when setting the mtime
on a directory on Windows.

NEEDSWORK: The Windows version of `utime()` (aka `mingw_utime()`) does
not properly handle directories because it uses `_wopen()`.  It should
be converted to using `CreateFileW()` and backup semantics at a minimum.
Since I'm already in the middle of a large patch series, I did not want
to destabilize other callers of `utime()` right now.  The problem has
only been observed in the t/perf/p7519 test when the test repo contains
an empty directory on disk.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/perf: avoid copying builtin fsmonitor files into test repo
Jeff Hostetler [Fri, 25 Mar 2022 18:03:05 +0000 (18:03 +0000)] 
t/perf: avoid copying builtin fsmonitor files into test repo

Do not copy any of the various fsmonitor--daemon files from the .git
directory of the (GIT_PREF_REPO or GIT_PERF_LARGE_REPO) source repo
into the test's trash directory.

When perf tests start, they copy the contents of the source repo into
the test's trash directory.  If fsmonitor is running in the source repo,
there may be control files, such as the IPC socket and/or fsmonitor
cookie files.  These should not be copied into the test repo.

Unix domain sockets cannot be copied in the manner used by the test
setup, so if present, the test setup fails.

Cookie files are harmless, but we should avoid them.

The builtin fsmonitor keeps all such control files/sockets in
.git/fsmonitor--daemon*, so it is simple to exclude them.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot7527: create test for fsmonitor--daemon
Jeff Hostetler [Fri, 25 Mar 2022 18:03:04 +0000 (18:03 +0000)] 
t7527: create test for fsmonitor--daemon

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/helper/fsmonitor-client: create IPC client to talk to FSMonitor Daemon
Jeff Hostetler [Fri, 25 Mar 2022 18:03:03 +0000 (18:03 +0000)] 
t/helper/fsmonitor-client: create IPC client to talk to FSMonitor Daemon

Create an IPC client to send query and flush commands to the daemon.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agohelp: include fsmonitor--daemon feature flag in version info
Jeff Hostetler [Fri, 25 Mar 2022 18:03:02 +0000 (18:03 +0000)] 
help: include fsmonitor--daemon feature flag in version info

Add the "feature: fsmonitor--daemon" message to the output of
`git version --build-options`.

The builtin FSMonitor is only available on certain platforms and
even then only when certain Makefile flags are enabled, so print
a message in the verbose version output when it is available.

This can be used by test scripts for prereq testing.  Granted, tests
could just try `git fsmonitor--daemon status` and look for a 128 exit
code or grep for a "not supported" message on stderr, but these
methods are rather obscure.

The main advantage is that the feature message will automatically
appear in bug reports and other support requests.

This concept was also used during the development of Scalar for
similar reasons.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: implement handle_client callback
Jeff Hostetler [Fri, 25 Mar 2022 18:03:01 +0000 (18:03 +0000)] 
fsmonitor--daemon: implement handle_client callback

Teach fsmonitor--daemon to respond to IPC requests from client
Git processes and respond with a list of modified pathnames
relative to the provided token.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompat/fsmonitor/fsm-listen-darwin: implement FSEvent listener on MacOS
Jeff Hostetler [Fri, 25 Mar 2022 18:03:00 +0000 (18:03 +0000)] 
compat/fsmonitor/fsm-listen-darwin: implement FSEvent listener on MacOS

Implement file system event listener on MacOS using FSEvent,
CoreFoundation, and CoreServices.

Co-authored-by: Kevin Willford <Kevin.Willford@microsoft.com>
Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompat/fsmonitor/fsm-listen-darwin: add MacOS header files for FSEvent
Jeff Hostetler [Fri, 25 Mar 2022 18:02:59 +0000 (18:02 +0000)] 
compat/fsmonitor/fsm-listen-darwin: add MacOS header files for FSEvent

Include MacOS system declarations to allow us to use FSEvent and
CoreFoundation APIs.  We need different versions of the declarations
for GCC vs. clang because of compiler and header file conflicts.

While it is quite possible to #include Apple's CoreServices.h when
compiling C source code with clang, trying to build it with GCC
currently fails with this error:

In file included
   from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
   ...Library/Frameworks/Security.framework/Headers/AuthSession.h:32,
   from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
   ...Library/Frameworks/Security.framework/Headers/Security.h:42,
   from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
   ...Library/Frameworks/CoreServices.framework/Frameworks/...
   ...OSServices.framework/Headers/CSIdentity.h:43,
   from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
   ...Library/Frameworks/CoreServices.framework/Frameworks/...
   ...OSServices.framework/Headers/OSServices.h:29,
   from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
   ...Library/Frameworks/CoreServices.framework/Frameworks/...
   ...LaunchServices.framework/Headers/IconsCore.h:23,
   from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
   ...Library/Frameworks/CoreServices.framework/Frameworks/...
   ...LaunchServices.framework/Headers/LaunchServices.h:23,
   from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
   ...Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:45,

     /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/...
     ...Library/Frameworks/Security.framework/Headers/Authorization.h:193:7:
     error: variably modified 'bytes' at file scope
       193 | char bytes[kAuthorizationExternalFormLength];
           |      ^~~~~

The underlying reason is that GCC (rightfully) objects that an `enum`
value such as `kAuthorizationExternalFormLength` is not a constant
(because it is not, the preprocessor has no knowledge of it, only the
actual C compiler does) and can therefore not be used to define the size
of a C array.

This is a known problem and tracked in GCC's bug tracker:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93082

In the meantime, let's not block things and go the slightly ugly route
of declaring/defining the FSEvents constants, data structures and
functions that we need, so that we can avoid above-mentioned issue.

Let's do this _only_ for GCC, though, so that the CI/PR builds (which
build both with clang and with GCC) can guarantee that we _are_ using
the correct data types.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompat/fsmonitor/fsm-listen-win32: implement FSMonitor backend on Windows
Jeff Hostetler [Fri, 25 Mar 2022 18:02:58 +0000 (18:02 +0000)] 
compat/fsmonitor/fsm-listen-win32: implement FSMonitor backend on Windows

Teach the win32 backend to register a watch on the working tree
root directory (recursively).  Also watch the <gitdir> if it is
not inside the working tree.  And to collect path change notifications
into batches and publish.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: create token-based changed path cache
Jeff Hostetler [Fri, 25 Mar 2022 18:02:57 +0000 (18:02 +0000)] 
fsmonitor--daemon: create token-based changed path cache

Teach fsmonitor--daemon to build a list of changed paths and associate
them with a token-id.  This will be used by the platform-specific
backends to accumulate changed paths in response to filesystem events.

The platform-specific file system listener thread receives file system
events containing one or more changed pathnames (with whatever
bucketing or grouping that is convenient for the file system).  These
paths are accumulated (without locking) by the file system layer into
a `fsmonitor_batch`.

When the file system layer has drained the kernel event queue, it will
"publish" them to our token queue and make them visible to concurrent
client worker threads.  The token layer is free to combine and/or de-dup
paths within these batches for efficient presentation to clients.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: define token-ids
Jeff Hostetler [Fri, 25 Mar 2022 18:02:56 +0000 (18:02 +0000)] 
fsmonitor--daemon: define token-ids

Teach fsmonitor--daemon to create token-ids and define the
overall token naming scheme.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: add pathname classification
Jeff Hostetler [Fri, 25 Mar 2022 18:02:55 +0000 (18:02 +0000)] 
fsmonitor--daemon: add pathname classification

Teach fsmonitor--daemon to classify relative and absolute
pathnames and decide how they should be handled.  This will
be used by the platform-specific backend to respond to each
filesystem event.

When we register for filesystem notifications on a directory,
we get events for everything (recursively) in the directory.
We want to report to clients changes to tracked and untracked
paths within the working directory proper.  We do not want to
report changes within the .git directory, for example.

This classification will be used in a later commit by the
different backends to classify paths as events are received.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: implement 'start' command
Jeff Hostetler [Fri, 25 Mar 2022 18:02:54 +0000 (18:02 +0000)] 
fsmonitor--daemon: implement 'start' command

Implement 'git fsmonitor--daemon start' command.  This command starts
an instance of 'git fsmonitor--daemon run' in the background using
the new 'start_bg_command()' function.

We avoid the fork-and-call technique on Unix systems in favor of a
fork-and-exec technique.  This gives us more uniform Trace2 child-*
events.  It also makes our usage more consistent with Windows usage.

On Windows, teach 'git fsmonitor--daemon run' to optionally call
'FreeConsole()' to release handles to the inherited Win32 console
(despite being passed invalid handles for stdin/out/err).  Without
this, command prompts and powershell terminal windows could hang
in "exit" until the last background child process exited or released
their Win32 console handle.  (This was not seen with git-bash shells
because they don't have a Win32 console attached to them.)

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: implement 'run' command
Jeff Hostetler [Fri, 25 Mar 2022 18:02:53 +0000 (18:02 +0000)] 
fsmonitor--daemon: implement 'run' command

Implement `run` command to try to begin listening for file system events.

This version defines the thread structure with a single fsmonitor_fs_listen
thread to watch for file system events and a simple IPC thread pool to
watch for connection from Git clients over a well-known named pipe or
Unix domain socket.

This commit does not actually do anything yet because the platform
backends are still just stubs.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompat/fsmonitor/fsm-listen-darwin: stub in backend for Darwin
Jeff Hostetler [Fri, 25 Mar 2022 18:02:52 +0000 (18:02 +0000)] 
compat/fsmonitor/fsm-listen-darwin: stub in backend for Darwin

Stub in empty implementation of fsmonitor--daemon
backend for Darwin (aka MacOS).

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompat/fsmonitor/fsm-listen-win32: stub in backend for Windows
Jeff Hostetler [Fri, 25 Mar 2022 18:02:51 +0000 (18:02 +0000)] 
compat/fsmonitor/fsm-listen-win32: stub in backend for Windows

Stub in empty filesystem listener backend for fsmonitor--daemon on Windows.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: implement 'stop' and 'status' commands
Jeff Hostetler [Fri, 25 Mar 2022 18:02:50 +0000 (18:02 +0000)] 
fsmonitor--daemon: implement 'stop' and 'status' commands

Implement `stop` and `status` client commands to control and query the
status of a `fsmonitor--daemon` server process (and implicitly start a
server process if necessary).

Later commits will implement the actual server and monitor the file
system.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor--daemon: add a built-in fsmonitor daemon
Jeff Hostetler [Fri, 25 Mar 2022 18:02:49 +0000 (18:02 +0000)] 
fsmonitor--daemon: add a built-in fsmonitor daemon

Create a built-in file system monitoring daemon that can be used by
the existing `fsmonitor` feature (protocol API and index extension)
to improve the performance of various Git commands, such as `status`.

The `fsmonitor--daemon` feature builds upon the `Simple IPC` API and
provides an alternative to hook access to existing fsmonitors such
as `watchman`.

This commit merely adds the new command without any functionality.

Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor: document builtin fsmonitor
Jeff Hostetler [Fri, 25 Mar 2022 18:02:48 +0000 (18:02 +0000)] 
fsmonitor: document builtin fsmonitor

Document how `core.fsmonitor` can be set to a boolean to enable
or disable the builtin FSMonitor.

Update references to `core.fsmonitor` and `core.fsmonitorHookVersion` and
pointers to `Watchman` to refer to it.

Create `git-fsmonitor--daemon` manual page and describe its features.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor: use IPC to query the builtin FSMonitor daemon
Jeff Hostetler [Fri, 25 Mar 2022 18:02:47 +0000 (18:02 +0000)] 
fsmonitor: use IPC to query the builtin FSMonitor daemon

Use simple IPC to directly communicate with the new builtin file
system monitor daemon when `core.fsmonitor` is set to true.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor: config settings are repository-specific
Jeff Hostetler [Fri, 25 Mar 2022 18:02:46 +0000 (18:02 +0000)] 
fsmonitor: config settings are repository-specific

Move fsmonitor config settings to a new and opaque
`struct fsmonitor_settings` structure.  Add a lazily-loaded pointer
to this into `struct repo_settings`

Create an `enum fsmonitor_mode` type in `struct fsmonitor_settings` to
represent the state of fsmonitor.  This lets us represent which, if
any, fsmonitor provider (hook or IPC) is enabled.

Create `fsm_settings__get_*()` getters to lazily look up fsmonitor-
related config settings.

Get rid of the `core_fsmonitor` global variable.  Move the code to
lookup the existing `core.fsmonitor` config value into the fsmonitor
settings.

Create a hook pathname variable in `struct fsmonitor-settings` and
only set it when in hook mode.

Extend the definition of `core.fsmonitor` to be either a boolean
or a hook pathname.  When true, the builtin FSMonitor is used.
When false or unset, no FSMonitor (neither builtin nor hook) is
used.

The existing `core_fsmonitor` global variable was used to store the
pathname to the fsmonitor hook *and* it was used as a boolean to see
if fsmonitor was enabled.  This dual usage and global visibility leads
to confusion when we add the IPC-based provider.  So lets hide the
details in fsmonitor-settings.c and let it decide which provider to
use in the case of multiple settings.  This avoids cluttering up
repo-settings.c with these private details.

A future commit in builtin-fsmonitor series will add the ability to
disqualify worktrees for various reasons, such as being mounted from a
remote volume, where fsmonitor should not be started.  Having the
config settings hidden in fsmonitor-settings.c allows such worktree
restrictions to override the config values used.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor-ipc: create client routines for git-fsmonitor--daemon
Jeff Hostetler [Fri, 25 Mar 2022 18:02:45 +0000 (18:02 +0000)] 
fsmonitor-ipc: create client routines for git-fsmonitor--daemon

Create fsmonitor_ipc__*() client routines to spawn the built-in file
system monitor daemon and send it an IPC request using the `Simple
IPC` API.

Stub in empty fsmonitor_ipc__*() functions for unsupported platforms.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor: enhance existing comments, clarify trivial response handling
Jeff Hostetler [Fri, 25 Mar 2022 18:02:44 +0000 (18:02 +0000)] 
fsmonitor: enhance existing comments, clarify trivial response handling

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe eighth batch
Junio C Hamano [Fri, 25 Feb 2022 23:47:20 +0000 (15:47 -0800)] 
The eighth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'tb/coc-plc-update'
Junio C Hamano [Fri, 25 Feb 2022 23:47:38 +0000 (15:47 -0800)] 
Merge branch 'tb/coc-plc-update'

Document Taylor as a new member of Git PLC at SFC.  Welcome.

* tb/coc-plc-update:
  CODE_OF_CONDUCT.md: update PLC members list

2 years agoMerge branch 'en/ort-inner-merge-conflict-report'
Junio C Hamano [Fri, 25 Feb 2022 23:47:38 +0000 (15:47 -0800)] 
Merge branch 'en/ort-inner-merge-conflict-report'

Messages "ort" merge backend prepares while dealing with conflicted
paths were unnecessarily confusing since it did not differentiate
inner merges and outer merges.

* en/ort-inner-merge-conflict-report:
  merge-ort: make informational messages from recursive merges clearer

2 years agoMerge branch 'rs/pcre-invalid-utf8-fix-fix'
Junio C Hamano [Fri, 25 Feb 2022 23:47:38 +0000 (15:47 -0800)] 
Merge branch 'rs/pcre-invalid-utf8-fix-fix'

Workaround we have for versions of PCRE2 before their version 10.36
were in effect only for their versions newer than 10.36 by mistake,
which has been corrected.

* rs/pcre-invalid-utf8-fix-fix:
  grep: fix triggering PCRE2_NO_START_OPTIMIZE workaround

2 years agoMerge branch 'ds/core-untracked-cache-config'
Junio C Hamano [Fri, 25 Feb 2022 23:47:36 +0000 (15:47 -0800)] 
Merge branch 'ds/core-untracked-cache-config'

Setting core.untrackedCache to true failed to add the untracked
cache extension to the index.

* ds/core-untracked-cache-config:
  dir: force untracked cache with core.untrackedCache

2 years agoMerge branch 'ab/diff-free-more'
Junio C Hamano [Fri, 25 Feb 2022 23:47:36 +0000 (15:47 -0800)] 
Merge branch 'ab/diff-free-more'

Leakfixes.

* ab/diff-free-more:
  diff.[ch]: have diff_free() free options->parseopts
  diff.[ch]: have diff_free() call clear_pathspec(opts.pathspec)

2 years agoMerge branch 'ab/date-mode-release'
Junio C Hamano [Fri, 25 Feb 2022 23:47:36 +0000 (15:47 -0800)] 
Merge branch 'ab/date-mode-release'

Plug (some) memory leaks around parse_date_format().

* ab/date-mode-release:
  date API: add and use a date_mode_release()
  date API: add basic API docs
  date API: provide and use a DATE_MODE_INIT
  date API: create a date.h, split from cache.h
  cache.h: remove always unused show_date_human() declaration

2 years agoMerge branch 'jc/name-rev-stdin'
Junio C Hamano [Fri, 25 Feb 2022 23:47:36 +0000 (15:47 -0800)] 
Merge branch 'jc/name-rev-stdin'

Finishing touches to an earlier "name-rev --annotate-stdin" series.

* jc/name-rev-stdin:
  name-rev: replace --stdin with --annotate-stdin in synopsis

2 years agoMerge branch 'ab/grep-patterntype'
Junio C Hamano [Fri, 25 Feb 2022 23:47:35 +0000 (15:47 -0800)] 
Merge branch 'ab/grep-patterntype'

Some code clean-up in the "git grep" machinery.

* ab/grep-patterntype:
  grep: simplify config parsing and option parsing
  grep.c: do "if (bool && memchr())" not "if (memchr() && bool)"
  grep.h: make "grep_opt.pattern_type_option" use its enum
  grep API: call grep_config() after grep_init()
  grep.c: don't pass along NULL callback value
  built-ins: trust the "prefix" from run_builtin()
  grep tests: add missing "grep.patternType" config tests
  grep tests: create a helper function for "BRE" or "ERE"
  log tests: check if grep_config() is called by "log"-like cmds
  grep.h: remove unused "regex_t regexp" from grep_opt

2 years agoMerge branch 'js/apply-partial-clone-filters-recursively'
Junio C Hamano [Fri, 25 Feb 2022 23:47:35 +0000 (15:47 -0800)] 
Merge branch 'js/apply-partial-clone-filters-recursively'

"git clone --filter=... --recurse-submodules" only makes the
top-level a partial clone, while submodules are fully cloned.  This
behaviour is changed to pass the same filter down to the submodules.

* js/apply-partial-clone-filters-recursively:
  clone, submodule: pass partial clone filters to submodules

2 years agoMerge branch 'ja/i18n-common-messages'
Junio C Hamano [Fri, 25 Feb 2022 23:47:35 +0000 (15:47 -0800)] 
Merge branch 'ja/i18n-common-messages'

Unify more messages to help l10n.

* ja/i18n-common-messages:
  i18n: fix some misformated placeholders in command synopsis
  i18n: remove from i18n strings that do not hold translatable parts
  i18n: factorize "invalid value" messages
  i18n: factorize more 'incompatible options' messages

2 years agoMerge branch 'ab/only-single-progress-at-once'
Junio C Hamano [Fri, 25 Feb 2022 23:47:35 +0000 (15:47 -0800)] 
Merge branch 'ab/only-single-progress-at-once'

Further tweaks on progress API.

* ab/only-single-progress-at-once:
  pack-bitmap-write.c: don't return without stop_progress()
  progress API: unify stop_progress{,_msg}(), fix trace2 bug
  progress.c: refactor stop_progress{,_msg}() to use helpers
  progress.c: use dereferenced "progress" variable, not "(*p_progress)"
  progress.h: format and be consistent with progress.c naming
  progress.c tests: test some invalid usage
  progress.c tests: make start/stop commands on stdin
  progress.c test helper: add missing braces
  leak tests: fix a memory leak in "test-progress" helper

2 years agoMerge branch 'ds/sparse-checkout-requires-per-worktree-config'
Junio C Hamano [Fri, 25 Feb 2022 23:47:33 +0000 (15:47 -0800)] 
Merge branch 'ds/sparse-checkout-requires-per-worktree-config'

"git sparse-checkout" wants to work with per-worktree configuration,
but did not work well in a worktree attached to a bare repository.

* ds/sparse-checkout-requires-per-worktree-config:
  config: make git_configset_get_string_tmp() private
  worktree: copy sparse-checkout patterns and config on add
  sparse-checkout: set worktree-config correctly
  config: add repo_config_set_worktree_gently()
  worktree: create init_worktree_config()
  Documentation: add extensions.worktreeConfig details

2 years agoMerge branch 'ab/ambiguous-object-name'
Junio C Hamano [Fri, 25 Feb 2022 23:47:33 +0000 (15:47 -0800)] 
Merge branch 'ab/ambiguous-object-name'

Error output given in response to an ambiguous object name has been
improved.

* ab/ambiguous-object-name:
  object-name: re-use "struct strbuf" in show_ambiguous_object()
  object-name: iterate ambiguous objects before showing header
  object-name: show date for ambiguous tag objects
  object-name: make ambiguous object output translatable
  object-name: explicitly handle bad tags in show_ambiguous_object()
  object-name: explicitly handle OBJ_BAD in show_ambiguous_object()
  object-name tests: add tests for ambiguous object blind spots

2 years agoThe seventh batch
Junio C Hamano [Thu, 24 Feb 2022 00:58:13 +0000 (16:58 -0800)] 
The seventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'bc/clarify-eol-attr'
Junio C Hamano [Thu, 24 Feb 2022 00:58:04 +0000 (16:58 -0800)] 
Merge branch 'bc/clarify-eol-attr'

Documentation update

* bc/clarify-eol-attr:
  doc: clarify interaction between 'eol' and text=auto

2 years agoMerge branch 'ds/mailmap'
Junio C Hamano [Thu, 24 Feb 2022 00:58:04 +0000 (16:58 -0800)] 
Merge branch 'ds/mailmap'

Update mailmap entries.

* ds/mailmap:
  mailmap: change primary address for Derrick Stolee

2 years agoMerge branch 'ah/log-no-graph'
Junio C Hamano [Thu, 24 Feb 2022 00:58:03 +0000 (16:58 -0800)] 
Merge branch 'ah/log-no-graph'

"git log --graph --graph" used to leak a graph structure, and there
was no way to countermand "--graph" that appear earlier on the
command line.  A "--no-graph" option has been added and resource
leakage has been plugged.

* ah/log-no-graph:
  log: add a --no-graph option
  log: fix memory leak if --graph is passed multiple times

2 years agoMerge branch 'hw/t1410-adjust-test-for-reftable'
Junio C Hamano [Thu, 24 Feb 2022 00:58:03 +0000 (16:58 -0800)] 
Merge branch 'hw/t1410-adjust-test-for-reftable'

Fix tests that are unnecessarily specific to ref-files backend.

* hw/t1410-adjust-test-for-reftable:
  t1410: mark bufsize boundary test as REFFILES
  t1410: use test-tool ref-store to inspect reflogs

2 years agoMerge branch 'ps/fetch-optim-with-commit-graph'
Junio C Hamano [Thu, 24 Feb 2022 00:58:03 +0000 (16:58 -0800)] 
Merge branch 'ps/fetch-optim-with-commit-graph'

A couple of optimization to "git fetch".

* ps/fetch-optim-with-commit-graph:
  fetch: skip computing output width when not printing anything
  fetch-pack: use commit-graph when computing cutoff

2 years agoMerge branch 'sy/t0001-use-path-is-helper'
Junio C Hamano [Thu, 24 Feb 2022 00:58:03 +0000 (16:58 -0800)] 
Merge branch 'sy/t0001-use-path-is-helper'

Test modernization.

* sy/t0001-use-path-is-helper:
  t0001: replace "test [-d|-f]" with test_path_is_* functions

2 years agoMerge branch 'bs/forbid-i18n-of-protocol-token-in-fetch-pack'
Junio C Hamano [Thu, 24 Feb 2022 00:58:03 +0000 (16:58 -0800)] 
Merge branch 'bs/forbid-i18n-of-protocol-token-in-fetch-pack'

L10n support for a few error messages.

* bs/forbid-i18n-of-protocol-token-in-fetch-pack:
  fetch-pack: parameterize message containing 'ready' keyword

2 years agoThe sixth batch
Junio C Hamano [Fri, 18 Feb 2022 17:53:31 +0000 (09:53 -0800)] 
The sixth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jc/glossary-worktree'
Junio C Hamano [Fri, 18 Feb 2022 21:53:30 +0000 (13:53 -0800)] 
Merge branch 'jc/glossary-worktree'

"working tree" and "per-worktree ref" were in glossary, but
"worktree" itself wasn't, which has been corrected.

* jc/glossary-worktree:
  glossary: describe "worktree"

2 years agoMerge branch 'jd/t0015-modernize'
Junio C Hamano [Fri, 18 Feb 2022 21:53:30 +0000 (13:53 -0800)] 
Merge branch 'jd/t0015-modernize'

Test modernization.

* jd/t0015-modernize:
  t/t0015-hash.sh: remove unnecessary '\' at line end

2 years agoMerge branch 'js/short-help-outside-repo-fix'
Junio C Hamano [Fri, 18 Feb 2022 21:53:30 +0000 (13:53 -0800)] 
Merge branch 'js/short-help-outside-repo-fix'

"git cmd -h" outside a repository should error out cleanly for many
commands, but instead it hit a BUG(), which has been corrected.

* js/short-help-outside-repo-fix:
  t0012: verify that built-ins handle `-h` even without gitdir
  checkout/fetch/pull/pack-objects: allow `-h` outside a repository

2 years agoMerge branch 'tb/midx-no-bitmap-for-no-objects'
Junio C Hamano [Fri, 18 Feb 2022 21:53:30 +0000 (13:53 -0800)] 
Merge branch 'tb/midx-no-bitmap-for-no-objects'

When there is no object to write .bitmap file for, "git
multi-pack-index" triggered an error, instead of just skipping,
which has been corrected.

* tb/midx-no-bitmap-for-no-objects:
  midx: prevent writing a .bitmap without any objects

2 years agoMerge branch 'ab/release-transport-ls-refs-options'
Junio C Hamano [Fri, 18 Feb 2022 21:53:29 +0000 (13:53 -0800)] 
Merge branch 'ab/release-transport-ls-refs-options'

* ab/release-transport-ls-refs-options:
  ls-remote & transport API: release "struct transport_ls_refs_options"

2 years agoMerge branch 'ab/hash-object-leakfix'
Junio C Hamano [Fri, 18 Feb 2022 21:53:29 +0000 (13:53 -0800)] 
Merge branch 'ab/hash-object-leakfix'

Trivial leakfix.

* ab/hash-object-leakfix:
  hash-object: fix a trivial leak in --path

2 years agoMerge branch 'gc/branch-recurse-submodules'
Junio C Hamano [Fri, 18 Feb 2022 21:53:29 +0000 (13:53 -0800)] 
Merge branch 'gc/branch-recurse-submodules'

"git branch" learned the "--recurse-submodules" option.

* gc/branch-recurse-submodules:
  branch.c: use 'goto cleanup' in setup_tracking() to fix memory leaks
  branch: add --recurse-submodules option for branch creation
  builtin/branch: consolidate action-picking logic in cmd_branch()
  branch: add a dry_run parameter to create_branch()
  branch: make create_branch() always create a branch
  branch: move --set-upstream-to behavior to dwim_and_setup_tracking()

2 years agoMerge branch 'ab/t0051-skip-on-non-windows'
Junio C Hamano [Fri, 18 Feb 2022 21:53:28 +0000 (13:53 -0800)] 
Merge branch 'ab/t0051-skip-on-non-windows'

Conditional test update.

* ab/t0051-skip-on-non-windows:
  t0051: use "skip_all" under !MINGW in single-test file

2 years agoMerge branch 'ps/avoid-unnecessary-hook-invocation-with-packed-refs'
Junio C Hamano [Fri, 18 Feb 2022 21:53:27 +0000 (13:53 -0800)] 
Merge branch 'ps/avoid-unnecessary-hook-invocation-with-packed-refs'

Because a deletion of ref would need to remove it from both the
loose ref store and the packed ref store, a delete-ref operation
that logically removes one ref may end up invoking ref-transaction
hook twice, which has been corrected.

* ps/avoid-unnecessary-hook-invocation-with-packed-refs:
  refs: skip hooks when deleting uncovered packed refs
  refs: do not execute reference-transaction hook on packing refs
  refs: demonstrate excessive execution of the reference-transaction hook
  refs: allow skipping the reference-transaction hook
  refs: allow passing flags when beginning transactions
  refs: extract packed_refs_delete_refs() to allow control of transaction

2 years agoMerge branch 'pw/use-in-process-checkout-in-rebase'
Junio C Hamano [Fri, 18 Feb 2022 21:53:27 +0000 (13:53 -0800)] 
Merge branch 'pw/use-in-process-checkout-in-rebase'

Use an internal call to reset_head() helper function instead of
spawning "git checkout" in "rebase", and update code paths that are
involved in the change.

* pw/use-in-process-checkout-in-rebase:
  rebase -m: don't fork git checkout
  rebase --apply: set ORIG_HEAD correctly
  rebase --apply: fix reflog
  reset_head(): take struct rebase_head_opts
  rebase: cleanup reset_head() calls
  create_autostash(): remove unneeded parameter
  reset_head(): make default_reflog_action optional
  reset_head(): factor out ref updates
  reset_head(): remove action parameter
  rebase --apply: don't run post-checkout hook if there is an error
  rebase: do not remove untracked files on checkout
  rebase: pass correct arguments to post-checkout hook
  t5403: refactor rebase post-checkout hook tests
  rebase: factor out checkout for up to date branch

2 years agoMerge branch 'cb/clear-quarantine-early-on-all-ref-update-errors'
Junio C Hamano [Fri, 18 Feb 2022 21:53:27 +0000 (13:53 -0800)] 
Merge branch 'cb/clear-quarantine-early-on-all-ref-update-errors'

"receive-pack" checks if it will do any ref updates (various
conditions could reject a push) before received objects are taken
out of the temporary directory used for quarantine purposes, so
that a push that is known-to-fail will not leave crufts that a
future "gc" needs to clean up.

* cb/clear-quarantine-early-on-all-ref-update-errors:
  receive-pack: purge temporary data if no command is ready to run

2 years agoCODE_OF_CONDUCT.md: update PLC members list
Taylor Blau [Fri, 18 Feb 2022 19:07:50 +0000 (14:07 -0500)] 
CODE_OF_CONDUCT.md: update PLC members list

As part of our code of conduct, we maintain a list of active members on
the Project Leadership Committee, which serves a couple of purposes. The
details are in 3f9ef874a7 (CODE_OF_CONDUCT: mention individual
project-leader emails, 2019-09-26), but the gist is as follows:

  - It makes it clear that people with a CoC complaint may contact
    members individually as opposed to the general PLC list (in case the
    subject of their complaint has to do with one of the committee
    members).

  - It also serves as the de-facto list of people on the PLC, which
    isn't committed anywhere else in the tree.

As of [1], Peff is no longer a member of Git's Project Leadership
Committee. Let's update the list of active members accordingly [2].

This also gives us a convenient opportunity to thank Peff for his many
years of service on the PLC, during which he helped the Git community in
more ways than we can easily list here.

[1]: https://lore.kernel.org/git/YboaAe4LWySOoAe7@coredump.intra.peff.net/
[2]: https://lore.kernel.org/git/CAP8UFD2XxP9r3PJ4GQjxUbV=E1ASDq1NDgB-h+S=v-bZQ7DYwQ@mail.gmail.com/

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe fifth batch
Junio C Hamano [Fri, 18 Feb 2022 00:24:23 +0000 (16:24 -0800)] 
The fifth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ab/complete-show-all-commands'
Junio C Hamano [Fri, 18 Feb 2022 00:25:05 +0000 (16:25 -0800)] 
Merge branch 'ab/complete-show-all-commands'

The command line completion script (in contrib/) learned to
complete all Git subcommands, including the ones that are normally
hidden, when GIT_COMPLETION_SHOW_ALL_COMMANDS is used.

* ab/complete-show-all-commands:
  completion: add a GIT_COMPLETION_SHOW_ALL_COMMANDS
  completion tests: re-source git-completion.bash in a subshell

2 years agoMerge branch 'sy/modernize-t-lib-read-tree-m-3way'
Junio C Hamano [Fri, 18 Feb 2022 00:25:05 +0000 (16:25 -0800)] 
Merge branch 'sy/modernize-t-lib-read-tree-m-3way'

Style updates on a test script helper.

* sy/modernize-t-lib-read-tree-m-3way:
  t/lib-read-tree-m-3way: indent with tabs
  t/lib-read-tree-m-3way: modernize style

2 years agoMerge branch 'po/doc-check-ignore-markup-fix'
Junio C Hamano [Fri, 18 Feb 2022 00:25:05 +0000 (16:25 -0800)] 
Merge branch 'po/doc-check-ignore-markup-fix'

Typofix.

* po/doc-check-ignore-markup-fix:
  doc: check-ignore: code-quote an exclamation mark

2 years agoMerge branch 'js/scalar-global-options'
Junio C Hamano [Fri, 18 Feb 2022 00:25:05 +0000 (16:25 -0800)] 
Merge branch 'js/scalar-global-options'

Scalar update.

* js/scalar-global-options:
  scalar: accept -C and -c options before the subcommand

2 years agoMerge branch 'vd/sparse-clean-etc'
Junio C Hamano [Fri, 18 Feb 2022 00:25:05 +0000 (16:25 -0800)] 
Merge branch 'vd/sparse-clean-etc'

"git update-index", "git checkout-index", and "git clean" are
taught to work better with the sparse checkout feature.

* vd/sparse-clean-etc:
  update-index: reduce scope of index expansion in do_reupdate
  update-index: integrate with sparse index
  update-index: add tests for sparse-checkout compatibility
  checkout-index: integrate with sparse index
  checkout-index: add --ignore-skip-worktree-bits option
  checkout-index: expand sparse checkout compatibility tests
  clean: integrate with sparse index
  reset: reorder wildcard pathspec conditions
  reset: fix validation in sparse index test

2 years agoMerge branch 'jz/rev-list-exclude-first-parent-only'
Junio C Hamano [Fri, 18 Feb 2022 00:25:05 +0000 (16:25 -0800)] 
Merge branch 'jz/rev-list-exclude-first-parent-only'

"git log" and friends learned an option --exclude-first-parent-only
to propagate UNINTERESTING bit down only along the first-parent
chain, just like --first-parent option shows commits that lack the
UNINTERESTING bit only along the first-parent chain.

* jz/rev-list-exclude-first-parent-only:
  git-rev-list: add --exclude-first-parent-only flag

2 years agoMerge branch 'jz/patch-id-hunk-header-parsing-fix'
Junio C Hamano [Fri, 18 Feb 2022 00:25:04 +0000 (16:25 -0800)] 
Merge branch 'jz/patch-id-hunk-header-parsing-fix'

Unlike "git apply", "git patch-id" did not handle patches with
hunks that has only 1 line in either preimage or postimage, which
has been corrected.

* jz/patch-id-hunk-header-parsing-fix:
  patch-id: fix scan_hunk_header on diffs with 1 line of before/after
  patch-id: fix antipatterns in tests

2 years agoMerge branch 'hn/reftable-tests'
Junio C Hamano [Fri, 18 Feb 2022 00:25:04 +0000 (16:25 -0800)] 
Merge branch 'hn/reftable-tests'

Prepare more test scripts for the introduction of reftable.

* hn/reftable-tests:
  t5312: prepare for reftable
  t1405: mark test that checks existence as REFFILES
  t1405: explictly delete reflogs for reftable

2 years agoMerge branch 'tk/subtree-merge-not-ff-only'
Junio C Hamano [Fri, 18 Feb 2022 00:25:04 +0000 (16:25 -0800)] 
Merge branch 'tk/subtree-merge-not-ff-only'

When "git subtree" wants to create a merge, it used "git merge" and
let it be affected by end-user's "merge.ff" configuration, which
has been corrected.

* tk/subtree-merge-not-ff-only:
  subtree: force merge commit

2 years agomerge-ort: make informational messages from recursive merges clearer
Elijah Newren [Thu, 17 Feb 2022 06:38:42 +0000 (06:38 +0000)] 
merge-ort: make informational messages from recursive merges clearer

This is another simple change with a long explanation...

merge-recursive and merge-ort are both based on the same recursive idea:
if there is more than one merge base, merge the merge bases (which may
require first merging the merge bases of the merges bases, etc.).  The
depth of the inner merge is recorded via a variable called "call_depth",
which we'll bring up again later.  Naturally, the inner merges
themselves can have conflicts and various messages generated about those
files.

merge-recursive immediately prints to stdout as it goes, at the risk of
printing multiple conflict notices for the same path separated far apart
from each other with many intervenining conflict notices for other paths
between them.  And this is true even if there are no inner merges
involved.  An example of this was given in [1] and apparently caused
some confusion:

    CONFLICT (rename/add): Rename A->B in HEAD. B added in otherbranch
    ...dozens of conflicts for OTHER paths...
    CONFLICT (content): Merge conflicts in B

In contrast, merge-ort collects messages and stores them by path so that
it can print them grouped by path.  Thus, the same case handled by
merge-ort would have output of the form:

    CONFLICT (rename/add): Rename A->B in HEAD. B added in otherbranch
    CONFLICT (content): Merge conflicts in B
    ...dozens of conflicts for OTHER paths...

This is generally helpful, but does make a separate bug more
problematic.  In particular, while merge-recursive might report the
following for a recursive merge:

      Auto-merging dir.c
      Auto-merging midx.c
      CONFLICT (content): Merge conflict in midx.c
    Auto-merging diff.c
    Auto-merging dir.c
    CONFLICT (content): Merge conflict in dir.c

merge-ort would instead report:

    Auto-merging diff.c
    Auto-merging dir.c
    Auto-merging dir.c
    CONFLICT (content): Merge conflict in dir.c
    Auto-merging midx.c
    CONFLICT (content): Merge conflict in midx.c

The fact that messages for the same file are together is probably
helpful in general, but with the indentation missing for the inner
merge it unfortunately serves to confuse.  This probably would lead
users to wonder:

  * Why is Git reporting that "dir.c" is being merged twice?
  * If midx.c has conflicts, why do I not see any when I open up the
    file and why are no conflicts shown in the index?

Fix this output confusion by changing the output to clearly
differentiate the messages for outer merges from the ones for inner
merges, changing the above output from merge-ort to:

    Auto-merging diff.c
      From inner merge:  Auto-merging dir.c
    Auto-merging dir.c
    CONFLICT (content): Merge conflict in dir.c
      From inner merge:  Auto-merging midx.c
      From inner merge:  CONFLICT (content): Merge conflict in midx.c

(Note: the number of spaces after the 'From inner merge:' is
2*call_depth).

One other thing to note here, that I didn't notice until typing up this
commit message, is that merge-recursive does not print any messages from
the inner merges by default; the extra verbosity has to be requested.
merge-ort currently has no verbosity controls and always prints these.
We may also want to change that, but for now, just make the output
clearer with these extra markings and indentation.

[1] https://lore.kernel.org/git/CAGyf7-He4in8JWUh9dpAwvoPkQz9hr8nCBpxOxhZEd8+jtqTpg@mail.gmail.com/

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogrep: fix triggering PCRE2_NO_START_OPTIMIZE workaround
René Scharfe [Thu, 17 Feb 2022 21:14:29 +0000 (22:14 +0100)] 
grep: fix triggering PCRE2_NO_START_OPTIMIZE workaround

PCRE2 bug 2642 was fixed in version 10.36.  Our 95ca1f987e (grep/pcre2:
better support invalid UTF-8 haystacks, 2021-01-24) worked around it on
older versions by setting the flag PCRE2_NO_START_OPTIMIZE.  797c359978
(grep/pcre2: use compile-time PCREv2 version test, 2021-02-18) switched
it around to set the flag on 10.36 and higher instead, while it claimed
to use "the same test done at compile-time".

Switch the condition back to apply the workaround on PCRE2 versions
_before_ 10.36.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodir: force untracked cache with core.untrackedCache
Derrick Stolee [Thu, 17 Feb 2022 21:00:29 +0000 (21:00 +0000)] 
dir: force untracked cache with core.untrackedCache

The GIT_FORCE_UNTRACKED_CACHE environment variable writes the untracked
cache more frequently than the core.untrackedCache config variable. This
is due to how read_directory() handles the creation of an untracked
cache.

Before this change, Git would not create the untracked cache extension
for an index that did not already have one. Users would need to run a
command such as 'git update-index --untracked-cache' before the index
would actually contain an untracked cache.

In particular, users noticed that the untracked cache would not appear
even with core.untrackedCache=true. Some users reported setting
GIT_FORCE_UNTRACKED_CACHE=1 in their engineering system environment to
ensure the untracked cache would be created.

The decision to not write the untracked cache without an environment
variable tracks back to fc9ecbeb9 (dir.c: don't flag the index as dirty
for changes to the untracked cache, 2018-02-05). The motivation of that
change is that writing the index is expensive, and if the untracked
cache is the only thing that needs to be written, then it is more
expensive than the benefit of the cache. However, this also means that
the untracked cache never gets populated, so the user who enabled it via
config does not actually get the extension until running 'git
update-index --untracked-cache' manually or using the environment
variable.

We have had a version of this change in the microsoft/git fork for a few
major releases now. It has been working well to get users into a good
state. Yes, that first index write is slow, but the remaining index
writes are much faster than they would be without this change.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe fourth batch
Junio C Hamano [Wed, 16 Feb 2022 23:12:19 +0000 (15:12 -0800)] 
The fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ab/do-not-hide-failures-in-git-dot-pm'
Junio C Hamano [Wed, 16 Feb 2022 23:14:30 +0000 (15:14 -0800)] 
Merge branch 'ab/do-not-hide-failures-in-git-dot-pm'

Git.pm update.

* ab/do-not-hide-failures-in-git-dot-pm:
  perl Git.pm: don't ignore signalled failure in _cmd_close()

2 years agoMerge branch 'js/no-more-legacy-stash'
Junio C Hamano [Wed, 16 Feb 2022 23:14:30 +0000 (15:14 -0800)] 
Merge branch 'js/no-more-legacy-stash'

Removal of unused code and doc.

* js/no-more-legacy-stash:
  stash: stop warning about the obsolete `stash.useBuiltin` config setting
  stash: remove documentation for `stash.useBuiltin`
  add: remove support for `git-legacy-stash`
  git-sh-setup: remove remnant bits referring to `git-legacy-stash`

2 years agoMerge branch 'js/diff-filter-negation-fix'
Junio C Hamano [Wed, 16 Feb 2022 23:14:30 +0000 (15:14 -0800)] 
Merge branch 'js/diff-filter-negation-fix'

"git diff --diff-filter=aR" is now parsed correctly.

* js/diff-filter-negation-fix:
  diff-filter: be more careful when looking for negative bits
  diff.c: move the diff filter bits definitions up a bit
  docs(diff): lose incorrect claim about `diff-files --diff-filter=A`