]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 years agonotes.c: introduce "--[no-]stripspace" option
Teng Long [Sat, 27 May 2023 07:57:53 +0000 (15:57 +0800)] 
notes.c: introduce "--[no-]stripspace" option

This commit introduces a new option "--[no-]stripspace" to git notes
append, git notes edit, and git notes add. This option allows users to
control whether the note message need to stripped out.

For the consideration of backward compatibility, let's look at the
behavior about "stripspace" in "git notes" command:

1. "Edit Message" case: using the default editor to edit the note
message.

    In "edit" case, the edited message will always be stripped out, the
    implementation which can be found in the "prepare_note_data()". In
    addition, the "-c" option supports to reuse an existing blob as a
    note message, then open the editor to make a further edition on it,
    the edited message will be stripped.

    This commit doesn't change the default behavior of "edit" case by
    using an enum "notes_stripspace", only when "--no-stripspace" option
    is specified, the note message will not be stripped out. If you do
    not specify the option or you specify "--stripspace", clearly, the
    note message will be stripped out.

2. "Assign Message" case: using the "-m"/"-F"/"-C" option to specify the
note message.

    In "assign" case, when specify message by "-m" or "-F", the message
    will be stripped out by default, but when specify message by "-C",
    the message will be copied verbatim, in other word, the message will
    not be stripped out. One more thing need to note is "the order of
    the options matter", that is, if you specify "-C" before "-m" or
    "-F", the reused message by "-C" will be stripped out together,
    because everytime concat "-m" or "-F" message, the concated message
    will be stripped together. Oppositely, if you specify "-m" or "-F"
    before "-C", the reused message by "-C" will not be stripped out.

    This commit doesn't change the default behavior of "assign" case by
    extending the "stripspace" field in "struct note_msg", so we can
    distinguish the different behavior of "-m"/"-F" and "-C" options
    when we need to parse and concat the message.

Signed-off-by: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agonotes.c: append separator instead of insert by pos
Teng Long [Sat, 27 May 2023 07:57:52 +0000 (15:57 +0800)] 
notes.c: append separator instead of insert by pos

Rename "insert_separator" to "append_separator" and also remove the
"postion" argument, this serves two purpose:

The first is that when specifying more than one "-m" ( like "-F", etc)
to "git notes add" or "git notes append", the order of them matters,
which means we need to append the each separator and message in turn,
so we don't have to make the caller specify the position, the "append"
operation is enough and clear.

The second is that when we execute the "git notes append" subcommand,
we need to combine the "prev_note" and "current_note" to get the
final result. Before, we inserted a newline character at the beginning
of "current_note". Now, we will append a newline to the end of
"prev_note" instead, this will give the consisitent results.

Signed-off-by: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agonotes.c: introduce '--separator=<paragraph-break>' option
Teng Long [Sat, 27 May 2023 07:57:51 +0000 (15:57 +0800)] 
notes.c: introduce '--separator=<paragraph-break>' option

When adding new notes or appending to an existing notes, we will
insert a blank line between the paragraphs, like:

     $ git notes add -m foo -m bar
     $ git notes show HEAD
     foo

     bar

The default behavour sometimes is not enough, the user may want
to use a custom delimiter between paragraphs, like when
specifying '-m', '-F', '-C', '-c' options. So this commit
introduce a new '--separator' option for 'git notes add' and
'git notes append', for example when executing:

    $ git notes add -m foo -m bar --separator="-"
    $ git notes show HEAD
    foo
    -
    bar

a newline is added to the value given to --separator if it
does not end with one already. So when executing:

      $ git notes add -m foo -m bar --separator="-"
and
      $ export LF="
      "
      $ git notes add -m foo -m bar --separator="-$LF"

Both the two exections produce the same result.

The reason we use a "strbuf" array to concat but not "string_list", is
that the binary file content may contain '\0' in the middle, this will
cause the corrupt result if using a string to save.

Signed-off-by: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot3321: add test cases about the notes stripspace behavior
Teng Long [Sat, 27 May 2023 07:57:50 +0000 (15:57 +0800)] 
t3321: add test cases about the notes stripspace behavior

Signed-off-by: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agonotes.c: use designated initializers for clarity
Teng Long [Sat, 27 May 2023 07:57:49 +0000 (15:57 +0800)] 
notes.c: use designated initializers for clarity

The "struct note_data d = { 0, 0, NULL, STRBUF_INIT };" style could be
replaced with designated initializer for clarity.

Signed-off-by: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agonotes.c: cleanup 'strbuf_grow' call in 'append_edit'
Teng Long [Sat, 27 May 2023 07:57:48 +0000 (15:57 +0800)] 
notes.c: cleanup 'strbuf_grow' call in 'append_edit'

Let's cleanup the unnecessary 'strbuf_grow' call in 'append_edit'. This
"strbuf_grow(&d.buf, size + 1);" is prepared for insert a blank line if
needed, but actually when inserting, "strbuf_insertstr(&d.buf, 0,
"\n");" will do the "grow" for us.

348f199b (builtin-notes: Refactor handling of -F option to allow
combining -m and -F, 2010-02-13) added these to mimic the code
introduced by 2347fae5 (builtin-notes: Add "append" subcommand for
appending to note objects, 2010-02-13) that reads in previous note
before the message.  And the resulting code with explicit sizing is
carried to this day.

In the context of reading an existing note in, exact sizing may have
made sense, but because the resulting note needs cleansing with
stripspace() when appending with this option, such an exact sizing
does not buy us all that much in practice.

It may help avoiding overallocation due to ALLOC_GROW() slop, but
nobody can feed so many long messages for it to matter from the
command line.

Signed-off-by: Teng Long <dyroneteng@gmail.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe twelfth batch
Junio C Hamano [Fri, 21 Apr 2023 21:57:45 +0000 (14:57 -0700)] 
The twelfth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ow/ref-filter-omit-empty'
Junio C Hamano [Fri, 21 Apr 2023 22:35:05 +0000 (15:35 -0700)] 
Merge branch 'ow/ref-filter-omit-empty'

"git branch --format=..." and "git format-patch --format=..."
learns "--omit-empty" to hide refs that whose formatting result
becomes an empty string from the output.

* ow/ref-filter-omit-empty:
  branch, for-each-ref, tag: add option to omit empty lines

2 years agoMerge branch 'ah/format-patch-thread-doc'
Junio C Hamano [Fri, 21 Apr 2023 22:35:04 +0000 (15:35 -0700)] 
Merge branch 'ah/format-patch-thread-doc'

Doc update.

* ah/format-patch-thread-doc:
  format-patch: correct documentation of --thread without an argument

2 years agoMerge branch 'rn/sparse-describe'
Junio C Hamano [Fri, 21 Apr 2023 22:35:04 +0000 (15:35 -0700)] 
Merge branch 'rn/sparse-describe'

"git describe --dirty" learns to work better with sparse-index.

* rn/sparse-describe:
  describe: enable sparse index for describe

2 years agoMerge branch 'rs/archive-from-subdirectory-fixes'
Junio C Hamano [Fri, 21 Apr 2023 22:35:04 +0000 (15:35 -0700)] 
Merge branch 'rs/archive-from-subdirectory-fixes'

"git archive" run from a subdirectory mishandled attributes and
paths outside the current directory.

* rs/archive-from-subdirectory-fixes:
  archive: improve support for running in subdirectory

