summaryrefslogtreecommitdiffstats
path: root/builtin (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-10-26branch: error copying or renaming a detached HEADRubén Justo1-20/+8
In c847f53712 (Detached HEAD (experimental), 2007-01-01) an error condition was introduced in rename_branch() to prevent renaming, later also copying, a detached HEAD. The condition used was checking for NULL in oldname, the source branch to rename/copy. That condition cannot be satisfied because if no source branch is specified, HEAD is going to be used in the call. The error issued instead is: fatal: Invalid branch name: 'HEAD' Let's remove the condition in copy_or_rename_branch() (the current function name) and check for HEAD before calling it, dying with the original intended error if we're in a detached HEAD. Signed-off-by: Rubén Justo <rjusto@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-26The sixth batchJunio C Hamano1-0/+14
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-26Downmerge a handful of topics for 2.38.2Junio C Hamano2-1/+48
2022-10-21The fifth batchJunio C Hamano1-1/+21
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-20ci: use DC_SHA1=YesPlease on osx-clang job for CIJunio C Hamano1-0/+2
7b8cfe34 (Merge branch 'ed/fsmonitor-on-networked-macos', 2022-10-17) broke the build on macOS with sha1dc by bypassing our hash abstraction (git_SHA_CTX etc.), but it wasn't caught before the problematic topic was merged down to the 'master' branch. Nobody was even compile testing with DC_SHA1 set, although it is the recommended choice in these days for folks when they use SHA-1. This was because the default for macOS uses Apple Common Crypto, and both of the two CI jobs did not override the default. Tweak one of them to use DC_SHA1 to improve the coverage. We may want to give similar diversity for Linux jobs so that some of them build with other implementations of SHA-1; they currently all build and test with DC_SHA1 as that is the default on everywhere other than macOS. But let's start small to fill only the immediate need. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-20ci: add address and undefined sanitizer tasksJunio C Hamano2-0/+12
The current code is clean with these two sanitizers, and we would like to keep it that way by running the checks for any new code. The signal of "passed with asan, but not ubsan" (or vice versa) is not that useful in practice, so it is tempting to run both santizers in a single task, but it seems to take forever, so tentatively let's try having two separate ones. Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-20The fourth batchJunio C Hamano1-0/+9
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-19fsmonitor OSX: compile with DC_SHA1=YesPleaseÆvar Arnfjörð Bjarmason1-5/+5
As we'll address in subsequent commits the "DC_SHA1=YesPlease" is not on by default on OSX, instead we use Apple Common Crypto's SHA-1 implementation. In 6beb2688d33 (fsmonitor: relocate socket file if .git directory is remote, 2022-10-04) the build was broken with "DC_SHA1=YesPlease" (and probably other non-"APPLE_COMMON_CRYPTO" SHA-1 backends). So let's extract the fix for this from [1] to get the build working again with "DC_SHA1=YesPlease". In addition to the fix in [1] we also need to replace "SHA_DIGEST_LENGTH" with "GIT_MAX_RAWSZ". 1. https://lore.kernel.org/git/c085fc15b314abcb5e5ca6b4ee5ac54a28327cab.1665326258.git.gitgitgadget@gmail.com/ Signed-off-by: Eric DeCosta <edecosta@mathworks.com> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-19Makefile: force -O0 when compiling with SANITIZE=leakJeff King1-0/+1
Compiling with -O2 can interact badly with LSan's leak-checker, causing false positives. Imagine a simplified example like: char *str = allocate_some_string(); if (some_func(str) < 0) die("bad str"); free(str); The compiler may eliminate "str" as a stack variable, and just leave it in a register. The register is preserved through most of the function, including across the call to some_func(), since we'd eventually need to free it. But because die() is marked with NORETURN, the compiler knows that it doesn't need to save registers, and just clobbers it. When die() eventually exits, the leak-checker runs. It looks in registers and on the stack for any reference to the memory allocated by str (which would indicate that it's not leaked), but can't find one. So it reports it as a leak. Neither system is wrong, really. The C standard (mostly section 5.1.2.3) defines an abstract machine, and compilers are allowed to modify the program as long as the observable behavior of that abstract machine is unchanged. Looking at random memory values on the stack is undefined behavior, and not something that the optimizer needs to support. But there really isn't any other way for a leak checker to work; it inherently has to do undefined things like scouring memory for pointers. So the two things are inherently at odds with each other. We can't fix it by changing the code, because from the perspective of the program running in an abstract machine, there is no leak. This has caused real false positives in the past, like: - https://lore.kernel.org/git/patch-v3-5.6-9a44204c4c9-20211022T175227Z-avarab@gmail.com/ - https://lore.kernel.org/git/Yy4eo6500C0ijhk+@coredump.intra.peff.net/ - https://lore.kernel.org/git/Y07yeEQu+C7AH7oN@nand.local/ This patch makes those go away by forcing -O0 when compiling with LSan. There are a few ways we could do this: - we could just teach the linux-leaks CI job to set -O0. That's the smallest change, and means we wouldn't get spurious CI failures. But it doesn't help people looking for leaks manually or in a specific test (and because the problem depends on the vagaries of the optimizer, investigating these can waste a lot of time in head-scratching as the problem comes and goes) - we default to -O2 in CFLAGS; we could pull this out to a separate variable ("-O$(O)" or something) and modify "O" when LSan is in use. This is the most flexible, in that you could still build with "make O=2 SANITIZE=leak" if you really wanted to (say, for experimenting). But it would also fail to kick in if the user defines their own CFLAGS variable, which again leads to head-scratching. - we can just stick -O0 into BASIC_CFLAGS when enabling LSan. Since this comes after the user-provided CFLAGS, it will override any previous -O setting found there. This is more foolproof, albeit less flexible. If you want to experiment with an optimized leak-checking build, you'll have to put "-O2 -fsanitize=leak" into CFLAGS manually, rather than using our SANITIZE=leak Makefile magic. Since the final one is the least likely to break in normal use, this patch uses that approach. The resulting build is a little slower, of course, but since LSan is already about 2x slower than a regular build, another 10% slowdown isn't that big a deal. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-17The third batchJunio C Hamano1-0/+34
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-13config: respect includes in protected configGlen Choo3-22/+26
Protected config is implemented by reading a fixed set of paths, which ignores config [include]-s. Replace this implementation with a call to config_with_options(), which handles [include]-s and saves us from duplicating the logic of 1) identifying which paths to read and 2) reading command line config. As a result, git_configset_add_parameters() is unused, so remove it. It was introduced alongside protected config in 5b3c650777 (config: learn `git_protected_config()`, 2022-07-14) as a way to handle command line config. Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-11The second batchJunio C Hamano1-0/+16
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-11CodingGuidelines: recommend against unportable C99 struct syntaxÆvar Arnfjörð Bjarmason1-0/+5
Per 33665d98e6b (reftable: make assignments portable to AIX xlc v12.01, 2022-03-28) forms like ".a.b = *c" can be replaced by using ".a = { .b = *c }" instead. We'll probably allow these sooner than later, but since the workaround is trivial let's note it among the C99 features we'd like to hold off on for now. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-11grep.c: remove "extended" in favor of "pattern_expression", fix segfaultÆvar Arnfjörð Bjarmason3-9/+16
Since 79d3696cfb4 (git-grep: boolean expression on pattern matching., 2006-06-30) the "pattern_expression" member has been used for complex queries (AND/OR...), with "pattern_list" being used for the simple OR queries. Since then we've used both "pattern_expression" and its associated boolean "extended" member to see if we have a complex expression. Since f41fb662f57 (revisions API: have release_revisions() release "grep_filter", 2022-04-13) we've had a subtle bug relating to that: If we supplied options that were only used for "complex queries", but didn't supply the query itself we'd set "opt->extended", but would have a NULL "pattern_expression". As a result these would segfault as we tried to call "free_grep_patterns()" from "release_revisions()": git -P log -1 --invert-grep git -P log -1 --all-match The root cause of this is that we were conflating the state management we needed in "compile_grep_patterns()" itself with whether or not we had an "opt->pattern_expression" later on. In this cases as we're going through "compile_grep_patterns()" we have no "opt->pattern_list" but have "opt->no_body_match" or "opt->all_match". So we'd set "opt->extended = 1", but not "return" on "opt->extended" as that's an "else if" in the same "if" statement. That behavior is intentional and required, as the common case is that we have an "opt->pattern_list" that we're about to parse into the "opt->pattern_expression". But we don't need to keep track of this "extended" flag beyond the state management in compile_grep_patterns() itself. It needs it, but once we're out of that function we can rely on "opt->pattern_expression" being non-NULL instead for using these extended patterns. As 79d3696cfb4 itself shows we've assumed that there's a one-to-one mapping between the two since the very beginning. I.e. "match_line()" would check "opt->extended" to see if it should call "match_expr()", and the first thing we do in that function is assume that we have a "opt->pattern_expression". We'd then call "match_expr_eval()", which would have died if that "opt->pattern_expression" was NULL. The "die" was added in c922b01f54c (grep: fix segfault when "git grep '('" is given, 2009-04-27), and can now be removed as it's now clearly unreachable. We still do the right thing in the case that prompted that fix: git grep '(' fatal: unmatched parenthesis Arguably neither the "--invert-grep" option added in [1] nor the earlier "--all-match" option added in [2] were intended to be used stand-alone, and another approach[3] would be to error out in those cases. But since we've been treating them as a NOOP when given without --grep for a long time let's keep doing that. We could also return in "free_pattern_expr()" if the argument is non-NULL, as an alternative fix for this segfault does [4]. That would be more elegant in making the "free_*()" function behave like "free()", but it would also remove a sanity check: The "free_pattern_expr()" function calls itself recursively, and only the top-level is allowed to be NULL, let's not conflate those two conditions. 1. 22dfa8a23de (log: teach --invert-grep option, 2015-01-12) 2. 0ab7befa31d (grep --all-match, 2006-09-27) 3. https://lore.kernel.org/git/patch-1.1-f4b90799fce-20221010T165711Z-avarab@gmail.com/ 4. http://lore.kernel.org/git/7e094882c2a71894416089f894557a9eae07e8f8.1665423686.git.me@ttaylorr.com Reported-by: orygaw <orygaw@protonmail.com> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-11archive: deduplicate verbose printingRené Scharfe1-5/+3
94bc671a1f (Add directory pattern matching to attributes, 2012-12-08) moved the code for adding the trailing slash to names of directories and submodules up. This left both branches of the if statement starting with the same conditional fprintf call. Deduplicate it. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-11fsmonitor: fix leak of warning messageJeff King1-1/+3
The fsm_settings__get_incompatible_msg() function returns an allocated string. So we can't pass its result directly to warning(); we must hold on to the pointer and free it to avoid a leak. The leak here is small and fixed size, but Coverity complained, and presumably SANITIZE=leaks would eventually. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-11branch: support for shortcuts like @{-1}, completedRubén Justo2-19/+58
branch command with options "edit-description", "set-upstream-to" and "unset-upstream" expects a branch name. Since ae5a6c3684 (checkout: implement "@{-N}" shortcut name for N-th last branch, 2009-01-17) a branch can be specified using shortcuts like @{-1}. Those shortcuts need to be resolved when considering the arguments. We can modify the description of the previously checked out branch with: $ git branch --edit--description @{-1} We can modify the upstream of the previously checked out branch with: $ git branch --set-upstream-to upstream @{-1} $ git branch --unset-upstream @{-1} Signed-off-by: Rubén Justo <rjusto@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-10CodingGuidelines: mention C99 features we can't useÆvar Arnfjörð Bjarmason1-0/+7
The C99 section of the CodingGuidelines is a good overview of what we can use, but is sorely lacking in what we can't use. Something that comes up occasionally is the portability of %z. Per [1] we couldn't use it for the longest time due to MSVC not supporting it, but nowadays by requiring C99 we rely on the MSVC version that does, but we can't use it yet because a C library that MinGW uses doesn't support it. 1. https://lore.kernel.org/git/a67e0fd8-4a14-16c9-9b57-3430440ef93c@gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-10CodingGuidelines: allow declaring variables in for loopsÆvar Arnfjörð Bjarmason2-15/+2
Since 44ba10d6712 (revision: use C99 declaration of variable in for() loop, 2021-11-14) released with v2.35.0 we've had a variable declared with in a for loop. Since then we've had inadvertent follow-ups to that with at least cb2607759e2 (merge-ort: store more specific conflict information, 2022-06-18) released with v2.38.0. As November 2022 is within the window of this upcoming release, let's update the guideline to allow this. We can have the promised "revisit" discussion while this patch cooks, and drop it if it turns out that it is still premature, which is not expected to happen at this moment. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-10CodingGuidelines: mention dynamic C99 initializer elementsÆvar Arnfjörð Bjarmason1-0/+5
The first use of variables in initializer elements appears to have been 2b6854c863a (Cleanup variables in cat-file, 2007-04-21) released with v1.5.2. Some of those caused portability issues, and e.g. that "cat-file" use was changed in 66dbfd55e38 (Rewrite dynamic structure initializations to runtime assignment, 2010-05-14) which went out with v1.7.2. But curiously 66dbfd55e38 missed some of them, e.g. an archive.c use added in d5f53d6d6f2 (archive: complain about path specs that don't match anything, 2009-12-12), and another one in merge-index.c (later builtin/merge-index.c) in 0077138cd9d (Simplify some instances of run_command() by using run_command_v_opt()., 2009-06-08). As far as I can tell there's been no point since 2b6854c863a in 2007 where a compiler that didn't support this has been able to compile git. Presumably 66dbfd55e38 was an attempt to make headway with wider portability that ultimately wasn't completed. In any case, we are thoroughly reliant on this syntax at this point, so let's update the guidelines, see https://lore.kernel.org/git/xmqqy1tunjgp.fsf@gitster.g/ for the initial discussion. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-10CodingGuidelines: update for C99Ævar Arnfjörð Bjarmason1-2/+6
Since 7bc341e21b5 (git-compat-util: add a test balloon for C99 support, 2021-12-01) we've had a hard dependency on C99, but the prose in CodingGuidelines was written under the assumption that we were using C89 with a few C99 features. As the updated prose notes we'd still like to hold off on novel C99 features, but let's make it clear that we target that C version, and then enumerate new C99 features that are safe to use. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-10t3435: remove redundant test casePhillip Wood1-8/+0
rebase --preserve-merges no longer exists so there is no point in carrying this failing test case. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-10config.mak.dev: disable suggest braces error on old clang versionsJeff Hostetler1-0/+25
Add the "-Wno-missing-braces" option when building with an old version of clang to suppress the "suggest braces around initialization" error in developer mode. For example, using an old version of clang gives the following errors (when in DEVELOPER=1 mode): $ make builtin/merge-file.o CC builtin/merge-file.o builtin/merge-file.c:29:23: error: suggest braces around initialization \ of subobject [-Werror,-Wmissing-braces] mmfile_t mmfs[3] = { 0 }; ^ {} builtin/merge-file.c:31:20: error: suggest braces around initialization \ of subobject [-Werror,-Wmissing-braces] xmparam_t xmp = { 0 }; ^ {} 2 errors generated. This example compiles without error/warning with updated versions of clang. Since this is an obsolete error, use the -Wno-missing-braces option to silence the warning when using an older compiler. This avoids the need to update the code to use "{{0}}" style initializations. Upstream clang version 8 has the problem. It was fixed in version 9. The version of clang distributed by Apple with XCode has its own unique set of version numbers. Apple clang version 11 has the problem. It was fixed in version 12. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-10The (real) first batch for 2.39Junio C Hamano1-0/+52
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-09symbolic-ref: teach "--[no-]recurse" optionJunio C Hamano3-8/+35
Suppose you are managing many maintenance tracks in your project, and some of the more recent ones are maint-2.36 and maint-2.37. Further imagine that your project recently tagged the official 2.38 release, which means you would need to start maint-2.38 track soon, by doing: $ git checkout -b maint-2.38 v2.38.0^0 $ git branch --list 'maint-2.3[6-9]' * maint-2.38 maint-2.36 maint-2.37 So far, so good. But it also is reasonable to want not to have to worry about which maintenance track is the latest, by pointing a more generic-sounding 'maint' branch at it, by doing: $ git symbolic-ref refs/heads/maint refs/heads/maint-2.38 which would allow you to say "whichever it is, check out the latest maintenance track", by doing: $ git checkout maint $ git branch --show-current maint-2.38 It is arguably better to say that we are on 'maint-2.38' rather than on 'maint', and "git merge/pull" would record "into maint-2.38" and not "into maint", so I think what we have is a good behaviour. One thing that is slightly irritating, however, is that I do not think there is a good way (other than "cat .git/HEAD") to learn that you checked out 'maint' to get into that state. Just like the output of "git branch --show-current" shows above, "git symbolic-ref HEAD" would report 'refs/heads/maint-2.38', bypassing the intermediate symbolic ref at 'refs/heads/maint' that is pointed at by HEAD. The internal resolve_ref() API already has the necessary support for stopping after resolving a single level of a symbolic-ref, and we can expose it by adding a "--[no-]recurse" option to the command. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-09git.c: improve code readability in cmd_main()Daniel Sonbolian1-6/+8
Check for an error condition whose body unconditionally exists first, and then perform the special casing of "version" and "help" as part of the preparation for the "normal codepath". This makes the code simpler to read. Signed-off-by: Daniel Sonbolian <dsal3389@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-09dir: use fspathncmp() in pl_hashmap_cmp()Jeff King1-3/+1
Call fspathncmp() instead of open-coding it. This shortens the code and makes it less repetitive. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-08branch: description for non-existent branch errorsRubén Justo2-2/+58
When the repository does not yet have commits, some errors describe that there is no branch: $ git init -b first $ git branch --edit-description first error: No branch named 'first'. $ git branch --set-upstream-to=upstream fatal: branch 'first' does not exist $ git branch -c second error: refname refs/heads/first not found fatal: Branch copy failed That "first" branch is unborn but to say it doesn't exists is confusing. Options "-c" (copy) and "-m" (rename) show the same error when the origin branch doesn't exists: $ git branch -c non-existent-branch second error: refname refs/heads/non-existent-branch not found fatal: Branch copy failed $ git branch -m non-existent-branch second error: refname refs/heads/non-existent-branch not found fatal: Branch rename failed Note that "--edit-description" without an explicit argument is already considering the _empty repository_ circumstance in its error. Also note that "-m" on the initial branch it is an allowed operation. Make the error descriptions for those branch operations with unborn or non-existent branches, more informative. This is the result of the change: $ git init -b first $ git branch --edit-description first error: No commit on branch 'first' yet. $ git branch --set-upstream-to=upstream fatal: No commit on branch 'first' yet. $ git branch -c second fatal: No commit on branch 'first' yet. $ git branch [-c/-m] non-existent-branch second fatal: No branch named 'non-existent-branch'. Signed-off-by: Rubén Justo <rjusto@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-08Start 2.39 cycleJunio C Hamano3-2/+24
The version numbers do not mean much, but we may want to call the first one in 2023 version 3.1 or something, but let's just increment the second digit from the previous one for this cycle. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-07SubmittingPatches: use usual capitalization in the log message bodyJunio C Hamano1-1/+3
Update the description of the summary section to clarify that the "do not capitalize" rule applies only the word after the "<area>:" prefix of the title and nowhere else. This hopefully will prevent folks from writing their proposed log message in all lowercase. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-07bundle-uri: fix technical doc issuesDerrick Stolee1-4/+4
Two documentation issues exist in the technical docs for the bundle URI feature. First, there is an extraneous "the" across a linebreak, making the nonsensical phrase "the bundle the list" which should just be "the bundle list". Secondly, the asciidoc update treats the string "`have`s" as starting a "<code>" block, but the second tick is interpreted as an apostrophe instead of a closing "</code>" tag. This causes entire sentences to be formatted as code until the next one comes along. Simply adding a space here does not work properly as the rendered HTML keeps that space. Instead, restructure the sentence slightly to avoid using a plural, allowing the HTML to render correctly. Reported-by: Philip Oakley <philipoakley@iee.email> Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-07bisect--helper: plug strvec leakRené Scharfe1-4/+3
The strvec "argv" is used to build a command for run_command_v_opt(), but never freed. Use a constant string array instead, which doesn't require any cleanup. Suggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-07Git 2.38.1v2.38.1Taylor Blau3-2/+7
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2022-10-07Git 2.37.4v2.37.4Taylor Blau1-1/+1
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2022-10-07t7527: prepare for changing protocol.file.allowTaylor Blau1-0/+4
Explicitly cloning over the "file://" protocol in t7527 in preparation for merging a security release which will change the default value of this configuration to be "user". Signed-off-by: Taylor Blau <me@ttaylorr.com>
2022-10-06Git 2.36.3v2.36.3Taylor Blau3-2/+7
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2022-10-06Git 2.35.5v2.35.5Taylor Blau3-2/+7
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2022-10-06Git 2.34.5v2.34.5Taylor Blau3-2/+7
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2022-10-06Git 2.33.5v2.33.5Taylor Blau3-2/+7
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2022-10-06Git 2.32.4v2.32.4Taylor Blau2-1/+6
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2022-10-06Git 2.31.5v2.31.5Taylor Blau2-1/+6
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2022-10-06Git 2.30.6v2.30.6Taylor Blau3-2/+62
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2022-10-06attr: drop DEBUG_ATTR codeJeff King1-38/+3
Since its inception in d0bfd026a8 (Add basic infrastructure to assign attributes to paths, 2007-04-12), the attribute code carries a little bit of debug code that is conditionally compiled only when DEBUG_ATTR is set. But since you have to know about it and make a special build of Git to use it, it's not clear that it's helping anyone (and there are very few mentions of it on the list over the years). Meanwhile, it causes slight headaches. Since it's not built as part of a regular compile, it's subject to bitrot. E.g., this was dealt with in 712efb1a42 (attr: make it build with DEBUG_ATTR again, 2013-01-15), and it currently fails to build with DEVELOPER=1 since e810e06357 (attr: tighten const correctness with git_attr and match_attr, 2017-01-27). And it causes confusion with -Wunused-parameter; the "what" parameter of fill_one() is unused in a normal build, but needed in a debug build. Let's just get rid of this code (and the now-useless parameter). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-06commit: avoid writing to global in option callbackJeff King1-2/+2
The callback function for --trailer writes directly to the global trailer_args and ignores opt->value completely. This is OK, since that's where we expect to find the value. But it does mean the option declaration isn't as clear. E.g., we have: OPT_BOOL(0, "reset-author", &renew_authorship, ...), OPT_CALLBACK_F(0, "trailer", NULL, ..., opt_pass_trailer) In the first one we can see where the result will be stored, but in the second, we get only NULL, and you have to go read the callback. Let's pass &trailer_args, and use it in the callback. As a bonus, this silences a -Wunused-parameter warning. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-06multi-pack-index: avoid writing to global in option callbackJeff King1-3/+4
We declare the --object-dir option like: OPT_CALLBACK(0, "object-dir", &opts.object_dir, ...); but the pointer to opts.object_dir is completely unused. Instead, the callback writes directly to a global. Which fortunately happens to be opts.object_dir. So everything works as expected, but it's unnecessarily confusing. Instead, let's have the callback write to the option value pointer that has been passed in. This also quiets a -Wunused-parameter warning (since we don't otherwise look at "opt"). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-06test-submodule: inline resolve_relative_url() functionJeff King1-14/+8
The resolve_relative_url() function takes argc and argv parameters; it then reads up to 3 elements of argv without looking at argc at all. At first glance, this seems like a bug. But it has only one caller, cmd__submodule_resolve_relative_url(), which does confirm that argc is 3. The main reason this is a separate function is that it was moved from library code in 96a28a9bc6 (submodule--helper: move "resolve-relative-url-test" to a test-tool, 2022-09-01). We can make this code simpler and more obviously safe by just inlining the function in its caller. As a bonus, this silences a -Wunused-parameter warning. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-06t/lib-httpd: pass LANG and LC_ALL to ApacheRené Scharfe1-0/+2
t5411 starts a web server with no explicit language setting, so it uses the system default. Ten of its tests expect it to return error messages containing the prefix "fatal: ", emitted by die(). This prefix can be localized since a1fd2cf8cd (i18n: mark message helpers prefix for translation, 2022-06-21), however. As a result these ten tests break for me on a system with LANG="de_DE.UTF-8" because the web server sends localized messages with "Schwerwiegend: " instead of "fatal: ". Fix these tests by passing LANG and LC_ALL to the web server, which are set to "C" by t/test-lib.sh, to get untranslated messages on both sides. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-06git-compat-util.h: GCC deprecated message arg only in GCC 4.5+Alejandro R. Sedeño1-1/+4
https://gcc.gnu.org/gcc-4.5/changes.html says The deprecated attribute now takes an optional string argument, for example, __attribute__((deprecated("text string"))), that will be printed together with the deprecation warning. While GCC 4.5 is already 12 years old, git checks for even older versions in places. Let's not needlessly break older compilers when a small and simple fix is readily available. Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu> Signed-off-by: Alejandro R Sedeño <asedeno@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-06Makefile: clarify runtime relative gitexecdirĐoàn Trần Công Danh1-2/+3
"git" built with RUNTIME_PREFIX flag turned on could figure out gitexecdir and other paths as relative to "git" executable. However, in the section specifies gitexecdir, RUNTIME_PREFIX wasn't mentioned, thus users may wrongly assume that "git" always locates gitexecdir as relative path to the executable. Let's clarify that only "git" built with RUNTIME_PREFIX will locate gitexecdir as relative path. Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-06t5537: prepare for changing protocol.file.allowTaylor Blau1-1/+2
Explicitly cloning over the "file://" protocol in t5537 in preparation for merging a security release which will change the default value of this configuration to be "user". Signed-off-by: Taylor Blau <me@ttaylorr.com>