]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
9 months agoGit 2.42-rc2 v2.42.0-rc2
Junio C Hamano [Tue, 15 Aug 2023 17:20:02 +0000 (10:20 -0700)] 
Git 2.42-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'pw/diff-no-index-from-named-pipes'
Junio C Hamano [Tue, 15 Aug 2023 17:19:47 +0000 (10:19 -0700)] 
Merge branch 'pw/diff-no-index-from-named-pipes'

Test updates.

* pw/diff-no-index-from-named-pipes:
  t4053: avoid writing to unopened pipe
  t4053: avoid race when killing background processes

9 months agoMerge branch 'st/mv-lstat-fix'
Junio C Hamano [Tue, 15 Aug 2023 17:19:47 +0000 (10:19 -0700)] 
Merge branch 'st/mv-lstat-fix'

Correct use of lstat() that assumed a failing call would not
clobber the statbuf.

* st/mv-lstat-fix:
  mv: handle lstat() failure correctly

9 months agoMerge branch 'jc/send-email-pre-process-fix'
Junio C Hamano [Tue, 15 Aug 2023 17:19:47 +0000 (10:19 -0700)] 
Merge branch 'jc/send-email-pre-process-fix'

Test fix.

* jc/send-email-pre-process-fix:
  t9001: remove excessive GIT_SEND_EMAIL_NOTTY=1

9 months agoMerge branch 'ds/maintenance-on-windows-fix'
Junio C Hamano [Tue, 15 Aug 2023 17:19:47 +0000 (10:19 -0700)] 
Merge branch 'ds/maintenance-on-windows-fix'

Windows updates.

* ds/maintenance-on-windows-fix:
  git maintenance: avoid console window in scheduled tasks on Windows
  win32: add a helper to run `git.exe` without a foreground window

9 months agoMerge branch 'js/allow-t4000-to-be-indented-with-spaces'
Junio C Hamano [Mon, 14 Aug 2023 20:26:41 +0000 (13:26 -0700)] 
Merge branch 'js/allow-t4000-to-be-indented-with-spaces'

File attribute update.

* js/allow-t4000-to-be-indented-with-spaces:
  t0040: declare non-tab indentation to be okay in this script

9 months agoMerge branch 'jk/send-email-with-new-readline'
Junio C Hamano [Mon, 14 Aug 2023 20:26:41 +0000 (13:26 -0700)] 
Merge branch 'jk/send-email-with-new-readline'

Adjust to newer Term::ReadLine to prevent it from breaking
the interactive prompt code in send-email.

* jk/send-email-with-new-readline:
  send-email: avoid creating more than one Term::ReadLine object
  send-email: drop FakeTerm hack

9 months agoMerge branch 'jk/repack-leakfix'
Junio C Hamano [Mon, 14 Aug 2023 20:26:40 +0000 (13:26 -0700)] 
Merge branch 'jk/repack-leakfix'

Leakfix.

* jk/repack-leakfix:
  repack: free geometry struct

9 months agoMerge branch 'rs/parse-opt-forbid-set-int-0-without-noneg'
Junio C Hamano [Mon, 14 Aug 2023 20:26:40 +0000 (13:26 -0700)] 
Merge branch 'rs/parse-opt-forbid-set-int-0-without-noneg'

Developer support to detect meaningless combination of options.

* rs/parse-opt-forbid-set-int-0-without-noneg:
  parse-options: disallow negating OPTION_SET_INT 0

9 months agoMerge branch 'ob/rebase-conflict-advice-i18n-fix'
Junio C Hamano [Mon, 14 Aug 2023 20:26:40 +0000 (13:26 -0700)] 
Merge branch 'ob/rebase-conflict-advice-i18n-fix'

i18n coverage improvement and avoidance of sentence lego.

* ob/rebase-conflict-advice-i18n-fix:
  advice: handle "rebase" in error_resolve_conflict()

9 months agot4053: avoid writing to unopened pipe
Jeff King [Sun, 13 Aug 2023 16:24:40 +0000 (12:24 -0400)] 
t4053: avoid writing to unopened pipe

This fixes an occasional hang I see when running t4053 with
--verbose-log using dash.

Commit 1e3f26542a (diff --no-index: support reading from named pipes,
2023-07-05) added a test that "diff --no-index" will complain when
comparing a named pipe and a directory. The minimum we need to test this
is to mkfifo the pipe, and then run "git diff --no-index pipe some_dir".
But the test does one thing more: it spawns a background shell process
that opens the pipe for writing, like this:

        {
                (>pipe) &
        } &&

This extra writer _could_ be useful if Git misbehaves and tries to open
the pipe for reading. Without the writer, Git would block indefinitely
and the test would never end. But since we do not have such a bug, Git
does not open the pipe and it is the writing process which will block
indefinitely, since there are no readers. The test addresses this by
running "kill $!" in a test_when_finished block. Since the writer should
be blocking forever, this kill command will reliably find it waiting.

However, this seems to be somewhat racy, in that the writing process
sometimes hangs around even after the "kill". In a normal run of the
test script without options, this doesn't have any effect; the
main test script completes anyway. But with --verbose-log, we spawn a
"tee" process that reads the script output, and it won't end until all
descriptors pointing to its input pipe are closed. And the background
process that is hanging around still has its stderr, etc, pointed into
that pipe.

You can reproduce the situation like this:

  cd t
  ./t4053-diff-no-index.sh --verbose-log --stress

Let that run for a few minutes, and then you'll find that some of the
runs have hung. For example, at 11:53, I ran:

  $ ps xk start o pid,start,command | grep tee | head
   713459 11:48:06 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-9.out
   713527 11:48:06 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-15.out
   719434 11:48:07 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-1.out
   728117 11:48:08 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-5.out
   738738 11:48:09 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-31.out
   739457 11:48:09 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-27.out
   744432 11:48:10 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-21.out
   744471 11:48:10 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-29.out
   761961 11:48:12 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-0.out
   812299 11:48:19 tee -a /home/peff/compile/git/t/test-results/t4053-diff-no-index.stress-8.out