2 years agoMerge branch 'fc/doc-stop-using-manversion'
Junio C Hamano [Fri, 21 Apr 2023 22:35:04 +0000 (15:35 -0700)] 
Merge branch 'fc/doc-stop-using-manversion'

Doc build simplification.

* fc/doc-stop-using-manversion:
  doc: simplify man version

2 years agoThe eleventh batch
Junio C Hamano [Thu, 20 Apr 2023 20:41:15 +0000 (13:41 -0700)] 
The eleventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'gc/better-error-when-local-clone-fails-with-symlink'
Junio C Hamano [Thu, 20 Apr 2023 21:33:36 +0000 (14:33 -0700)] 
Merge branch 'gc/better-error-when-local-clone-fails-with-symlink'

"git clone --local" stops copying from an original repository that
has symbolic links inside its $GIT_DIR; an error message when that
happens has been updated.

* gc/better-error-when-local-clone-fails-with-symlink:
  clone: error specifically with --local and symlinked objects

2 years agoMerge branch 'ar/t2024-checkout-output-fix'
Junio C Hamano [Thu, 20 Apr 2023 21:33:36 +0000 (14:33 -0700)] 
Merge branch 'ar/t2024-checkout-output-fix'

Test fix.

* ar/t2024-checkout-output-fix:
  t2024: fix loose/strict local base branch DWIM test

2 years agoMerge branch 'rs/get-tar-commit-id-use-defined-const'
Junio C Hamano [Thu, 20 Apr 2023 21:33:36 +0000 (14:33 -0700)] 
Merge branch 'rs/get-tar-commit-id-use-defined-const'

Code clean-up to replace a hardcoded constant with a CPP macro.

* rs/get-tar-commit-id-use-defined-const:
  get-tar-commit-id: use TYPEFLAG_GLOBAL_HEADER instead of magic value

2 years agoMerge branch 'rs/remove-approxidate-relative'
Junio C Hamano [Thu, 20 Apr 2023 21:33:35 +0000 (14:33 -0700)] 
Merge branch 'rs/remove-approxidate-relative'

The approxidate() API has been simplified by losing an extra
function that did the same thing as another one.

* rs/remove-approxidate-relative:
  date: remove approxidate_relative()

2 years agoMerge branch 'rs/userdiff-multibyte-regex'
Junio C Hamano [Thu, 20 Apr 2023 21:33:35 +0000 (14:33 -0700)] 
Merge branch 'rs/userdiff-multibyte-regex'

The userdiff regexp patterns for various filetypes that are built
into the system have been updated to avoid triggering regexp errors
from UTF-8 aware regex engines.

* rs/userdiff-multibyte-regex:
  userdiff: support regexec(3) with multi-byte support

2 years agoThe tenth batch
Junio C Hamano [Mon, 17 Apr 2023 23:41:04 +0000 (16:41 -0700)] 
The tenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'pw/rebase-cleanup-merge-strategy-option-handling'
Junio C Hamano [Tue, 18 Apr 2023 01:05:13 +0000 (18:05 -0700)] 
Merge branch 'pw/rebase-cleanup-merge-strategy-option-handling'

Clean-up of the code path that deals with merge strategy option
handling in "git rebase".

* pw/rebase-cleanup-merge-strategy-option-handling:
  rebase: remove a couple of redundant strategy tests
  rebase -m: fix serialization of strategy options
  rebase -m: cleanup --strategy-option handling
  sequencer: use struct strvec to store merge strategy options
  rebase: stop reading and writing unnecessary strategy state

2 years agoMerge branch 'cm/branch-delete-error-message-update'
Junio C Hamano [Tue, 18 Apr 2023 01:05:12 +0000 (18:05 -0700)] 
Merge branch 'cm/branch-delete-error-message-update'

"git branch -d origin/master" would say "no such branch", but it is
likely a missed "-r" if refs/remotes/origin/master exists.  The
command has been taught to give such a hint in its error message.

* cm/branch-delete-error-message-update:
  branch: improve error log on branch not found by checking remotes refs

2 years agoMerge branch 'fc/remove-header-workarounds-for-asciidoc'
Junio C Hamano [Tue, 18 Apr 2023 01:05:12 +0000 (18:05 -0700)] 
Merge branch 'fc/remove-header-workarounds-for-asciidoc'

Doc toolchain update to remove old workaround for AsciiDoc.

* fc/remove-header-workarounds-for-asciidoc:
  doc: asciidoc: remove custom header macro

2 years agoMerge branch 'la/mfc-markup-fix'
Junio C Hamano [Tue, 18 Apr 2023 01:05:12 +0000 (18:05 -0700)] 
Merge branch 'la/mfc-markup-fix'

Documentation mark-up fix.

* la/mfc-markup-fix:
  MyFirstContribution: render literal *

2 years agoMerge branch 'tk/mergetool-gui-default-config'
Junio C Hamano [Tue, 18 Apr 2023 01:05:11 +0000 (18:05 -0700)] 
Merge branch 'tk/mergetool-gui-default-config'

"git mergetool" and "git difftool" learns a new configuration
guiDefault to optionally favor configured guitool over non-gui-tool
automatically when $DISPLAY is set.

* tk/mergetool-gui-default-config:
  mergetool: new config guiDefault supports auto-toggling gui by DISPLAY

2 years agoMerge branch 'sl/sparse-write-tree'
Junio C Hamano [Tue, 18 Apr 2023 01:05:11 +0000 (18:05 -0700)] 
Merge branch 'sl/sparse-write-tree'

"git write-tree" learns to work better with sparse-index.

* sl/sparse-write-tree:
  write-tree: integrate with sparse index

2 years agobranch, for-each-ref, tag: add option to omit empty lines
Øystein Walle [Fri, 7 Apr 2023 17:53:16 +0000 (19:53 +0200)] 
branch, for-each-ref, tag: add option to omit empty lines

If the given format string expands to the empty string, a newline is
still printed. This makes using the output linewise more tedious. For
example, git update-ref --stdin does not accept empty lines.

Add options to "git branch", "git for-each-ref", and "git tag" to
not print these empty lines.  The default behavior remains the same.

Signed-off-by: Øystein Walle <oystwa@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe ninth batch
Junio C Hamano [Tue, 11 Apr 2023 19:33:25 +0000 (12:33 -0700)] 
The ninth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jk/use-perl-path-consistently'
Junio C Hamano [Tue, 11 Apr 2023 20:49:13 +0000 (13:49 -0700)] 
Merge branch 'jk/use-perl-path-consistently'

Tests had a few places where we ignored PERL_PATH and blindly used
/usr/bin/perl, which have been corrected.

* jk/use-perl-path-consistently:
  t/lib-httpd: pass PERL_PATH to CGI scripts

2 years agoMerge branch 'jc/clone-object-format-from-void'
Junio C Hamano [Tue, 11 Apr 2023 20:49:13 +0000 (13:49 -0700)] 
Merge branch 'jc/clone-object-format-from-void'

"git clone" from an empty repository learned to propagate the
choice of the hash algorithm from the source repository to the
newly created repository.

* jc/clone-object-format-from-void:
  clone: propagate object-format when cloning from void

2 years agoMerge branch 'fc/doc-manpage-base-url-fix'
Junio C Hamano [Tue, 11 Apr 2023 20:49:13 +0000 (13:49 -0700)] 
Merge branch 'fc/doc-manpage-base-url-fix'

Modernize manpage generation toolchain.

