]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agoMerge branch 'bs/asciidoctor-installation-hints'
Junio C Hamano [Tue, 30 Mar 2021 21:35:36 +0000 (14:35 -0700)] 
Merge branch 'bs/asciidoctor-installation-hints'

Doc update.

* bs/asciidoctor-installation-hints:
  INSTALL: note on using Asciidoctor to build doc

3 years agoMerge branch 'mt/checkout-remove-nofollow'
Junio C Hamano [Tue, 30 Mar 2021 21:35:36 +0000 (14:35 -0700)] 
Merge branch 'mt/checkout-remove-nofollow'

When "git checkout" removes a path that does not exist in the
commit it is checking out, it wasn't careful enough not to follow
symbolic links, which has been corrected.

* mt/checkout-remove-nofollow:
  checkout: don't follow symlinks when removing entries
  symlinks: update comment on threaded_check_leading_path()

3 years agoSync with v2.31.1
Junio C Hamano [Fri, 26 Mar 2021 21:59:47 +0000 (14:59 -0700)] 
Sync with v2.31.1

3 years agoThe fourth batch
Junio C Hamano [Fri, 26 Mar 2021 21:58:49 +0000 (14:58 -0700)] 
The fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'cm/rebase-i-fixup-amend-reword'
Junio C Hamano [Fri, 26 Mar 2021 21:59:03 +0000 (14:59 -0700)] 
Merge branch 'cm/rebase-i-fixup-amend-reword'

"git commit --fixup=<commit>", which was to tweak the changes made
to the contents while keeping the original log message intact,
learned "--fixup=(amend|reword):<commit>", that can be used to
tweak both the message and the contents, and only the message,
respectively.

* cm/rebase-i-fixup-amend-reword:
  doc/git-commit: add documentation for fixup=[amend|reword] options
  t3437: use --fixup with options to create amend! commit
  t7500: add tests for --fixup=[amend|reword] options
  commit: add a reword suboption to --fixup
  commit: add amend suboption to --fixup to create amend! commit
  sequencer: export and rename subject_length()

3 years agoMerge branch 'cm/rebase-i-updates'
Junio C Hamano [Fri, 26 Mar 2021 21:59:03 +0000 (14:59 -0700)] 
Merge branch 'cm/rebase-i-updates'

Follow-up fixes to "cm/rebase-i" topic.

* cm/rebase-i-updates:
  doc/rebase -i: fix typo in the documentation of 'fixup' command
  t/t3437: fixup the test 'multiple fixup -c opens editor once'
  t/t3437: use named commits in the tests
  t/t3437: simplify and document the test helpers
  t/t3437: check the author date of fixed up commit
  t/t3437: remove the dependency of 'expected-message' file from tests
  t/t3437: fixup here-docs in the 'setup' test
  t/lib-rebase: update the documentation of FAKE_LINES
  rebase -i: clarify and fix 'fixup -c' rebase-todo help
  sequencer: rename a few functions
  sequencer: fixup the datatype of the 'flag' argument

3 years agoMerge branch 'cm/rebase-i'
Junio C Hamano [Fri, 26 Mar 2021 21:59:03 +0000 (14:59 -0700)] 
Merge branch 'cm/rebase-i'

"rebase -i" is getting cleaned up and also enhanced.

* cm/rebase-i:
  doc/git-rebase: add documentation for fixup [-C|-c] options
  rebase -i: teach --autosquash to work with amend!
  t3437: test script for fixup [-C|-c] options in interactive rebase
  rebase -i: add fixup [-C | -c] command
  sequencer: use const variable for commit message comments
  sequencer: pass todo_item to do_pick_commit()
  rebase -i: comment out squash!/fixup! subjects from squash message
  sequencer: factor out code to append squash message
  rebase -i: only write fixup-message when it's needed

3 years agoMerge branch 'js/http-pki-credential-store'
Junio C Hamano [Fri, 26 Mar 2021 21:59:02 +0000 (14:59 -0700)] 
Merge branch 'js/http-pki-credential-store'

The http codepath learned to let the credential layer to cache the
password used to unlock a certificate that has successfully been
used.

* js/http-pki-credential-store:
  http: drop the check for an empty proxy password before approving
  http: store credential when PKI auth is used

3 years agoMerge branch 'ab/make-cleanup'
Junio C Hamano [Fri, 26 Mar 2021 21:59:02 +0000 (14:59 -0700)] 
Merge branch 'ab/make-cleanup'

Reorganize Makefile to allow building git.o and other essential
objects without extra stuff needed only for testing.

* ab/make-cleanup:
  Makefile: add {program,xdiff,test,git,fuzz}-objs & objects targets
  Makefile: split OBJECTS into OBJECTS and GIT_OBJS
  Makefile: sort OBJECTS assignment for subsequent change
  Makefile: split up long OBJECTS line
  Makefile: guard against TEST_OBJS in the environment

3 years agoGit 2.31.1 v2.31.1
Junio C Hamano [Fri, 19 Mar 2021 22:07:58 +0000 (15:07 -0700)] 
Git 2.31.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe third patch
Junio C Hamano [Wed, 24 Mar 2021 21:36:01 +0000 (14:36 -0700)] 
The third patch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'nk/diff-index-fsmonitor'
Junio C Hamano [Wed, 24 Mar 2021 21:36:27 +0000 (14:36 -0700)] 
Merge branch 'nk/diff-index-fsmonitor'

"git diff-index" codepath has been taught to trust fsmonitor status
to reduce number of lstat() calls.

* nk/diff-index-fsmonitor:
  fsmonitor: add perf test for git diff HEAD
  fsmonitor: add assertion that fsmonitor is valid to check_removed
  fsmonitor: skip lstat deletion check during git diff-index

3 years agoMerge branch 'jk/fail-prereq-testfix'
Junio C Hamano [Wed, 24 Mar 2021 21:36:27 +0000 (14:36 -0700)] 
Merge branch 'jk/fail-prereq-testfix'

GIT_TEST_FAIL_PREREQS is a mechanism to skip test pieces with
prerequisites to catch broken tests that depend on the side effects
of optional pieces, but did not work at all when negative
prerequisites were involved.

* jk/fail-prereq-testfix:
  t: annotate !PTHREADS tests with !FAIL_PREREQS

3 years agoMerge branch 'tb/geometric-repack'
Junio C Hamano [Wed, 24 Mar 2021 21:36:27 +0000 (14:36 -0700)] 
Merge branch 'tb/geometric-repack'

"git repack" so far has been only capable of repacking everything
under the sun into a single pack (or split by size).  A cleverer
strategy to reduce the cost of repacking a repository has been
introduced.

* tb/geometric-repack:
  builtin/pack-objects.c: ignore missing links with --stdin-packs
  builtin/repack.c: reword comment around pack-objects flags
  builtin/repack.c: be more conservative with unsigned overflows
  builtin/repack.c: assign pack split later
  t7703: test --geometric repack with loose objects
  builtin/repack.c: do not repack single packs with --geometric
  builtin/repack.c: add '--geometric' option
  packfile: add kept-pack cache for find_kept_pack_entry()
  builtin/pack-objects.c: rewrite honor-pack-keep logic
  p5303: measure time to repack with keep
  p5303: add missing &&-chains
  builtin/pack-objects.c: add '--stdin-packs' option
  revision: learn '--no-kept-objects'
  packfile: introduce 'find_kept_pack_entry()'

3 years agoMerge branch 'tb/push-simple-uses-branch-merge-config'
Junio C Hamano [Wed, 24 Mar 2021 21:36:27 +0000 (14:36 -0700)] 
Merge branch 'tb/push-simple-uses-branch-merge-config'

Doc update.

* tb/push-simple-uses-branch-merge-config:
  Documentation/git-push.txt: correct configuration typo

3 years agoThe second batch
Junio C Hamano [Mon, 22 Mar 2021 21:00:00 +0000 (14:00 -0700)] 
The second batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'bc/clone-bare-with-conflicting-config'
Junio C Hamano [Mon, 22 Mar 2021 21:00:25 +0000 (14:00 -0700)] 
Merge branch 'bc/clone-bare-with-conflicting-config'

