]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agoremote-mediawiki tests: use inline PerlIO for readability
Ævar Arnfjörð Bjarmason [Mon, 21 Sep 2020 10:39:53 +0000 (12:39 +0200)] 
remote-mediawiki tests: use inline PerlIO for readability

Replace the use of the "open" pragma with a three-arg open in the
places that actually care about UTF-8, while leaving those that
don't (the config parsing).

Unlike the previous "encoding" pragma change this isn't needed for
compatibility with anything. I just think it's easier to read code
that has localized effects than code that changes global settings.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoremote-mediawiki tests: replace deprecated Perl construct
Ævar Arnfjörð Bjarmason [Mon, 21 Sep 2020 10:39:52 +0000 (12:39 +0200)] 
remote-mediawiki tests: replace deprecated Perl construct

The use of the encoding pragma has been a hard error since Perl
5.18 (released in 2013).

What this script really wanted to do was to decode @ARGV and write out
some files with the UTF-8 PerlIO layer. Let's just do that explicitly
instead.

This explicitly does not retain the previous UTF-8 semantics of the
script. The "encoding" pragma had all sorts of global effects (program
text being UTF-8, stdin/stdout etc.). But the only thing that was
required was decoding @ARGV and writing out UTF-8 data, which is
currently facilitated with the "open" pragma.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoremote-mediawiki tests: use a more idiomatic dispatch table
Ævar Arnfjörð Bjarmason [Mon, 21 Sep 2020 10:39:51 +0000 (12:39 +0200)] 
remote-mediawiki tests: use a more idiomatic dispatch table

Change the dispatch table code in test-gitmw.pl to use a hash where
subroutine references are the values. This is more obvious than a hash
where the values are strings we'll use to go searching around in the
symbol table for the function.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoremote-mediawiki tests: use "$dir/" instead of "$dir."
Ævar Arnfjörð Bjarmason [Mon, 21 Sep 2020 10:39:50 +0000 (12:39 +0200)] 
remote-mediawiki tests: use "$dir/" instead of "$dir."

Change UI messages to use "$dir/" instead of "$dir.". I think this is
less confusing when referring to an absolute directory path.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoremote-mediawiki tests: change `[]` to `test`
Ævar Arnfjörð Bjarmason [Mon, 21 Sep 2020 10:39:49 +0000 (12:39 +0200)] 
remote-mediawiki tests: change `[]` to `test`

Convert `[]` to `test` and break if-then into separate lines, both of
which bring the style in line with Git's coding guidelines.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoremote-mediawiki tests: use test_cmp in tests
Ævar Arnfjörð Bjarmason [Mon, 21 Sep 2020 10:39:48 +0000 (12:39 +0200)] 
remote-mediawiki tests: use test_cmp in tests

Change code that used an ad-hoc "diff -b" invocation to use our
test_cmp helper instead. I'm also changing the order of arguments to
be the standard "test_cmp <expected> <actual>".

Using test_cmp has different semantics since the "-b" option to diff
causes it to ignore whitespace, but in these cases the use of "-b" was
just meaningless boilerplate. The desired semantics here are to
compare "git log" lines with know-good data, so we don't want to
ignore whitespace.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoremote-mediawiki tests: use a 10 character password
Ævar Arnfjörð Bjarmason [Mon, 21 Sep 2020 10:39:47 +0000 (12:39 +0200)] 
remote-mediawiki tests: use a 10 character password

In more recent versions of MediaWiki this is a requirement, e.g. the
current stable version of 1.32.2.

The web installer now refuses our old 9 character password, the
command-line one (will be used in a subsequent change) will accept it,
but trying to use it in the web UI will emit an error asking the user
to reset the password. Let's use a password that'll just work and
allow us to log in as the admin user.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoremote-mediawiki tests: use the login/password variables
Ævar Arnfjörð Bjarmason [Mon, 21 Sep 2020 10:39:46 +0000 (12:39 +0200)] 
remote-mediawiki tests: use the login/password variables

Change a hardcoded user/password for the corresponding variable
defined in contrib/mw-to-git/t/test.config.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoremote-mediawiki doc: don't hardcode Debian PHP versions
Ævar Arnfjörð Bjarmason [Mon, 21 Sep 2020 10:39:45 +0000 (12:39 +0200)] 
remote-mediawiki doc: don't hardcode Debian PHP versions

Change the hardcoded version 5 PHP versions to the version-agnostic
packages. Currently Debian stable's version is 7.3, and there's a
php7.3, php7.3-cli etc. package available (but no php5-*).

The corresponding version-less package is a dependency package which
depends on whatever the current stable version is. By not hardcoding
the version these instructions won't be out of date when the next
Debian/Ubuntu release happens.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoremote-mediawiki doc: link to MediaWiki's current version
Ævar Arnfjörð Bjarmason [Wed, 16 Sep 2020 10:29:05 +0000 (12:29 +0200)] 
remote-mediawiki doc: link to MediaWiki's current version

Amend a comment in the test.config file to point to the latest
upstream version, which makes it easier for the user to tweak this.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoremote-mediawiki doc: correct link to GitHub project
Ævar Arnfjörð Bjarmason [Wed, 16 Sep 2020 10:29:04 +0000 (12:29 +0200)] 
remote-mediawiki doc: correct link to GitHub project

Change the link to the canonical one, the old link redirects to the
new one.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoFourteenth batch
Junio C Hamano [Wed, 9 Sep 2020 20:52:54 +0000 (13:52 -0700)] 
Fourteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'os/vcbuild'
Junio C Hamano [Wed, 9 Sep 2020 20:53:09 +0000 (13:53 -0700)] 
Merge branch 'os/vcbuild'

Fix build procedure for MSVC.

* os/vcbuild:
  contrib/buildsystems: fix expat library name for generated vcxproj
  vcbuild: fix batch file name in README
  vcbuild: fix library name for expat with make MSVC=1

3 years agoMerge branch 'jt/interpret-branch-name-fallback'
Junio C Hamano [Wed, 9 Sep 2020 20:53:08 +0000 (13:53 -0700)] 
Merge branch 'jt/interpret-branch-name-fallback'

"git status" has trouble showing where it came from by interpreting
reflog entries that recordcertain events, e.g. "checkout @{u}", and
gives a hard/fatal error.  Even though it inherently is impossible
to give a correct answer because the reflog entries lose some
information (e.g. "@{u}" does not record what branch the user was
on hence which branch 'the upstream' needs to be computed, and even
if the record were available, the relationship between branches may
have changed), at least hide the error to allow "status" show its
output.

* jt/interpret-branch-name-fallback:
  wt-status: tolerate dangling marks
  refs: move dwim_ref() to header file
  sha1-name: replace unsigned int with option struct

3 years agoMerge branch 'js/ci-squelch-false-failure'
Junio C Hamano [Wed, 9 Sep 2020 20:53:08 +0000 (13:53 -0700)] 
Merge branch 'js/ci-squelch-false-failure'

CI noise reduction.