* fc/doc-manpage-base-url-fix:
  doc: remove manpage-base-url workaround

2 years agoMerge branch 'dw/doc-submittingpatches-grammofix'
Junio C Hamano [Tue, 11 Apr 2023 20:49:13 +0000 (13:49 -0700)] 
Merge branch 'dw/doc-submittingpatches-grammofix'

Grammofix.

* dw/doc-submittingpatches-grammofix:
  SubmittingPatches: clarify MUA discussion with "the"

2 years agoMerge branch 'jx/cap-object-info-uninitialized-fix'
Junio C Hamano [Tue, 11 Apr 2023 20:49:12 +0000 (13:49 -0700)] 
Merge branch 'jx/cap-object-info-uninitialized-fix'

Correct use of an uninitialized structure member.

* jx/cap-object-info-uninitialized-fix:
  object-info: init request_info before reading arg

2 years agoMerge branch 'ar/adjust-tests-for-the-index-fallout'
Junio C Hamano [Tue, 11 Apr 2023 20:49:12 +0000 (13:49 -0700)] 
Merge branch 'ar/adjust-tests-for-the-index-fallout'

Comment updates.

* ar/adjust-tests-for-the-index-fallout:
  t2107: fix mention of the_index.cache_changed
  t3060: fix mention of function prune_index

2 years agoMerge branch 'jc/spell-id-in-both-caps-in-message-id'
Junio C Hamano [Tue, 11 Apr 2023 20:49:12 +0000 (13:49 -0700)] 
Merge branch 'jc/spell-id-in-both-caps-in-message-id'

Consistently spell "Message-ID" as such, not "Message-Id".

* jc/spell-id-in-both-caps-in-message-id:
  e-mail workflow: Message-ID is spelled with ID in both capital letters

2 years agoMerge branch 'ws/sparse-check-rules'
Junio C Hamano [Tue, 11 Apr 2023 20:49:12 +0000 (13:49 -0700)] 
Merge branch 'ws/sparse-check-rules'

"git sparse-checkout" command learns a debugging aid for the sparse
rule definitions.

* ws/sparse-check-rules:
  builtin/sparse-checkout: add check-rules command
  builtin/sparse-checkout: remove NEED_WORK_TREE flag

2 years agoclone: error specifically with --local and symlinked objects
Glen Choo [Mon, 10 Apr 2023 22:18:50 +0000 (22:18 +0000)] 
clone: error specifically with --local and symlinked objects

6f054f9fb3 (builtin/clone.c: disallow --local clones with
symlinks, 2022-07-28) gives a good error message when "git clone
--local" fails when the repo to clone has symlinks in
"$GIT_DIR/objects". In bffc762f87 (dir-iterator: prevent top-level
symlinks without FOLLOW_SYMLINKS, 2023-01-24), we later extended this
restriction to the case where "$GIT_DIR/objects" is itself a symlink,
but we didn't update the error message then - bffc762f87's tests show
that we print a generic "failed to start iterator over" message.

This is exacerbated by the fact that Documentation/git-clone.txt
mentions neither restriction, so users are left wondering if this is
intentional behavior or not.

Fix this by adding a check to builtin/clone.c: when doing a local clone,
perform an extra check to see if "$GIT_DIR/objects" is a symlink, and if
so, assume that that was the reason for the failure and report the
relevant information. Ideally, dir_iterator_begin() would tell us that
the real failure reason is the presence of the symlink, but (as far as I
can tell) there isn't an appropriate errno value for that.

Also, update Documentation/git-clone.txt to reflect that this
restriction exists.

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot2024: fix loose/strict local base branch DWIM test
Andrei Rybak [Sat, 8 Apr 2023 20:54:50 +0000 (22:54 +0200)] 
t2024: fix loose/strict local base branch DWIM test

Test 'loosely defined local base branch is reported correctly' in
t2024-checkout-dwim.sh, which was introduced in [1] compares output of
two invocations of "git checkout", invoked with two different branches
named "strict" and "loose".  As per description in [1], the test is
validating that output of tracking information for these two branches.
This tracking information is printed to standard output:

    Your branch is behind 'main' by 1 commit, and can be fast-forwarded.
      (use "git pull" to update your local branch)

The test assumes that the names of the two branches (strict and loose)
are in that output, and pipes the output through sed to replace names of
the branches with "BRANCHNAME".  Command "git checkout", however,
outputs the branch name to standard error, not standard output -- see
message "Switched to branch '%s'\n" in function "update_refs_for_switch"
in "builtin/checkout.c".  This means that the two invocations of sed do
nothing.

Redirect both the standard output and the standard error of "git
checkout" for these assertions.  Ensure that compared files have the
string "BRANCHNAME".

In a series of piped commands, only the return code of the last command
is used.  Thus, all other commands will have their return codes masked.
Avoid piping of output of git directly into sed to preserve the exit
status code of "git checkout", while we're here.

[1] 05e73682cd (checkout: report upstream correctly even with loosely
    defined branch.*.merge, 2014-10-14)

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorebase: remove a couple of redundant strategy tests
Phillip Wood [Mon, 10 Apr 2023 09:08:31 +0000 (10:08 +0100)] 
rebase: remove a couple of redundant strategy tests

Remove a test in t3402 that has been redundant ever since 80ff47957b
(rebase: remember strategy and strategy options, 2011-02-06).  That
commit added a new test, the first part of which (as noted in the old
commit message) duplicated an existing test.

Also remove a test t3418 that has been redundant since the merge backend
was removed in 68aa495b59 (rebase: implement --merge via the interactive
machinery, 2018-12-11), since it now tests the same code paths as the
preceding test.

Helped-by: Elijah Newren <newren@gmail.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorebase -m: fix serialization of strategy options
Phillip Wood [Mon, 10 Apr 2023 09:08:30 +0000 (10:08 +0100)] 
rebase -m: fix serialization of strategy options

To store the strategy options rebase prepends " --" to each one and
writes them to a file. To load them it reads the file and passes the
contents to split_cmdline(). This roughly mimics the behavior of the
scripted rebase but has a couple of limitations, (1) options containing
whitespace are not properly preserved (this is true of the scripted
rebase as well) and (2) options containing '"' or '\' are incorrectly
parsed and may cause the parser to return an error.

Fix these limitations by quoting each option when they are stored so
that they can be parsed correctly. Now that "--preserve-merges" no
longer exist this change also stops prepending "--" to the options when
they are stored as that was an artifact of the scripted rebase.

These changes are backwards compatible so the files written by an older
version of git can still be read. They are also forwards compatible,
the file can still be parsed by recent versions of git as they treat the
"--" prefix as optional.

Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorebase -m: cleanup --strategy-option handling
Phillip Wood [Mon, 10 Apr 2023 09:08:29 +0000 (10:08 +0100)] 
rebase -m: cleanup --strategy-option handling

When handling "--strategy-option" rebase collects the commands into a
struct string_list, then concatenates them into a string, prepending "--"
to each one before splitting the string and removing the "--" prefix.
This is an artifact of the scripted rebase and the need to support
"rebase --preserve-merges". Now that "--preserve-merges" no-longer
exists we can cleanup the way the argument is handled.

The tests for a bad strategy option are adjusted now that
parse_strategy_opts() is no-longer called when starting a rebase. The
fact that it only errors out when running "git rebase --continue" is a
mixed blessing but the next commit will fix the root cause of the
parsing problem so lets not worry about that here.

Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosequencer: use struct strvec to store merge strategy options
Phillip Wood [Mon, 10 Apr 2023 09:08:28 +0000 (10:08 +0100)] 
sequencer: use struct strvec to store merge strategy options