"git -c core.bare=false clone --bare ..." would have segfaulted,
which has been corrected.

* bc/clone-bare-with-conflicting-config:
  builtin/init-db: handle bare clones when core.bare set to false

3 years agoMerge branch 'jk/filter-branch-sha256'
Junio C Hamano [Mon, 22 Mar 2021 21:00:25 +0000 (14:00 -0700)] 
Merge branch 'jk/filter-branch-sha256'

Code clean-up.

* jk/filter-branch-sha256:
  filter-branch: drop $_x40 glob
  filter-branch: drop multiple-ancestor warning
  t7003: test ref rewriting explicitly

3 years agoMerge branch 'ps/update-ref-trans-hook-doc'
Junio C Hamano [Mon, 22 Mar 2021 21:00:25 +0000 (14:00 -0700)] 
Merge branch 'ps/update-ref-trans-hook-doc'

Doc update.

* ps/update-ref-trans-hook-doc:
  githooks.txt: clarify documentation on reference-transaction hook
  githooks.txt: replace mentions of SHA-1 specific properties

3 years agoMerge branch 'rr/mailmap-entry-self'
Junio C Hamano [Mon, 22 Mar 2021 21:00:25 +0000 (14:00 -0700)] 
Merge branch 'rr/mailmap-entry-self'

* rr/mailmap-entry-self:
  Add entry for Ramkumar Ramachandra

3 years agoMerge branch 'jr/doc-ignore-typofix'
Junio C Hamano [Mon, 22 Mar 2021 21:00:25 +0000 (14:00 -0700)] 
Merge branch 'jr/doc-ignore-typofix'

Doc cleanup.

* jr/doc-ignore-typofix:
  doc: .gitignore documentation typofix

3 years agoMerge branch 'sv/t9801-test-path-is-file-cleanup'
Junio C Hamano [Mon, 22 Mar 2021 21:00:24 +0000 (14:00 -0700)] 
Merge branch 'sv/t9801-test-path-is-file-cleanup'

Test cleanup.

* sv/t9801-test-path-is-file-cleanup:
  t9801: replace test -f with test_path_is_file

3 years agoMerge branch 'dl/cat-file-doc-cleanup'
Junio C Hamano [Mon, 22 Mar 2021 21:00:24 +0000 (14:00 -0700)] 
Merge branch 'dl/cat-file-doc-cleanup'

Doc cleanup.

* dl/cat-file-doc-cleanup:
  git-cat-file.txt: remove references to "sha1"
  git-cat-file.txt: monospace args, placeholders and filenames

3 years agoMerge branch 'rs/pretty-describe'
Junio C Hamano [Mon, 22 Mar 2021 21:00:24 +0000 (14:00 -0700)] 
Merge branch 'rs/pretty-describe'

"git log --format='...'" learned "%(describe)" placeholder.

* rs/pretty-describe:
  archive: expand only a single %(describe) per archive
  pretty: document multiple %(describe) being inconsistent
  t4205: assert %(describe) test coverage
  pretty: add merge and exclude options to %(describe)
  pretty: add %(describe)

3 years agoMerge branch 'dl/stash-show-untracked'
Junio C Hamano [Mon, 22 Mar 2021 21:00:24 +0000 (14:00 -0700)] 
Merge branch 'dl/stash-show-untracked'

"git stash show" learned to optionally show untracked part of the
stash.

* dl/stash-show-untracked:
  stash show: learn stash.showIncludeUntracked
  stash show: teach --include-untracked and --only-untracked

3 years agoMerge branch 'en/ort-perf-batch-8'
Junio C Hamano [Mon, 22 Mar 2021 21:00:23 +0000 (14:00 -0700)] 
Merge branch 'en/ort-perf-batch-8'

Rename detection rework continues.

* en/ort-perf-batch-8:
  diffcore-rename: compute dir_rename_guess from dir_rename_counts
  diffcore-rename: limit dir_rename_counts computation to relevant dirs
  diffcore-rename: compute dir_rename_counts in stages
  diffcore-rename: extend cleanup_dir_rename_info()
  diffcore-rename: move dir_rename_counts into dir_rename_info struct
  diffcore-rename: add function for clearing dir_rename_count
  Move computation of dir_rename_count from merge-ort to diffcore-rename
  diffcore-rename: add a mapping of destination names to their indices
  diffcore-rename: provide basic implementation of idx_possible_rename()
  diffcore-rename: use directory rename guided basename comparisons

3 years agoMerge branch 'ab/grep-pcre2-allocfix'
Junio C Hamano [Mon, 22 Mar 2021 21:00:23 +0000 (14:00 -0700)] 
Merge branch 'ab/grep-pcre2-allocfix'

Updates to memory allocation code around the use of pcre2 library.

* ab/grep-pcre2-allocfix:
  grep/pcre2: move definitions of pcre2_{malloc,free}
  grep/pcre2: move back to thread-only PCREv2 structures
  grep/pcre2: actually make pcre2 use custom allocator
  grep/pcre2: use pcre2_maketables_free() function
  grep/pcre2: use compile-time PCREv2 version test
  grep/pcre2: add GREP_PCRE2_DEBUG_MALLOC debug mode
  grep/pcre2: prepare to add debugging to pcre2_malloc()
  grep/pcre2: correct reference to grep_init() in comment
  grep/pcre2: drop needless assignment to NULL
  grep/pcre2: drop needless assignment + assert() on opt->pcre2

3 years agoMerge branch 'jk/perf-in-worktrees'
Junio C Hamano [Mon, 22 Mar 2021 21:00:23 +0000 (14:00 -0700)] 
Merge branch 'jk/perf-in-worktrees'

Perf test update to work better in secondary worktrees.

* jk/perf-in-worktrees:
  t/perf: avoid copying worktree files from test repo
  t/perf: handle worktrees as test repos

3 years agoMerge branch 'ds/commit-graph-generation-config'
Junio C Hamano [Mon, 22 Mar 2021 21:00:23 +0000 (14:00 -0700)] 
Merge branch 'ds/commit-graph-generation-config'

A new configuration variable has been introduced to allow choosing
which version of the generation number gets used in the
commit-graph file.

* ds/commit-graph-generation-config:
  commit-graph: use config to specify generation type
  commit-graph: create local repository pointer

3 years agoMerge branch 'ab/remote-write-config-in-camel-case'
Junio C Hamano [Mon, 22 Mar 2021 21:00:23 +0000 (14:00 -0700)] 
Merge branch 'ab/remote-write-config-in-camel-case'

Update C code that sets a few configuration variables when a remote
is configured so that it spells configuration variable names in the
canonical camelCase.

* ab/remote-write-config-in-camel-case:
  remote: write camel-cased *.pushRemote on rename
  remote: add camel-cased *.tagOpt key, like clone

3 years agoMerge branch 'mt/cleanly-die-upon-missing-required-filter'
Junio C Hamano [Mon, 22 Mar 2021 21:00:22 +0000 (14:00 -0700)] 
Merge branch 'mt/cleanly-die-upon-missing-required-filter'

We had a code to diagnose and die cleanly when a required
clean/smudge filter is missing, but an assert before that
unnecessarily fired, hiding the end-user facing die() message.

* mt/cleanly-die-upon-missing-required-filter:
  convert: fail gracefully upon missing clean cmd on required filter

3 years agoMerge branch 'jk/open-dotgitx-with-nofollow'
Junio C Hamano [Mon, 22 Mar 2021 21:00:22 +0000 (14:00 -0700)] 
Merge branch 'jk/open-dotgitx-with-nofollow'

It does not make sense to make ".gitattributes", ".gitignore" and
".mailmap" symlinks, as they are supposed to be usable from the
object store (think: bare repositories where HEAD:.mailmap etc. are
used).  When these files are symbolic links, we used to read the
contents of the files pointed by them by mistake, which has been
corrected.

* jk/open-dotgitx-with-nofollow:
  mailmap: do not respect symlinks for in-tree .mailmap
  exclude: do not respect symlinks for in-tree .gitignore
  attr: do not respect symlinks for in-tree .gitattributes
  exclude: add flags parameter to add_patterns()
  attr: convert "macro_ok" into a flags field
  add open_nofollow() helper