* js/ci-squelch-false-failure:
  ci: avoid ugly "failure" in the `ci-config` job
  ci: fix indentation of the `ci-config` job

3 years agoMerge branch 'pb/imap-send-updates'
Junio C Hamano [Wed, 9 Sep 2020 20:53:07 +0000 (13:53 -0700)] 
Merge branch 'pb/imap-send-updates'

"git imap-send" updates.

* pb/imap-send-updates:
  git-imap-send.txt: add note about localized Gmail folders
  git-imap-send.txt: do verify SSL certificate for gmail.com
  git-imap-send.txt: don't duplicate 'Examples' sections

3 years agoMerge branch 'hv/ref-filter-misc'
Junio C Hamano [Wed, 9 Sep 2020 20:53:07 +0000 (13:53 -0700)] 
Merge branch 'hv/ref-filter-misc'

The "--format=" option to the "for-each-ref" command and friends
learned a few more tricks, e.g. the ":short" suffix that applies to
"objectname" now also can be used for "parent", "tree", etc.

* hv/ref-filter-misc:
  ref-filter: add `sanitize` option for 'subject' atom
  pretty: refactor `format_sanitized_subject()`
  ref-filter: add `short` modifier to 'parent' atom
  ref-filter: add `short` modifier to 'tree' atom
  ref-filter: rename `objectname` related functions and fields
  ref-filter: modify error messages in `grab_objectname()`
  ref-filter: refactor `grab_objectname()`
  ref-filter: support different email formats

3 years agoMerge branch 'ss/submodule-summary-in-c-fixes'
Junio C Hamano [Wed, 9 Sep 2020 20:53:07 +0000 (13:53 -0700)] 
Merge branch 'ss/submodule-summary-in-c-fixes'

Fixups to a topic in 'next'.

* ss/submodule-summary-in-c-fixes:
  t7421: eliminate 'grep' check in t7421.4 for mingw compatibility
  submodule: fix style in function definition
  submodule: eliminate unused parameters from print_submodule_summary()

3 years agoMerge branch 'so/separate-field-for-m-and-diff-merges'
Junio C Hamano [Wed, 9 Sep 2020 20:53:07 +0000 (13:53 -0700)] 
Merge branch 'so/separate-field-for-m-and-diff-merges'

Internal API clean-up to handle two options "diff-index" and "log"
have, which happen to share the same short form, more sensibly.

* so/separate-field-for-m-and-diff-merges:
  revision: add separate field for "-m" of "diff-index -m"

3 years agoMerge branch 'es/worktree-repair'
Junio C Hamano [Wed, 9 Sep 2020 20:53:07 +0000 (13:53 -0700)] 
Merge branch 'es/worktree-repair'

"git worktree" gained a "repair" subcommand to help users recover
after moving the worktrees or repository manually without telling
Git.  Also, "git init --separate-git-dir" no longer corrupts
administrative data related to linked worktrees.

* es/worktree-repair:
  init: make --separate-git-dir work from within linked worktree
  init: teach --separate-git-dir to repair linked worktrees
  worktree: teach "repair" to fix outgoing links to worktrees
  worktree: teach "repair" to fix worktree back-links to main worktree
  worktree: add skeleton "repair" command

3 years agoMerge branch 'jk/worktree-check-clean-leakfix'
Junio C Hamano [Wed, 9 Sep 2020 20:53:07 +0000 (13:53 -0700)] 
Merge branch 'jk/worktree-check-clean-leakfix'

Leakfix.

* jk/worktree-check-clean-leakfix:
  worktree: fix leak in check_clean_worktree()

3 years agoMerge branch 'tb/repack-clearing-midx'
Junio C Hamano [Wed, 9 Sep 2020 20:53:06 +0000 (13:53 -0700)] 
Merge branch 'tb/repack-clearing-midx'

When a packfile is removed by "git repack", multi-pack-index gets
cleared; the code was taught to do so less aggressively by first
checking if the midx actually refers to a pack that no longer
exists.

* tb/repack-clearing-midx:
  midx: traverse the local MIDX first
  builtin/repack.c: invalidate MIDX only when necessary

3 years agoMerge branch 'ss/submodule-summary-in-c'
Junio C Hamano [Wed, 9 Sep 2020 20:53:05 +0000 (13:53 -0700)] 
Merge branch 'ss/submodule-summary-in-c'

Yet another subcommand of "git submodule" is getting rewritten in C.

* ss/submodule-summary-in-c:
  submodule: port submodule subcommand 'summary' from shell to C
  t7421: introduce a test script for verifying 'summary' output
  submodule: rename helper functions to avoid ambiguity
  submodule: remove extra line feeds between callback struct and macro

3 years agocontrib/buildsystems: fix expat library name for generated vcxproj
Orgad Shaneh [Mon, 7 Sep 2020 06:00:05 +0000 (06:00 +0000)] 
contrib/buildsystems: fix expat library name for generated vcxproj

expat.lib -> libexpat.lib (libexpatd.lib for debug build).

Signed-off-by: Orgad Shaneh <orgads@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThirteenth batch
Junio C Hamano [Thu, 3 Sep 2020 19:23:59 +0000 (12:23 -0700)] 
Thirteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'pb/doc-external-diff-env'
Junio C Hamano [Thu, 3 Sep 2020 19:37:09 +0000 (12:37 -0700)] 
Merge branch 'pb/doc-external-diff-env'

Doc update.

* pb/doc-external-diff-env:
  git.txt: correct stale 'GIT_EXTERNAL_DIFF' description

3 years agoMerge branch 'jk/xrealloc-avoid-use-after-free'
Junio C Hamano [Thu, 3 Sep 2020 19:37:08 +0000 (12:37 -0700)] 
Merge branch 'jk/xrealloc-avoid-use-after-free'

It was possible for xrealloc() to send a non-NULL pointer that has
been freed, which has been fixed.

* jk/xrealloc-avoid-use-after-free:
  xrealloc: do not reuse pointer freed by zero-length realloc()

3 years agoMerge branch 'jc/post-checkout-doc'
Junio C Hamano [Thu, 3 Sep 2020 19:37:07 +0000 (12:37 -0700)] 
Merge branch 'jc/post-checkout-doc'

Doc update.

* jc/post-checkout-doc:
  doc: clarify how exit status of post-checkout hook is used

3 years agoMerge branch 'pb/doc-sequence-editor-configuration'
Junio C Hamano [Thu, 3 Sep 2020 19:37:06 +0000 (12:37 -0700)] 
Merge branch 'pb/doc-sequence-editor-configuration'

Doc update.

* pb/doc-sequence-editor-configuration:
  doc: mention GIT_SEQUENCE_EDITOR and 'sequence.editor' more

3 years agoMerge branch 'hl/bisect-doc-clarify-bad-good-ordering'
Junio C Hamano [Thu, 3 Sep 2020 19:37:06 +0000 (12:37 -0700)] 
Merge branch 'hl/bisect-doc-clarify-bad-good-ordering'

Doc update.

* hl/bisect-doc-clarify-bad-good-ordering:
  bisect: swap command-line options in documentation