The sequencer stores the merge strategy options in an array of strings
which allocated with ALLOC_GROW(). Using "struct strvec" avoids manually
managing the memory of that array and simplifies the code.

Aside from memory allocation the changes to the sequencer are largely
mechanical, changing xopts_nr to xopts.nr and xopts[i] to xopts.v[i]. A
new option parsing macro OPT_STRVEC() is also added to collect the
strategy options.  Hopefully this can be used to simplify the code in
builtin/merge.c in the future.

Note that there is a change of behavior to "git cherry-pick" and "git
revert" as passing “--no-strategy-option” will now clear any previous
strategy options whereas before this change it did nothing.

Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorebase: stop reading and writing unnecessary strategy state
Phillip Wood [Mon, 10 Apr 2023 09:08:27 +0000 (10:08 +0100)] 
rebase: stop reading and writing unnecessary strategy state

The state files for "--strategy" and "--strategy-option" are written and
read twice, once by builtin/rebase.c and then by sequencer.c. This is an
artifact of the scripted rebase and the need to support "rebase
--preserve-merges". Now that "--preserve-merges" no-longer exists we
only need to read and write these files in sequencer.c. This enables us
to remove a call to free() in read_strategy_opts() that was added by
f1f4ebf432 (sequencer.c: fix "opts->strategy" leak in
read_strategy_opts(), 2022-11-08) as this commit fixes the root cause of
that leak.

There is further scope for removing duplication in the reading and
writing of state files between builtin/rebase.c and sequencer.c but that
is left for a follow up series.

Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoget-tar-commit-id: use TYPEFLAG_GLOBAL_HEADER instead of magic value
René Scharfe [Sat, 8 Apr 2023 10:25:04 +0000 (12:25 +0200)] 
get-tar-commit-id: use TYPEFLAG_GLOBAL_HEADER instead of magic value

Use the same macro in the archive reader code as on the writer side in
archive-tar.c to document the connection.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodate: remove approxidate_relative()
René Scharfe [Sat, 8 Apr 2023 09:35:24 +0000 (11:35 +0200)] 
date: remove approxidate_relative()

When 29f4332e66 (Quit passing 'now' to date code, 2019-09-11) removed
its timeval parameter, approxidate_relative() became equivalent to
approxidate().  Convert its last two call sites and remove the redundant
function.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodoc: simplify man version
Felipe Contreras [Sat, 8 Apr 2023 00:18:29 +0000 (18:18 -0600)] 
doc: simplify man version

The hacks to add version information to the man pages comes from 2007
7ef195ba3e (Documentation: Add version information to man pages,
2007-03-25). In that code we passed three fields to DocBook Stylesheets:
`source`, `version`, and `manual`, however, all the stylesheets do is
join the strings `source` and `version` [1].

Their own documentation explains that in pracice the source is just a
combination of two fields [2]:

  In practice, there are many pages that simply have a version number in
  the "source" field.

Splitting that information might have seemed more proper in 2007, but it
not achieve anything in practice.

Asciidoctor had support for this information in their manpage backend
since day 1: v1.5.3 (2015), but it didn't include the version. In the
docbook5 backend they did in v1.5.7 (2018), but again: no version.

There is no need for us to demand that that they add support for the
version field when in reality all that is going to happen is that both
fields are going to be joined.

Let's do that ourselves so we can forget about all our hacks for this
and so it works for both asciidoc.py, and docbook5 and manpage backends
of asciidoctor.

[1] https://github.com/docbook/xslt10-stylesheets/blob/master/xsl/common/refentry.xsl#L545
[2] https://docbook.sourceforge.net/release/xsl/current/doc/common/template.get.refentry.source.html

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomailmap: change primary address for Emily Shaffer
Emily Shaffer [Fri, 7 Apr 2023 21:22:49 +0000 (14:22 -0700)] 
mailmap: change primary address for Emily Shaffer

Emily finally figured out how to set up their alias at DayJob, and would
prefer to use nasamuffin@google.com, partially to reduce confusion
between IRC and list, and partially because they just like the alias a
lot more.

Signed-off-by: Emily Shaffer <nasamuffin@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agouserdiff: support regexec(3) with multi-byte support
René Scharfe [Thu, 6 Apr 2023 20:19:11 +0000 (22:19 +0200)] 
userdiff: support regexec(3) with multi-byte support

Since 1819ad327b (grep: fix multibyte regex handling under macOS,
2022-08-26) we use the system library for all regular expression
matching on macOS, not just for git grep.  It supports multi-byte
strings and rejects invalid multi-byte characters.

This broke all built-in userdiff word regexes in UTF-8 locales because
they all include such invalid bytes in expressions that are intended to
match multi-byte characters without explicit support for that from the
regex engine.

"|[^[:space:]]|[\xc0-\xff][\x80-\xbf]+" is added to all built-in word
regexes to match a single non-space or multi-byte character.  The \xNN
characters are invalid if interpreted as UTF-8 because they have their
high bit set, which indicates they are part of a multi-byte character,
but they are surrounded by single-byte characters.

Replace that expression with "|[^[:space:]]" if the regex engine
supports multi-byte matching, as there is no need to have an explicit
range for multi-byte characters then.  Check for that capability at
runtime, because it depends on the locale and thus on environment
variables.  Construct the full replacement expression at build time
and just switch it in if necessary to avoid string manipulation and
allocations at runtime.

Additionally the word regex for tex contains the expression
"[a-zA-Z0-9\x80-\xff]+" with a similarly invalid range.  The best
replacement with only valid characters that I can come up with is
"([a-zA-Z0-9]|[^\x01-\x7f])+".  Unlike the original it matches NUL
characters, though.  Assuming that tex files usually don't contain NUL
this should be acceptable.

Reported-by: D. Ben Knoble <ben.knoble@gmail.com>
Reported-by: Eric Sunshine <sunshine@sunshineco.com>
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>
2 years agoMyFirstContribution: render literal *
Linus Arver [Wed, 5 Apr 2023 02:28:29 +0000 (02:28 +0000)] 
MyFirstContribution: render literal *

The HTML version of MyFirstContribution [1] does not render the
asterisks (*) meant to be typed in as glob patterns by the user, because
they are being interpreted as bold text delimiters.

[1]: Search for "pattern" in
https://git-scm.com/docs/MyFirstContribution#v2-git-send-email

Signed-off-by: Linus Arver <linusa@google.com>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe eighth batch
Junio C Hamano [Thu, 6 Apr 2023 18:52:31 +0000 (11:52 -0700)] 
The eighth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ds/fetch-bundle-uri-with-all'
Junio C Hamano [Thu, 6 Apr 2023 20:38:32 +0000 (13:38 -0700)] 
Merge branch 'ds/fetch-bundle-uri-with-all'

"git fetch --all" does not have to download and handle the same
bundleURI over and over, which has been corrected.

* ds/fetch-bundle-uri-with-all:
  fetch: download bundles once, even with --all

2 years agoMerge branch 'ow/ref-format-remove-unused-member'
Junio C Hamano [Thu, 6 Apr 2023 20:38:32 +0000 (13:38 -0700)] 
Merge branch 'ow/ref-format-remove-unused-member'

Code clean-up.

* ow/ref-format-remove-unused-member:
  ref-filter: remove unused ref_format member