All of these have been hung for several minutes. We can investigate one
and see that it's waiting to get EOF on its input:

  $ strace -p 713459
  strace: Process 713459 attached
  read(0,
  ^C

Who else has that descriptor open?

  $ lsof -a -p 713459 -d 0 +E
  COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME
  tee     713459 peff    0r  FIFO   0,13      0t0 3943636 pipe 719203,sh,5w 719203,sh,7w 719203,sh,12w 719203,sh,13w
  sh      719203 peff    5w  FIFO   0,13      0t0 3943636 pipe 713459,tee,0r 719203,sh,7w 719203,sh,12w 719203,sh,13w
  sh      719203 peff    7w  FIFO   0,13      0t0 3943636 pipe 713459,tee,0r 719203,sh,5w 719203,sh,12w 719203,sh,13w
  sh      719203 peff   12w  FIFO   0,13      0t0 3943636 pipe 713459,tee,0r 719203,sh,5w 719203,sh,7w 719203,sh,13w
  sh      719203 peff   13w  FIFO   0,13      0t0 3943636 pipe 713459,tee,0r 719203,sh,5w 719203,sh,7w 719203,sh,12w

It's a shell, presumably a subshell spawned by the main script. Though
it may seem odd, having the same descriptor open several times is not
unreasonable (they're all basically the original stdout/stderr of the
script that has been copied). And they should all close when the process
exits. So what's it doing? Curiously, it will exit as soon as we strace
it:

  $ strace -s 64 -p 719203
  strace: Process 719203 attached
  openat(AT_FDCWD, "pipe", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)
  write(2, "./t4053-diff-no-index.sh: 7: eval: ", 35) = 35
  write(2, "cannot create pipe: Directory nonexistent", 41) = 41
  write(2, "\n", 1)                       = 1
  exit_group(2)                           = ?
  +++ exited with 2 +++

I think what happens is this:

  - it is blocking in the openat() call for the pipe, as we expect (so
    this is definitely the backgrounded subshell mentioned above)

  - strace sends signals (probably STOP/CONT); those cause the kernel to
    stop blocking, but libc will restart the system call automatically

  - by this time, the "pipe" fifo is gone, so we'll actually try to
    create a regular file. But of course the surrounding directory is
    gone, too! So we get ENOENT, and then exit as normal.

So the blocking is something we expect to happen. But what we didn't
expect is for the process to still exist at all! It should have been
killed earlier when the parent process called "kill", but it wasn't. And
we can't catch the race at this point, because it happened much earlier.

One can guess, though, that there is some race with the shell setting up
the signal handling in the backgrounded subshell, and possibly blocking
or ignoring signals at the time that the "kill" is received.  Curiously,
the race does not seem to happen if I use "bash" instead of "dash", so
presumably bash's setup here is more atomic.

One fix might be to try killing the subshell more aggressively, either
using SIGKILL, or looping on kill/wait. But that seems complex and
likely to introduce new problems/races. Instead, we can observe that the
writer is not needed at all. Git will notice the pipe via stat() before
it is ever opened. So we can simply drop the writer subshell entirely.

If we ever changed Git to open the path and fstat() it, this would
result in the test hanging. But we're not likely to do that. After all,
we have to stat() paths to see if they are openable at all (e.g., it
could be a directory), so this seems like a low risk. And anybody who
does make such a change will immediately see the issue, as Git would
hang consistently.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agot4053: avoid race when killing background processes
Phillip Wood [Thu, 10 Aug 2023 14:33:13 +0000 (14:33 +0000)] 
t4053: avoid race when killing background processes

The test 'diff --no-index reads from pipes' starts a couple of
background processes that write to the pipes that are passed to "diff
--no-index". If the test passes then we expect these processes to exit
as all their output will have been read. However if the test fails
then we want to make sure they do not hang about on the users machine
and the test remembers they should be killed by calling

      test_when_finished  "! kill $!"

after each background process is created. Unfortunately there is a
race where test_when_finished may run before the background process
exits even when all its output has been read resulting in the kill
command succeeding which causes the test to fail. Fix this by ignoring
the exit status of the kill command. If the diff is successful we
could instead wait for the background process to exit and check their
status but that feels like it is testing the platform's printf
implementation rather than git's code.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoGit 2.42-rc1 v2.42.0-rc1
Junio C Hamano [Wed, 9 Aug 2023 23:17:27 +0000 (16:17 -0700)] 
Git 2.42-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'pw/rebase-skip-commit-message-fix'
Junio C Hamano [Wed, 9 Aug 2023 23:18:16 +0000 (16:18 -0700)] 
Merge branch 'pw/rebase-skip-commit-message-fix'

"git rebase -i" with a series of squash/fixup, when one of the
steps stopped in conflicts and ended up getting skipped, did not
handle the accumulated commit log messages, which has been
corrected.

* pw/rebase-skip-commit-message-fix:
  rebase --skip: fix commit message clean up when skipping squash

9 months agoMerge branch 'ma/locate-in-path-for-windows'
Junio C Hamano [Wed, 9 Aug 2023 23:18:15 +0000 (16:18 -0700)] 
Merge branch 'ma/locate-in-path-for-windows'

"git bisect visualize" stopped running "gitk" on Git for Windows
when the command was reimplemented in C around Git 2.34 timeframe.
This has been corrected.

* ma/locate-in-path-for-windows:
  docs: update when `git bisect visualize` uses `gitk`
  compat/mingw: implement a native locate_in_PATH()
  run-command: conditionally define locate_in_PATH()

9 months agoMerge branch 'bc/ignore-clangd-cache'
Junio C Hamano [Wed, 9 Aug 2023 23:18:15 +0000 (16:18 -0700)] 
Merge branch 'bc/ignore-clangd-cache'

.gitignore update.

* bc/ignore-clangd-cache:
  gitignore: ignore clangd .cache directory

9 months agoMerge branch 'bc/ident-dot-is-no-longer-crud-letter'
Junio C Hamano [Wed, 9 Aug 2023 23:18:15 +0000 (16:18 -0700)] 
Merge branch 'bc/ident-dot-is-no-longer-crud-letter'

Exclude "." from the set of characters to be removed from the
beginning and the end of the human-readable name.

* bc/ident-dot-is-no-longer-crud-letter:
  ident: don't consider '.' a crud

9 months agoMerge branch 'ew/hash-with-openssl-evp'
Junio C Hamano [Wed, 9 Aug 2023 23:18:15 +0000 (16:18 -0700)] 
Merge branch 'ew/hash-with-openssl-evp'

Adjust to OpenSSL 3+, which deprecates its SHA-1 functions based on
its traditional API, by using its EVP API instead.

* ew/hash-with-openssl-evp:
  avoid SHA-1 functions deprecated in OpenSSL 3+
  sha256: avoid functions deprecated in OpenSSL 3+

9 months agogit maintenance: avoid console window in scheduled tasks on Windows
Johannes Schindelin [Wed, 9 Aug 2023 16:54:47 +0000 (16:54 +0000)] 
git maintenance: avoid console window in scheduled tasks on Windows

We just introduced a helper to avoid showing a console window when the
scheduled task runs `git.exe`. Let's actually use it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agowin32: add a helper to run `git.exe` without a foreground window
Johannes Schindelin [Wed, 9 Aug 2023 16:54:46 +0000 (16:54 +0000)] 
win32: add a helper to run `git.exe` without a foreground window

On Windows, there are two kinds of executables, console ones and
non-console ones. Git's executables are all console ones.

When launching the former e.g. in a scheduled task, a CMD window pops
up. This is not what we want for the tasks installed via the `git
maintenance` command.

To work around this, let's introduce `headless-git.exe`, which is a
non-console program that does _not_ pop up any window. All it does is to
re-launch `git.exe`, suppressing that console window, passing through
all command-line arguments as-are.

Helped-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Helped-by: Yuyi Wang <Strawberry_Str@hotmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agot9001: remove excessive GIT_SEND_EMAIL_NOTTY=1
Oswald Buddenhagen [Wed, 9 Aug 2023 17:15:31 +0000 (19:15 +0200)] 
t9001: remove excessive GIT_SEND_EMAIL_NOTTY=1

This was added by 3ece9bf0f9 (send-email: clear the $message_id after
validation, 2023-05-17) for no apparent reason, as this is required only
in cases when git's stdin is (must be) redirected, which isn't the case
here.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agomv: handle lstat() failure correctly
Sebastian Thiel [Wed, 9 Aug 2023 07:47:41 +0000 (07:47 +0000)] 
mv: handle lstat() failure correctly

When moving a directory onto another with `git mv` various checks are
performed. One of of these validates that the destination is not existing.

When calling `lstat` on the destination path and it fails as the path
doesn't exist, some environments seem to overwrite the passed  in
`stat` memory nonetheless (I observed this issue on debian 12 of x86_64,
running on OrbStack on ARM, emulated with Rosetta).

This would affect the code that followed as it would still acccess a now
modified `st` structure, which now seems to contain uninitialized memory.
`S_ISDIR(st_dir_mode)` would then typically return false causing the code
to run into a bad case.

The fix avoids overwriting the existing `st` structure, providing an
alternative that exists only for that purpose.

Note that this patch minimizes complexity instead of stack-frame size.

Signed-off-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoparse-options: disallow negating OPTION_SET_INT 0
René Scharfe [Tue, 8 Aug 2023 20:05:57 +0000 (22:05 +0200)] 
parse-options: disallow negating OPTION_SET_INT 0

An option of type OPTION_SET_INT can be defined to set its variable to
zero.  It's negated variant will do the same, though, which is
confusing.  Several such options were fixed by disabling negation,
changing the value to set or using a different option type:

991c552916 (ls-tree: fix --no-full-name, 2023-07-18)
e12cb98e1e (branch: reject "--no-all" and "--no-remotes" early, 2023-07-18)
68cbb20e73 (show-branch: reject --[no-](topo|date)-order, 2023-07-19)
3821eb6c3d (reset: reject --no-(mixed|soft|hard|merge|keep) option, 2023-07-19)
36f76d2a25 (pack-objects: fix --no-quiet, 2023-07-21)
3a5f308741 (pack-objects: fix --no-keep-true-parents, 2023-07-21)
c95ae3ff9c (describe: fix --no-exact-match, 2023-07-21)
d089a06421 (bundle: use OPT_PASSTHRU_ARGV, 2023-07-29)

Check for such options that allow negation in parse_options_check() and
report them to find future cases quicker.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agorepack: free geometry struct
Jeff King [Tue, 8 Aug 2023 18:50:23 +0000 (14:50 -0400)] 
repack: free geometry struct

When the program is ending, we call clear_pack_geometry() to free any
resources in the pack_geometry struct. But the struct itself is
allocated on the heap, and leak-checkers will complain about the
resulting small leak.

This one was marked by Coverity as a "new" leak, though it has existed
since 0fabafd0b9 (builtin/repack.c: add '--geometric' option,
2021-02-22). This might be because recent unrelated changes in the file
confused it about what is new and what is not. But regardless, it is
worth addressing.

We can fix it easily by free-ing the struct. We'll convert our "clear"
function to "free", since the allocation happens in the matching init()
function (though since there is only one call to each, and the struct is
local to this file, it's mostly academic).

Another option would be to put the struct on the stack rather than the
heap. However, this gets tricky, as we check the pointer against NULL in
several places to decide whether we're in geometric mode.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agosend-email: avoid creating more than one Term::ReadLine object
Jeff King [Tue, 8 Aug 2023 18:15:31 +0000 (14:15 -0400)] 
send-email: avoid creating more than one Term::ReadLine object

Every time git-send-email calls its ask() function to prompt the user,
we call term(), which instantiates a new Term::ReadLine object. But in
v1.46 of Term::ReadLine::Gnu (which provides the Term::ReadLine
interface on some platforms), its constructor refuses to create a second
instance[1]. So on systems with that version of the module, most
git-send-email instances will fail (as we usually prompt for both "to"
and "in-reply-to" unless the user provided them on the command line).

We can fix this by keeping a single instance variable and returning it
for each call to term(). In perl 5.10 and up, we could do that with a
"state" variable. But since we only require 5.008, we'll do it the
old-fashioned way, with a lexical "my" in its own scope.

Note that the tests in t9001 detect this problem as-is, since the
failure mode is for the program to die. But let's also beef up the
"Prompting works" test to check that it correctly handles multiple
inputs (if we had chosen to keep our FakeTerm hack in the previous
commit, then the failure mode would be incorrectly ignoring prompts
after the first).

[1] For discussion of why multiple instances are forbidden, see:
    https://github.com/hirooih/perl-trg/issues/16

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agosend-email: drop FakeTerm hack
Jeff King [Tue, 8 Aug 2023 18:14:36 +0000 (14:14 -0400)] 
send-email: drop FakeTerm hack

Back in 280242d1cc (send-email: do not barf when Term::ReadLine does not
like your terminal, 2006-07-02), we added a fallback for when
Term::ReadLine's constructor failed: we'd have a FakeTerm object
instead, which would then die if anybody actually tried to call
readline() on it. Since we instantiated the $term variable at program
startup, we needed this workaround to let the program run in modes when
we did not prompt the user.

But later, in f4dc9432fd (send-email: lazily load modules for a big
speedup, 2021-05-28), we started loading Term::ReadLine lazily only when
ask() is called. So at that point we know we're trying to prompt the
user, and we can just die if ReadLine instantiation fails, rather than
making this fake object to lazily delay showing the error.

This should be OK even if there is no tty (e.g., we're in a cron job),
because Term::ReadLine will return a stub object in that case whose "IN"
and "OUT" functions return undef. And since 5906f54e47 (send-email:
don't attempt to prompt if tty is closed, 2009-03-31), we check for that
case and skip prompting.

And we can be sure that FakeTerm was not kicking in for such a
situation, because it has actually been broken since that commit! It
does not define "IN" or "OUT" methods, so perl would barf with an error.
If FakeTerm was in use, we were neither honoring what 5906f54e47 tried
to do, nor producing the readable message that 280242d1cc intended.

So we're better off just dropping FakeTerm entirely, and letting the
error reported by constructing Term::ReadLine through.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agot0040: declare non-tab indentation to be okay in this script
Johannes Schindelin [Tue, 8 Aug 2023 10:37:34 +0000 (10:37 +0000)] 
t0040: declare non-tab indentation to be okay in this script

By necessity, this script needs to verify that certain Git output
matches expectations, including text indented with spaces instead of
tabs.

Most recently, such a check was introduced in 448abbba6347 (short help:
allow multi-line opthelp, 2023-07-18) which is reported by `git diff
--check 448abbba6347^!` as having whitespace issues.

Let's not complain about this because it is intentional.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoadvice: handle "rebase" in error_resolve_conflict()
Oswald Buddenhagen [Mon, 7 Aug 2023 17:09:35 +0000 (19:09 +0200)] 
advice: handle "rebase" in error_resolve_conflict()

This makes sure that we get a properly translated message rather than
inserting the command (which we failed to translate) into a generic
fallback message.

The function is called indirectly via die_resolve_conflict() with fixed
strings, and directly with the string obtained via action_name(), which
in turn returns a string from a fixed set. Hence we know that the now
covered set of strings is exhausitive, and will therefore BUG() out when
encountering an unexpected string. We also know that all covered strings
are actually used.

Arguably, the above suggests that it would be cleaner to pass the
command as an enum in the first place, but that's left for another time.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoA few more topics before -rc1
Junio C Hamano [Mon, 7 Aug 2023 17:18:48 +0000 (10:18 -0700)] 
A few more topics before -rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agomailmap: change primary address for Glen Choo
Glen Choo [Mon, 7 Aug 2023 18:41:50 +0000 (18:41 +0000)] 
mailmap: change primary address for Glen Choo

Glen will lose access to his work email soon.

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'ew/sha256-gcrypt-leak-fixes'
Junio C Hamano [Mon, 7 Aug 2023 18:57:18 +0000 (11:57 -0700)] 
Merge branch 'ew/sha256-gcrypt-leak-fixes'

Leakfixes.

* ew/sha256-gcrypt-leak-fixes:
  sha256/gcrypt: die on gcry_md_open failures
  sha256/gcrypt: fix memory leak with SHA-256 repos
  sha256/gcrypt: fix build with SANITIZE=leak

9 months agoMerge branch 'rs/bundle-parseopt-cleanup'
Junio C Hamano [Mon, 7 Aug 2023 18:57:18 +0000 (11:57 -0700)] 
Merge branch 'rs/bundle-parseopt-cleanup'

Code clean-up.

* rs/bundle-parseopt-cleanup:
  bundle: use OPT_PASSTHRU_ARGV

9 months agoMerge branch 'am/doc-sha256'
Junio C Hamano [Mon, 7 Aug 2023 18:57:18 +0000 (11:57 -0700)] 
Merge branch 'am/doc-sha256'

Tone down the warning on SHA-256 repositories being an experimental
curiosity.  We do not have support for them to interoperate with
traditional SHA-1 repositories, but at this point, we do not plan
to make breaking changes to SHA-256 repositories and there is no
longer need for such a strongly phrased warning.

* am/doc-sha256:
  doc: sha256 is no longer experimental

9 months agoMerge branch 'tb/commit-graph-tests'
Junio C Hamano [Mon, 7 Aug 2023 18:57:18 +0000 (11:57 -0700)] 
Merge branch 'tb/commit-graph-tests'

Test updates.

* tb/commit-graph-tests:
  t/lib-commit-graph.sh: avoid sub-shell in `graph_git_behavior()`
  t5328: avoid top-level directory changes
  t5318: avoid top-level directory changes
  t/lib-commit-graph.sh: avoid directory change in `graph_git_behavior()`
  t/lib-commit-graph.sh: allow `graph_read_expect()` in sub-directories

9 months agogitignore: ignore clangd .cache directory
brian m. carlson [Fri, 4 Aug 2023 17:13:28 +0000 (17:13 +0000)] 
gitignore: ignore clangd .cache directory

In at least some versions of clangd, including version 15 in Ubuntu
23.04, a directory, .cache, is written in the root of the repository
with index information about the files in the repository.  Since clangd
is the most common language server protocol (LSP) implementation for C,
and we already support it using the GENERATE_COMPILATION_DATABASE flags
to make it functional, it's likely many users are using or will want to
use it.

As a result, ignore the ".cache" directory to help avoid users
accidentally committing the data.

Signed-off-by: brian m. carlson <bk2204@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoGit 2.42-rc0 v2.42.0-rc0
Junio C Hamano [Fri, 4 Aug 2023 17:01:45 +0000 (10:01 -0700)] 
Git 2.42-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'jc/branch-in-use-error-message'
Junio C Hamano [Fri, 4 Aug 2023 17:52:31 +0000 (10:52 -0700)] 
Merge branch 'jc/branch-in-use-error-message'

"git branch -f X" to repoint the branch X said that X was "checked
out" in another worktree, even when branch X was not and instead
being bisected or rebased.  The message was reworded to say the
branch was "in use".

* jc/branch-in-use-error-message:
  branch: update the message to refuse touching a branch in-use

9 months agoMerge branch 'hy/blame-in-bare-with-contents'
Junio C Hamano [Fri, 4 Aug 2023 17:52:31 +0000 (10:52 -0700)] 
Merge branch 'hy/blame-in-bare-with-contents'

"git blame --contents=file" has been taught to work in a bare
repository.

* hy/blame-in-bare-with-contents:
  blame: allow --contents to work with bare repo

9 months agoMerge branch 'jc/parse-options-short-help'
Junio C Hamano [Fri, 4 Aug 2023 17:52:31 +0000 (10:52 -0700)] 
Merge branch 'jc/parse-options-short-help'

Command line parser fix, and a small parse-options API update.

* jc/parse-options-short-help:
  short help: allow a gap smaller than USAGE_GAP
  remote: simplify "remote add --tags" help text
  short help: allow multi-line opthelp

9 months agoMerge branch 'jc/doc-sent-patch-now-what'
Junio C Hamano [Fri, 4 Aug 2023 17:52:30 +0000 (10:52 -0700)] 
Merge branch 'jc/doc-sent-patch-now-what'

Process document update.

* jc/doc-sent-patch-now-what:
  MyFirstContribution: refrain from self-iterating too much

9 months agoMerge branch 'la/doc-choose-starting-point-fixup'
Junio C Hamano [Fri, 4 Aug 2023 17:52:30 +0000 (10:52 -0700)] 
Merge branch 'la/doc-choose-starting-point-fixup'

Clarify how to pick a starting point for a new topic in the
SubmittingPatches document.

* la/doc-choose-starting-point-fixup:
  SubmittingPatches: use of older maintenance tracks is an exception
  SubmittingPatches: explain why 'next' and above are inappropriate base
  SubmittingPatches: choice of base for fixing an older maintenance track

9 months agoMerge branch 'pv/doc-submodule-update-settings'
Junio C Hamano [Fri, 4 Aug 2023 17:52:30 +0000 (10:52 -0700)] 
Merge branch 'pv/doc-submodule-update-settings'

Rewrite the description of giving a custom command to the
submodule.<name>.update configuration variable.

* pv/doc-submodule-update-settings:
  doc: highlight that .gitmodules does not support !command

9 months agoMerge branch 'ja/worktree-orphan-fix'
Junio C Hamano [Fri, 4 Aug 2023 17:52:30 +0000 (10:52 -0700)] 
Merge branch 'ja/worktree-orphan-fix'

Fix tests with unportable regex patterns.

* ja/worktree-orphan-fix:
  t2400: rewrite regex to avoid unintentional PCRE
  builtin/worktree.c: convert tab in advice to space
  t2400: drop no-op `--sq` from rev-parse call

9 months agoMerge branch 'jc/retire-get-sha1-hex'
Junio C Hamano [Fri, 4 Aug 2023 17:52:30 +0000 (10:52 -0700)] 
Merge branch 'jc/retire-get-sha1-hex'

The implementation of "get_sha1_hex()" that reads a hexadecimal
string that spells a full object name has been extended to cope
with any hash function used in the repository, but the "sha1" in
its name survived.  Rename it to get_hash_hex(), a name that is
more consistent within its friends like get_hash_hex_algop().

* jc/retire-get-sha1-hex:
  hex: retire get_sha1_hex()

9 months agoMerge branch 'la/doc-choose-starting-point'
Junio C Hamano [Fri, 4 Aug 2023 17:52:29 +0000 (10:52 -0700)] 
Merge branch 'la/doc-choose-starting-point'

Clarify how to choose the starting point for a new topic in
developer guidance document.

* la/doc-choose-starting-point:
  SubmittingPatches: simplify guidance for choosing a starting point
  SubmittingPatches: emphasize need to communicate non-default starting points
  SubmittingPatches: de-emphasize branches as starting points
  SubmittingPatches: discuss subsystems separately from git.git
  SubmittingPatches: reword awkward phrasing

9 months agodocs: update when `git bisect visualize` uses `gitk`
Matthias Aßhauer [Fri, 4 Aug 2023 04:08:44 +0000 (04:08 +0000)] 
docs: update when `git bisect visualize` uses `gitk`

This check has involved more environment variables than just `DISPLAY` since
508e84a790 (bisect view: check for MinGW32 and MacOSX in addition to X11,
2008-02-14), so let's update the documentation accordingly.

Signed-off-by: Matthias Aßhauer <mha1993@live.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agocompat/mingw: implement a native locate_in_PATH()
Matthias Aßhauer [Fri, 4 Aug 2023 04:08:43 +0000 (04:08 +0000)] 
compat/mingw: implement a native locate_in_PATH()

since 5e1f28d (bisect--helper: reimplement `bisect_visualize()` shell
 function in C, 2021-09-13) `git bisect visualize` uses exists_in_PATH()
to check wether it should call `gitk`, but exists_in_PATH() relies on
locate_in_PATH() which currently only understands POSIX-ish PATH variables
(a list of paths, separated by colons) on native Windows executables
we encounter Windows PATH variables (a list of paths that often contain
drive letters (and thus colons), separated by semicolons). Luckily we do
already have a function that can lookup executables on windows PATHs:
path_lookup(). Implement a small replacement for the existing
locate_in_PATH() based on path_lookup().

Reported-by: Louis Strous <Louis.Strous@intellimagic.com>
Signed-off-by: Matthias Aßhauer <mha1993@live.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agorun-command: conditionally define locate_in_PATH()
Matthias Aßhauer [Fri, 4 Aug 2023 04:08:42 +0000 (04:08 +0000)] 
run-command: conditionally define locate_in_PATH()

This commit doesn't change any behaviour by itself, but allows us to easily
define compat replacements for locate_in_PATH(). It prepares us for the next
commit that adds a native Windows implementation of locate_in_PATH().

Signed-off-by: Matthias Aßhauer <mha1993@live.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agorebase --skip: fix commit message clean up when skipping squash
Phillip Wood [Thu, 3 Aug 2023 13:09:35 +0000 (13:09 +0000)] 
rebase --skip: fix commit message clean up when skipping squash

During a series of "fixup" and/or "squash" commands, the interactive
rebase accumulates a commit message from all the commits that are being
squashed together. If one of the commits has conflicts when it is picked
and the user chooses to skip that commit then we need to remove that
commit's message from accumulated messages.  To do this 15ef69314d5
(rebase --skip: clean up commit message after a failed fixup/squash,
2018-04-27) updated commit_staged_changes() to reset the accumulated
message to the commit message of HEAD (which does not contain the
message from the skipped commit) when the last command was "fixup" or
"squash" and there are no staged changes. Unfortunately the code to do
this contains two bugs.

(1) If parse_head() fails we pass an invalid pointer to
    unuse_commit_buffer().

(2) The reconstructed message uses the entire commit buffer from HEAD
    including the headers, rather than just the commit message.

The first issue is fixed by splitting up the "if" condition into several
statements each with its own error handling. The second issue is fixed
by finding the start of the commit message within the commit buffer
using find_commit_subject().

The existing test added by 15ef69314d5 is modified to show the effect of
this bug.  The bug is triggered when skipping the first command in the
chain (as the test does before this commit) but the effect is hidden
because opts->current_fixup_count is set to zero which leads
update_squash_messages() to recreate the squash message file from
scratch overwriting the bad message created by
commit_staged_changes(). The test is also updated to explicitly check
the commit messages rather than relying on grep to ensure they do not
contain any stray commit headers.

To check the commit message the function test_commit_message() is moved
from t3437-rebase-fixup-options.sh to test-lib.sh. As the function is
now publicly available it is updated to provide better error detection
and avoid overwriting the commonly used files "actual" and "expect".
Support for reading the expected commit message from stdin is also
added.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoident: don't consider '.' a crud
brian m. carlson [Wed, 2 Aug 2023 16:49:32 +0000 (09:49 -0700)] 
ident: don't consider '.' a crud

When we process a user's name (as in user.name), we strip all
leading and trailing crud from it.  Right now, we consider a dot
a crud character, and strip it off.

However, this is unsuitable for many personal names because humans
frequently have abbreviated suffixes, such as "Jr." or "Sr." at the end
of their names, and this corrupts them.  Some other users may wish to
use an abbreviated name or initial, which will pose a problem especially
in cultures that write the family name first, followed by the personal
name.

Since the current approach causes lots of practical problems, let's
avoid it by no longer considering a dot to be crud.

Note that "." in the name forces the entire name to be quoted to
please mailers, but stripping "." only at the beginning and the end
does not help a name with "." in the middle (like "brian m. carlson")
so this change will not make it much worse.  A name like "Given
Family, Jr." that did not have to be quoted now would need to be, in
order to be placed on the e-mail headers, though.

This is based on a weather-balloon patch by Jeff King sent in Aug 2021
https://lore.kernel.org/git/YSKm8Q8nyTavQaox@coredump.intra.peff.net/

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoThe eighteenth batch
Junio C Hamano [Wed, 2 Aug 2023 15:44:02 +0000 (08:44 -0700)] 
The eighteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoDocumentation/RelNotes/2.42.0.txt: typofix
Taylor Blau [Tue, 1 Aug 2023 18:20:18 +0000 (14:20 -0400)] 
Documentation/RelNotes/2.42.0.txt: typofix

Fix a typo introduced in aa9166bcc0 (The ninth batch, 2023-07-08).

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'ks/ref-filter-describe'
Junio C Hamano [Wed, 2 Aug 2023 16:37:24 +0000 (09:37 -0700)] 
Merge branch 'ks/ref-filter-describe'

"git branch --list --format=<format>" and friends are taught
a new "%(describe)" placeholder.

* ks/ref-filter-describe:
  ref-filter: add new "describe" atom
  ref-filter: add multiple-option parsing functions

9 months agoMerge branch 'ah/sequencer-rewrite-todo-fix'
Junio C Hamano [Wed, 2 Aug 2023 16:37:23 +0000 (09:37 -0700)] 
Merge branch 'ah/sequencer-rewrite-todo-fix'

When the user edits "rebase -i" todo file so that it starts with a
"fixup", which would make it invalid, the command truncated the
rest of the file before giving an error and returning the control
back to the user.  Stop truncating to make it easier to correct
such a malformed todo file.

* ah/sequencer-rewrite-todo-fix:
  sequencer: finish parsing the todo list despite an invalid first line

9 months agoMerge branch 'bb/use-trace2-counters-for-fsync-stats'
Junio C Hamano [Wed, 2 Aug 2023 16:37:23 +0000 (09:37 -0700)] 
Merge branch 'bb/use-trace2-counters-for-fsync-stats'

Instead of inventing a custom counter variables for debugging,
use existing trace2 facility in the fsync customization codepath.

* bb/use-trace2-counters-for-fsync-stats:
  wrapper: use trace2 counters to collect fsync stats

9 months agoMerge branch 'ah/autoconf-fixes'
Junio C Hamano [Wed, 2 Aug 2023 16:37:23 +0000 (09:37 -0700)] 
Merge branch 'ah/autoconf-fixes'

"./configure --with-expat=no" did not work as a way to refuse use
of the expat library on a system with the library installed, which
has been corrected.

* ah/autoconf-fixes:
  configure.ac: always save NO_ICONV to config.status
  configure.ac: don't overwrite NO_CURL option
  configure.ac: don't overwrite NO_EXPAT option

9 months agoMerge branch 'jc/tree-walk-drop-base-offset'
Junio C Hamano [Wed, 2 Aug 2023 16:37:23 +0000 (09:37 -0700)] 
Merge branch 'jc/tree-walk-drop-base-offset'

Code simplification.

* jc/tree-walk-drop-base-offset:
  tree-walk: drop unused base_offset from do_match()
  tree-walk: lose base_offset that is never used in tree_entry_interesting

9 months agoavoid SHA-1 functions deprecated in OpenSSL 3+
Eric Wong [Tue, 1 Aug 2023 02:54:54 +0000 (02:54 +0000)] 
avoid SHA-1 functions deprecated in OpenSSL 3+

OpenSSL 3+ deprecates the SHA1_Init, SHA1_Update, and SHA1_Final
functions, leading to errors when building with `DEVELOPER=1'.

Use the newer EVP_* API with OpenSSL 3+ (only) despite being more
error-prone and less efficient due to heap allocations.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agosha256: avoid functions deprecated in OpenSSL 3+
Eric Wong [Tue, 1 Aug 2023 02:54:53 +0000 (02:54 +0000)] 
sha256: avoid functions deprecated in OpenSSL 3+

OpenSSL 3+ deprecates the SHA256_Init, SHA256_Update, and SHA256_Final
functions, leading to errors when building with `DEVELOPER=1'.

Use the newer EVP_* API with OpenSSL 3+ despite being more
error-prone and less efficient due to heap allocations.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agodoc: sha256 is no longer experimental
Adam Majer [Mon, 31 Jul 2023 13:42:02 +0000 (15:42 +0200)] 
doc: sha256 is no longer experimental

Remove scary wording that basically stops people using sha256
repositories not because of interoperability issues with sha1
repositories, but from fear that their work will suddenly become
incompatible in some future version of git.

We should be clear that currently sha256 repositories will not work with
sha1 repositories but stop the scary words.

Signed-off-by: Adam Majer <adamm@zombino.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agosha256/gcrypt: die on gcry_md_open failures
Eric Wong [Mon, 31 Jul 2023 12:08:08 +0000 (12:08 +0000)] 
sha256/gcrypt: die on gcry_md_open failures

`gcry_md_open' allocates memory and must (like all allocation
functions) be checked for failure.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agosha256/gcrypt: fix memory leak with SHA-256 repos
Eric Wong [Mon, 31 Jul 2023 12:08:07 +0000 (12:08 +0000)] 
sha256/gcrypt: fix memory leak with SHA-256 repos

`gcry_md_open' needs to be paired with `gcry_md_close' to ensure
resources are released.  Since our internal APIs don't have
separate close/release callbacks, sticking it into the finalization
callback seems appropriate.

Building with SANITIZE=leak and running `git fsck' on a SHA-256
repository no longer reports leaks.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agosha256/gcrypt: fix build with SANITIZE=leak
Eric Wong [Mon, 31 Jul 2023 12:08:06 +0000 (12:08 +0000)] 
sha256/gcrypt: fix build with SANITIZE=leak

Non-static functions cause `undefined reference' errors when
building with `SANITIZE=leak' due to the lack of prototypes.
Mark all these functions as `static inline' as we do in
sha256/nettle.h to avoid the need to maintain prototypes.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agobundle: use OPT_PASSTHRU_ARGV
René Scharfe [Sat, 29 Jul 2023 20:40:27 +0000 (22:40 +0200)] 
bundle: use OPT_PASSTHRU_ARGV

"git bundle" passes the progress control options to "git pack-objects"
by parsing and then recreating them explicitly.  Simplify that process
by using OPT_PASSTHRU_ARGV instead.

This also fixes --no-quiet, which has been doing the same as --quiet
since its introduction by 79862b6b77 (bundle-create: progress output
control, 2019-11-10) because it had been defined using OPT_SET_INT with
a value of 0, which sets 0 when negated as well.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoThe seventeenth batch
Junio C Hamano [Fri, 28 Jul 2023 16:17:53 +0000 (09:17 -0700)] 
The seventeenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'rs/pack-objects-parseopt-fix'
Junio C Hamano [Fri, 28 Jul 2023 16:45:22 +0000 (09:45 -0700)] 
Merge branch 'rs/pack-objects-parseopt-fix'

Command line parser fix.

* rs/pack-objects-parseopt-fix:
  pack-objects: fix --no-quiet
  pack-objects: fix --no-keep-true-parents

9 months agoMerge branch 'rs/describe-parseopt-fix'
Junio C Hamano [Fri, 28 Jul 2023 16:45:21 +0000 (09:45 -0700)] 
Merge branch 'rs/describe-parseopt-fix'

Command line parser fix.

* rs/describe-parseopt-fix:
  describe: fix --no-exact-match

9 months agoMerge branch 'bb/trace2-comment-fix'
Junio C Hamano [Fri, 28 Jul 2023 16:45:21 +0000 (09:45 -0700)] 
Merge branch 'bb/trace2-comment-fix'

In-code comment fix.

* bb/trace2-comment-fix:
  trace2: fix a comment

9 months agoMyFirstContribution: refrain from self-iterating too much
Junio C Hamano [Fri, 28 Jul 2023 00:43:17 +0000 (17:43 -0700)] 
MyFirstContribution: refrain from self-iterating too much

Finding mistakes in and improving your own patches is a good idea,
but doing so too quickly is being inconsiderate to reviewers who
have just seen the initial iteration and taking their time to review
it.  Encourage new developers to perform such a self review before
they send out their patches, not after.  After sending a patch that
they immediately found mistakes in, they are welcome to comment on
them, mentioning what and how they plan to improve them in an
updated version, before sending out their updates.

Helped-by: Torsten Bögershausen <tboegi@web.de>
Helped-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoThe sixteenth batch
Junio C Hamano [Thu, 27 Jul 2023 22:02:38 +0000 (15:02 -0700)] 
The sixteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'jc/parse-options-reset'
Junio C Hamano [Thu, 27 Jul 2023 22:26:37 +0000 (15:26 -0700)] 
Merge branch 'jc/parse-options-reset'

Command line parser fix.

* jc/parse-options-reset:
  reset: reject --no-(mixed|soft|hard|merge|keep) option

9 months agoMerge branch 'jc/parse-options-show-branch'
Junio C Hamano [Thu, 27 Jul 2023 22:26:37 +0000 (15:26 -0700)] 
Merge branch 'jc/parse-options-show-branch'

Command line parser fixes.

* jc/parse-options-show-branch:
  show-branch: reject --[no-](topo|date)-order
  show-branch: --no-sparse should give dense output

9 months agoMerge branch 'jc/transport-parseopt-fix'
Junio C Hamano [Thu, 27 Jul 2023 22:26:37 +0000 (15:26 -0700)] 
Merge branch 'jc/transport-parseopt-fix'

Command line parser fixes.

* jc/transport-parseopt-fix:
  fetch: reject --no-ipv[46]
  parse-options: introduce OPT_IPVERSION()

9 months agoMerge branch 'jc/gitignore-doc-pattern-markup'
Junio C Hamano [Thu, 27 Jul 2023 22:26:36 +0000 (15:26 -0700)] 
Merge branch 'jc/gitignore-doc-pattern-markup'

Doc mark-up update.

* jc/gitignore-doc-pattern-markup:
  gitignore.txt: mark up explanation of patterns consistently

9 months agoSubmittingPatches: use of older maintenance tracks is an exception
Junio C Hamano [Wed, 26 Jul 2023 05:21:12 +0000 (22:21 -0700)] 
SubmittingPatches: use of older maintenance tracks is an exception

While we could technically fix each and every bug on top of the
commit that introduced it, it is not necessarily practical.  For
trivial and low-value bugfixes, it often is simpler and sufficient
to just fix it in the current maintenance track, leaving the bug
unfixed in the older maintenance tracks.

Demote the "use older maintenance track to fix old bugs" as a side
note, and explain that the choice is used only in exceptional cases.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoSubmittingPatches: explain why 'next' and above are inappropriate base
Junio C Hamano [Wed, 26 Jul 2023 05:17:31 +0000 (22:17 -0700)] 
SubmittingPatches: explain why 'next' and above are inappropriate base

The 'next' branch is primarily meant to be a testing ground to make
sure that topics that are reasonably well done work well together.
Building a new work on it would mean everything that was already in
'next' must have graduated to 'master' before the new work can also
be merged to 'master', and that is why we do not encourage basing
new work on 'next'.

Helped-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agot2400: rewrite regex to avoid unintentional PCRE
Jacob Abel [Wed, 26 Jul 2023 21:42:34 +0000 (21:42 +0000)] 
t2400: rewrite regex to avoid unintentional PCRE

Replace all cases of `\s` with ` ` as it is not part of POSIX BRE or ERE
and therefore not all versions of grep handle it.

For the same reason all cases of `\S` are replaced with `[^ ]`. It is
not an exact replacement but it is close enough for this use case.

Also, do not write `\+` in BRE and expect it to mean 1 or more;
it is a GNU extension that may not work everywhere.

Remove `.*` from the end of a pattern that is not right-anchored.

Signed-off-by: Jacob Abel <jacobabel@nullpo.dev>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agobuiltin/worktree.c: convert tab in advice to space
Jacob Abel [Wed, 26 Jul 2023 21:42:24 +0000 (21:42 +0000)] 
builtin/worktree.c: convert tab in advice to space

Signed-off-by: Jacob Abel <jacobabel@nullpo.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agot2400: drop no-op `--sq` from rev-parse call
Jacob Abel [Wed, 26 Jul 2023 21:42:18 +0000 (21:42 +0000)] 
t2400: drop no-op `--sq` from rev-parse call

Signed-off-by: Jacob Abel <jacobabel@nullpo.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoThe fifteenth batch
Junio C Hamano [Wed, 26 Jul 2023 20:40:42 +0000 (13:40 -0700)] 
The fifteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'jc/branch-parseopt-fix'
Junio C Hamano [Wed, 26 Jul 2023 21:13:15 +0000 (14:13 -0700)] 
Merge branch 'jc/branch-parseopt-fix'

Command line parser fixes.

* jc/branch-parseopt-fix:
  branch: reject "--no-all" and "--no-remotes" early

9 months agoMerge branch 'jc/am-parseopt-fix'
Junio C Hamano [Wed, 26 Jul 2023 21:13:15 +0000 (14:13 -0700)] 
Merge branch 'jc/am-parseopt-fix'

Code simplification.

* jc/am-parseopt-fix:
  am: simplify parsing of "--[no-]keep-cr"

9 months agoMerge branch 'rs/ls-tree-no-full-name-fix'
Junio C Hamano [Wed, 26 Jul 2023 21:13:15 +0000 (14:13 -0700)] 
Merge branch 'rs/ls-tree-no-full-name-fix'

Command line parser fix.

* rs/ls-tree-no-full-name-fix:
  ls-tree: fix --no-full-name

9 months agoMerge branch 'jr/gitignore-doc-example-markup'
Junio C Hamano [Wed, 26 Jul 2023 21:13:15 +0000 (14:13 -0700)] 
Merge branch 'jr/gitignore-doc-example-markup'

Doc update.

* jr/gitignore-doc-example-markup:
  gitignore.txt: use backticks instead of double quotes

9 months agoSubmittingPatches: choice of base for fixing an older maintenance track
Junio C Hamano [Wed, 26 Jul 2023 05:16:49 +0000 (22:16 -0700)] 
SubmittingPatches: choice of base for fixing an older maintenance track

When working on an high-value bugfix that must be given to ancient
maintenance tracks, a starting point that is older than `maint` may
have to be chosen.

Helped-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agodoc: highlight that .gitmodules does not support !command
Petar Vutov [Tue, 25 Jul 2023 21:22:18 +0000 (23:22 +0200)] 
doc: highlight that .gitmodules does not support !command

Bugfix for fc01a5d2 (submodule update documentation: don't repeat
ourselves, 2016-12-27).

The `custom command` and `none` options are described as sharing the
same limitations, but one is allowed in .gitmodules and the other is
not.

Rewrite the description for custom commands to be more precise,
and make it easier for readers to notice that custom commands cannot
be used in the .gitmodules file.

Signed-off-by: Petar Vutov <pvutov@imap.cc>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoThe fourteenth batch
Junio C Hamano [Tue, 25 Jul 2023 19:05:40 +0000 (12:05 -0700)] 
The fourteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'jk/nested-points-at'
Junio C Hamano [Tue, 25 Jul 2023 19:05:24 +0000 (12:05 -0700)] 
Merge branch 'jk/nested-points-at'

"git tag --list --points-at X" showed tags that directly refers to
object X, but did not list a tag that points at such a tag, which
has been corrected.

* jk/nested-points-at:
  ref-filter: simplify return type of match_points_at
  ref-filter: avoid parsing non-tags in match_points_at()
  ref-filter: avoid parsing tagged objects in match_points_at()
  ref-filter: handle nested tags in --points-at option

9 months agoMerge branch 'rs/strbuf-addftime-simplify'
Junio C Hamano [Tue, 25 Jul 2023 19:05:24 +0000 (12:05 -0700)] 
Merge branch 'rs/strbuf-addftime-simplify'

Code clean-up.

* rs/strbuf-addftime-simplify:
  strbuf: use skip_prefix() in strbuf_addftime()

9 months agoMerge branch 'rs/ref-filter-signature-fix'
Junio C Hamano [Tue, 25 Jul 2023 19:05:24 +0000 (12:05 -0700)] 
Merge branch 'rs/ref-filter-signature-fix'

Test fix.

* rs/ref-filter-signature-fix:
  t6300: fix setup with GPGSSH but without GPG

9 months agoMerge branch 'jk/unused-parameter'
Junio C Hamano [Tue, 25 Jul 2023 19:05:24 +0000 (12:05 -0700)] 
Merge branch 'jk/unused-parameter'

Mark-up unused parameters in the code so that we can eventually
enable -Wunused-parameter by default.

* jk/unused-parameter:
  t/helper: mark unused callback void data parameters
  tag: mark unused parameters in each_tag_name_fn callbacks
  rev-parse: mark unused parameter in for_each_abbrev callback
  replace: mark unused parameter in each_mergetag_fn callback
  replace: mark unused parameter in ref callback
  merge-tree: mark unused parameter in traverse callback
  fsck: mark unused parameters in various fsck callbacks
  revisions: drop unused "opt" parameter in "tweak" callbacks
  count-objects: mark unused parameter in alternates callback
  am: mark unused keep_cr parameters
  http-push: mark unused parameter in xml callback
  http: mark unused parameters in curl callbacks
  do_for_each_ref_helper(): mark unused repository parameter
  test-ref-store: drop unimplemented reflog-expire command

9 months agoMerge branch 'dk/bundle-i18n-more'
Junio C Hamano [Tue, 25 Jul 2023 19:05:24 +0000 (12:05 -0700)] 
Merge branch 'dk/bundle-i18n-more'

Update message mark-up for i18n in "git bundle".

* dk/bundle-i18n-more:
  i18n: mark more bundle.c strings for translation

9 months agoMerge branch 'mh/mingw-case-sensitive-build'
Junio C Hamano [Tue, 25 Jul 2023 19:05:23 +0000 (12:05 -0700)] 
Merge branch 'mh/mingw-case-sensitive-build'

Names of MinGW header files are spelled in mixed case in some
source files, but the build host can be using case sensitive
filesystem with header files with their name spelled in all
lowercase.

* mh/mingw-case-sensitive-build:
  mingw: use lowercase includes for some Windows headers

9 months agoMerge branch 'dk/t4002-syntaxo-fix'
Junio C Hamano [Tue, 25 Jul 2023 19:05:23 +0000 (12:05 -0700)] 
Merge branch 'dk/t4002-syntaxo-fix'

Test fix.

* dk/t4002-syntaxo-fix:
  t4002: fix "diff can read from stdin" syntax

9 months agoMerge branch 'tb/object-access-overflow-protection'
Junio C Hamano [Tue, 25 Jul 2023 19:05:23 +0000 (12:05 -0700)] 
Merge branch 'tb/object-access-overflow-protection'

Various offset computation in the code that accesses the packfiles
and other data in the object layer has been hardened against
arithmetic overflow, especially on 32-bit systems.

* tb/object-access-overflow-protection:
  commit-graph.c: prevent overflow in `verify_commit_graph()`
  commit-graph.c: prevent overflow in `write_commit_graph()`
  commit-graph.c: prevent overflow in `merge_commit_graph()`
  commit-graph.c: prevent overflow in `split_graph_merge_strategy()`
  commit-graph.c: prevent overflow in `load_tree_for_commit()`
  commit-graph.c: prevent overflow in `fill_commit_in_graph()`
  commit-graph.c: prevent overflow in `fill_commit_graph_info()`
  commit-graph.c: prevent overflow in `load_oid_from_graph()`
  commit-graph.c: prevent overflow in add_graph_to_chain()
  commit-graph.c: prevent overflow in `write_commit_graph_file()`
  pack-bitmap.c: ensure that eindex lookups don't overflow
  midx.c: prevent overflow in `fill_included_packs_batch()`
  midx.c: prevent overflow in `write_midx_internal()`
  midx.c: store `nr`, `alloc` variables as `size_t`'s
  midx.c: prevent overflow in `nth_midxed_offset()`
  midx.c: prevent overflow in `nth_midxed_object_oid()`
  midx.c: use `size_t`'s for fanout nr and alloc
  packfile.c: use checked arithmetic in `nth_packed_object_offset()`
  packfile.c: prevent overflow in `load_idx()`
  packfile.c: prevent overflow in `nth_packed_object_id()`

9 months agoMerge branch 'ah/advise-force-pushing'
Junio C Hamano [Tue, 25 Jul 2023 19:05:23 +0000 (12:05 -0700)] 
Merge branch 'ah/advise-force-pushing'

Help newbies by suggesting that there are cases where force-pushing
is a valid and sensible thing to update a branch at a remote
repository, rather than reconciling with merge/rebase.

* ah/advise-force-pushing:
  push: don't imply that integration is always required before pushing
  remote: don't imply that integration is always required before pushing
  wt-status: don't show divergence advice when committing

9 months agohex: retire get_sha1_hex()
Junio C Hamano [Mon, 24 Jul 2023 23:11:03 +0000 (16:11 -0700)] 
hex: retire get_sha1_hex()

The naming convention around get_sha1_hex() and its friends is
awkward these days, after "struct object_id" was introduced.

There are three public functions around this area:

 * get_sha1_hex()       - use the implied the_hash_algo, fill uchar *
 * get_oid_hex()        - use the implied the_hash_algo, fill oid *
 * get_oid_hex_algop()  - use the passed algop, fill oid *

Between the latter two, the "_algop" suffix signals whether the
the_hash_algo is used as the implied algorithm or the caller should
pass an algorithm explicitly.  That is very much understandable and
is a good convention.

Between the former two, however, the "SHA1" vs "OID" in the names
differentiate in what type of variable the result is stored.

We could argue that it makes sense to use "SHA1" to mean "flat byte
buffer" to honor the historical practice in the days before "struct
object_id" was invented, but the natural fourth friend of the above
group would take an algop and fill a flat byte buffer, and it would
be strange to name it get_sha1_hex_algop().  Do we use the passed in
algo, or are we limited to SHA-1 ;-)?

In fact, such a function exists, albeit as a private helper function
used by the implementation of these functions, and is named a lot
more sensibly: get_hash_hex_algop().

Correct the misnomer of get_sha1_hex() and use "hash", instead of
"sha1", as "flat byte buffer that stores binary (as opposed to
hexadecimal) representation of the hash".

The four (2x2) friends now become:

 * get_hash_hex()       - use the implied the_hash_algo, fill uchar *
 * get_oid_hex()        - use the implied the_hash_algo, fill oid *
 * get_hash_hex_algop() - use the passed algop, fill uchar *
 * get_oid_hex_algop()  - use the passed algop, fill oid *

As there are only two remaining calls to get_sha1_hex() in the
codebase right now, the blast radious of this change is fairly
small.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agot/lib-commit-graph.sh: avoid sub-shell in `graph_git_behavior()`
Taylor Blau [Mon, 24 Jul 2023 16:39:34 +0000 (12:39 -0400)] 
t/lib-commit-graph.sh: avoid sub-shell in `graph_git_behavior()`

In a previous commit, we introduced a sub-shell in the implementation of
`graph_git_behavior()`, in order to allow us to pass `-C "$DIR"`
directly to the git processes spawned by `graph_git_two_modes()`.

Now that its callers are always operating from the "$TRASH_DIRECTORY"
instead of one of its sub-directories, we can drop the inner sub-shell,
as it is no longer required.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agot5328: avoid top-level directory changes
Taylor Blau [Mon, 24 Jul 2023 16:39:31 +0000 (12:39 -0400)] 
t5328: avoid top-level directory changes

In a similar spirit as the last commit, avoid top-level directory
changes in the last remaining commit-graph related test, t5328.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agot5318: avoid top-level directory changes
Taylor Blau [Mon, 24 Jul 2023 16:39:28 +0000 (12:39 -0400)] 
t5318: avoid top-level directory changes

Avoid changing the current working directory from outside of a sub-shell
during the tests in t5318.

Each test has mostly straightforward changes, either:

  - Removing the top-level `cd "$TRASH_DIRECTORY/full"`, which is
    unnecessary after ensuring that other tests don't change their
    working directory outside of a sub-shell.

  - Changing any Git invocations which want to be in a sub-directory by
    either (a) adding a "-C $DIR" argument, or (b) moving the whole test
    into a sub-shell.

While we're here, remove any explicit "git config core.commitGraph true"
invocations which were designed to enable use of the commit-graph. These
are unnecessary following 31b1de6a09b (commit-graph: turn on
commit-graph by default, 2019-08-13).

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>