3 years agoMerge branch 'so/pretty-abbrev-doc'
Junio C Hamano [Thu, 3 Sep 2020 19:37:05 +0000 (12:37 -0700)] 
Merge branch 'so/pretty-abbrev-doc'

Documentation update for "--no-abbrev-commit".

* so/pretty-abbrev-doc:
  pretty-options.txt: fix --no-abbrev-commit description

3 years agoMerge branch 'mr/diff-hide-stat-wo-textual-change'
Junio C Hamano [Thu, 3 Sep 2020 19:37:05 +0000 (12:37 -0700)] 
Merge branch 'mr/diff-hide-stat-wo-textual-change'

"git diff --stat -w" showed 0-line changes for paths whose changes
were only whitespaces, which was not intuitive.  We now omit such
paths from the stat output.

* mr/diff-hide-stat-wo-textual-change:
  diff: teach --stat to ignore uninteresting modifications

3 years agoMerge branch 'jt/lazy-fetch'
Junio C Hamano [Thu, 3 Sep 2020 19:37:04 +0000 (12:37 -0700)] 
Merge branch 'jt/lazy-fetch'

Updates to on-demand fetching code in lazily cloned repositories.

* jt/lazy-fetch:
  fetch: no FETCH_HEAD display if --no-write-fetch-head
  fetch-pack: remove no_dependents code
  promisor-remote: lazy-fetch objects in subprocess
  fetch-pack: do not lazy-fetch during ref iteration
  fetch: only populate existing_refs if needed
  fetch: avoid reading submodule config until needed
  fetch: allow refspecs specified through stdin
  negotiator/noop: add noop fetch negotiator

3 years agoMerge branch 'jc/run-command-use-embedded-args'
Junio C Hamano [Thu, 3 Sep 2020 19:37:03 +0000 (12:37 -0700)] 
Merge branch 'jc/run-command-use-embedded-args'

Various callers of run_command API has been modernized.

* jc/run-command-use-embedded-args:
  run_command: teach API users to use embedded 'args' more

3 years agoMerge branch 'jc/undash-in-tree-git-callers'
Junio C Hamano [Thu, 3 Sep 2020 19:37:03 +0000 (12:37 -0700)] 
Merge branch 'jc/undash-in-tree-git-callers'

A handful of places in in-tree code still relied on being able to
execute the git subcommands, especially built-ins, in "git-foo"
form, which have been corrected.

* jc/undash-in-tree-git-callers:
  credential-cache: use child_process.args
  cvsexportcommit: do not run git programs in dashed form
  transport-helper: do not run git-remote-ext etc. in dashed form

3 years agoMerge branch 'jk/slimmed-down'
Junio C Hamano [Thu, 3 Sep 2020 19:37:02 +0000 (12:37 -0700)] 
Merge branch 'jk/slimmed-down'

Trim an unused binary and turn a bunch of commands into built-in.

* jk/slimmed-down:
  drop vcs-svn experiment
  make git-fast-import a builtin
  make git-bugreport a builtin
  make credential helpers builtins
  Makefile: drop builtins from MSVC pdb list

3 years agoMerge branch 'pw/add-p-allowed-options-fix'
Junio C Hamano [Thu, 3 Sep 2020 19:37:02 +0000 (12:37 -0700)] 
Merge branch 'pw/add-p-allowed-options-fix'

"git add -p" update.

* pw/add-p-allowed-options-fix:
  add -p: fix checking of user input
  add -p: use ALLOC_GROW_BY instead of ALLOW_GROW

3 years agoMerge branch 'jt/fetch-pack-loosen-validation-with-packfile-uri'
Junio C Hamano [Thu, 3 Sep 2020 19:37:01 +0000 (12:37 -0700)] 
Merge branch 'jt/fetch-pack-loosen-validation-with-packfile-uri'

Bugfix for "git fetch" when the packfile URI capability is in use.

* jt/fetch-pack-loosen-validation-with-packfile-uri:
  fetch-pack: make packfile URIs work with transfer.fsckobjects
  fetch-pack: document only_packfile in get_pack()
  (various): document from_promisor parameter

3 years agoMerge branch 'ss/t7401-modernize'
Junio C Hamano [Thu, 3 Sep 2020 19:37:01 +0000 (12:37 -0700)] 
Merge branch 'ss/t7401-modernize'

Test clean-up.

* ss/t7401-modernize:
  t7401: add a NEEDSWORK
  t7401: change indentation for enhanced readability
  t7401: change syntax of test_i18ncmp calls for clarity
  t7401: use 'short' instead of 'verify' and cut in rev-parse calls
  t7401: modernize style

3 years agoMerge branch 'pw/rebase-i-more-options'
Junio C Hamano [Thu, 3 Sep 2020 19:37:01 +0000 (12:37 -0700)] 
Merge branch 'pw/rebase-i-more-options'

"git rebase -i" learns a bit more options.

* pw/rebase-i-more-options:
  t3436: do not run git-merge-recursive in dashed form
  rebase: add --reset-author-date
  rebase -i: support --ignore-date
  rebase -i: support --committer-date-is-author-date
  am: stop exporting GIT_COMMITTER_DATE
  rebase -i: add --ignore-whitespace flag

3 years agovcbuild: fix batch file name in README
Orgad Shaneh [Wed, 2 Sep 2020 20:18:20 +0000 (20:18 +0000)] 
vcbuild: fix batch file name in README

Signed-off-by: Orgad Shaneh <orgads@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agovcbuild: fix library name for expat with make MSVC=1
Orgad Shaneh [Wed, 2 Sep 2020 20:16:38 +0000 (20:16 +0000)] 
vcbuild: fix library name for expat with make MSVC=1

Signed-off-by: Orgad Shaneh <orgads@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agowt-status: tolerate dangling marks
Jonathan Tan [Tue, 1 Sep 2020 22:28:09 +0000 (15:28 -0700)] 
wt-status: tolerate dangling marks

When a user checks out the upstream branch of HEAD, the upstream branch
not being a local branch, and then runs "git status", like this:

  git clone $URL client
  cd client
  git checkout @{u}
  git status

no status is printed, but instead an error message:

  fatal: HEAD does not point to a branch

(This error message when running "git branch" persists even after
checking out other things - it only stops after checking out a branch.)

This is because "git status" reads the reflog when determining the "HEAD
detached" message, and thus attempts to DWIM "@{u}", but that doesn't
work because HEAD no longer points to a branch.

Therefore, when calculating the status of a worktree, tolerate dangling
marks. This is done by adding an additional parameter to
dwim_ref() and repo_dwim_ref().

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorefs: move dwim_ref() to header file
Jonathan Tan [Tue, 1 Sep 2020 22:28:08 +0000 (15:28 -0700)] 
refs: move dwim_ref() to header file

This makes it clear that dwim_ref() is just repo_dwim_ref() without the
first parameter.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosha1-name: replace unsigned int with option struct
Jonathan Tan [Tue, 1 Sep 2020 22:28:07 +0000 (15:28 -0700)] 
sha1-name: replace unsigned int with option struct