2 years agoMerge branch 'jk/chainlint-fixes'
Junio C Hamano [Thu, 6 Apr 2023 20:38:31 +0000 (13:38 -0700)] 
Merge branch 'jk/chainlint-fixes'

Test framework fix.

* jk/chainlint-fixes:
  tests: skip test_eval_ in internal chain-lint
  tests: drop here-doc check from internal chain-linter
  tests: diagnose unclosed here-doc in chainlint.pl
  tests: replace chainlint subshell with a function
  tests: run internal chain-linter under "make test"

2 years agoMerge branch 'en/header-split-cleanup'
Junio C Hamano [Thu, 6 Apr 2023 20:38:31 +0000 (13:38 -0700)] 
Merge branch 'en/header-split-cleanup'

Split key function and data structure definitions out of cache.h to
new header files and adjust the users.

* en/header-split-cleanup:
  csum-file.h: remove unnecessary inclusion of cache.h
  write-or-die.h: move declarations for write-or-die.c functions from cache.h
  treewide: remove cache.h inclusion due to setup.h changes
  setup.h: move declarations for setup.c functions from cache.h
  treewide: remove cache.h inclusion due to environment.h changes
  environment.h: move declarations for environment.c functions from cache.h
  treewide: remove unnecessary includes of cache.h
  wrapper.h: move declarations for wrapper.c functions from cache.h
  path.h: move function declarations for path.c functions from cache.h
  cache.h: remove expand_user_path()
  abspath.h: move absolute path functions from cache.h
  environment: move comment_line_char from cache.h
  treewide: remove unnecessary cache.h inclusion from several sources
  treewide: remove unnecessary inclusion of gettext.h
  treewide: be explicit about dependence on gettext.h
  treewide: remove unnecessary cache.h inclusion from a few headers

2 years agoMerge branch 'ab/remove-implicit-use-of-the-repository'
Junio C Hamano [Thu, 6 Apr 2023 20:38:30 +0000 (13:38 -0700)] 
Merge branch 'ab/remove-implicit-use-of-the-repository'

Code clean-up around the use of the_repository.

* ab/remove-implicit-use-of-the-repository:
  libs: use "struct repository *" argument, not "the_repository"
  post-cocci: adjust comments for recent repo_* migration
  cocci: apply the "revision.h" part of "the_repository.pending"
  cocci: apply the "rerere.h" part of "the_repository.pending"
  cocci: apply the "refs.h" part of "the_repository.pending"
  cocci: apply the "promisor-remote.h" part of "the_repository.pending"
  cocci: apply the "packfile.h" part of "the_repository.pending"
  cocci: apply the "pretty.h" part of "the_repository.pending"
  cocci: apply the "object-store.h" part of "the_repository.pending"
  cocci: apply the "diff.h" part of "the_repository.pending"
  cocci: apply the "commit.h" part of "the_repository.pending"
  cocci: apply the "commit-reach.h" part of "the_repository.pending"
  cocci: apply the "cache.h" part of "the_repository.pending"
  cocci: add missing "the_repository" macros to "pending"
  cocci: sort "the_repository" rules by header
  cocci: fix incorrect & verbose "the_repository" rules
  cocci: remove dead rule from "the_repository.pending.cocci"

2 years agoMerge branch 'gc/config-parsing-cleanup'
Junio C Hamano [Thu, 6 Apr 2023 20:38:29 +0000 (13:38 -0700)] 
Merge branch 'gc/config-parsing-cleanup'

Config API clean-up to reduce its dependence on static variables

* gc/config-parsing-cleanup:
  config.c: rename "struct config_source cf"
  config: report cached filenames in die_bad_number()
  config.c: remove current_parsing_scope
  config.c: remove current_config_kvi
  config.c: plumb the_reader through callbacks
  config.c: create config_reader and the_reader
  config.c: don't assign to "cf_global" directly
  config.c: plumb config_source through static fns

2 years agoMerge branch 'sm/ssl-key-type-config'
Junio C Hamano [Thu, 6 Apr 2023 20:38:29 +0000 (13:38 -0700)] 
Merge branch 'sm/ssl-key-type-config'

Add a few configuration variables to tell the cURL library that
different types of ssl-cert and ssl-key are in use.

* sm/ssl-key-type-config:
  http: add support for different sslcert and sslkey types.

2 years agoMerge branch 'ab/config-multi-and-nonbool'
Junio C Hamano [Thu, 6 Apr 2023 20:38:28 +0000 (13:38 -0700)] 
Merge branch 'ab/config-multi-and-nonbool'

Assorted config API updates.

* ab/config-multi-and-nonbool:
  for-each-repo: with bad config, don't conflate <path> and <cmd>
  config API: add "string" version of *_value_multi(), fix segfaults
  config API users: test for *_get_value_multi() segfaults
  for-each-repo: error on bad --config
  config API: have *_multi() return an "int" and take a "dest"
  versioncmp.c: refactor config reading next commit
  config API: add and use a "git_config_get()" family of functions
  config tests: add "NULL" tests for *_get_value_multi()
  config tests: cover blind spots in git_die_config() tests

2 years agoMerge branch 'ps/fetch-ref-update-reporting'
Junio C Hamano [Thu, 6 Apr 2023 20:38:28 +0000 (13:38 -0700)] 
Merge branch 'ps/fetch-ref-update-reporting'

Clean-up of the code path that reports what "git fetch" did to each
ref.

* ps/fetch-ref-update-reporting:
  fetch: centralize printing of reference updates
  fetch: centralize logic to print remote URL
  fetch: centralize handling of per-reference format
  fetch: pass the full local reference name to `format_display`
  fetch: move output format into `display_state`
  fetch: move reference width calculation into `display_state`

2 years agoMerge branch 'jk/unused-post-2.40-part2'
Junio C Hamano [Thu, 6 Apr 2023 20:38:28 +0000 (13:38 -0700)] 
Merge branch 'jk/unused-post-2.40-part2'

Code clean-up for "-Wunused-parameter" build.

* jk/unused-post-2.40-part2:
  parse-options: drop parse_opt_unknown_cb()
  t/helper: mark unused argv/argc arguments
  mark "argv" as unused when we check argc
  builtins: mark unused prefix parameters
  builtins: annotate always-empty prefix parameters
  builtins: always pass prefix to parse_options()
  fast-import: fix file access when run from subdir

2 years agoMerge branch 'jk/unused-post-2.40'
Junio C Hamano [Thu, 6 Apr 2023 20:38:28 +0000 (13:38 -0700)] 
Merge branch 'jk/unused-post-2.40'

More "-Wunused-parameters" code clean-up.

* jk/unused-post-2.40:
  transport: mark unused parameters in fetch_refs_from_bundle()
  http: mark unused parameter in fill_active_slot() callbacks
  http: drop unused parameter from start_object_request()
  mailmap: drop debugging code

2 years agoMerge branch 'jk/document-pack-redundant-deprecation'
Junio C Hamano [Thu, 6 Apr 2023 20:38:27 +0000 (13:38 -0700)] 
Merge branch 'jk/document-pack-redundant-deprecation'

Document that we have marked "pack-redundant" as deprecated.

* jk/document-pack-redundant-deprecation:
  pack-redundant: document deprecation

2 years agoMerge branch 'ps/ahead-behind-truncation-fix'
Junio C Hamano [Thu, 6 Apr 2023 20:38:27 +0000 (13:38 -0700)] 
Merge branch 'ps/ahead-behind-truncation-fix'