3 years agoMerge branch 'tb/git-mv-icase-fix'
Junio C Hamano [Fri, 19 Mar 2021 22:25:40 +0000 (15:25 -0700)] 
Merge branch 'tb/git-mv-icase-fix'

Fix a corner case bug in "git mv" on case insensitive systems,
which was introduced in 2.29 timeframe.

* tb/git-mv-icase-fix:
  git mv foo FOO ; git mv foo bar gave an assert

3 years agoThe first batch in 2.32 cycle
Junio C Hamano [Fri, 19 Mar 2021 22:07:58 +0000 (15:07 -0700)] 
The first batch in 2.32 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'rs/xcalloc-takes-nelem-first'
Junio C Hamano [Fri, 19 Mar 2021 22:25:39 +0000 (15:25 -0700)] 
Merge branch 'rs/xcalloc-takes-nelem-first'

Code cleanup.

* rs/xcalloc-takes-nelem-first:
  fix xcalloc() argument order

3 years agoMerge branch 'ah/make-fuzz-all-doc-update'
Junio C Hamano [Fri, 19 Mar 2021 22:25:39 +0000 (15:25 -0700)] 
Merge branch 'ah/make-fuzz-all-doc-update'

Update insn in Makefile comments to run fuzz-all target.

* ah/make-fuzz-all-doc-update:
  Makefile: update 'make fuzz-all' docs to reflect modern clang

3 years agoMerge branch 'jk/slimmed-down'
Junio C Hamano [Fri, 19 Mar 2021 22:25:38 +0000 (15:25 -0700)] 
Merge branch 'jk/slimmed-down'

Unused code removal.

* jk/slimmed-down:
  vcs-svn: remove header files as well

3 years agoMerge branch 'rs/calloc-array'
Junio C Hamano [Fri, 19 Mar 2021 22:25:38 +0000 (15:25 -0700)] 
Merge branch 'rs/calloc-array'

CALLOC_ARRAY() macro replaces many uses of xcalloc().

* rs/calloc-array:
  cocci: allow xcalloc(1, size)
  use CALLOC_ARRAY
  git-compat-util.h: drop trailing semicolon from macro definition

3 years agoMerge branch 'rs/avoid-null-statement-after-macro-call'
Junio C Hamano [Fri, 19 Mar 2021 22:25:38 +0000 (15:25 -0700)] 
Merge branch 'rs/avoid-null-statement-after-macro-call'

Fix macros that can silently inject unintended null-statements.

* rs/avoid-null-statement-after-macro-call:
  mem-pool: drop trailing semicolon from macro definition
  block-sha1: drop trailing semicolon from macro definition

3 years agoMerge branch 'km/config-doc-typofix'
Junio C Hamano [Fri, 19 Mar 2021 22:25:38 +0000 (15:25 -0700)] 
Merge branch 'km/config-doc-typofix'

Docfix.

* km/config-doc-typofix:
  config.txt: add missing period

3 years agoMerge branch 'jt/clone-unborn-head'
Junio C Hamano [Fri, 19 Mar 2021 22:25:37 +0000 (15:25 -0700)] 
Merge branch 'jt/clone-unborn-head'

Test fix.

* jt/clone-unborn-head:
  t5606: run clone branch name test with protocol v2

3 years agoMerge branch 'js/fsmonitor-unpack-fix'
Junio C Hamano [Fri, 19 Mar 2021 22:25:37 +0000 (15:25 -0700)] 
Merge branch 'js/fsmonitor-unpack-fix'

The data structure used by fsmonitor interface was not properly
duplicated during an in-core merge, leading to use-after-free etc.

* js/fsmonitor-unpack-fix:
  fsmonitor: do not forget to release the token in `discard_index()`
  fsmonitor: fix memory corruption in some corner cases

3 years agoMerge branch 'jk/bisect-peel-tag-fix'
Junio C Hamano [Fri, 19 Mar 2021 22:25:37 +0000 (15:25 -0700)] 
Merge branch 'jk/bisect-peel-tag-fix'

"git bisect" reimplemented more in C during 2.30 timeframe did not
take an annotated tag as a good/bad endpoint well.  This regression
has been corrected.

* jk/bisect-peel-tag-fix:
  bisect: peel annotated tags to commits

3 years agoMerge branch 'jh/fsmonitor-prework'
Junio C Hamano [Fri, 19 Mar 2021 22:25:37 +0000 (15:25 -0700)] 
Merge branch 'jh/fsmonitor-prework'

The fsmonitor interface read from its input without making sure
there is something to read from.  This bug is new in 2.31
timeframe.

* jh/fsmonitor-prework:
  fsmonitor: avoid global-buffer-overflow READ when checking trivial response

3 years agoMerge branch 'jc/calloc-fix'
Junio C Hamano [Fri, 19 Mar 2021 22:25:37 +0000 (15:25 -0700)] 
Merge branch 'jc/calloc-fix'

Code clean-up.

* jc/calloc-fix:
  xcalloc: use CALLOC_ARRAY() when applicable

3 years agobuiltin/pack-objects.c: ignore missing links with --stdin-packs
Taylor Blau [Fri, 19 Mar 2021 15:40:52 +0000 (11:40 -0400)] 
builtin/pack-objects.c: ignore missing links with --stdin-packs

When 'git pack-objects --stdin-packs' encounters a commit in a pack, it
marks it as a starting point of a best-effort reachability traversal
that is used to populate the name-hash of the objects listed in the
given packs.

The traversal expects that it should be able to walk the ancestors of
all commits in a pack without issue. Ordinarily this is the case, but it
is possible to having missing parents from an unreachable part of the
repository. In that case, we'd consider any missing objects in the
unreachable portion of the graph to be junk.