In preparation for a future patch adding a boolean parameter to
repo_interpret_branch_name(), which might be easily confused with an
existing unsigned int parameter, refactor repo_interpret_branch_name()
to take an option struct instead of the unsigned int parameter.

The static function interpret_branch_mark() is also updated to take the
option struct in preparation for that future patch, since it will also
make use of the to-be-introduced boolean parameter.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofetch: no FETCH_HEAD display if --no-write-fetch-head
Jonathan Tan [Wed, 2 Sep 2020 21:05:39 +0000 (14:05 -0700)] 
fetch: no FETCH_HEAD display if --no-write-fetch-head

887952b8c6 ("fetch: optionally allow disabling FETCH_HEAD update",
2020-08-18) introduced the ability to disable writing to FETCH_HEAD
during fetch, but did not suppress the "<source> -> FETCH_HEAD" message
when this ability is used. This message is misleading in this case,
because FETCH_HEAD is not written. Also, because "fetch" is used to
lazy-fetch missing objects in a partial clone, this significantly
clutters up the output in that case since the objects to be fetched are
potentially numerous.

Therefore, suppress this message when --no-write-fetch-head is passed
(but not when --dry-run is set).

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci: avoid ugly "failure" in the `ci-config` job
Johannes Schindelin [Tue, 1 Sep 2020 20:19:27 +0000 (20:19 +0000)] 
ci: avoid ugly "failure" in the `ci-config` job

In the common case where users have _not_ pushed a `ci-config` branch to
configure which branches should be included in the GitHub workflow runs,
there is a big fat ugly annotation about a failure in the run's log:

X Check failure on line 1 in .github

  @github-actions github-actions / ci-config

  .github#L1

  Process completed with exit code 128.

The reason is that the `ci-config` job tries to clone that `ci-config`
branch, and even if it is configured to continue on error, the
annotation is displayed, and it is distracting.

Let's just handle this on the shell script level, so that the job's step
is not marked as a failure.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci: fix indentation of the `ci-config` job
Johannes Schindelin [Tue, 1 Sep 2020 20:19:26 +0000 (20:19 +0000)] 
ci: fix indentation of the `ci-config` job

The section added in e76eec35540f (ci: allow per-branch config for
GitHub Actions, 2020-05-07) contains a `&&`-chain that connects several
commands. The first command is actually so long that it stretches over
multiple lines, and as per usual, the continuation lines are indented one
more level than the first.

However, the subsequent commands in the `&&`-chain were also indented
one more level than the first command, which was almost certainly
unintended.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoxrealloc: do not reuse pointer freed by zero-length realloc()
Jeff King [Wed, 2 Sep 2020 07:54:39 +0000 (03:54 -0400)] 
xrealloc: do not reuse pointer freed by zero-length realloc()

This patch fixes a bug where xrealloc(ptr, 0) can double-free and
corrupt the heap on some platforms (including at least glibc).

The C99 standard says of malloc (section 7.20.3):

  If the size of the space requested is zero, the behavior is
  implementation-defined: either a null pointer is returned, or the
  behavior is as if the size were some nonzero value, except that the
  returned pointer shall not be used to access an object.

So we might get NULL back, or we might get an actual pointer (but we're
not allowed to look at its contents). To simplify our code, our
xmalloc() handles a NULL return by converting it into a single-byte
allocation. That way callers get consistent behavior. This was done way
back in 4e7a2eccc2 (?alloc: do not return NULL when asked for zero
bytes, 2005-12-29).

We also gave xcalloc() and xrealloc() the same treatment. And according
to C99, that is fine; the text above is in a paragraph that applies to
all three. But what happens to the memory we passed to realloc() in such
a case? I.e., if we do:

  ret = realloc(ptr, 0);

and "ptr" is non-NULL, but we get NULL back, is "ptr" still valid? C99
doesn't cover this case specifically, but says (section 7.20.3.4):

  The realloc function deallocates the old object pointed to by ptr and
  returns a pointer to a new object that has the size specified by size.

So "ptr" is now deallocated, and we must only look at "ret". And since
"ret" is NULL, that means we have no allocated object at all. But that's
not quite the whole story. It also says:

  If memory for the new object cannot be allocated, the old object is
  not deallocated and its value is unchanged.
  [...]
  The realloc function returns a pointer to the new object (which may
  have the same value as a pointer to the old object), or a null pointer
  if the new object could not be allocated.

So if we see a NULL return with a non-zero size, we can expect that the
original object _is_ still valid. But with a non-zero size, it's
ambiguous. The NULL return might mean a failure (in which case the
object is valid), or it might mean that we successfully allocated
nothing, and used NULL to represent that.

The glibc manpage for realloc() explicitly says:

  [...]if size is equal to zero, and ptr is not NULL, then the call is
  equivalent to free(ptr).

Likewise, this StackOverflow answer:

  https://stackoverflow.com/a/2135302

claims that C89 gave similar guidance (but I don't have a copy to verify
it). A comment on this answer:

  https://stackoverflow.com/a/2022410

claims that Microsoft's CRT behaves the same.

But our current "retry with 1 byte" code passes the original pointer
again. So on glibc, we effectively free() the pointer and then try to
realloc() it again, which is undefined behavior.

The simplest fix here is to just pass "ret" (which we know to be NULL)
to the follow-up realloc(). But that means that a system which _doesn't_
free the original pointer would leak it. It's not clear if any such
systems exist, and that interpretation of the standard seems unlikely
(I'd expect a system that doesn't deallocate to simply return the
original pointer in this case). But it's easy enough to err on the safe
side, and just never pass a zero size to realloc() at all.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit.txt: correct stale 'GIT_EXTERNAL_DIFF' description
Philippe Blain [Tue, 1 Sep 2020 13:20:12 +0000 (13:20 +0000)] 
git.txt: correct stale 'GIT_EXTERNAL_DIFF' description

In fde97d8ac6 (Update documentation to remove incorrect GIT_DIFF_OPTS
example., 2006-11-27), the description of the 'GIT_EXTERNAL_DIFF'
variable was moved from 'diff-format.txt' to 'git.txt', and the
documentation was updated to remove a 'diff(1)' invocation since Git did
not use an external diff program anymore by default.

However, the description of 'GIT_EXTERNAL_DIFF' still mentions "instead
of the diff invocation described above", which is confusing.

Correct that outdated sentence.

Also, link to git(1) in 'diff-generate-patch.txt' when GIT_DIFF_OPTS and
GIT_EXTERNAL_DIFF are mentioned, so that users can easily know what
these variables are about.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoTwelfth batch
Junio C Hamano [Mon, 31 Aug 2020 22:00:05 +0000 (15:00 -0700)] 
Twelfth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'ps/ref-transaction-hook'
Junio C Hamano [Mon, 31 Aug 2020 22:49:52 +0000 (15:49 -0700)] 
Merge branch 'ps/ref-transaction-hook'

Code simplification by removing ineffective optimization.