Fix unnecessary truncation of generation numbers used in-core.

* ps/ahead-behind-truncation-fix:
  commit-graph: fix truncated generation numbers

2 years agoMerge branch 'ds/ahead-behind'
Junio C Hamano [Thu, 6 Apr 2023 20:38:21 +0000 (13:38 -0700)] 
Merge branch 'ds/ahead-behind'

"git for-each-ref" learns '%(ahead-behind:<base>)' that computes the
distances from a single reference point in the history with bunch
of commits in bulk.

* ds/ahead-behind:
  commit-reach: add tips_reachable_from_bases()
  for-each-ref: add ahead-behind format atom
  commit-reach: implement ahead_behind() logic
  commit-graph: introduce `ensure_generations_valid()`
  commit-graph: return generation from memory
  commit-graph: simplify compute_generation_numbers()
  commit-graph: refactor compute_topological_levels()
  for-each-ref: explicitly test no matches
  for-each-ref: add --stdin option

2 years agobranch: improve error log on branch not found by checking remotes refs
Clement Mabileau [Wed, 5 Apr 2023 11:43:20 +0000 (11:43 +0000)] 
branch: improve error log on branch not found by checking remotes refs

New git users may want to locally delete remote-tracking branches but
don't really understand how they are distinguished from branches by git.
Then one may naively try:
`git branch -d foo/bar` and get a correct error `branch foo/bar not
found` but hard to understand for a newbie, this patch aims to guide one
in such case.

when failing to delete a branch with `git branch -d <branch>` because
of branch not found, try to find a **remote refs** matching `<branch>`
and if so, add an hint:
`Did you forget --remote?` to the error message

Signed-off-by: Clement Mabileau <mabileau.clement@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/lib-httpd: pass PERL_PATH to CGI scripts
Jeff King [Thu, 6 Apr 2023 09:36:02 +0000 (05:36 -0400)] 
t/lib-httpd: pass PERL_PATH to CGI scripts

As discussed in t/README, tests should aim to use PERL_PATH rather than
straight "perl". We usually do this automatically with a "perl" function
in test-lib.sh, but a few cases need to be handled specially.

One such case is the apply-one-time-perl.sh CGI, which invokes plain
"perl". It should be using $PERL_PATH, but to make that work, we must
also instruct Apache to pass through the variable.

Prior to this patch, doing:

  mv /usr/bin/perl /usr/bin/my-perl
  make PERL_PATH=/usr/bin/my-perl test

would fail t5702, t5703, and t5616. After this it passes. This is a
pretty extreme case, as even if you install perl elsewhere, you'd likely
still have it in your $PATH. A more realistic case is that you don't
want to use the perl in your $PATH (because it's older, broken, etc) and
expect PERL_PATH to consistently override that (since that's what it's
documented to do). Removing it completely is just a convenient way of
completely breaking it for testing purposes.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodoc: asciidoc: remove custom header macro
Felipe Contreras [Thu, 23 Mar 2023 22:15:23 +0000 (16:15 -0600)] 
doc: asciidoc: remove custom header macro

In 2007 we added a custom header macro to provide version information
7ef195ba3e (Documentation: Add version information to man pages,
2007-03-25),

However, in 2008 asciidoc added the attributes to do this properly [1].

This was not implemented in Git until 2019: 226daba280 (Doc/Makefile:
give mansource/-version/-manual attributes, 2019-09-16).

But in 2023 we are doing it properly, so there's no need for the custom
macro.

[1] https://github.com/asciidoc-py/asciidoc-py/commit/ad78a3c

Cc: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomergetool: new config guiDefault supports auto-toggling gui by DISPLAY
Tao Klerks [Sat, 18 Mar 2023 15:27:43 +0000 (15:27 +0000)] 
mergetool: new config guiDefault supports auto-toggling gui by DISPLAY

When no merge.tool or diff.tool is configured or manually selected, the
selection of a default tool is sensitive to the DISPLAY variable; in a
GUI session a gui-specific tool will be proposed if found, and
otherwise a terminal-based one. This "GUI-optimizing" behavior is
important because a GUI can make a huge difference to a user's ability
to understand and correctly complete a non-trivial conflicting merge.

Some time ago the merge.guitool and diff.guitool config options were
introduced to enable users to configure both a GUI tool, and a non-GUI
tool (with fallback if no GUI tool configured), in the same environment.

Unfortunately, the --gui argument introduced to support the selection of
the guitool is still explicit. When using configured tools, there is no
equivalent of the no-tool-configured "propose a GUI tool if we are in a GUI
environment" behavior.

As proposed in <xmqqmtb8jsej.fsf@gitster.g>, introduce new configuration
options, difftool.guiDefault and mergetool.guiDefault, supporting a special
value "auto" which causes the corresponding tool or guitool to be selected
depending on the presence of a non-empty DISPLAY value. Also support "true"
to say "default to the guitool (unless --no-gui is passed on the
commandline)", and "false" as the previous default behavior when these new
configuration options are not specified.

Signed-off-by: Tao Klerks <tao@klerks.biz>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoSubmittingPatches: clarify MUA discussion with "the"
Daniel Watson [Wed, 5 Apr 2023 08:34:03 +0000 (01:34 -0700)] 
SubmittingPatches: clarify MUA discussion with "the"

Without the word "the", the sentence is a little harder to read. The
word "the" makes it clearer that the comment refers to discrete patches,
and not portions of individual patches.

Signed-off-by: Daniel Watson <ozzloy@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodoc: remove manpage-base-url workaround
Felipe Contreras [Wed, 22 Mar 2023 00:08:15 +0000 (18:08 -0600)] 
doc: remove manpage-base-url workaround

Commit 50d9bbba92 (Documentation: Avoid use of xmlto --stringparam,
2009-12-04) introduced manpage-base-url.xsl because ancient versions of
xmlto did not have --stringparam.

However, that was more than ten years ago, no need for that complexity
anymore, we can just use --stringparam.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Acked-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoclone: propagate object-format when cloning from void
Junio C Hamano [Wed, 5 Apr 2023 21:15:33 +0000 (14:15 -0700)] 
clone: propagate object-format when cloning from void

A user could prepare an empty repository and set it to use SHA256 as
the object format.  The new repository created by "git clone" from
such a repository however would not record that it is expecting
objects in the same SHA256 format.  This works as expected if the
source repository is not empty.

Just like we started copying the name of the primary branch from the
remote repository even if it is unborn in 3d8314f8 (clone: propagate
empty remote HEAD even with other branches, 2022-07-07), lift the
code that records the object format out of the block executed only
when cloning from an instantiated repository, so that it works also
when cloning from an empty repository.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe seventh batch
Junio C Hamano [Tue, 4 Apr 2023 21:28:07 +0000 (14:28 -0700)] 
The seventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jk/really-deprecate-pack-redundant'
Junio C Hamano [Tue, 4 Apr 2023 21:28:29 +0000 (14:28 -0700)] 
Merge branch 'jk/really-deprecate-pack-redundant'

"git pack-redundant" gave a warning when run, as the command has
outlived its usefulness long ago and is nominated for future
removal.  Now we escalate to give an error.

* jk/really-deprecate-pack-redundant:
  pack-redundant: escalate deprecation warning to an error