This should be handled gracefully: since the traversal is best-effort
(i.e., we don't strictly need to fill in all of the name-hash fields),
we should simply ignore any missing links.

This patch does that (by setting the 'ignore_missing_links' bit on the
rev_info struct), and ensures we don't regress in the future by adding a
test which demonstrates this case.

It is a little over-eager, since it will also ignore missing links in
reachable parts of the packs (which would indicate a corrupted
repository), but '--stdin-packs' is explicitly *not* about reachability.
So this step isn't making anything worse for a repository which contains
packs missing reachable objects (since we never drop objects with
'--stdin-packs').

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoINSTALL: note on using Asciidoctor to build doc
Bagas Sanjaya [Fri, 19 Mar 2021 11:00:45 +0000 (18:00 +0700)] 
INSTALL: note on using Asciidoctor to build doc

Note on using Asciidoctor to build documentation suite.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot: annotate !PTHREADS tests with !FAIL_PREREQS
Jeff King [Wed, 17 Mar 2021 22:47:03 +0000 (18:47 -0400)] 
t: annotate !PTHREADS tests with !FAIL_PREREQS

Some tests in t5300 and t7810 expect us to complain about a "--threads"
argument when Git is compiled without pthread support. Running these
under GIT_TEST_FAIL_PREREQS produces a confusing failure: we pretend to
the tests that there is no pthread support, so they expect the warning,
but of course the actual build is perfectly happy to respect the
--threads argument.

We never noticed before the recent a926c4b904 (tests: remove most uses
of C_LOCALE_OUTPUT, 2021-02-11), because the tests also were marked as
requiring the C_LOCALE_OUTPUT prerequisite. Which means they'd never
have run in FAIL_PREREQS mode, since it would always pretend that the
locale prereq was not satisfied.

These tests can't possibly work in this mode; it is a mismatch between
what the tests expect and what the build was told to do. So let's just
mark them to be skipped, using the special prereq introduced by
dfe1a17df9 (tests: add a special setup where prerequisites fail,
2019-05-13).

Reported-by: Son Luong Ngoc <sluongng@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofsmonitor: add perf test for git diff HEAD
Nipunn Koorapati [Wed, 17 Mar 2021 21:22:23 +0000 (21:22 +0000)] 
fsmonitor: add perf test for git diff HEAD

Update the xargs call so that if your large repo contains
symlinks, test-tool chmtime failure does not end the script.

On Linux
Test                                                          this tree           upstream/master
---------------------------------------------------------------------------------------------------------
7519.4: status (fsmonitor=fsmonitor-watchman)                 0.52(0.43+0.10)     0.53(0.49+0.05) +1.9%
7519.5: status -uno (fsmonitor=fsmonitor-watchman)            0.21(0.15+0.07)     0.22(0.13+0.09) +4.8%
7519.6: status -uall (fsmonitor=fsmonitor-watchman)           1.65(0.93+0.71)     1.69(1.03+0.65) +2.4%
7519.7: status (dirty) (fsmonitor=fsmonitor-watchman)         11.99(11.34+1.58)   11.95(11.02+1.79) -0.3%
7519.8: diff (fsmonitor=fsmonitor-watchman)                   0.25(0.17+0.26)     0.25(0.18+0.26) +0.0%
7519.9: diff HEAD (fsmonitor=fsmonitor-watchman)              0.39(0.25+0.34)     0.89(0.35+0.74) +128.2%
7519.10: diff -- 0_files (fsmonitor=fsmonitor-watchman)       0.16(0.13+0.04)     0.16(0.12+0.05) +0.0%
7519.11: diff -- 10_files (fsmonitor=fsmonitor-watchman)      0.16(0.12+0.05)     0.16(0.12+0.05) +0.0%
7519.12: diff -- 100_files (fsmonitor=fsmonitor-watchman)     0.16(0.12+0.05)     0.16(0.12+0.05) +0.0%
7519.13: diff -- 1000_files (fsmonitor=fsmonitor-watchman)    0.16(0.11+0.06)     0.16(0.12+0.05) +0.0%
7519.14: diff -- 10000_files (fsmonitor=fsmonitor-watchman)   0.18(0.13+0.06)     0.17(0.10+0.08) -5.6%
7519.15: add (fsmonitor=fsmonitor-watchman)                   2.25(1.53+0.68)     2.25(1.47+0.74) +0.0%
7519.18: status (fsmonitor=disabled)                          0.88(0.73+1.03)     0.89(0.67+1.08) +1.1%
7519.19: status -uno (fsmonitor=disabled)                     0.45(0.43+0.89)     0.45(0.34+0.98) +0.0%
7519.20: status -uall (fsmonitor=disabled)                    1.88(1.16+1.58)     1.88(1.22+1.51) +0.0%
7519.21: status (dirty) (fsmonitor=disabled)                  7.53(7.05+2.11)     7.53(6.98+2.04) +0.0%
7519.22: diff (fsmonitor=disabled)                            0.42(0.37+0.92)     0.42(0.38+0.91) +0.0%
7519.23: diff HEAD (fsmonitor=disabled)                       0.44(0.41+0.90)     0.44(0.40+0.91) +0.0%
7519.24: diff -- 0_files (fsmonitor=disabled)                 0.13(0.09+0.05)     0.13(0.09+0.05) +0.0%
7519.25: diff -- 10_files (fsmonitor=disabled)                0.13(0.10+0.04)     0.13(0.10+0.04) +0.0%
7519.26: diff -- 100_files (fsmonitor=disabled)               0.13(0.09+0.05)     0.13(0.10+0.04) +0.0%
7519.27: diff -- 1000_files (fsmonitor=disabled)              0.13(0.09+0.06)     0.13(0.09+0.05) +0.0%
7519.28: diff -- 10000_files (fsmonitor=disabled)             0.14(0.11+0.05)     0.14(0.10+0.05) +0.0%
7519.29: add (fsmonitor=disabled)                             2.43(1.61+1.64)     2.43(1.69+1.57) +0.0%

On linux (2.29.2 vs w/ this patch):
nipunn@nipunn-dbx:~/src/server3$ strace -f -c git diff 2>&1 | grep lstat
  0.04    0.000063           3        20         6 lstat
nipunn@nipunn-dbx:~/src/server3$ strace -f -c git diff HEAD 2>&1 | grep lstat
 94.98    5.242262          10    523783        13 lstat
nipunn@nipunn-dbx:~/src/server3$ strace -f -c ../git/bin-wrappers/git diff 2>&1 | grep lstat
  0.38    0.000032           5         7         3 lstat
nipunn@nipunn-dbx:~/src/server3$ strace -f -c ../git/bin-wrappers/git diff HEAD 2>&1 | grep lstat
 99.44    0.741892           9     81634        10 lstat

On mac (2.29.2 vs w/ this patch):
nipunn-mbp:server nipunn$ sudo dtruss -L -f -c git diff 2>&1 | grep "^lstat64 "
lstat64                                         8
nipunn-mbp:server nipunn$ sudo dtruss -L -f -c git diff HEAD 2>&1 | grep "^lstat64 "
lstat64                                    120242
nipunn-mbp:server nipunn$ sudo dtruss -L -f -c ../git/bin-wrappers/git diff 2>&1 | grep "^lstat64 "
lstat64                                         4
nipunn-mbp:server nipunn$ sudo dtruss -L -f -c ../git/bin-wrappers/git diff HEAD 2>&1 | grep "^lstat64 "
lstat64                                      4497

There are still a bunch of lstats - on directories, but not every file. Progress!

Signed-off-by: Nipunn Koorapati <nipunn@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofsmonitor: add assertion that fsmonitor is valid to check_removed
Nipunn Koorapati [Wed, 17 Mar 2021 21:22:22 +0000 (21:22 +0000)] 
fsmonitor: add assertion that fsmonitor is valid to check_removed

Validate that fsmonitor is valid to futureproof against bugs where
check_removed might be called from places that haven't refreshed.

Signed-off-by: Nipunn Koorapati <nipunn@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofsmonitor: skip lstat deletion check during git diff-index
Nipunn Koorapati [Wed, 17 Mar 2021 21:22:21 +0000 (21:22 +0000)] 
fsmonitor: skip lstat deletion check during git diff-index

Teach git to honor fsmonitor rather than issuing an lstat
when checking for dirty local deletes. Eliminates O(files)
lstats during `git diff HEAD`

Signed-off-by: Nipunn Koorapati <nipunn@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocheckout: don't follow symlinks when removing entries
Matheus Tavares [Thu, 18 Mar 2021 18:43:47 +0000 (15:43 -0300)] 
checkout: don't follow symlinks when removing entries

At 1d718a5108 ("do not overwrite untracked symlinks", 2011-02-20),
symlink.c:check_leading_path() started returning different codes for
FL_ENOENT and FL_SYMLINK. But one of its callers, unlink_entry(), was
not adjusted for this change, so it started to follow symlinks on the
leading path of to-be-removed entries. Fix that and add a regression
test.

Note that since 1d718a5108 check_leading_path() no longer differentiates
the case where it found a symlink in the path's leading components from
the cases where it found a regular file or failed to lstat() the
component. So, a side effect of this current patch is that
unlink_entry() now returns early in all of these three cases. And
because we no longer try to unlink such paths, we also don't get the
warning from remove_or_warn().

For the regular file and symlink cases, it's questionable whether the
warning was useful in the first place: unlink_entry() removes tracked
paths that should no longer be present in the state we are checking out
to. If the path had its leading dir replaced by another file, it means
that the basename already doesn't exist, so there is no need for a
warning. Sure, we are leaving a regular file or symlink behind at the
path's dirname, but this file is either untracked now (so again, no
need to warn), or it will be replaced by a tracked file during the next
phase of this checkout operation.