* ps/ref-transaction-hook:
  refs: remove lookup cache for reference-transaction hook

3 years agoMerge branch 'jk/rev-input-given-fix'
Junio C Hamano [Mon, 31 Aug 2020 22:49:52 +0000 (15:49 -0700)] 
Merge branch 'jk/rev-input-given-fix'

Feeding "$ZERO_OID" to "git log --ignore-missing --stdin", and
running "git log --ignore-missing $ZERO_OID" fell back to start
digging from HEAD; it has been corrected to become a no-op, like
"git log --tags=no-tag-matches-this-pattern" does.

* jk/rev-input-given-fix:
  revision: set rev_input_given in handle_revision_arg()

3 years agoMerge branch 'jc/ident-whose-ident'
Junio C Hamano [Mon, 31 Aug 2020 22:49:51 +0000 (15:49 -0700)] 
Merge branch 'jc/ident-whose-ident'

Error message update.

* jc/ident-whose-ident:
  ident: say whose identity is missing when giving user.name hint

3 years agoMerge branch 'rp/apply-cached-doc'
Junio C Hamano [Mon, 31 Aug 2020 22:49:51 +0000 (15:49 -0700)] 
Merge branch 'rp/apply-cached-doc'

The description of --cached/--index options in "git apply --help"
has been updated.

* rp/apply-cached-doc:
  git-apply.txt: update descriptions of --cached, --index

3 years agoMerge branch 'rs/checkout-no-overlay-pathspec-fix'
Junio C Hamano [Mon, 31 Aug 2020 22:49:50 +0000 (15:49 -0700)] 
Merge branch 'rs/checkout-no-overlay-pathspec-fix'

"git restore/checkout --no-overlay" with wildcarded pathspec
mistakenly removed matching paths in subdirectories, which has been
corrected.

* rs/checkout-no-overlay-pathspec-fix:
  checkout, restore: make pathspec recursive

3 years agoMerge branch 'al/bisect-first-parent'
Junio C Hamano [Mon, 31 Aug 2020 22:49:49 +0000 (15:49 -0700)] 
Merge branch 'al/bisect-first-parent'

Finishing touches.

* al/bisect-first-parent:
  bisect: add first-parent option to documentation

3 years agoMerge branch 'jk/refspecs-cleanup'
Junio C Hamano [Mon, 31 Aug 2020 22:49:48 +0000 (15:49 -0700)] 
Merge branch 'jk/refspecs-cleanup'

Preliminary code clean-up before introducing "negative refspec".

* jk/refspecs-cleanup:
  refspec: make sure stack refspec_item variables are zeroed
  refspec: fix documentation referring to refspec_item

3 years agoMerge branch 'hn/refs-pseudorefs'
Junio C Hamano [Mon, 31 Aug 2020 22:49:48 +0000 (15:49 -0700)] 
Merge branch 'hn/refs-pseudorefs'

Accesses to two pseudorefs have been updated to properly use ref
API.

* hn/refs-pseudorefs:
  sequencer: treat REVERT_HEAD as a pseudo ref
  builtin/commit: suggest update-ref for pseudoref removal
  sequencer: treat CHERRY_PICK_HEAD as a pseudo ref
  refs: make refs_ref_exists public

3 years agoMerge branch 'jk/index-pack-w-more-threads'
Junio C Hamano [Mon, 31 Aug 2020 22:49:48 +0000 (15:49 -0700)] 
Merge branch 'jk/index-pack-w-more-threads'

Long ago, we decided to use 3 threads by default when running the
index-pack task in parallel, which has been adjusted a bit upwards.

* jk/index-pack-w-more-threads:
  index-pack: adjust default threading cap
  p5302: count up to online-cpus for thread tests
  p5302: disable thread-count parameter tests by default

3 years agoMerge branch 'hv/ref-filter-trailers-atom-parsing-fix'
Junio C Hamano [Mon, 31 Aug 2020 22:49:47 +0000 (15:49 -0700)] 
Merge branch 'hv/ref-filter-trailers-atom-parsing-fix'

The parser for "git for-each-ref --format=..." was too loose when
parsing the "%(trailers...)" atom, and forgot that "trailers" and
"trailers:<modifiers>" are the only two allowed forms, which has
been corrected.

* hv/ref-filter-trailers-atom-parsing-fix:
  ref-filter: 'contents:trailers' show error if `:` is missing
  t6300: unify %(trailers) and %(contents:trailers) tests

3 years agoMerge branch 'jt/promisor-pack-fix'
Junio C Hamano [Mon, 31 Aug 2020 22:49:46 +0000 (15:49 -0700)] 
Merge branch 'jt/promisor-pack-fix'

Updates into a lazy/partial clone with a submodule did not work
well with transfer.fsckobjects set.

* jt/promisor-pack-fix:
  fetch-pack: in partial clone, pass --promisor

3 years agoMerge branch 'dd/diff-customize-index-line-abbrev'
Junio C Hamano [Mon, 31 Aug 2020 22:49:46 +0000 (15:49 -0700)] 
Merge branch 'dd/diff-customize-index-line-abbrev'

The output from the "diff" family of the commands had abbreviated
object names of blobs involved in the patch, but its length was not
affected by the --abbrev option.  Now it is.

* dd/diff-customize-index-line-abbrev:
  diff: index-line: respect --abbrev in object's name
  t4013: improve diff-post-processor logic

3 years agoMerge branch 'am/ci-wsfix'
Junio C Hamano [Mon, 31 Aug 2020 22:49:46 +0000 (15:49 -0700)] 
Merge branch 'am/ci-wsfix'

Aesthetic fix to a CI configuration file.

* am/ci-wsfix:
  ci: fix inconsistent indentation

3 years agorevision: add separate field for "-m" of "diff-index -m"
Sergey Organov [Mon, 31 Aug 2020 20:14:22 +0000 (23:14 +0300)] 
revision: add separate field for "-m" of "diff-index -m"

Add separate 'match_missing' field for diff-index to use and set it when we
encounter "-m" option. This field won't then be cleared when another meaning of
"-m" is reverted (e.g., by "--no-diff-merges"), nor it will be affected by
future option(s) that might drive 'ignore_merges' field.

Use this new field from diff-lib:do_oneway_diff() instead of reusing
'ignore_merges' field.

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoinit: make --separate-git-dir work from within linked worktree
Eric Sunshine [Mon, 31 Aug 2020 06:58:00 +0000 (02:58 -0400)] 
init: make --separate-git-dir work from within linked worktree

The intention of `git init --separate-work-dir=<path>` is to move the
.git/ directory to a location outside of the main worktree. When used
within a linked worktree, however, rather than moving the .git/
directory as intended, it instead incorrectly moves the worktree's
.git/worktrees/<id> directory to <path>, thus disconnecting the linked
worktree from its parent repository and breaking the worktree in the
process since its local .git file no longer points at a location at
which it can find the object database. Fix this broken behavior.

