summaryrefslogtreecommitdiffstats
path: root/git-merge-one-file.sh (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-08-20l10n: zh_TW.po: Git 2.42Yi-Jyun Pan1-192/+411
Co-authored-by: Lumynous <lumynou5.tw@gmail.com> Signed-off-by: Yi-Jyun Pan <pan93412@gmail.com>
2023-08-20fsck: use enum object_type for fsck_walk callbackJeff King1-1/+1
We switched the function interface for fsck callbacks in a1aad71601 (fsck.h: use "enum object_type" instead of "int", 2021-03-28). However, we accidentally flipped the type back to "int" as part of 0b4e9013f1 (fsck: mark unused parameters in various fsck callbacks, 2023-07-03). The mistake happened because that commit was written before a1aad71601 and rebased forward, and I screwed up while resolving the conflict. Curiously, the compiler does not warn about this mismatch, at least not when using gcc and clang on Linux (nor in any of our CI environments). Based on 28abf260a5 (builtin/fsck.c: don't conflate "int" and "enum" in callback, 2021-06-01), I'd guess that this would cause the AIX xlc compiler to complain. I noticed because clang-18's UBSan now identifies mis-matched function calls at runtime, and does complain of this case when running the test suite. I'm not entirely clear on whether this mismatch is a problem in practice. Compilers are certainly free to make enums smaller than "int" if they don't need the bits, but I suspect that they have to promote back to int for function calls (though I didn't dig in the standard, and I won't be surprised if I'm simply wrong and the real-world impact would depend on the ABI). Regardless, switching it back to enum is obviously the right thing to do here; the switch to "int" was simply a mistake. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-18l10n: zh_CN: 2.42.0 round 2Teng Long1-5/+4
Signed-off-by: Teng Long <dyroneteng@gmail.com>
2023-08-18l10n: zh_CN: v2.42.0 round 1Teng Long1-180/+381
Signed-off-by: Teng Long <dyroneteng@gmail.com>
2023-08-17l10n: Update German translationRalf Thielow1-175/+357
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2023-08-16rev-list-options: fix typo in `--stdin` documentationMartin Ågren1-1/+1
With `--stdin`, we read *from* standard input, not *for*. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-16show-ref doc: fix carets in monospaceMartin Ågren1-2/+2
When commit 00bf685975 (show-ref doc: update for internal consistency, 2023-05-19) switched from double quotes to backticks around our {caret} macro, we started rendering "{caret}" literally. Fix this by replacing by a "^" character. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-16notes doc: tidy up `--no-stripspace` paragraphMartin Ågren1-3/+3
Where we document the `--no-stripspace` option, remove a superfluous "For" to fix the grammar. Mark option names and command names using `backticks` to set them in monospace. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-16notes doc: split up run-on sentencesMartin Ågren1-5/+4
When commit c4e2aa7d45 (notes.c: introduce "--[no-]stripspace" option, 2023-05-27) mentioned the new `--no-stripspace` in the documentation for `-m` and `-F`, it created run-on sentences. It also used slightly different language in the two sections for no apparent reason. Split the sentences in two to improve readability, and while touching the two sites, make them more similar. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-16l10n: Update Catalan translationJordi Mas1-176/+372
Signed-off-by: Jordi Mas <jmas@softcatala.org>
2023-08-16l10n: tr: git 2.42.0Emir SARI1-159/+331
Signed-off-by: Emir SARI <emir_sari@icloud.com>
2023-08-16l10n: fr v2.42.0 rnd 2Jean-Noël Avila1-5/+8
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
2023-08-16l10n: fr v2.42.0 rnd 1Jean-Noël Avila1-162/+348
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
2023-08-16l10n: sv.po: Update Swedish translation 5549t0f0uPeter Krefting1-165/+328
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2023-08-16l10n: uk: update translation (2.42.0)Arkadii Yakovets1-2901/+4115
Co-authored-by: Kate Golovanova <kate@kgthreads.com> Signed-off-by: Arkadii Yakovets <ark@cho.red> Signed-off-by: Kate Golovanova <kate@kgthreads.com>
2023-08-15Git 2.42-rc2v2.42.0-rc2Junio C Hamano2-1/+14
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-14t4053: avoid writing to unopened pipeJeff King1-4/+0
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>
2023-08-10t4053: avoid race when killing background processesPhillip Wood1-2/+2
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>
2023-08-10Git 2.42-rc1v2.42.0-rc1Junio C Hamano2-1/+21
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-09git maintenance: avoid console window in scheduled tasks on WindowsJohannes Schindelin1-1/+1
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>
2023-08-09win32: add a helper to run `git.exe` without a foreground windowJohannes Schindelin6-2/+139
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>
2023-08-09t9001: remove excessive GIT_SEND_EMAIL_NOTTY=1Oswald Buddenhagen1-1/+0
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>
2023-08-09mv: handle lstat() failure correctlySebastian Thiel2-2/+9
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>
2023-08-09parse-options: disallow negating OPTION_SET_INT 0René Scharfe1-0/+3
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>
2023-08-09repack: free geometry structJeff King1-5/+3
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>
2023-08-09send-email: avoid creating more than one Term::ReadLine objectJeff King2-7/+16
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>
2023-08-09send-email: drop FakeTerm hackJeff King1-20/+2
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>
2023-08-09t0040: declare non-tab indentation to be okay in this scriptJohannes Schindelin1-0/+1
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>
2023-08-07advice: handle "rebase" in error_resolve_conflict()Oswald Buddenhagen1-2/+3
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>
2023-08-07A few more topics before -rc1Junio C Hamano1-0/+8
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-07mailmap: change primary address for Glen ChooGlen Choo1-0/+1
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>
2023-08-06l10n: po-id for 2.42 (round 1)Bagas Sanjaya1-194/+414
Update following components: * commit-graph.c * diff-no-index.c * builtin/notes.c * builtin/pack-refs.c * builtin/worktree.c Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
2023-08-04gitignore: ignore clangd .cache directorybrian m. carlson1-0/+1
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>
2023-08-04Git 2.42-rc0v2.42.0-rc0Junio C Hamano2-1/+24
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-04docs: update when `git bisect visualize` uses `gitk`Matthias Aßhauer1-3/+8
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>
2023-08-04compat/mingw: implement a native locate_in_PATH()Matthias Aßhauer2-0/+8
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>
2023-08-04run-command: conditionally define locate_in_PATH()Matthias Aßhauer1-0/+2
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>
2023-08-03rebase --skip: fix commit message clean up when skipping squashPhillip Wood4-39/+93
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>
2023-08-02ident: don't consider '.' a crudbrian m. carlson3-4/+12
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>
2023-08-02The eighteenth batchJunio C Hamano1-0/+19
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-02Documentation/RelNotes/2.42.0.txt: typofixTaylor Blau1-1/+1
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>
2023-08-01avoid SHA-1 functions deprecated in OpenSSL 3+Eric Wong3-1/+63
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>
2023-08-01sha256: avoid functions deprecated in OpenSSL 3+Eric Wong3-1/+57
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>
2023-07-31doc: sha256 is no longer experimentalAdam Majer2-8/+11
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>
2023-07-31sha256/gcrypt: die on gcry_md_open failuresEric Wong1-1/+3
`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>
2023-07-31sha256/gcrypt: fix memory leak with SHA-256 reposEric Wong1-0/+1
`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>
2023-07-31sha256/gcrypt: fix build with SANITIZE=leakEric Wong1-4/+4
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>
2023-07-31bundle: use OPT_PASSTHRU_ARGVRené Scharfe2-23/+23
"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>
2023-07-28The seventeenth batchJunio C Hamano1-0/+3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-28MyFirstContribution: refrain from self-iterating too muchJunio C Hamano1-0/+32
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>