As for failing to lstat() one of the leading components, the basename
might still exist only we cannot unlink it (e.g. due to the lack of the
required permissions). Since the user expect it to be removed
(especially with checkout's --no-overlay option), add back the warning
in this more relevant case.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosymlinks: update comment on threaded_check_leading_path()
Matheus Tavares [Thu, 18 Mar 2021 18:43:46 +0000 (15:43 -0300)] 
symlinks: update comment on threaded_check_leading_path()

Since 1d718a5108 ("do not overwrite untracked symlinks", 2011-02-20),
the comment on top of threaded_check_leading_path() is outdated and no
longer reflects the behavior of this function. Let's updated it to avoid
confusions. While we are here, also remove some duplicated comments to
avoid similar maintenance problems.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofsmonitor: do not forget to release the token in `discard_index()`
Johannes Schindelin [Wed, 17 Mar 2021 15:30:49 +0000 (15:30 +0000)] 
fsmonitor: do not forget to release the token in `discard_index()`

In 56c6910028a (fsmonitor: change last update timestamp on the
index_state to opaque token, 2020-01-07), we forgot to adjust
`discard_index()` to release the "last-update" token: it is no longer a
64-bit number, but a free-form string that has been allocated.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofsmonitor: fix memory corruption in some corner cases
Johannes Schindelin [Wed, 17 Mar 2021 15:30:48 +0000 (15:30 +0000)] 
fsmonitor: fix memory corruption in some corner cases

In 56c6910028a (fsmonitor: change last update timestamp on the
index_state to opaque token, 2020-01-07), we forgot to adjust the part
of `unpack_trees()` that copies the FSMonitor "last-update" information
that we copy from the source index to the result index since 679f2f9fdd2
(unpack-trees: skip stat on fsmonitor-valid files, 2019-11-20).

Since the "last-update" information is no longer a 64-bit number, but a
free-form string that has been allocated, we need to duplicate it rather
than just copying it.

This is important because there _are_ cases when `unpack_trees()` will
perform a oneway merge that implicitly calls `refresh_fsmonitor()`
(which will allocate that "last-update" token). This happens _after_
that token was copied into the result index. However, we _then_ call
`check_updates()` on that index, which will _also_ call
`refresh_fsmonitor()`, accessing the "last-update" string, which by now
would be released already.

In the instance that lead to this patch, this caused a segmentation
fault during a lengthy, complicated rebase involving the todo command
`reset` that (crucially) had to updated many files. Unfortunately, it
seems very hard to trigger that crash, therefore this patch is not
accompanied by a regression test.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoconfig.txt: add missing period
Kyle Meyer [Tue, 16 Mar 2021 14:40:40 +0000 (10:40 -0400)] 
config.txt: add missing period

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobisect: peel annotated tags to commits
Jeff King [Tue, 16 Mar 2021 15:15:55 +0000 (11:15 -0400)] 
bisect: peel annotated tags to commits

This patch fixes a bug where git-bisect doesn't handle receiving
annotated tags as "git bisect good <tag>", etc. It's a regression in
27257bc466 (bisect--helper: reimplement `bisect_state` & `bisect_head`
shell functions in C, 2020-10-15).

The original shell code called:

  sha=$(git rev-parse --verify "$rev^{commit}") ||
          die "$(eval_gettext "Bad rev input: \$rev")"

which will peel the input to a commit (or complain if that's not
possible). But the C code just calls get_oid(), which will yield the oid
of the tag.

The fix is to peel to a commit. The error message here is a little
non-idiomatic for Git (since it starts with a capital). I've mostly left
it, as it matches the other converted messages (like the "Bad rev input"
we print when get_oid() fails), though I did add an indication that it
was the peeling that was the problem. It might be worth taking a pass
through this converted code to modernize some of the error messages.

Note also that the test does a bare "grep" (not i18ngrep) on the
expected "X is the first bad commit" output message. This matches the
rest of the test script.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5606: run clone branch name test with protocol v2
Jonathan Tan [Wed, 17 Mar 2021 15:42:00 +0000 (08:42 -0700)] 
t5606: run clone branch name test with protocol v2

4f37d45706 ("clone: respect remote unborn HEAD", 2021-02-05) introduces
a new feature (if the remote has an unborn HEAD, e.g. when the remote
repository is empty, use it as the name of the branch) that only works
in protocol v2, but did not ensure that one of its tests always uses
protocol v2, and thus that test would fail if
GIT_TEST_PROTOCOL_VERSION=0 (or 1) is used. Therefore, add "-c
protocol.version=2" to the appropriate test.

(The rest of the tests from that commit have "-c protocol.version=2"
already added.)

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomem-pool: drop trailing semicolon from macro definition
René Scharfe [Sat, 13 Mar 2021 16:17:37 +0000 (17:17 +0100)] 
mem-pool: drop trailing semicolon from macro definition

Allow BLOCK_GROWTH_SIZE to be used like an integer literal by removing
the trailing semicolon from its definition.  Also wrap the expression in
parentheses, to allow it to be used with operators without leading to
unexpected results.  It doesn't matter for the current use site, but
make it follow standard macro rules anyway to avoid future surprises.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoblock-sha1: drop trailing semicolon from macro definition
René Scharfe [Sat, 13 Mar 2021 16:17:30 +0000 (17:17 +0100)] 
block-sha1: drop trailing semicolon from macro definition

23119ffb4e (block-sha1: put expanded macro parameters in parentheses,
2012-07-22) added a trailing semicolon to the definition of SHA_MIX
without explanation.  It doesn't matter with the current code, but make
sure to avoid potential surprises by removing it again.

This allows the macro to be used almost like a function: Users can
combine it with operators of their choice, but still must not pass an
expression with side-effects as a parameter, as it would be evaluated
multiple times.

Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofsmonitor: avoid global-buffer-overflow READ when checking trivial response
Andrzej Hunt [Mon, 15 Mar 2021 16:39:23 +0000 (16:39 +0000)] 
fsmonitor: avoid global-buffer-overflow READ when checking trivial response

query_result can be be an empty strbuf (STRBUF_INIT) - in that case
trying to read 3 bytes triggers a buffer overflow read (as
query_result.buf = '\0').

Therefore we need to check query_result's length before trying to read 3
bytes.

This overflow was introduced in:
  940b94f35c (fsmonitor: log invocation of FSMonitor hook to trace2, 2021-02-03)
It was found when running the test-suite against ASAN, and can be most
easily reproduced with the following command:

make GIT_TEST_OPTS="-v" DEFAULT_TEST_TARGET="t7519-status-fsmonitor.sh" \
SANITIZE=address DEVELOPER=1 test

==2235==ERROR: AddressSanitizer: global-buffer-overflow on address 0x0000019e6e5e at pc 0x00000043745c bp 0x7fffd382c520 sp 0x7fffd382bcc8
READ of size 3 at 0x0000019e6e5e thread T0
    #0 0x43745b in MemcmpInterceptorCommon(void*, int (*)(void const*, void const*, unsigned long), void const*, void const*, unsigned long) /home/abuild/rpmbuild/BUILD/llvm-11.0.0.src/build/../projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:842:7
    #1 0x43786d in bcmp /home/abuild/rpmbuild/BUILD/llvm-11.0.0.src/build/../projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:887:10
    #2 0x80b146 in fsmonitor_is_trivial_response /home/ahunt/oss-fuzz/git/fsmonitor.c:192:10
    #3 0x80b146 in query_fsmonitor /home/ahunt/oss-fuzz/git/fsmonitor.c:175:7
    #4 0x80a749 in refresh_fsmonitor /home/ahunt/oss-fuzz/git/fsmonitor.c:267:21
    #5 0x80bad1 in tweak_fsmonitor /home/ahunt/oss-fuzz/git/fsmonitor.c:429:4
    #6 0x90f040 in read_index_from /home/ahunt/oss-fuzz/git/read-cache.c:2321:3
    #7 0x8e5d08 in repo_read_index_preload /home/ahunt/oss-fuzz/git/preload-index.c:164:15
    #8 0x52dd45 in prepare_index /home/ahunt/oss-fuzz/git/builtin/commit.c:363:6
    #9 0x52a188 in cmd_commit /home/ahunt/oss-fuzz/git/builtin/commit.c:1588:15
    #10 0x4ce77e in run_builtin /home/ahunt/oss-fuzz/git/git.c:453:11
    #11 0x4ccb18 in handle_builtin /home/ahunt/oss-fuzz/git/git.c:704:3
    #12 0x4cb01c in run_argv /home/ahunt/oss-fuzz/git/git.c:771:4
    #13 0x4cb01c in cmd_main /home/ahunt/oss-fuzz/git/git.c:902:19
    #14 0x6aca8d in main /home/ahunt/oss-fuzz/git/common-main.c:52:11
    #15 0x7fb027bf5349 in __libc_start_main (/lib64/libc.so.6+0x24349)
    #16 0x4206b9 in _start /home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:120

0x0000019e6e5e is located 2 bytes to the left of global variable 'strbuf_slopbuf' defined in 'strbuf.c:51:6' (0x19e6e60) of size 1
  'strbuf_slopbuf' is ascii string ''
0x0000019e6e5e is located 126 bytes to the right of global variable 'signals' defined in 'sigchain.c:11:31' (0x19e6be0) of size 512
SUMMARY: AddressSanitizer: global-buffer-overflow /home/abuild/rpmbuild/BUILD/llvm-11.0.0.src/build/../projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:842:7 in MemcmpInterceptorCommon(void*, int (*)(void const*, void const*, unsigned long), void const*, void const*, unsigned long)
Shadow bytes around the buggy address:
  0x000080334d70: f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 00 00 00 00
  0x000080334d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000080334d90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000080334da0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000080334db0: 00 00 00 00 00 00 00 00 00 00 00 00 f9 f9 f9 f9
=>0x000080334dc0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9[f9]01 f9 f9 f9
  0x000080334dd0: f9 f9 f9 f9 03 f9 f9 f9 f9 f9 f9 f9 02 f9 f9 f9
  0x000080334de0: f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9
  0x000080334df0: f9 f9 f9 f9 01 f9 f9 f9 f9 f9 f9 f9 00 00 00 00
  0x000080334e00: f9 f9 f9 f9 00 00 00 00 f9 f9 f9 f9 01 f9 f9 f9
  0x000080334e10: f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc

Signed-off-by: Andrzej Hunt <ajrhunt@google.com>
Acked-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agococci: allow xcalloc(1, size)
Junio C Hamano [Tue, 16 Mar 2021 00:56:07 +0000 (17:56 -0700)] 
cocci: allow xcalloc(1, size)

Allocating a pre-cleared single element is quite common and it is
misleading to use CALLOC_ARRAY(); these allocations that would be
affected without this change are not allocating an array.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoxcalloc: use CALLOC_ARRAY() when applicable
Junio C Hamano [Mon, 15 Mar 2021 22:05:04 +0000 (15:05 -0700)] 
xcalloc: use CALLOC_ARRAY() when applicable

These are for codebase before Git 2.31

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc/git-commit: add documentation for fixup=[amend|reword] options
Charvi Mendiratta [Mon, 15 Mar 2021 07:54:36 +0000 (13:24 +0530)] 
doc/git-commit: add documentation for fixup=[amend|reword] options

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Charvi Mendiratta <charvi077@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot3437: use --fixup with options to create amend! commit
Charvi Mendiratta [Mon, 15 Mar 2021 07:54:35 +0000 (13:24 +0530)] 
t3437: use --fixup with options to create amend! commit

We taught `git commit --fixup` to create "amend!" commit. Let's also
update the tests and use it to setup the rebase tests.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Charvi Mendiratta <charvi077@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot7500: add tests for --fixup=[amend|reword] options
Charvi Mendiratta [Mon, 15 Mar 2021 07:54:34 +0000 (13:24 +0530)] 
t7500: add tests for --fixup=[amend|reword] options

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Charvi Mendiratta <charvi077@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit: add a reword suboption to --fixup
Charvi Mendiratta [Mon, 15 Mar 2021 07:54:33 +0000 (13:24 +0530)] 
commit: add a reword suboption to --fixup

`git commit --fixup=reword:<commit>` aliases
`--fixup=amend:<commit> --only`, where it creates an empty "amend!"
commit that will reword <commit> without changing its contents when
it is rebased with `--autosquash`.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Charvi Mendiratta <charvi077@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit: add amend suboption to --fixup to create amend! commit
Charvi Mendiratta [Mon, 15 Mar 2021 07:54:32 +0000 (13:24 +0530)] 
commit: add amend suboption to --fixup to create amend! commit

`git commit --fixup=amend:<commit>` will create an "amend!" commit.
The resulting commit message subject will be "amend! ..." where
"..." is the subject line of <commit> and the initial message
body will be <commit>'s message.

The "amend!" commit when rebased with --autosquash will fixup the
contents and replace the commit message of <commit> with the
"amend!" commit's message body.

In order to prevent rebase from creating commits with an empty
message we refuse to create an "amend!" commit if commit message
body is empty.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Charvi Mendiratta <charvi077@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosequencer: export and rename subject_length()
Charvi Mendiratta [Mon, 15 Mar 2021 07:54:31 +0000 (13:24 +0530)] 
sequencer: export and rename subject_length()

This function can be used in other parts of git. Let's move the
function to commit.c and also rename it to make the name of the
function more generic.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Charvi Mendiratta <charvi077@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGit 2.31 v2.31.0
Junio C Hamano [Mon, 15 Mar 2021 18:51:51 +0000 (11:51 -0700)] 
Git 2.31

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jn/mergetool-hideresolved-is-optional'
Junio C Hamano [Sun, 14 Mar 2021 23:01:41 +0000 (16:01 -0700)] 
Merge branch 'jn/mergetool-hideresolved-is-optional'

Disable the recent mergetool's hideresolved feature by default for
backward compatibility and safety.

* jn/mergetool-hideresolved-is-optional:
  doc: describe mergetool configuration in git-mergetool(1)
  mergetool: do not enable hideResolved by default

3 years agoMerge branch 'tb/pack-revindex-on-disk'
Junio C Hamano [Sun, 14 Mar 2021 23:01:40 +0000 (16:01 -0700)] 
Merge branch 'tb/pack-revindex-on-disk'

Fix for a topic in 'master'.

* tb/pack-revindex-on-disk:
  pack-revindex.c: don't close unopened file descriptors

3 years agoMerge tag 'l10n-2.31.0-rnd2' of git://github.com/git-l10n/git-po
Junio C Hamano [Sun, 14 Mar 2021 22:50:36 +0000 (15:50 -0700)] 
Merge tag 'l10n-2.31.0-rnd2' of git://github.com/git-l10n/git-po

l10n for Git 2.31.0 round 2

* tag 'l10n-2.31.0-rnd2' of git://github.com/git-l10n/git-po:
  l10n: zh_CN: for git v2.31.0 l10n round 1 and 2
  l10n: de.po: Update German translation for Git v2.31.0
  l10n: pt_PT: add Portuguese translations part 1
  l10n: vi.po(5104t): for git v2.31.0 l10n round 2
  l10n: es: 2.31.0 round 2
  l10n: Add translation team info
  l10n: start Indonesian translation
  l10n: zh_TW.po: v2.31.0 round 2 (15 untranslated)
  l10n: bg.po: Updated Bulgarian translation (5104t)
  l10n: fr: v2.31 rnd 2
  l10n: tr: v2.31.0-rc1
  l10n: sv.po: Update Swedish translation (5104t0f0u)
  l10n: git.pot: v2.31.0 round 2 (9 new, 8 removed)
  l10n: tr: v2.31.0-rc0
  l10n: sv.po: Update Swedish translation (5103t0f0u)
  l10n: pl.po: Update translation
  l10n: fr: v2.31.0 rnd 1
  l10n: git.pot: v2.31.0 round 1 (155 new, 89 removed)
  l10n: Update Catalan translation
  l10n: ru.po: update Russian translation

3 years agovcs-svn: remove header files as well
René Scharfe [Sun, 14 Mar 2021 14:37:39 +0000 (15:37 +0100)] 
vcs-svn: remove header files as well

fc47391e24 (drop vcs-svn experiment, 2020-08-13) removed most vcs-svn
files.  Drop the remaining header files as well, as they are no longer
used.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agol10n: zh_CN: for git v2.31.0 l10n round 1 and 2
Jiang Xin [Thu, 4 Mar 2021 14:44:43 +0000 (22:44 +0800)] 
l10n: zh_CN: for git v2.31.0 l10n round 1 and 2

Translate 161 new messages (5104t0f0u) for git 2.31.0.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
3 years agoMerge branch 'master' of github.com:vnwildman/git
Jiang Xin [Sun, 14 Mar 2021 16:04:47 +0000 (00:04 +0800)] 
Merge branch 'master' of github.com:vnwildman/git

* 'master' of github.com:vnwildman/git:
  l10n: vi.po(5104t): for git v2.31.0 l10n round 2

3 years agoMerge branch 'l10n/zh_TW/210301' of github.com:l10n-tw/git-po
Jiang Xin [Sun, 14 Mar 2021 14:35:44 +0000 (22:35 +0800)] 
Merge branch 'l10n/zh_TW/210301' of github.com:l10n-tw/git-po

* 'l10n/zh_TW/210301' of github.com:l10n-tw/git-po:
  l10n: zh_TW.po: v2.31.0 round 2 (15 untranslated)

3 years agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Sun, 14 Mar 2021 14:35:17 +0000 (22:35 +0800)] 
Merge branch 'po-id' of github.com:bagasme/git-po