An intentional side-effect of this change is that it also closes a
loophole not caught by ccf236a23a (init: disallow --separate-git-dir
with bare repository, 2020-08-09) in which the check to prevent
--separate-git-dir being used in conjunction with a bare repository was
unable to detect the invalid combination when invoked from within a
linked worktree. Therefore, add a test to verify that this loophole is
closed, as well.

Reported-by: Henré Botha <henrebotha@gmail.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoinit: teach --separate-git-dir to repair linked worktrees
Eric Sunshine [Mon, 31 Aug 2020 06:57:59 +0000 (02:57 -0400)] 
init: teach --separate-git-dir to repair linked worktrees

A linked worktree's .git file is a "gitfile" pointing at the
.git/worktrees/<id> directory within the repository. When `git init
--separate-git-dir=<path>` is used on an existing repository to relocate
the repository's .git/ directory to a different location, it neglects to
update the .git files of linked worktrees, thus breaking the worktrees
by making it impossible for them to locate the repository. Fix this by
teaching --separate-git-dir to repair the .git file of each linked
worktree to point at the new repository location.

Reported-by: Henré Botha <henrebotha@gmail.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoworktree: teach "repair" to fix outgoing links to worktrees
Eric Sunshine [Mon, 31 Aug 2020 06:57:58 +0000 (02:57 -0400)] 
worktree: teach "repair" to fix outgoing links to worktrees

The .git/worktrees/<id>/gitdir file points at the location of a linked
worktree's .git file. Its content must be of the form
/path/to/worktree/.git (from which the location of the worktree itself
can be derived by stripping the "/.git" suffix). If the gitdir file is
deleted or becomes corrupted or outdated, then Git will be unable to
find the linked worktree. An easy way for the gitdir file to become
outdated is for the user to move the worktree manually (without using
"git worktree move"). Although it is possible to manually update the
gitdir file to reflect the new linked worktree location, doing so
requires a level of knowledge about worktree internals beyond what a
user should be expected to know offhand.