2 years agoMerge branch 'jk/document-rev-list-object-name'
Junio C Hamano [Tue, 4 Apr 2023 21:28:29 +0000 (14:28 -0700)] 
Merge branch 'jk/document-rev-list-object-name'

Document what the pathname-looking strings in "rev-list --object"
output are for and what they mean.

* jk/document-rev-list-object-name:
  docs: document caveats of rev-list's object-name output

2 years agoMerge branch 'ar/test-cleanup-unused-file-creation'
Junio C Hamano [Tue, 4 Apr 2023 21:28:29 +0000 (14:28 -0700)] 
Merge branch 'ar/test-cleanup-unused-file-creation'

Test clean-up.

* ar/test-cleanup-unused-file-creation:
  t1507: assert output of rev-parse
  t1404: don't create unused file
  t1400: assert output of update-ref
  t1302: don't create unused file
  t1010: don't create unused files
  t1006: assert error output of cat-file
  t1005: assert output of ls-files

2 years agoMerge branch 'ob/sequencer-save-head-simplify'
Junio C Hamano [Tue, 4 Apr 2023 21:28:28 +0000 (14:28 -0700)] 
Merge branch 'ob/sequencer-save-head-simplify'

Code clean-up.

* ob/sequencer-save-head-simplify:
  sequencer: rewrite save_head() in terms of write_message()

2 years agoMerge branch 'ob/rollback-after-commit-lock-failure'
Junio C Hamano [Tue, 4 Apr 2023 21:28:28 +0000 (14:28 -0700)] 
Merge branch 'ob/rollback-after-commit-lock-failure'

Code clean-up.

* ob/rollback-after-commit-lock-failure:
  sequencer: remove pointless rollback_lock_file()

2 years agoMerge branch 'jk/blame-contents-with-arbitrary-commit'
Junio C Hamano [Tue, 4 Apr 2023 21:28:28 +0000 (14:28 -0700)] 
Merge branch 'jk/blame-contents-with-arbitrary-commit'

"git blame --contents=<file> <rev> -- <path>" used to be forbidden,
but now it finds the origins of lines starting at <file> contents
through the history that leads to <rev>.

* jk/blame-contents-with-arbitrary-commit:
  blame: allow --contents to work with non-HEAD commit

2 years agoMerge branch 'rs/archive-mtime'
Junio C Hamano [Tue, 4 Apr 2023 21:28:28 +0000 (14:28 -0700)] 
Merge branch 'rs/archive-mtime'

Test update.

* rs/archive-mtime:
  t5000: use check_mtime()

2 years agoMerge branch 'ah/rebase-merges-config'
Junio C Hamano [Tue, 4 Apr 2023 21:28:27 +0000 (14:28 -0700)] 
Merge branch 'ah/rebase-merges-config'

Streamline --rebase-merges command line option handling and
introduce rebase.merges configuration variable.

* ah/rebase-merges-config:
  rebase: add a config option for --rebase-merges
  rebase: deprecate --rebase-merges=""
  rebase: add documentation and test for --no-rebase-merges

2 years agoMerge branch 'jk/fast-export-cleanup'
Junio C Hamano [Tue, 4 Apr 2023 21:28:27 +0000 (14:28 -0700)] 
Merge branch 'jk/fast-export-cleanup'

Code clean-up.

* jk/fast-export-cleanup:
  fast-export: drop unused parameter from anonymize_commit_message()
  fast-export: drop data parameter from anonymous generators
  fast-export: de-obfuscate --anonymize-map handling
  fast-export: factor out anonymized_entry creation
  fast-export: simplify initialization of anonymized hashmaps
  fast-export: drop const when storing anonymized values

2 years agoMerge branch 'js/split-index-fixes'
Junio C Hamano [Tue, 4 Apr 2023 21:28:27 +0000 (14:28 -0700)] 
Merge branch 'js/split-index-fixes'

The index files can become corrupt under certain conditions when
the split-index feature is in use, especially together with
fsmonitor, which have been corrected.

* js/split-index-fixes:
  unpack-trees: take care to propagate the split-index flag
  fsmonitor: avoid overriding `cache_changed` bits
  split-index; stop abusing the `base_oid` to strip the "link" extension
  split-index & fsmonitor: demonstrate a bug

2 years agoMerge branch 'pw/wildmatch-fixes'
Junio C Hamano [Tue, 4 Apr 2023 21:28:27 +0000 (14:28 -0700)] 
Merge branch 'pw/wildmatch-fixes'

The wildmatch library code unlearns exponential behaviour it
acquired some time ago since it was borrowed from rsync.

* pw/wildmatch-fixes:
  t3070: make chain lint tester happy
  wildmatch: hide internal return values
  wildmatch: avoid undefined behavior
  wildmatch: fix exponential behavior

2 years agowrite-tree: integrate with sparse index
Shuqi Liang [Tue, 4 Apr 2023 00:35:39 +0000 (20:35 -0400)] 
write-tree: integrate with sparse index

Update 'git write-tree' to allow using the sparse-index in memory
without expanding to a full one.

The recursive algorithm for update_one() was already updated in 2de37c5
(cache-tree: integrate with sparse directory entries, 2021-03-03) to
handle sparse directory entries in the index. Hence we can just set the
requires-full-index to false for "write-tree".

The `p2000` tests demonstrate a ~96% execution time reduction for 'git
write-tree' using a sparse index:

Test                                           before  after
-----------------------------------------------------------------
2000.78: git write-tree (full-v3)              0.34    0.33 -2.9%
2000.79: git write-tree (full-v4)              0.32    0.30 -6.3%
2000.80: git write-tree (sparse-v3)            0.47    0.02 -95.8%
2000.81: git write-tree (sparse-v4)            0.45    0.02 -95.6%

Signed-off-by: Shuqi Liang <cheskaqiqi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodescribe: enable sparse index for describe
Raghul Nanth A [Mon, 3 Apr 2023 16:47:49 +0000 (22:17 +0530)] 
describe: enable sparse index for describe

git describe compares the index with the working tree when (and only
when) it is run with the "--dirty" flag. This is done by the
run_diff_index() function. The function has been made aware of the
sparse-index in the series that led to 8d2c3732 (Merge branch
'ld/sparse-diff-blame', 2021-12-21). Hence we can just set the
requires-full-index to false for "describe".

Performance metrics

  Test                                                     HEAD~1            HEAD
  -------------------------------------------------------------------------------------------------
  2000.2: git describe --dirty (full-v3)                   0.08(0.09+0.01)   0.08(0.06+0.03) +0.0%
  2000.3: git describe --dirty (full-v4)                   0.09(0.07+0.03)   0.08(0.05+0.04) -11.1%
  2000.4: git describe --dirty (sparse-v3)                 0.88(0.82+0.06)   0.02(0.01+0.05) -97.7%
  2000.5: git describe --dirty (sparse-v4)                 0.68(0.60+0.08)   0.02(0.02+0.04) -97.1%
  2000.6: echo >>new && git describe --dirty (full-v3)     0.08(0.04+0.05)   0.08(0.05+0.04) +0.0%
  2000.7: echo >>new && git describe --dirty (full-v4)     0.08(0.07+0.03)   0.08(0.05+0.04) +0.0%
  2000.8: echo >>new && git describe --dirty (sparse-v3)   0.75(0.69+0.07)   0.02(0.03+0.03) -97.3%
  2000.9: echo >>new && git describe --dirty (sparse-v4)   0.81(0.73+0.09)   0.02(0.01+0.05) -97.5%