* 'po-id' of github.com:bagasme/git-po:
  l10n: Add translation team info
  l10n: start Indonesian translation

3 years agoMerge branch 'master' of github.com:Softcatala/git-po
Jiang Xin [Sun, 14 Mar 2021 14:34:46 +0000 (22:34 +0800)] 
Merge branch 'master' of github.com:Softcatala/git-po

* 'master' of github.com:Softcatala/git-po:
  l10n: Update Catalan translation

3 years agoMerge branch 'russian-l10n' of github.com:DJm00n/git-po-ru
Jiang Xin [Sun, 14 Mar 2021 14:34:12 +0000 (22:34 +0800)] 
Merge branch 'russian-l10n' of github.com:DJm00n/git-po-ru

* 'russian-l10n' of github.com:DJm00n/git-po-ru:
  l10n: ru.po: update Russian translation

3 years agoMerge branch 'pt-PT' of github.com:git-l10n-pt-PT/git-po
Jiang Xin [Sun, 14 Mar 2021 14:33:26 +0000 (22:33 +0800)] 
Merge branch 'pt-PT' of github.com:git-l10n-pt-PT/git-po

* 'pt-PT' of github.com:git-l10n-pt-PT/git-po:
  l10n: pt_PT: add Portuguese translations part 1

3 years agouse CALLOC_ARRAY
René Scharfe [Sat, 13 Mar 2021 16:17:22 +0000 (17:17 +0100)] 
use CALLOC_ARRAY