Therefore, teach "git worktree repair" how to repair broken or outdated
.git/worktrees/<id>/gitdir files automatically. (For this to work, the
command must either be invoked from within the worktree whose gitdir
file requires repair, or from within the main or any linked worktree by
providing the path of the broken worktree as an argument to "git
worktree repair".)

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoworktree: teach "repair" to fix worktree back-links to main worktree
Eric Sunshine [Mon, 31 Aug 2020 06:57:57 +0000 (02:57 -0400)] 
worktree: teach "repair" to fix worktree back-links to main worktree

The .git file in a linked worktree is a "gitfile" which points back to
the .git/worktrees/<id> entry in the main worktree or bare repository.
If a worktree's .git file is deleted or becomes corrupted or outdated,
then the linked worktree won't know how to find the repository or any of
its own administrative files (such as 'index', 'HEAD', etc.). An easy
way for the .git file to become outdated is for the user to move the
main worktree or bare repository. Although it is possible to manually
update each linked worktree's .git file to reflect the new repository
location, doing so requires a level of knowledge about worktree
internals beyond what a user should be expected to know offhand.

Therefore, teach "git worktree repair" how to repair broken or outdated
worktree .git files automatically. (For this to work, the command must
be invoked from within the main worktree or bare repository, or from
within a worktree which has not become disconnected from the repository
-- such as one which was created after the repository was moved.)

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc: mention GIT_SEQUENCE_EDITOR and 'sequence.editor' more
Philippe Blain [Mon, 31 Aug 2020 03:40:08 +0000 (03:40 +0000)] 
doc: mention GIT_SEQUENCE_EDITOR and 'sequence.editor' more

The environment variable `GIT_SEQUENCE_EDITOR`, and the configuration
variable 'sequence.editor', which were added in 821881d88d ("rebase -i":
support special-purpose editor to edit insn sheet, 2011-10-17), are
mentioned in the `git config` man page but not anywhere else.

Include `config/sequencer.txt` in `git-rebase.txt`, so that both the
environment variable and the configuration setting are mentioned there.

Also, add `GIT_SEQUENCE_EDITOR` to the list of environment variables
in `git(1)`.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-imap-send.txt: add note about localized Gmail folders
Philippe Blain [Sun, 30 Aug 2020 22:01:20 +0000 (22:01 +0000)] 
git-imap-send.txt: add note about localized Gmail folders

The name of the "Special-Use Mailboxes" in Gmail are localized
using the user's localization settings. Add a note to that effect
in `git imap-send`'s documentation, to make it easier for users to
configure their account.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-imap-send.txt: do verify SSL certificate for gmail.com
Philippe Blain [Sun, 30 Aug 2020 22:01:19 +0000 (22:01 +0000)] 
git-imap-send.txt: do verify SSL certificate for gmail.com

As a public service, it is unlikely that the Gmail server is configured
to throw a certificate that does not verify at the user.

Remove the `sslVerify=false` config from the Gmail example.

Also, comment it in the `example.com` example, and add a note to the
user explaining that they might want to uncomment it if they are having
trouble connecting. While at it, use an Asciidoc 'Note' section in the
Gmail example also.

Based-on-patch-by: Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-imap-send.txt: don't duplicate 'Examples' sections
Philippe Blain [Sun, 30 Aug 2020 22:01:18 +0000 (22:01 +0000)] 
git-imap-send.txt: don't duplicate 'Examples' sections

Remove the 'Examples' subsection in the 'Configuration' section and move
these examples to the 'Examples' section. Also remove the 'Variables'
title since it is now useless.

Also, use appropriate Asciidoc syntax for configuration values, and
capitalize 'Gmail' properly.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomidx: traverse the local MIDX first
Taylor Blau [Fri, 28 Aug 2020 20:22:13 +0000 (16:22 -0400)] 
midx: traverse the local MIDX first

When a repository has an alternate object directory configured, callers
can traverse through each alternate's MIDX by walking the '->next'
pointer.

But, when 'prepare_multi_pack_index_one()' loads multiple MIDXs, it
places the new ones at the front of this pointer chain, not at the end.
This can be confusing for callers such as 'git repack -ad', causing test
failures like in t7700.6 with 'GIT_TEST_MULTI_PACK_INDEX=1'.

The occurs when dropping a pack known to the local MIDX with alternates
configured that have their own MIDX. Since the alternate's MIDX is
returned via 'get_multi_pack_index()', 'midx_contains_pack()' returns
true (which is correct, since it traverses through the '->next' pointer
to find the MIDX in the chain that does contain the requested object).
But, we call 'clear_midx_file()' on 'the_repository', which drops the
MIDX at the path of the first MIDX in the chain, which (in the case of
t7700.6 is the one in the alternate).

This patch addresses that by:

  - placing the local MIDX first in the chain when calling
    'prepare_multi_pack_index_one()', and

  - introducing a new 'get_local_multi_pack_index()', which explicitly
    returns the repository-local MIDX, if any.

Don't impose an additional order on the MIDX's '->next' pointer beyond
that the first item in the chain must be local if one exists so that we
avoid a quadratic insertion.

Likewise, use 'get_local_multi_pack_index()' in
'remove_redundant_pack()' to fix the formerly broken t7700.6 when run
with 'GIT_TEST_MULTI_PACK_INDEX=1'.

Finally, note that the MIDX ordering invariant is only preserved by the
insertion order in 'prepare_packed_git()', which traverses through the
ODB's '->next' pointer, meaning we visit the local object store first.
This fragility makes this an undesirable long-term solution if more
callers are added, but it is acceptable for now since this is the only
caller.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobisect: swap command-line options in documentation
Hugo Locurcio [Fri, 28 Aug 2020 15:31:19 +0000 (15:31 +0000)] 
bisect: swap command-line options in documentation

The positional arguments are specified in this order: "bad" then "good".
To avoid confusion, the options above the positional arguments
are now specified in the same order. They can still be specified in any
order since they're options, not positional arguments.

Signed-off-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agopo: add missing letter for French message
brian m. carlson [Thu, 27 Aug 2020 22:35:27 +0000 (22:35 +0000)] 
po: add missing letter for French message

Add the missing "e" in "de".  While it is possible in French to omit it,
that only occurs with an apostrophe and only when the next word starts
with a vowel or mute h, which is not the case here.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Acked-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoref-filter: add `sanitize` option for 'subject' atom
Hariom Verma [Fri, 21 Aug 2020 21:41:50 +0000 (21:41 +0000)] 
ref-filter: add `sanitize` option for 'subject' atom

Currently, subject does not take any arguments. This commit introduce
`sanitize` formatting option to 'subject' atom.

`subject:sanitize` - print sanitized subject line, suitable for a filename.

e.g.
%(subject): "the subject line"
%(subject:sanitize): "the-subject-line"

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Heba Waly <heba.waly@gmail.com>
Signed-off-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agopretty: refactor `format_sanitized_subject()`
Hariom Verma [Fri, 21 Aug 2020 21:41:49 +0000 (21:41 +0000)] 
pretty: refactor `format_sanitized_subject()`

The function 'format_sanitized_subject()' is responsible for
sanitized subject line in pretty.c
e.g.
the subject line
the-sanitized-subject-line

It would be a nice enhancement to `subject` atom to have the
same feature. So in the later commits, we plan to add this feature
to ref-filter.

Refactor `format_sanitized_subject()`, so it can be reused in
ref-filter.c for adding new modifier `sanitize` to "subject" atom.

Currently, the loop inside `format_sanitized_subject()` runs
until `\n` is found. But now, we stored the first occurrence
of `\n` in a variable `eol` and passed it in
`format_sanitized_subject()`. And the loop runs upto `eol`.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Heba Waly <heba.waly@gmail.com>
Signed-off-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoref-filter: add `short` modifier to 'parent' atom
Hariom Verma [Fri, 21 Aug 2020 21:41:48 +0000 (21:41 +0000)] 
ref-filter: add `short` modifier to 'parent' atom

Sometimes while using 'parent' atom, user might want to see abbrev hash
instead of full 40 character hash.

Just like 'objectname', it might be convenient for users to have the
`:short` and `:short=<length>` option for printing 'parent' hash.

Let's introduce `short` option to 'parent' atom.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Heba Waly <heba.waly@gmail.com>
Signed-off-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoref-filter: add `short` modifier to 'tree' atom
Hariom Verma [Fri, 21 Aug 2020 21:41:47 +0000 (21:41 +0000)] 
ref-filter: add `short` modifier to 'tree' atom

Sometimes while using 'tree' atom, user might want to see abbrev hash
instead of full 40 character hash.

Just like 'objectname', it might be convenient for users to have the
`:short` and `:short=<length>` option for printing 'tree' hash.

Let's introduce `short` option to 'tree' atom.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Heba Waly <heba.waly@gmail.com>
Signed-off-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoref-filter: rename `objectname` related functions and fields
Hariom Verma [Fri, 21 Aug 2020 21:41:46 +0000 (21:41 +0000)] 
ref-filter: rename `objectname` related functions and fields

In previous commits, we prepared some `objectname` related functions
for more generic usage, so that these functions can be used for `tree`
and `parent` atom.

But the name of some functions and fields may mislead someone.
For ex: function `objectname_atom_parser()` implies that it is
for atom `objectname`.

Let's rename all such functions and fields.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Heba Waly <heba.waly@gmail.com>
Signed-off-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoref-filter: modify error messages in `grab_objectname()`
Hariom Verma [Fri, 21 Aug 2020 21:41:45 +0000 (21:41 +0000)] 
ref-filter: modify error messages in `grab_objectname()`

As we plan to use `grab_objectname()` for `tree` and `parent` atom,
it's better to parameterize the error messages in the function
`grab_objectname()` where "objectname" is hard coded.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Heba Waly <heba.waly@gmail.com>
Signed-off-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoref-filter: refactor `grab_objectname()`
Hariom Verma [Fri, 21 Aug 2020 21:41:44 +0000 (21:41 +0000)] 
ref-filter: refactor `grab_objectname()`

Prepares `grab_objectname()` for more generic usage.
This change will allow us to reuse `grab_objectname()` for
the `tree` and `parent` atoms in a following commit.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Heba Waly <heba.waly@gmail.com>
Signed-off-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoref-filter: support different email formats
Hariom Verma [Fri, 21 Aug 2020 21:41:43 +0000 (21:41 +0000)] 
ref-filter: support different email formats

Currently, ref-filter only supports printing email with angle brackets.

Let's add support for two more email options.
- trim : for email without angle brackets.
- localpart : for the part before the @ sign out of trimmed email

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Heba Waly <heba.waly@gmail.com>
Signed-off-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc: clarify how exit status of post-checkout hook is used
Junio C Hamano [Thu, 27 Aug 2020 21:45:11 +0000 (14:45 -0700)] 
doc: clarify how exit status of post-checkout hook is used

Because the hook runs after the main checkout operation finishes, it
cannot affect what branch will be the current branch, what paths are
updated in the working tree, etc., which was described as "cannot
affect the outcome of 'checkout'".

However, the exit status of the hook is used as the exit status of
the 'checkout' command and is observable by anybody who spawned the
'checkout', which was missing from the documentation.  Fix this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoEleventh batch
Junio C Hamano [Thu, 27 Aug 2020 20:57:13 +0000 (13:57 -0700)] 
Eleventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'hn/refs-fetch-head-is-special'
Junio C Hamano [Thu, 27 Aug 2020 21:04:49 +0000 (14:04 -0700)] 
Merge branch 'hn/refs-fetch-head-is-special'

The FETCH_HEAD is now always read from the filesystem regardless of
the ref backend in use, as its format is much richer than the
normal refs, and written directly by "git fetch" as a plain file..

* hn/refs-fetch-head-is-special:
  refs: read FETCH_HEAD and MERGE_HEAD generically
  refs: move gitdir into base ref_store
  refs: fix comment about submodule ref_stores
  refs: split off reading loose ref data in separate function

3 years agoMerge branch 'rz/complete-more-options'
Junio C Hamano [Thu, 27 Aug 2020 21:04:49 +0000 (14:04 -0700)] 
Merge branch 'rz/complete-more-options'

Command line completion (in contrib/) usually omits redundant,
deprecated and/or dangerous options from its output; it learned to
optionally include all of them.

* rz/complete-more-options:
  completion: add GIT_COMPLETION_SHOW_ALL env var
  parse-options: add --git-completion-helper-all

3 years agoMerge branch 'jk/leakfix'
Junio C Hamano [Thu, 27 Aug 2020 21:04:49 +0000 (14:04 -0700)] 
Merge branch 'jk/leakfix'

Code clean-up.

* jk/leakfix:
  submodule--helper: fix leak of core.worktree value
  config: fix leak in git_config_get_expiry_in_days()
  config: drop git_config_get_string_const()
  config: fix leaks from git_config_get_string_const()
  checkout: fix leak of non-existent branch names
  submodule--helper: use strbuf_release() to free strbufs
  clear_pattern_list(): clear embedded hashmaps

3 years agoMerge branch 'en/mem-pool'
Junio C Hamano [Thu, 27 Aug 2020 21:04:48 +0000 (14:04 -0700)] 
Merge branch 'en/mem-pool'

API update.

* en/mem-pool:
  mem-pool: use consistent pool variable name
  mem-pool: use more standard initialization and finalization
  mem-pool: add convenience functions for strdup and strndup

3 years agot7421: eliminate 'grep' check in t7421.4 for mingw compatibility
Shourya Shukla [Thu, 27 Aug 2020 17:45:01 +0000 (23:15 +0530)] 
t7421: eliminate 'grep' check in t7421.4 for mingw compatibility

The 'grep' check in test 4 of t7421 resulted in the failure of t7421 on
Windows due to a different error message

    error: cannot spawn git: No such file or directory

instead of

    fatal: exec 'rev-parse': cd to 'my-subm' failed: No such file or directory

Tighten up the check to compute 'src_abbrev' by guarding the
'verify_submodule_committish()' call using `p->status !='D'`, so that
the former isn't called in case of non-existent submodule directory,
consequently, there is no such error message on any execution
environment. The same need not be implemented for 'dst_abbrev' and is
rather redundant since the conditional 'if (S_ISGITLINK(p->mod_dst))'
already guards the 'verify_submodule_committish()' when we have a
status of 'D'.

Therefore, eliminate the 'grep' check in t7421. Instead, verify the
absence of an error message by doing a 'test_must_be_empty' on the
file containing the error.

Reported-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Helped-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoworktree: add skeleton "repair" command
Eric Sunshine [Thu, 27 Aug 2020 08:21:25 +0000 (04:21 -0400)] 
worktree: add skeleton "repair" command

Worktree administrative files can become corrupted or outdated due to
external factors. Although, it is often possible to recover from such
situations by hand-tweaking these files, doing so requires intimate
knowledge of worktree internals. While information necessary to make
such repairs manually can be obtained from git-worktree.txt and
gitrepository-layout.txt, we can assist users more directly by teaching
git-worktree how to repair its administrative files itself (at least to
some extent). Therefore, add a "git worktree repair" command which
attempts to correct common problems which may arise due to factors
beyond Git's control.

At this stage, the "repair" command is a mere skeleton; subsequent
commits will flesh out the functionality.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agopretty-options.txt: fix --no-abbrev-commit description
Sergey Organov [Wed, 26 Aug 2020 14:49:23 +0000 (17:49 +0300)] 
pretty-options.txt: fix --no-abbrev-commit description

Description suggested --no-abbrev-commit negates --oneline as well as any other
option that implies --abbrev-commit. Fix it to say that it's --abbrev-commit
that is negated, not the option that implies it.

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocredential-cache: use child_process.args
Junio C Hamano [Wed, 26 Aug 2020 21:37:39 +0000 (14:37 -0700)] 
credential-cache: use child_process.args

As child_process structure has an embedded strvec args for
formulating the command line, let's use it instead of using
an out-of-line argv[] whose length needs to be maintained
correctly.

Also, when spawning a git subcommand, omit it from the command list
and instead use the .git_cmd bit in the child_process structure.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoworktree: fix leak in check_clean_worktree()
Jeff King [Thu, 27 Aug 2020 05:25:04 +0000 (01:25 -0400)] 
worktree: fix leak in check_clean_worktree()

We allocate a child_env strvec but never free its memory. Instead, let's
just use the strvec that our child_process struct provides, which is
cleaned up automatically when we run the command.

And while we're moving the initialization of the child_process around,
let's switch it to use the official init function (zero-initializing it
works OK, since strvec is happy enough with that, but it sets a bad
example).

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorun_command: teach API users to use embedded 'args' more
Junio C Hamano [Wed, 26 Aug 2020 22:25:03 +0000 (15:25 -0700)] 
run_command: teach API users to use embedded 'args' more