Signed-off-by: Raghul Nanth A <nanth.raghul@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoformat-patch: correct documentation of --thread without an argument
Alex Henrie [Mon, 3 Apr 2023 04:07:24 +0000 (22:07 -0600)] 
format-patch: correct documentation of --thread without an argument

In Git, almost all command line flags unconditionally override the
corresponding config option.[1] Add a test to confirm that this is the
case for `git format-patch --thread`.

[1] https://lore.kernel.org/git/CAMMLpeS3+NUQa2oqpHKVo3yWQNVMgkEXrs4U5_ggvk31yQbezQ@mail.gmail.com/

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoobject-info: init request_info before reading arg
Jiang Xin [Sun, 2 Apr 2023 13:05:57 +0000 (21:05 +0800)] 
object-info: init request_info before reading arg

When retrieving object info via capability "object-info", we store the
command args into a requested_info variable, but forget to initialize
it. Initialize the variable before use to prevent unexpected output.

Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoe-mail workflow: Message-ID is spelled with ID in both capital letters
Junio C Hamano [Fri, 16 Dec 2022 01:47:19 +0000 (10:47 +0900)] 
e-mail workflow: Message-ID is spelled with ID in both capital letters

We used to write "Message-Id:" and "Message-ID:" pretty much
interchangeably, and the header name is defined to be case
insensitive by the RFCs, but the canonical form "Message-ID:" is
used throughout the RFC documents, so let's imitate it ourselves.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
2 years agoThe sixth batch
Junio C Hamano [Sat, 1 Apr 2023 00:50:32 +0000 (17:50 -0700)] 
The sixth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'ss/hashmap-typofix'
Junio C Hamano [Sat, 1 Apr 2023 00:50:23 +0000 (17:50 -0700)] 
Merge branch 'ss/hashmap-typofix'

Typofix.

* ss/hashmap-typofix:
  hashmap.h: fix minor typo

2 years agoMerge branch 'ds/p2000-fix-grep-sparse'
Junio C Hamano [Sat, 1 Apr 2023 00:50:23 +0000 (17:50 -0700)] 
Merge branch 'ds/p2000-fix-grep-sparse'

Fix perf test.

* ds/p2000-fix-grep-sparse:
  p2000: remove stray '--sparse' flag from test

2 years agoMerge branch 'kh/commentchar-config-error-message'
Junio C Hamano [Sat, 1 Apr 2023 00:50:23 +0000 (17:50 -0700)] 
Merge branch 'kh/commentchar-config-error-message'

Doc update.

* kh/commentchar-config-error-message:
  config: tell the user that we expect an ASCII character

2 years agoMerge branch 'ab/retire-scripted-add-p'
Junio C Hamano [Sat, 1 Apr 2023 00:50:23 +0000 (17:50 -0700)] 
Merge branch 'ab/retire-scripted-add-p'

Test fix.

* ab/retire-scripted-add-p:
  t3701: we don't need no Perl for `add -i` anymore

2 years agoMerge branch 'js/t5563-portability-fix'
Junio C Hamano [Sat, 1 Apr 2023 00:50:23 +0000 (17:50 -0700)] 
Merge branch 'js/t5563-portability-fix'

Test portability fix.

* js/t5563-portability-fix:
  t5563: prevent "ambiguous redirect"

2 years agoMerge branch 'bb/unicode-width-table-15'
Junio C Hamano [Sat, 1 Apr 2023 00:50:23 +0000 (17:50 -0700)] 
Merge branch 'bb/unicode-width-table-15'

Update width table for the latest edition of Unicode.

* bb/unicode-width-table-15:
  unicode: update the width tables to Unicode 15

2 years agot2107: fix mention of the_index.cache_changed
Andrei Rybak [Fri, 31 Mar 2023 14:36:04 +0000 (16:36 +0200)] 
t2107: fix mention of the_index.cache_changed

Commit [1] added a test to t2107-update-index-basic.sh with a comment
that mentions macro "active_cache_changed".  Later in [2], the macro was
removed and its usage in function cmd_update_index in file
builtin/update-index.c was replaced with "the_index.cache_changed".

Fix the outdated comment in file t2107-update-index-basic.sh.

[1] fa137f67a4 (lockfile.c: store absolute path, 2014-11-02)
[2] dc594180d9 (cocci & cache.h: apply variable section of "pending"
    index-compatibility, 2022-11-19)

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot3060: fix mention of function prune_index
Andrei Rybak [Fri, 31 Mar 2023 14:36:03 +0000 (16:36 +0200)] 
t3060: fix mention of function prune_index

Commit [1] added tests which trigger function prune_cache.  The comments
in these tests, however, incorrectly call it "prune_path".  Since then,
function "prune_cache" has been renamed to "prune_index" in commit [2].
Later still in commit [3], the_index singleton, which is also mentioned
in a comment, stopped being used directly with function "prune_index".

Fix mentions of function "prune_index" and the struct it changes in
comments in file "t3060-ls-files-with-tree.sh".

[1] 54e1abce90 (Add test case for ls-files --with-tree, 2007-10-03)
[2] 6510ae173a (ls-files: convert prune_cache to take an index,
    2017-06-12)
[3] 188dce131f (ls-files: use repository object, 2017-06-22)

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofetch: download bundles once, even with --all
Derrick Stolee [Fri, 31 Mar 2023 15:59:04 +0000 (15:59 +0000)] 
fetch: download bundles once, even with --all

When fetch.bundleURI is set, 'git fetch' downloads bundles from the
given bundle URI before fetching from the specified remote. However,
when using non-file remotes, 'git fetch --all' will launch 'git fetch'
subprocesses which then read fetch.bundleURI and fetch the bundle list
again. We do not expect the bundle list to have new information during
these multiple runs, so avoid these extra calls by un-setting
fetch.bundleURI in the subprocess arguments.

Be careful to skip fetching bundles for the empty bundle string.
Fetching bundles from the empty list presents some interesting test
failures.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot5563: prevent "ambiguous redirect"
Johannes Schindelin [Fri, 31 Mar 2023 06:52:05 +0000 (06:52 +0000)] 
t5563: prevent "ambiguous redirect"

When I ran this test using `TEST_SHELL_PATH=/bin/bash` in my Ubuntu
setup (where Bash is at version 5.0.17(1)-release), I was greeted with
this error message:

./test-lib.sh: line 1072: $CHALLENGE: ambiguous redirect

This commit fixes that error by quoting the `CHALLENGE` variable (which
has as value a path containing spaces), and by avoiding to cuddle the
empty string parameter in the `printf` call with the redirect character
(in fact, the `printf ''>$CHALLENGE` is removed because the next line
overwrites the file anyway because it _also_ uses a single `>` to
redirect the output).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe fifth batch
Junio C Hamano [Thu, 30 Mar 2023 20:47:19 +0000 (13:47 -0700)] 
The fifth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'mk/workaround-pcre-jit-ucp-bug'
Junio C Hamano [Thu, 30 Mar 2023 20:47:12 +0000 (13:47 -0700)] 
Merge branch 'mk/workaround-pcre-jit-ucp-bug'

A recent-ish change to allow unicode character classes to be used
with "grep -P" triggered a JIT bug in older pcre2 libraries.
The problematic change in Git built with these older libraries has
been disabled to work around the bug.

* mk/workaround-pcre-jit-ucp-bug:
  grep: work around UTF-8 related JIT bug in PCRE2 <= 10.34