Add and apply a semantic patch for converting code that open-codes
CALLOC_ARRAY to use it instead.  It shortens the code and infers the
element size automatically.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-compat-util.h: drop trailing semicolon from macro definition
René Scharfe [Sat, 13 Mar 2021 16:10:47 +0000 (17:10 +0100)] 
git-compat-util.h: drop trailing semicolon from macro definition

Make CALLOC_ARRAY usable like a function by requiring callers to supply
the trailing semicolon, which all of the current ones already do.  With
the extra semicolon e.g. the following code wouldn't compile because it
disconnects the "else" from the "if":

if (condition)
CALLOC_ARRAY(ptr, n);
else
whatever();

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoDocumentation/git-push.txt: correct configuration typo
Taylor Blau [Mon, 8 Mar 2021 18:43:47 +0000 (13:43 -0500)] 
Documentation/git-push.txt: correct configuration typo

In the EXAMPLES section, git-push(1) says that 'git push origin' pushes
the current branch to the value of the 'remote.origin.merge'
configuration.

This wording (which dates back to b2ed944af7 (push: switch default from
"matching" to "simple", 2013-01-04)) is incorrect. There is no such
configuration as 'remote.<name>.merge'. This likely was originally
intended to read "branch.<name>.merge" instead.

Indeed, when 'push.default' is 'simple' (which is the default value, and
is applicable in this scenario per "without additional configuration"),
setup_push_upstream() dies if the branch's local name does not match
'branch.<name>.merge'.

Correct this long-standing typo to resolve some recent confusion on the
intended behavior of this example.

Reported-by: Adam Sharafeddine <adam.shrfdn@gmail.com>
Reported-by: Fabien Terrani <terranifabien@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc: describe mergetool configuration in git-mergetool(1)
Jonathan Nieder [Sat, 13 Mar 2021 08:41:33 +0000 (00:41 -0800)] 
doc: describe mergetool configuration in git-mergetool(1)

In particular, this describes mergetool.hideResolved, which can help
users discover this setting (either because it may be useful to them
or in order to understand mergetool's behavior if they have forgotten
setting it in the past).

Tested by running

make -C Documentation git-mergetool.1
man Documentation/git-mergetool.1

and reading through the page.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomergetool: do not enable hideResolved by default
Jonathan Nieder [Sat, 13 Mar 2021 08:38:48 +0000 (00:38 -0800)] 
mergetool: do not enable hideResolved by default

When 98ea309b3f (mergetool: add hideResolved configuration,
2021-02-09) introduced the mergetool.hideResolved setting to reduce
the clutter in viewing non-conflicted sections of files in a
mergetool, it enabled it by default, explaining:

    No adverse effects were noted in a small survey of popular mergetools[1]
    so this behavior defaults to `true`.

In practice, alas, adverse effects do appear.  A few issues:

1. No indication is shown in the UI that the base, local, and remote
   versions shown have been modified by additional resolution.  This
   is inherent in the design: the idea of mergetool.hideResolved is to
   convince a mergetool that expects pristine local, base, and remote
   files to show partially resolved verisons of those files instead;
   there is no additional source of information accessible to the
   mergetool to see where the resolution has happened.

   (By contrast, a mergetool generating the partial resolution from
   conflict markers for itself would be able to hilight the resolved
   sections with a different color.)

   A user accustomed to seeing the files without partial resolution
   gets no indication that this behavior has changed when they upgrade
   Git.

2. If the computed merge did not line up the files correctly (for
   example due to repeated sections in the file), the partially
   resolved files can be misleading and do not have enough information
   to reconstruct what happened and compute the correct merge result.

3. Resolving a conflict can involve information beyond the textual
   conflict.  For example, if the local and remote versions added
   overlapping functionality in different ways, seeing the full
   unresolved versions of each alongside the base gives information
   about each side's intent that makes it possible to come up with a
   resolution that combines those two intents.  By contrast, when
   starting with partially resolved versions of those files, one can
   produce a subtly wrong resolution that includes redundant extra
   code added by one side that is not needed in the approach taken
   on the other.

All that said, a user wanting to focus on textual conflicts with
reduced clutter can still benefit from mergetool.hideResolved=true as
a way to deemphasize sections of the code that resolve cleanly without
requiring any changes to the invoked mergetool.  The caveats described
above are reduced when the user has explicitly turned this on, because
then the user is aware of them.

Flip the default to 'false'.

Reported-by: Dana Dahlstrom <dahlstrom@google.com>
Helped-by: Seth House <seth@eseth.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agohttp: drop the check for an empty proxy password before approving
John Szakmeister [Fri, 12 Mar 2021 02:40:27 +0000 (21:40 -0500)] 
http: drop the check for an empty proxy password before approving

credential_approve() already checks for a non-empty password before
saving, so there's no need to do the extra check here.

Signed-off-by: John Szakmeister <john@szakmeister.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agohttp: store credential when PKI auth is used
John Szakmeister [Fri, 12 Mar 2021 02:40:26 +0000 (21:40 -0500)] 
http: store credential when PKI auth is used

We already looked for the PKI credentials in the credential store, but
failed to approve it on success.  Meaning, the PKI certificate password
was never stored and git would request it on every connection to the
remote.  Let's complete the chain by storing the certificate password on
success.

Likewise, we also need to reject the credential when there is a failure.
Curl appears to report client-related certificate issues are reported
with the CURLE_SSL_CERTPROBLEM error.  This includes not only a bad
password, but potentially other client certificate related problems.
Since we cannot get more information from curl, we'll go ahead and
reject the credential upon receiving that error, just to be safe and
avoid caching or saving a bad password.