The child_process structure has an embedded strvec for formulating
the command line argument list these days, but code that predates
the wide use of it prepared a separate char *argv[] array and
manually set the child_process.argv pointer point at it.

Teach these old-style code to lose the separate argv[] array.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocvsexportcommit: do not run git programs in dashed form
Junio C Hamano [Wed, 26 Aug 2020 19:46:50 +0000 (12:46 -0700)] 
cvsexportcommit: do not run git programs in dashed form

This ancient script runs "git-foo" all over the place, which is
OK for a scripted Porcelain in the Git suite, but asking "git" to
dispatch to subcommands is the usual way these days.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotransport-helper: do not run git-remote-ext etc. in dashed form
Junio C Hamano [Wed, 26 Aug 2020 19:46:49 +0000 (12:46 -0700)] 
transport-helper: do not run git-remote-ext etc. in dashed form

Running it as "git remote-ext" and letting "git" dispatch to
"remote-ext" would just be fine and is more idiomatic.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot3436: do not run git-merge-recursive in dashed form
Junio C Hamano [Wed, 26 Aug 2020 21:46:23 +0000 (14:46 -0700)] 
t3436: do not run git-merge-recursive in dashed form

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobuiltin/repack.c: invalidate MIDX only when necessary
Taylor Blau [Tue, 25 Aug 2020 16:04:36 +0000 (12:04 -0400)] 
builtin/repack.c: invalidate MIDX only when necessary

In 525e18c04b (midx: clear midx on repack, 2018-07-12), 'git repack'
learned to remove a multi-pack-index file if it added or removed a pack
from the object store.

This mechanism is a little over-eager, since it is only necessary to
drop a MIDX if 'git repack' removes a pack that the MIDX references.
Adding a pack outside of the MIDX does not require invalidating the
MIDX, and likewise for removing a pack the MIDX does not know about.

Teach 'git repack' to check for this by loading the MIDX, and checking
whether the to-be-removed pack is known to the MIDX. This requires a
slightly odd alternation to a test in t5319, which is explained with a
comment. A new test is added to show that the MIDX is left alone when
both packs known to it are marked as .keep, but two packs unknown to it
are removed and combined into one new pack.

Helped-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>