Signed-off-by: John Szakmeister <john@szakmeister.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoarchive: expand only a single %(describe) per archive
René Scharfe [Sun, 28 Feb 2021 11:22:47 +0000 (12:22 +0100)] 
archive: expand only a single %(describe) per archive

Every %(describe) placeholder in $Format:...$ strings in files with the
attribute export-subst is expanded by calling git describe.  This can
potentially result in a lot of such calls per archive.  That's OK for
local repositories under control of the user of git archive, but could
be a problem for hosted repositories.

Expand only a single %(describe) placeholder per archive for now to
avoid denial-of-service attacks.  We can make this limit configurable
later if needed, but let's start out simple.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobuiltin/init-db: handle bare clones when core.bare set to false
brian m. carlson [Wed, 10 Mar 2021 01:11:20 +0000 (01:11 +0000)] 
builtin/init-db: handle bare clones when core.bare set to false

In 552955ed7f ("clone: use more conventional config/option layering",
2020-10-01), clone learned to read configuration options earlier in its
execution, before creating the new repository.  However, that led to a
problem: if the core.bare setting is set to false in the global config,
cloning a bare repository segfaults.  This happens because the
repository is falsely thought to be non-bare, but clone has set the work
tree to NULL, which is then dereferenced.

The code to initialize the repository already considers the fact that a
user might want to override the --bare option for git init, but it
doesn't take into account clone, which uses a different option.  Let's
just check that the work tree is not NULL, since that's how clone
indicates that the repository is bare.  This is also the case for git
init, so we won't be regressing that case.

Reported-by: Joseph Vusich <jvusich@amazon.com>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofilter-branch: drop $_x40 glob
Jeff King [Wed, 10 Mar 2021 17:07:37 +0000 (12:07 -0500)] 
filter-branch: drop $_x40 glob

When checking whether a commit was rewritten to a single object id, we
use a glob that insists on a 40-hex result. This works for sha1, but
fails t7003 when run with GIT_TEST_DEFAULT_HASH=sha256.

Since the previous commit simplified the case statement here, we only
have two arms: an empty string or a single object id. We can just loosen
our glob to match anything, and still distinguish those cases (we lose
the ability to notice bogus input, but that's not a problem; we are the
one who wrote the map in the first place, and anyway update-ref will
complain loudly if the input isn't a valid hash).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofilter-branch: drop multiple-ancestor warning
Jeff King [Wed, 10 Mar 2021 17:07:27 +0000 (12:07 -0500)] 
filter-branch: drop multiple-ancestor warning

When a ref maps to a commit that is neither rewritten nor kept by
filter-branch (e.g., because it was eliminated by rev-list's pathspec
selection), we rewrite it to its nearest ancestor.

Since the initial commit in 6f6826c52b (Add git-filter-branch,
2007-06-03), we have warned when there are multiple such ancestors in
the map file. However, the warning code is impossible to trigger these
days. Since a0e46390d3 (filter-branch: fix ref rewriting with
--subdirectory-filter, 2008-08-12), we find the ancestor using "rev-list
-1", so it can only ever have a single value.

This code is made doubly confusing by the fact that we append to the map
file when mapping ancestors. However, this can never yield multiple
values because:

  - we explicitly check whether the map already exists, and if so, do
    nothing (so our "append" will always be to a file that does not
    exist)

  - even if we were to try mapping twice, the process to do so is
    deterministic. I.e., we'd always end up with the same ancestor for a
    given sha1. So warning about it would be pointless; there is no
    ambiguity.

So swap out the warning code for a BUG (which we'll simplify further in
the next commit). And let's stop using the append operator to make the
ancestor-mapping code less confusing.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot7003: test ref rewriting explicitly
Jeff King [Wed, 10 Mar 2021 17:07:19 +0000 (12:07 -0500)] 
t7003: test ref rewriting explicitly

After it has rewritten all of the commits, filter-branch will then
rewrite each of the input refs based on the resulting map of old/new
commits. But we don't have any explicit test coverage of this code.
Let's make sure we are covering each of those cases:

  - deleting a ref when all of its commits were pruned

  - rewriting a ref based on the mapping (this happens throughout the
    script, but let's make sure we generate the correct messages)

  - rewriting a ref whose tip was excluded, in which case we rewrite to
    the nearest ancestor. Note in this case that we still insist that no
    "warning" line is present (even though it looks like we'd trigger
    the "... was rewritten into multiple commits" one). See the next
    commit for more details.

Note these all pass currently, but the latter two will fail when run
with GIT_TEST_DEFAULT_HASH=sha256.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGit 2.31-rc2 v2.31.0-rc2
Junio C Hamano [Tue, 9 Mar 2021 00:09:43 +0000 (16:09 -0800)] 
Git 2.31-rc2

3 years agoSync with Git 2.30.2 for CVE-2021-21300
Junio C Hamano [Tue, 9 Mar 2021 00:09:07 +0000 (16:09 -0800)] 
Sync with Git 2.30.2 for CVE-2021-21300

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jt/transfer-fsck-across-packs-fix'
Junio C Hamano [Tue, 9 Mar 2021 00:04:47 +0000 (16:04 -0800)] 
Merge branch 'jt/transfer-fsck-across-packs-fix'

The code to fsck objects received across multiple packs during a
single git fetch session has been broken when the packfile URI
feature was in use.  A workaround has been added by disabling the
codepath to avoid keeping a packfile that is too small.

* jt/transfer-fsck-across-packs-fix:
  fetch-pack: do not mix --pack_header and packfile uri

3 years agol10n: de.po: Update German translation for Git v2.31.0
Matthias Rüster [Sun, 28 Feb 2021 14:40:23 +0000 (15:40 +0100)] 
l10n: de.po: Update German translation for Git v2.31.0

Reviewed-by: Ralf Thielow <ralf.thielow@gmail.com>
Reviewed-by: Phillip Szelat <phillip.szelat@gmail.com>
Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
3 years agoMakefile: update 'make fuzz-all' docs to reflect modern clang
Andrzej Hunt [Mon, 8 Mar 2021 17:14:42 +0000 (17:14 +0000)] 
Makefile: update 'make fuzz-all' docs to reflect modern clang

Clang no longer produces a libFuzzer.a. Instead, you can include
libFuzzer by using -fsanitize=fuzzer. Therefore we should use that in
the example command for building fuzzers.

We also add -fsanitize=fuzzer-no-link to the CFLAGS to ensure that all
the required instrumentation is added when compiling git [1], and remove
 -fsanitize-coverage=trace-pc-guard as it is deprecated.

I happen to have tested with LLVM 11 - however -fsanitize=fuzzer appears
to work in a wide range of reasonably modern clangs.

(On my system: what used to be libFuzzer.a now lives under the following
 path, which is tricky albeit not impossible for a novice such as myself
 to find:
/usr/lib64/clang/11.0.0/lib/linux/libclang_rt.fuzzer-x86_64.a )

[1] https://releases.llvm.org/11.0.0/docs/LibFuzzer.html#fuzzer-usage

Signed-off-by: Andrzej Hunt <ajrhunt@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoAdd entry for Ramkumar Ramachandra
Ramkumar Ramachandra [Sat, 6 Mar 2021 15:45:15 +0000 (16:45 +0100)] 
Add entry for Ramkumar Ramachandra

Signed-off-by: Ramkumar Ramachandra <r@artagnon.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofix xcalloc() argument order
René Scharfe [Sat, 6 Mar 2021 11:26:19 +0000 (12:26 +0100)] 
fix xcalloc() argument order

Pass the number of elements first and ther size second, as expected
by xcalloc().  Provide a semantic patch, which was actually used to
generate the rest of this patch.

The semantic patch would generate flip-flop diffs if both arguments
are sizeofs.  We don't have such a case, and it's hard to imagine
the usefulness of such an allocation.  If it ever occurs then we
could deal with it by duplicating the rule in the semantic patch to
make it cancel itself out, or we could change the code to use
CALLOC_ARRAY.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>