]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agoMerge branch 'jc/compat-util-setitimer-fix'
Junio C Hamano [Fri, 18 Dec 2020 23:15:17 +0000 (15:15 -0800)] 
Merge branch 'jc/compat-util-setitimer-fix'

Fix a recent bug in a rarely used replacement code.

* jc/compat-util-setitimer-fix:
  compat-util: pretend that stub setitimer() always succeeds

3 years agoMerge branch 'dd/doc-p4-requirements-update'
Junio C Hamano [Fri, 18 Dec 2020 23:15:17 +0000 (15:15 -0800)] 
Merge branch 'dd/doc-p4-requirements-update'

Doc update.

* dd/doc-p4-requirements-update:
  doc: mention Python 3.x supports

3 years agoMerge branch 'js/init-defaultbranch-advice'
Junio C Hamano [Fri, 18 Dec 2020 23:15:17 +0000 (15:15 -0800)] 
Merge branch 'js/init-defaultbranch-advice'

Our users are going to be trained to prepare for future change of
init.defaultBranch configuration variable.

* js/init-defaultbranch-advice:
  init: provide useful advice about init.defaultBranch
  get_default_branch_name(): prepare for showing some advice
  branch -m: allow renaming a yet-unborn branch
  init: document `init.defaultBranch` better

3 years agoMerge https://github.com/prati0100/git-gui
Junio C Hamano [Fri, 18 Dec 2020 23:07:10 +0000 (15:07 -0800)] 
Merge https://github.com/prati0100/git-gui

* https://github.com/prati0100/git-gui:
  git-gui: use gray background for inactive text widgets
  git-gui: Fix selected text colors
  Makefile: conditionally include GIT-VERSION-FILE
  git-gui: fix colored label backgrounds when using themed widgets
  git-gui: ssh-askpass: add a checkbox to show the input text
  git-gui: update Russian translation
  git-gui: use commit message template
  git-gui: Only touch GITGUI_MSG when needed

3 years agoMerge branch 'sh/inactive-background'
Pratyush Yadav [Fri, 18 Dec 2020 19:32:34 +0000 (01:02 +0530)] 
Merge branch 'sh/inactive-background'

Set a different background color for selections in inactive widgets.
This inactive color is calculated from the current theme colors to make
sure it works for all themes.

* sh/inactive-background:
  git-gui: use gray background for inactive text widgets

3 years agogit-gui: use gray background for inactive text widgets
Stefan Haller [Fri, 18 Dec 2020 09:43:14 +0000 (10:43 +0100)] 
git-gui: use gray background for inactive text widgets

This makes it easier to see at a glance which of the four main views has the
keyboard focus.

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
3 years agoAnother batch before 2.30-rc1
Junio C Hamano [Thu, 17 Dec 2020 23:04:26 +0000 (15:04 -0800)] 
Another batch before 2.30-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jh/index-v2-doc-on-fsmn'
Junio C Hamano [Thu, 17 Dec 2020 23:06:42 +0000 (15:06 -0800)] 
Merge branch 'jh/index-v2-doc-on-fsmn'

Doc update.

* jh/index-v2-doc-on-fsmn:
  index-format.txt: document v2 format of file system monitor extension

3 years agoMerge branch 'jb/midx-doc-update'
Junio C Hamano [Thu, 17 Dec 2020 23:06:41 +0000 (15:06 -0800)] 
Merge branch 'jb/midx-doc-update'

Doc update.

* jb/midx-doc-update:
  docs: multi-pack-index: remove note about future 'verify' work

3 years agoMerge branch 'rj/make-clean'
Junio C Hamano [Thu, 17 Dec 2020 23:06:40 +0000 (15:06 -0800)] 
Merge branch 'rj/make-clean'

Build optimization.

* rj/make-clean:
  Makefile: don't use a versioned temp distribution directory
  Makefile: don't try to clean old debian build product
  gitweb/Makefile: conditionally include ../GIT-VERSION-FILE
  Documentation/Makefile: conditionally include ../GIT-VERSION-FILE
  Documentation/Makefile: conditionally include doc.dep

3 years agoMerge branch 'js/t7064-master-to-initial'
Junio C Hamano [Thu, 17 Dec 2020 23:06:40 +0000 (15:06 -0800)] 
Merge branch 'js/t7064-master-to-initial'

Test update.

* js/t7064-master-to-initial:
  t7064: avoid relying on a specific default branch name

3 years agoMerge branch 'js/t6300-hardcode-main'
Junio C Hamano [Thu, 17 Dec 2020 23:06:40 +0000 (15:06 -0800)] 
Merge branch 'js/t6300-hardcode-main'

Test update.

* js/t6300-hardcode-main:
  t6300: avoid using the default name of the initial branch

3 years agoMerge branch 'jk/oid-array-cleanup'
Junio C Hamano [Thu, 17 Dec 2020 23:06:40 +0000 (15:06 -0800)] 
Merge branch 'jk/oid-array-cleanup'

Code clean-up.

* jk/oid-array-cleanup:
  commit-graph: use size_t for array allocation and indexing
  commit-graph: replace packed_oid_list with oid_array
  commit-graph: drop count_distinct_commits() function
  oid-array: provide a for-loop iterator
  oid-array: make sort function public
  cache.h: move hash/oid functions to hash.h
  t0064: make duplicate tests more robust
  t0064: drop sha1 mention from filename
  oid-array.h: drop sha1 mention from header guard

3 years agoMerge branch 'tb/partial-clone-filters-fix'
Junio C Hamano [Thu, 17 Dec 2020 23:06:40 +0000 (15:06 -0800)] 
Merge branch 'tb/partial-clone-filters-fix'

Fix potential server side resource deallocation issues when
responding to a partial clone request.

* tb/partial-clone-filters-fix:
  upload-pack.c: don't free allowed_filters util pointers
  builtin/clone.c: don't ignore transport_fetch_refs() errors

3 years agoMerge branch 'js/t7900-protect-pwd-in-config-get'
Junio C Hamano [Thu, 17 Dec 2020 23:06:39 +0000 (15:06 -0800)] 
Merge branch 'js/t7900-protect-pwd-in-config-get'

Hotfix for test breakage.

* js/t7900-protect-pwd-in-config-get:
  t7900: use --fixed-value in git-maintenance tests

3 years agoMerge branch 'st/selected-text-colors'
Pratyush Yadav [Thu, 17 Dec 2020 20:22:26 +0000 (01:52 +0530)] 
Merge branch 'st/selected-text-colors'

Set colors for selected text properly.

* st/selected-text-colors:
  git-gui: Fix selected text colors

3 years agogit-gui: Fix selected text colors
Serg Tereshchenko [Sun, 22 Nov 2020 13:32:33 +0000 (15:32 +0200)] 
git-gui: Fix selected text colors

Added selected state colors for text widget.

Same colors for active and inactive selection, to match previous
behaviour.

Signed-off-by: Serg Tereshchenko <serg.partizan@gmail.com>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
3 years agoMerge branch 'rj/clean-speedup'
Pratyush Yadav [Thu, 17 Dec 2020 19:12:14 +0000 (00:42 +0530)] 
Merge branch 'rj/clean-speedup'

Speed up 'make clean' on Cygwin.

* rj/clean-speedup:
  Makefile: conditionally include GIT-VERSION-FILE

3 years agoMakefile: conditionally include GIT-VERSION-FILE
Ramsay Jones [Mon, 7 Dec 2020 00:39:30 +0000 (00:39 +0000)] 
Makefile: conditionally include GIT-VERSION-FILE

The 'clean' target is noticeably slow on cygwin, even for a 'do-nothing'
invocation of 'make clean'. For example, the second 'make clean' given
below:

  $ make clean >/dev/null 2>&1
  $ make clean
  GITGUI_VERSION = 0.21.0.85.g3e5c
  rm -rf git-gui lib/tclIndex po/*.msg
  rm -rf GIT-VERSION-FILE GIT-GUI-VARS
  $

has been timed at 1.934s on my laptop (an old core i5-4200M @ 2.50GHz,
8GB RAM, 1TB HDD).

Notice that the Makefile, as part of processing the 'clean' target, is
updating the 'GIT-VERSION-FILE' file.  This is to ensure that the
$(GITGUI_VERSION) make variable is set, once that file had been included.
However, the 'clean' target does not use the $(GITGUI_VERSION) variable,
so this is wasted effort.

In order to eliminate such wasted effort, use the value of the internal
$(MAKECMDGOALS) variable to only '-include GIT-VERSION-FILE' when the
target is not 'clean'. (This drops the time down to 0.676s, on my laptop,
giving an improvement of 65.05%).

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
3 years agoMerge branch 'sh/macos-labels'
Pratyush Yadav [Thu, 17 Dec 2020 19:02:06 +0000 (00:32 +0530)] 
Merge branch 'sh/macos-labels'

Fix label background colors on MacOS when ttk is enabled.

* sh/macos-labels:
  git-gui: fix colored label backgrounds when using themed widgets

3 years agogit-gui: fix colored label backgrounds when using themed widgets
Stefan Haller [Sun, 22 Nov 2020 19:45:37 +0000 (20:45 +0100)] 
git-gui: fix colored label backgrounds when using themed widgets

The aqua theme on Mac doesn't support changing the background color for labels
and frames [1]. Since the red, green, and yellow backgrounds of the labels for
unstaged and staged files and the diff pane are so important design elements of
git gui's main window, it's not acceptable for them to have grey backgrounds on
Mac.

To work around this, simply use non-themed widgets for all labels on Mac. This
is not a big problem because labels don't look extremely different between the
themed and non-themed versions. There are subtle differences, but they are not
as bad as having the wrong background color.

[1] https://stackoverflow.com/a/6723911

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
3 years agocompat-util: pretend that stub setitimer() always succeeds
Junio C Hamano [Tue, 15 Dec 2020 21:26:17 +0000 (13:26 -0800)] 
compat-util: pretend that stub setitimer() always succeeds

When 15b52a44 (compat-util: type-check parameters of no-op
replacement functions, 2020-08-06) turned a handful of no-op
C-preprocessor macros into static inline functions to give the
callers a better type checking for their parameters, it forgot
to return anything from the stubbed out setitimer() function,
even though the function was defined to return an int just like the
real thing.

Since the original C-preprocessor macro implementation was to just
turn the call to the function an empty statement, we know that the
existing callers do not check the return value from it, and it does
not matter what value we return.  But it is safer to pretend that
the call succeeded by returning 0 than making it fail by returning -1
and clobbering errno with some value.

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc: mention Python 3.x supports
Đoàn Trần Công Danh [Thu, 10 Dec 2020 14:30:17 +0000 (21:30 +0700)] 
doc: mention Python 3.x supports

Commit 0b4396f068, (git-p4: make python2.7 the oldest supported version,
2019-12-13) pointed out that git-p4 uses Python 2.7-or-later features
in the code.

In addition, git-p4 gained enough support for Python 3 from
6cec21a82f, (git-p4: encode/decode communication with p4 for
python3, 2019-12-13).

Let's update our documentation to reflect that fact.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGit 2.30-rc0 v2.30.0-rc0
Junio C Hamano [Mon, 14 Dec 2020 18:30:05 +0000 (10:30 -0800)] 
Git 2.30-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'js/t5526-with-no-particular-primary-branch-name'
Junio C Hamano [Mon, 14 Dec 2020 18:21:38 +0000 (10:21 -0800)] 
Merge branch 'js/t5526-with-no-particular-primary-branch-name'

Test update.

* js/t5526-with-no-particular-primary-branch-name:
  t5526: drop the prereq expecting the default branch name `main`
  t5526: avoid depending on a specific default branch name

3 years agoMerge branch 'js/cmake-extra-built-ins-fix'
Junio C Hamano [Mon, 14 Dec 2020 18:21:38 +0000 (10:21 -0800)] 
Merge branch 'js/cmake-extra-built-ins-fix'

VSbuild fix.

* js/cmake-extra-built-ins-fix:
  cmake: determine list of extra built-ins dynamically

3 years agoMerge branch 'da/vs-build-iconv-fix'
Junio C Hamano [Mon, 14 Dec 2020 18:21:38 +0000 (10:21 -0800)] 
Merge branch 'da/vs-build-iconv-fix'

Build update.

* da/vs-build-iconv-fix:
  ci(vs-build): stop passing the iconv library location explicitly

3 years agoMerge branch 'jk/multi-line-indent-style-fix'
Junio C Hamano [Mon, 14 Dec 2020 18:21:38 +0000 (10:21 -0800)] 
Merge branch 'jk/multi-line-indent-style-fix'

Style fix.

* jk/multi-line-indent-style-fix:
  style: indent multiline "if" conditions to align

3 years agoMerge branch 'jk/check-config-parsing-error-in-upload-pack'
Junio C Hamano [Mon, 14 Dec 2020 18:21:37 +0000 (10:21 -0800)] 
Merge branch 'jk/check-config-parsing-error-in-upload-pack'

Tighten error checking in the codepath that responds to "git fetch".

* jk/check-config-parsing-error-in-upload-pack:
  upload-pack: propagate return value from object filter config callback

3 years agoMerge branch 'ae/doc-reproducible-html'
Junio C Hamano [Mon, 14 Dec 2020 18:21:37 +0000 (10:21 -0800)] 
Merge branch 'ae/doc-reproducible-html'

Newer versions of xsltproc can assign IDs in HTML documents it
generates in a consistent manner.  Use the feature to help format
HTML version of the user manual reproducibly.

* ae/doc-reproducible-html:
  doc: make HTML manual reproducible

3 years agoMerge branch 'so/glossary-branch-is-not-necessarily-active'
Junio C Hamano [Mon, 14 Dec 2020 18:21:36 +0000 (10:21 -0800)] 
Merge branch 'so/glossary-branch-is-not-necessarily-active'

The glossary described a branch as an "active" line of development,
which is misleading---a stale and non-moving branch is still a
branch.

* so/glossary-branch-is-not-necessarily-active:
  glossary: improve "branch" definition

3 years agoMerge branch 'fc/atmark-in-refspec'
Junio C Hamano [Mon, 14 Dec 2020 18:21:36 +0000 (10:21 -0800)] 
Merge branch 'fc/atmark-in-refspec'

"@" sometimes worked (e.g. "git push origin @:there") as a part of
a refspec element, but "git push origin @" did not work, which has
been corrected.

* fc/atmark-in-refspec:
  refspec: make @ a synonym of HEAD
  tests: push: trivial cleanup
  tests: push: improve cleanup of HEAD tests

3 years agoMerge branch 'dd/help-autocorrect-never'
Junio C Hamano [Mon, 14 Dec 2020 18:21:36 +0000 (10:21 -0800)] 
Merge branch 'dd/help-autocorrect-never'

"git $cmd $args", when $cmd is not a recognised subcommand, by
default tries to see if $cmd is a typo of an existing subcommand
and optionally executes the corrected command if there is only one
possibility, depending on the setting of help.autocorrect; the
users can now disable the whole thing, including the cycles spent
to find a likely typo, by setting the configuration variable to
'never'.

* dd/help-autocorrect-never:
  help.c: help.autocorrect=never means "do not compute suggestions"

3 years agoindex-format.txt: document v2 format of file system monitor extension
Jeff Hostetler [Mon, 14 Dec 2020 13:33:42 +0000 (13:33 +0000)] 
index-format.txt: document v2 format of file system monitor extension

Update the documentation of the file system monitor extension to
describe version 2.

The format was extended to support opaque tokens in:
56c6910028 fsmonitor: change last update timestamp on the index_state to opaque token

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodocs: multi-pack-index: remove note about future 'verify' work
Johannes Berg [Sun, 13 Dec 2020 10:13:40 +0000 (11:13 +0100)] 
docs: multi-pack-index: remove note about future 'verify' work

This was implemented in the 'git multi-pack-index' command and
merged in 468b3221 (Merge branch 'ds/multi-pack-verify',
2018-10-10).

And there's no 'git midx' command.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoinit: provide useful advice about init.defaultBranch
Johannes Schindelin [Fri, 11 Dec 2020 11:36:57 +0000 (11:36 +0000)] 
init: provide useful advice about init.defaultBranch

To give ample warning for users wishing to override Git's the fall-back
for an unconfigured `init.defaultBranch` (in case we decide to change it
in a future Git version), let's introduce some advice that is shown upon
`git init` when that value is not set.

Note: two test cases in Git's test suite want to verify that the
`stderr` output of `git init` is empty. It is now necessary to suppress
the advice, we now do that via the `init.defaultBranch` setting. While
not strictly necessary, we also set this to `false` in
`test_create_repo()`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoget_default_branch_name(): prepare for showing some advice
Johannes Schindelin [Fri, 11 Dec 2020 11:36:56 +0000 (11:36 +0000)] 
get_default_branch_name(): prepare for showing some advice

We are about to introduce a message giving users running `git init` some
advice about `init.defaultBranch`. This will necessarily be done in
`repo_default_branch_name()`.

Not all code paths want to show that advice, though. In particular, the
`git clone` codepath _specifically_ asks for `init_db()` to be quiet,
via the `INIT_DB_QUIET` flag.

In preparation for showing users above-mentioned advice, let's change
the function signature of `get_default_branch_name()` to accept the
parameter `quiet`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobranch -m: allow renaming a yet-unborn branch
Johannes Schindelin [Fri, 11 Dec 2020 11:36:55 +0000 (11:36 +0000)] 
branch -m: allow renaming a yet-unborn branch

In one of the next commits, we would like to give users some advice
regarding the initial branch name, and how to modify it.

To that end, it would be good if `git branch -m <name>` worked in a
freshly initialized repository without any commits. Let's make it so.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoinit: document `init.defaultBranch` better
Johannes Schindelin [Fri, 11 Dec 2020 11:36:54 +0000 (11:36 +0000)] 
init: document `init.defaultBranch` better

Our documentation does not mention any future plan to change 'master' to
other value. It is a good idea to document this, though.

Initial-patch-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot7900: use --fixed-value in git-maintenance tests
Josh Steadmon [Wed, 9 Dec 2020 19:16:16 +0000 (11:16 -0800)] 
t7900: use --fixed-value in git-maintenance tests

Use --fixed-value in git-config calls in the git-maintenance tests, so
that the tests will continue to work even if the repo path contains
regexp metacharacters.

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMakefile: don't use a versioned temp distribution directory
Ramsay Jones [Tue, 8 Dec 2020 22:36:33 +0000 (22:36 +0000)] 
Makefile: don't use a versioned temp distribution directory

The 'dist' target uses a versioned temp directory, $(GIT_TARNAME), into
which it copies various files added to the distribution tarball. Should
it be necessary to remove this directory in the 'clean' target, since
the name depends on $(GIT_VERSION), the current HEAD must be positioned
on the same commit as when 'make dist' was issued. Otherwise, the target
will fail to remove that directory.

Create an '.dist-tmp-dir' directory and copy the various files into this
now un-versioned directory while creating the distribution tarball. Change
the 'clean' target to remove the '.dist-tmp-dir' directory, instead of the
version dependent $(GIT_TARNAME) directory.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMakefile: don't try to clean old debian build product
Ramsay Jones [Tue, 8 Dec 2020 22:35:27 +0000 (22:35 +0000)] 
Makefile: don't try to clean old debian build product

The 'clean' target includes code to remove an '*.tar.gz' file that
was the by-product of a debian build. This was originally added by
commit 5a571cdd8a (Clean generated files a bit more, to cope with
Debian build droppings., 2005-08-12). However, all support for the
'debian build' was dropped by commit 7d0e65b892 (Retire debian/
directory., 2006-01-06), which seems to have simply forgotten to
remove the 'git-core_$(GIT_VERSION)-*.tar.gz' from the 'clean'
target. Remove it now.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogitweb/Makefile: conditionally include ../GIT-VERSION-FILE
Ramsay Jones [Tue, 8 Dec 2020 22:34:28 +0000 (22:34 +0000)] 
gitweb/Makefile: conditionally include ../GIT-VERSION-FILE

The 'clean' target is still noticeably slow on cygwin, despite the
improvements made by previous patches. For example, the second
invocation of 'make clean' below:

  $ make clean >/dev/null 2>&1
  $ make clean
  ...
  make[1]: Entering directory '/home/ramsay/git/gitweb'
  make[2]: Entering directory '/home/ramsay/git'
  make[2]: 'GIT-VERSION-FILE' is up to date.
  make[2]: Leaving directory '/home/ramsay/git'
  ...
  $

has been timed at 10.361s on my laptop (an old core i5-4200M @ 2.50GHz,
8GB RAM, 1TB HDD).

Notice that the 'clean' target is making a nested call to the parent
Makefile to ensure that the GIT-VERSION-FILE is up-to-date. This is to
ensure that the $(GIT_VERSION) make variable is set, once that file had
been included. However, the 'clean' target does not use the $(GIT_VERSION)
variable, directly or indirectly, so it does not have any affect on what
the target removes. Therefore, the time spent on ensuring an up to date
GIT-VERSION-FILE is wasted effort.

In order to eliminate such wasted effort, use the value of the internal
$(MAKECMDGOALS) variable to only '-include ../GIT-VERSION-FILE' when the
target is not 'clean'. (This drops the time down to 8.430s, on my laptop,
giving an improvement of 18.64%).

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoDocumentation/Makefile: conditionally include ../GIT-VERSION-FILE
Ramsay Jones [Tue, 8 Dec 2020 22:33:05 +0000 (22:33 +0000)] 
Documentation/Makefile: conditionally include ../GIT-VERSION-FILE

The 'clean' target is still noticeably slow on cygwin, despite the
substantial improvement made by the previous patch. For example, the
second invocation of 'make clean' below:

  $ make clean >/dev/null 2>&1
  $ make clean
  ...
  make[1]: Entering directory '/home/ramsay/git/Documentation'
  make[2]: Entering directory '/home/ramsay/git'
  make[2]: 'GIT-VERSION-FILE' is up to date.
  make[2]: Leaving directory '/home/ramsay/git'
  ...
  $

has been timed at 12.364s on my laptop (an old core i5-4200M @ 2.50GHz,
8GB RAM, 1TB HDD).

Notice that the 'clean' target is making a nested call to the parent
Makefile to ensure that the GIT-VERSION-FILE is up-to-date (prior to
the previous patch, there would have been _two_ such invocations).
This is to ensure that the $(GIT_VERSION) make variable is set, once
that file had been included.  However, the 'clean' target does not use
the $(GIT_VERSION) variable, directly or indirectly, so it does not
have any affect on what the target removes. Therefore, the time spent
on ensuring an up to date GIT-VERSION-FILE is wasted effort.

In order to eliminate such wasted effort, use the value of the internal
$(MAKECMDGOALS) variable to only '-include ../GIT-VERSION-FILE' when the
target is not 'clean'. (This drops the time down to 10.361s, on my laptop,
giving an improvement of 16.20%).

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoDocumentation/Makefile: conditionally include doc.dep
Ramsay Jones [Tue, 8 Dec 2020 22:31:44 +0000 (22:31 +0000)] 
Documentation/Makefile: conditionally include doc.dep

The 'clean' target is noticeably slow on cygwin, even for a 'do-nothing'
invocation of 'make clean'. For example, the second 'make clean' below:

  $ make clean >/dev/null 2>&1
  $ make clean
  GIT_VERSION = 2.29.0
  ...
  make[1]: Entering directory '/home/ramsay/git/Documentation'
      GEN mergetools-list.made
      GEN cmd-list.made
      GEN doc.dep
  ...
  $

has been timed at 23.339s, using git v2.29.0, on my laptop (an old core
i5-4200M @ 2.50GHz, 8GB RAM, 1TB HDD).

Notice that, since the 'doc.dep' file does not exist, make takes the
time (about 8s) to generate several files in order to create the doc.dep
include file. (If an 'include' file is missing, but a target for the
said file is present in the Makefile, make will execute that target
and, if that file now exists, throw away all its internal data and
re-read and re-parse the Makefile). Having spent the time to include
the 'doc.dep' file, the 'clean' target immediately deletes those files.
The document dependencies specified in the 'doc.dep' include file,
expressed as make targets and prerequisites, do not affect what the
'clean' target removes. Therefore, the time spent in generating the
dependencies is completely wasted effort.

In order to eliminate such wasted effort, use the value of the internal
$(MAKECMDGOALS) variable to only '-include doc.dep' when the target is
not 'clean'. (This drops the time down to 12.364s, on my laptop, giving
an improvement of 47.02%).

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoEleventh batch
Junio C Hamano [Tue, 8 Dec 2020 22:56:00 +0000 (14:56 -0800)] 
Eleventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'fc/zsh-completion'
Junio C Hamano [Tue, 8 Dec 2020 23:11:22 +0000 (15:11 -0800)] 
Merge branch 'fc/zsh-completion'

Hotfix for a recent breakage.

* fc/zsh-completion:
  completion: bash: fix gitk alias regression
  completion: zsh: fix file completion regression

3 years agoMerge branch 'sn/config-doc-typofix'
Junio C Hamano [Tue, 8 Dec 2020 23:11:22 +0000 (15:11 -0800)] 
Merge branch 'sn/config-doc-typofix'

Fix for an old typo.

* sn/config-doc-typofix:
  config.txt: fix a typo (backslash != backquote)

3 years agoMerge branch 'fc/random-cleanup'
Junio C Hamano [Tue, 8 Dec 2020 23:11:21 +0000 (15:11 -0800)] 
Merge branch 'fc/random-cleanup'

Random cleanup.

* fc/random-cleanup:
  gitignore: remove entry for git serve
  gitignore: drop duplicate entry for git-sh-i18n
  tests: lib-functions: trivial style cleanups
  test: completion: fix typos
  .gitignore: remove dangling file
  refspec: trivial cleanup

3 years agoMerge branch 'nm/imap-send-use-default-config'
Junio C Hamano [Tue, 8 Dec 2020 23:11:21 +0000 (15:11 -0800)] 
Merge branch 'nm/imap-send-use-default-config'

"git imap-send" used to ignore configuration variables like
core.askpass; this has been corrected.

* nm/imap-send-use-default-config:
  imap-send: parse default git config

3 years agoMerge branch 'jk/banned'
Junio C Hamano [Tue, 8 Dec 2020 23:11:21 +0000 (15:11 -0800)] 
Merge branch 'jk/banned'

Non-reentrant time-related library functions and ctime/asctime with
awkward calling interfaces are banned from the codebase.

* jk/banned:
  banned.h: mark ctime_r() and asctime_r() as banned
  banned.h: mark non-reentrant gmtime, etc as banned

3 years agoMerge branch 'tb/bugreport-no-localtime'
Junio C Hamano [Tue, 8 Dec 2020 23:11:21 +0000 (15:11 -0800)] 
Merge branch 'tb/bugreport-no-localtime'

Use of non-reentrant localtime() has been removed.

* tb/bugreport-no-localtime:
  builtin/bugreport.c: use thread-safe localtime_r()

3 years agoMerge branch 'rs/maintenance-run-outside-repo'
Junio C Hamano [Tue, 8 Dec 2020 23:11:20 +0000 (15:11 -0800)] 
Merge branch 'rs/maintenance-run-outside-repo'

"git maintenance run/start/stop" needed to be run in a repository
to hold the lockfile they use, but didn't make sure they are
actually in a repository, which has been corrected.

* rs/maintenance-run-outside-repo:
  t7900: fix typo: "test_execpt_success"
  maintenance: fix SEGFAULT when no repository

3 years agoMerge branch 'rs/fetch-pack-invalid-lockfile'
Junio C Hamano [Tue, 8 Dec 2020 23:11:20 +0000 (15:11 -0800)] 
Merge branch 'rs/fetch-pack-invalid-lockfile'

"fetch-pack" could pass NULL pointer to unlink(2) when it sees an
invalid filename; the error checking has been tightened to make
this impossible.

* rs/fetch-pack-invalid-lockfile:
  fetch-pack: disregard invalid pack lockfiles

3 years agoMerge branch 'nk/perf-fsmonitor-cleanup'
Junio C Hamano [Tue, 8 Dec 2020 23:11:20 +0000 (15:11 -0800)] 
Merge branch 'nk/perf-fsmonitor-cleanup'

Test clean-up.

* nk/perf-fsmonitor-cleanup:
  perf/fsmonitor: use test_must_be_empty helper

3 years agoMerge branch 'ma/grep-init-default'
Junio C Hamano [Tue, 8 Dec 2020 23:11:20 +0000 (15:11 -0800)] 
Merge branch 'ma/grep-init-default'

Code clean-up.

* ma/grep-init-default:
  MyFirstObjectWalk: drop `init_walken_defaults()`
  grep: copy struct in one fell swoop
  grep: use designated initializers for `grep_defaults`
  grep: don't set up a "default" repo for grep

3 years agoMerge branch 'js/trace2-session-id'
Junio C Hamano [Tue, 8 Dec 2020 23:11:20 +0000 (15:11 -0800)] 
Merge branch 'js/trace2-session-id'

The transport layer was taught to optionally exchange the session
ID assigned by the trace2 subsystem during fetch/push transactions.

* js/trace2-session-id:
  receive-pack: log received client session ID
  send-pack: advertise session ID in capabilities
  upload-pack, serve: log received client session ID
  fetch-pack: advertise session ID in capabilities
  transport: log received server session ID
  serve: advertise session ID in v2 capabilities
  receive-pack: advertise session ID in v0 capabilities
  upload-pack: advertise session ID in v0 capabilities
  trace2: add a public function for getting the SID
  docs: new transfer.advertiseSID option
  docs: new capability to advertise session IDs

3 years agoMerge branch 'mt/do-not-use-scld-in-working-tree'
Junio C Hamano [Tue, 8 Dec 2020 23:11:19 +0000 (15:11 -0800)] 
Merge branch 'mt/do-not-use-scld-in-working-tree'

"git apply" adjusted the permission bits of working-tree files and
directories according core.sharedRepository setting by mistake and
for a long time, which has been corrected.

* mt/do-not-use-scld-in-working-tree:
  apply: don't use core.sharedRepository to create working tree files

3 years agoMerge branch 'ds/maintenance-part-3'
Junio C Hamano [Tue, 8 Dec 2020 23:11:19 +0000 (15:11 -0800)] 
Merge branch 'ds/maintenance-part-3'

"git maintenance" command had trouble working in a directory whose
pathname contained an ERE metacharacter like '+'.

* ds/maintenance-part-3:
  maintenance: use 'git config --fixed-value'

3 years agoMerge branch 'ds/maintenance-part-2'
Junio C Hamano [Tue, 8 Dec 2020 23:11:19 +0000 (15:11 -0800)] 
Merge branch 'ds/maintenance-part-2'

Test fix.

* ds/maintenance-part-2:
  t7900: speed up expensive test

3 years agoMerge branch 'ds/config-literal-value'
Junio C Hamano [Tue, 8 Dec 2020 23:11:19 +0000 (15:11 -0800)] 
Merge branch 'ds/config-literal-value'

Various subcommands of "git config" that takes value_regex
learn the "--literal-value" option to take the value_regex option
as a literal string.

* ds/config-literal-value:
  config doc: value-pattern is not necessarily a regexp
  config: implement --fixed-value with --get*
  config: plumb --fixed-value into config API
  config: add --fixed-value option, un-implemented
  t1300: add test for --replace-all with value-pattern
  t1300: test "set all" mode with value-pattern
  config: replace 'value_regex' with 'value_pattern'
  config: convert multi_replace to flags

3 years agoMerge branch 'ds/maintenance-part-1'
Junio C Hamano [Tue, 8 Dec 2020 23:11:19 +0000 (15:11 -0800)] 
Merge branch 'ds/maintenance-part-1'

Build consistency fix.

* ds/maintenance-part-1:
  Makefile: mark git-maintenance as a builtin

3 years agoMerge branch 'tb/idx-midx-race-fix'
Junio C Hamano [Tue, 8 Dec 2020 23:11:18 +0000 (15:11 -0800)] 
Merge branch 'tb/idx-midx-race-fix'

Processes that access packdata while the .idx file gets removed
(e.g. while repacking) did not fail or fall back gracefully as they
could.

* tb/idx-midx-race-fix:
  midx.c: protect against disappearing packs
  packfile.c: protect against disappearing indexes

3 years agoMerge branch 'ps/update-ref-multi-transaction'
Junio C Hamano [Tue, 8 Dec 2020 23:11:17 +0000 (15:11 -0800)] 
Merge branch 'ps/update-ref-multi-transaction'

"git update-ref --stdin" learns to take multiple transactions in a
single session.

* ps/update-ref-multi-transaction:
  update-ref: disallow "start" for ongoing transactions
  p1400: use `git-update-ref --stdin` to test multiple transactions
  update-ref: allow creation of multiple transactions
  t1400: avoid touching refs on filesystem

3 years agoMerge branch 'js/add-i-color-fix'
Junio C Hamano [Tue, 8 Dec 2020 23:11:17 +0000 (15:11 -0800)] 
Merge branch 'js/add-i-color-fix'

"git add -i" failed to honor custom colors configured to show
patches, which has been corrected.

* js/add-i-color-fix:
  add -i: verify in the tests that colors can be overridden
  add -p: prefer color.diff.context over color.diff.plain
  add -i (Perl version): color header to match the C version
  add -i (built-in): use the same indentation as the Perl version
  add -p (built-in): do not color the progress indicator separately
  add -i (built-in): use correct names to load color.diff.* config
  add -i (built-in): prevent the `reset` "color" from being configured
  add -i: use `reset_color` consistently
  add -p (built-in): imitate `xdl_format_hunk_hdr()` generating hunk headers
  add -i (built-in): send error messages to stderr
  add -i (built-in): do show an error message for incorrect inputs

3 years agoMerge branch 'jt/trace-error-on-warning'
Junio C Hamano [Tue, 8 Dec 2020 23:11:17 +0000 (15:11 -0800)] 
Merge branch 'jt/trace-error-on-warning'

Like die() and error(), a call to warning() will also trigger a
trace2 event.

* jt/trace-error-on-warning:
  usage: add trace2 entry upon warning()

3 years agot7064: avoid relying on a specific default branch name
Johannes Schindelin [Mon, 7 Dec 2020 15:19:40 +0000 (15:19 +0000)] 
t7064: avoid relying on a specific default branch name

To allow us to consider a change in the default behavior of `git init`
where it uses a more inclusive name for the initial branch, we must
first teach the test suite not to rely on a specific default branch
name. In this patch, we teach t7064 that trick.

To that end, we set a specific name for the initial branch. Ideally, we
would simply start out by calling `git branch -M initial-branch`, but
there is a bug in `git branch -M` that does not allow renaming branches
unless they already have commits. This will be fixed in the
`js/init-defaultbranch-advice` topic, and until that time, we use the
equivalent (but less intuitive) `git checkout -f --orphan`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot7900: fix typo: "test_execpt_success"
Josh Steadmon [Tue, 8 Dec 2020 20:12:56 +0000 (12:12 -0800)] 
t7900: fix typo: "test_execpt_success"

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: bash: fix gitk alias regression
Felipe Contreras [Sat, 5 Dec 2020 07:10:23 +0000 (01:10 -0600)] 
completion: bash: fix gitk alias regression

Long time ago when the _git_complete helper was introduced, _gitk was
replaced with __gitk_main, and a placeholder for backwards compatibility
pointing to __git_wrap_main_gitk was left in place.

When "__git_complete gitk __gitk_main" was called, that created the
__git_wrap__gitk_main helper, which is just basically "__git_func_wrap
__gitk_main" plus `complete` options.

Unfortunately the commit b0a4b2d257 (completion: add support for
backwards compatibility, 2012-05-19) missed a previous instance of a
call to _gitk in _git_gitk

So, basically we had __git_wrap__git_main -> __git_func_wrap __git_main ->
__git_complete_command gitk -> _git_gitk -> _gitk ->
__git_wrap__gitk_main -> __git_func_wrap __gitk_main -> __gitk_main.

There was never any need to call __git_func_wrap twice. Since _git_gitk
is always called inside the wrapper, it can call __gitk_main directly.

And then, in commit 441ecdab37 (completion: bash: remove old compat
wrappers, 2020-10-27) _gitk was removed, which triggers the following
error:

  _git_gitk:9: command not found: _gitk

Let's call the correct function: __gitk_main.

Cc: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph: use size_t for array allocation and indexing
Jeff King [Mon, 7 Dec 2020 19:11:08 +0000 (14:11 -0500)] 
commit-graph: use size_t for array allocation and indexing

Our packed_commit_list is an array of pointers to commit structs. We use
"int" for the allocation, which is 32-bit even on 64-bit platforms. This
isn't likely to overflow in practice (we're writing commit graphs, so
you'd need to actually have billions of unique commits in the
repository). But it's good practice to use size_t for allocations.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph: replace packed_oid_list with oid_array
Jeff King [Mon, 7 Dec 2020 19:11:05 +0000 (14:11 -0500)] 
commit-graph: replace packed_oid_list with oid_array

Our custom packed_oid_list data structure is really just an oid_array in
disguise. Let's switch to using the generic structure, which shortens
and simplifies the code slightly.

There's one slightly awkward part: in the old code we copied a hash
straight from the mmap'd on-disk data into the final object_id. And now
we'll copy to a temporary oid, which we'll then pass to
oid_array_append(). But this is an operation we have to do all over the
commit-graph code already, since it mostly uses object_id structs
internally. I also measured "git commit-graph --append", which triggers
this code path, and it showed no difference.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph: drop count_distinct_commits() function
Jeff King [Mon, 7 Dec 2020 19:11:02 +0000 (14:11 -0500)] 
commit-graph: drop count_distinct_commits() function

When writing a commit graph, we collect a list of object ids in an
array, which we'll eventually copy into an array of "struct commit"
pointers. Before we do that, though, we count the number of distinct
commit entries. There's a subtle bug in this step, though.

We eliminate not only duplicate oids, but also in split mode, any oids
which are not commits or which are already in a graph file. However, the
loop starts at index 1, always counting index 0 as distinct. And indeed
it can't be a duplicate, since we check for those by comparing against
the previous entry, and there isn't one for index 0. But it could be a
commit that's already in a graph file, and we'd overcount the number of
commits by 1 in that case.

That turns out not to be a problem, though. The only things we do with
the count are:

  - check if our count will overflow our data structures. But the limit
    there is 2^31 commits, so while this is a useful check, the
    off-by-one is not likely to matter.

  - pre-allocate the array of commit pointers. But over-allocating by
    one isn't a problem; we'll just waste a few extra bytes.

The bug would be easy enough to fix, but we can observe that neither of
those steps is necessary.

After building the actual commit array, we'll likewise check its count
for overflow. So the extra check of the distinct commit count here is
redundant.

And likewise we use ALLOC_GROW() when building the commit array, so
there's no need to preallocate it (it's possible that doing so is
slightly more efficient, but if we care we can just optimistically
allocate one slot for each oid; I didn't bother here).

So count_distinct_commits() isn't doing anything useful. Let's just get
rid of that step.

Note that a side effect of the function was that we sorted the list of
oids, which we do rely on in copy_oids_to_commits(), since it must also
skip the duplicates. So we'll move the qsort there. I didn't copy the
"TODO" about adding more progress meters. It's actually quite hard to
make a repository large enough for this qsort would take an appreciable
amount of time, so this doesn't seem like a useful note.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agooid-array: provide a for-loop iterator
Jeff King [Mon, 7 Dec 2020 19:11:00 +0000 (14:11 -0500)] 
oid-array: provide a for-loop iterator

We provide oid_array_for_each_unique() for iterating over the
de-duplicated items in an array. But it's awkward to use for two
reasons:

  1. It uses a callback, which means marshaling arguments into a struct
     and passing it to the callback with a void parameter.

  2. The callback doesn't know the numeric index of the oid we're
     looking at. This is useful for things like progress meters.

Iterating with a for-loop is much more natural for some cases, but the
caller has to do the de-duping itself. However, we can provide a small
helper to make this easier (see the docstring in the header for an
example use).

The caller does have to remember to sort the array first. We could add
an assertion into the helper that array->sorted is set, but I didn't
want to complicate what is otherwise a pretty fast code path.

I also considered adding a full iterator type with init/next/end
functions (similar to what we have for hashmaps). But it ended up making
the callers much harder to read. This version keeps us close to a basic
for-loop.

Yet another option would be adding an option to sort the array and
compact out the duplicates. This would mean iterating over the array an
extra time, though that's probably not a big deal (we did just do an
O(n log n) sort). But we'd still have to write a for-loop to iterate, so
it doesn't really make anything easier for the caller.

No new test, since we'll convert the callback iterator (which is covered
by t0064, among other callers) to use the new code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6300: avoid using the default name of the initial branch
Johannes Schindelin [Sun, 6 Dec 2020 13:15:59 +0000 (13:15 +0000)] 
t6300: avoid using the default name of the initial branch

Our test suite currently only passes when `git init` uses the name
`master` for the initial branch. This would stop us from changing the
default branch name.

Let's adjust t6300 so that it does not rely on any specific default
branch name. This trick is done by (force-)renaming the initial branch
to the name `main` in the `setup` and the `:remotename and :remoteref`
test cases, and then replacing all mentions of `master` and `MASTER`
with `main` and `MAIN`, respectively.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agooid-array: make sort function public
Jeff King [Fri, 4 Dec 2020 18:52:07 +0000 (13:52 -0500)] 
oid-array: make sort function public

We sort the oid-array as a side effect of calling the lookup or
unique-iteration functions. But callers may want to sort it themselves
(especially as we add new iteration options in future patches).

We'll also move the check of the "sorted" flag into the sort function,
so callers don't have to remember to check it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocache.h: move hash/oid functions to hash.h
Jeff King [Fri, 4 Dec 2020 18:51:39 +0000 (13:51 -0500)] 
cache.h: move hash/oid functions to hash.h

We define git_hash_algo and object_id in hash.h, but most of the utility
functions are declared in the main cache.h. Let's move them to hash.h
along with their struct definitions. This cleans up cache.h a bit, but
also avoids circular dependencies when other headers need to know about
these functions (e.g., if oid-array.h were to have an inline that used
oideq(), it couldn't include cache.h because it is itself included by
cache.h).

No including C files should be affected, because hash.h is always
included in cache.h already.

We do have to mention repository.h at the top of hash.h, though, since
we depend on the_repository in some of our inline functions.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot0064: make duplicate tests more robust
Jeff King [Fri, 4 Dec 2020 18:50:23 +0000 (13:50 -0500)] 
t0064: make duplicate tests more robust

Our tests for handling duplicates in oid-array provide only a single
duplicate for each number, so our sorted array looks like:

  44 44 55 55 88 88 aa aa

A slightly more interesting test is to have multiple duplicates, which
makes sure that we not only skip the duplicate, but keep skipping until
we are out of the set of matching duplicates.

Unsurprisingly this works just fine, but it's worth beefing up this test
since we're about to change the duplicate-detection code.

Note that we do need to adjust the results on the lookup test, since it
is returning the index of the found item (and now we have more items
before our range, and the range itself is slightly larger, since we'll
accept a match of any element).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot0064: drop sha1 mention from filename
Jeff King [Fri, 4 Dec 2020 18:49:24 +0000 (13:49 -0500)] 
t0064: drop sha1 mention from filename

The data type is an oid_array these days, and we are using "test-tool
oid-array", so let's name the test script appropriately.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agooid-array.h: drop sha1 mention from header guard
Jeff King [Fri, 4 Dec 2020 18:48:54 +0000 (13:48 -0500)] 
oid-array.h: drop sha1 mention from header guard

When this file was moved from sha1-array.h, we forgot to update the
preprocessor header guard to match the new name.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocmake: determine list of extra built-ins dynamically
Johannes Schindelin [Fri, 4 Dec 2020 19:33:56 +0000 (19:33 +0000)] 
cmake: determine list of extra built-ins dynamically

In 0a21d0e08902 (Makefile: mark git-maintenance as a builtin,
2020-12-01), we marked git-maintenance as a builtin in the Makefile, but
forgot to do the same in `CMakeLists.txt`.

Rather than always play catch-up and adjust `git_builtin_extra`
manually, use the `BUILT_INS` definitions in the Makefile as
authoritative source and generate `git_builtin_extra` dynamically.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5526: drop the prereq expecting the default branch name `main`
Johannes Schindelin [Fri, 4 Dec 2020 14:34:22 +0000 (14:34 +0000)] 
t5526: drop the prereq expecting the default branch name `main`

Initially, we started converting this test script in anticipation for
renaming the default branch name to `main`. To that end, we partially
converted it to accommodate for that default branch name, marking the
now-failing test cases with a prereq that was designed to be fulfilled
once the rename was complete.

However, the effort to move to the branch name `main` needs quite a bit
longer, as it was decided that we need a deprecation phase first.

To avoid keeping t5526 in limbo for such a long time, we just made it
independent of the actual default branch name used by Git. Therefore,
that prereq is no longer necessary, and we can drop it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5526: avoid depending on a specific default branch name
Johannes Schindelin [Fri, 4 Dec 2020 14:34:21 +0000 (14:34 +0000)] 
t5526: avoid depending on a specific default branch name

While at it, use different default branch names for the three different
repositories involved in the test script: this makes it easier to debug
failures, too (otherwise you have to wonder which `master` branch was
meant: the super project's? The submodule's? The nested submodule's?).

Note: this touches code that was originally modified to prepare for
renaming the default branch name to `main`. This patch side-steps that
effort completely by overriding the initial branch name explicitly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci(vs-build): stop passing the iconv library location explicitly
Dennis Ameling [Fri, 4 Dec 2020 14:22:20 +0000 (14:22 +0000)] 
ci(vs-build): stop passing the iconv library location explicitly

Something changed in `vcpkg` (which we use in our Visual C++ build to
provide the dependencies such as libcurl) and our `vs-build` job started
failing in CI. The reason is that we had a work-around in place to help
CMake find iconv, and this work-around is neither needed nor does it
work anymore.

For the full discussion with the vcpkg project, see this comment:
https://github.com/microsoft/vcpkg/issues/14780#issuecomment-735368280

Signed-off-by: Dennis Ameling <dennis@dennisameling.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoupload-pack.c: don't free allowed_filters util pointers
Taylor Blau [Thu, 3 Dec 2020 18:55:18 +0000 (13:55 -0500)] 
upload-pack.c: don't free allowed_filters util pointers

To keep track of which object filters are allowed or not, 'git
upload-pack' stores the name of each filter in a string_list, and sets
it ->util pointer to be either 0 or 1, indicating whether it is banned
or allowed.

Later on, we attempt to clear that list, but we incorrectly ask for the
util pointers to be free()'d, too. This behavior (introduced back in
6dd3456a8c (upload-pack.c: allow banning certain object filter(s),
2020-08-03)) leads to an invalid free, and causes us to crash.

In order to trigger this, one needs to fetch from a server that (a) has
at least one object filter allowed, and (b) issue a fetch that contains
a subset of the allowed filters (i.e., we cannot ask for a banned
filter, since this causes us to die() before we hit the bogus
string_list_clear()).

In that case, whatever banned filters exist will cause a noop free()
(since those ->util pointers are set to 0), but the first allowed filter
we try to free will crash us.

We never noticed this in the tests because we didn't have an example of
setting 'uploadPackFilter' configuration variables and then following up
with a valid fetch. The first new 'git clone' prevents further
regression here. For good measure on top, add a test which checks the
same behavior at a tree depth greater than 0.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobuiltin/clone.c: don't ignore transport_fetch_refs() errors
Taylor Blau [Thu, 3 Dec 2020 18:55:13 +0000 (13:55 -0500)] 
builtin/clone.c: don't ignore transport_fetch_refs() errors

If 'git clone' couldn't execute 'transport_fetch_refs()' (e.g., because
of an error on the remote's side in 'git upload-pack'), then it will
silently ignore it.

Even though this has been the case at least since clone was ported to C
(way back in 8434c2f1af (Build in clone, 2008-04-27)), 'git fetch'
doesn't ignore these and reports any failures it sees.

That suggests that ignoring the return value in 'git clone' is simply an
oversight that should be corrected. That's exactly what this patch does.
(Noticing and fixing this is no coincidence, we'll want it in the next
patch in order to demonstrate a regression in 'git upload-pack' via a
'git clone'.)

There's no additional logging here, but that matches how 'git fetch'
handles the same case. An assumption there is that whichever part of
transport_fetch_refs() fails will complain loudly, so any additional
logging here is redundant.

Co-authored-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 agostyle: indent multiline "if" conditions to align
Jeff King [Thu, 3 Dec 2020 08:00:18 +0000 (03:00 -0500)] 
style: indent multiline "if" conditions to align

Commit 6dc905d974 (config: split repo scope to local and worktree,
2020-02-10) made some "if" statements multiline, but didn't indent the
second lines in our usual way.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoupload-pack: propagate return value from object filter config callback
Jeff King [Thu, 3 Dec 2020 08:09:42 +0000 (03:09 -0500)] 
upload-pack: propagate return value from object filter config callback

If we encounter an error in parse_filter_object_config(), we'll complain
to stderr but won't actually propagate the return value up the stack.
This is unlike most of our config callbacks, which return the error to
git_config() so it can die (this includes the call just below us to
parse_hide_refs_config(), which can also produce errors).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoTenth batch
Junio C Hamano [Thu, 3 Dec 2020 07:44:25 +0000 (23:44 -0800)] 
Tenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'pk/subsub-fetch-fix'
Junio C Hamano [Thu, 3 Dec 2020 08:18:07 +0000 (00:18 -0800)] 
Merge branch 'pk/subsub-fetch-fix'

An earlier attempt to fix "git fetch --recurse-submodules" broke
another use case; revert it until a better fix is found.

* pk/subsub-fetch-fix:
  Revert "submodules: fix of regression on fetching of non-init subsub-repo"

3 years agoMerge branch 'jk/stop-pack-objects-when-fetch-is-killed'
Junio C Hamano [Thu, 3 Dec 2020 08:18:07 +0000 (00:18 -0800)] 
Merge branch 'jk/stop-pack-objects-when-fetch-is-killed'

"git fetch" that is killed may leave a pack-objects process behind,
still computing to find a good compression, wasting cycles.  This
has been corrected.

* jk/stop-pack-objects-when-fetch-is-killed:
  upload-pack: kill pack-objects helper on signal or exit

3 years agoMerge branch 'jk/stop-pack-objects-when-push-is-killed'
Junio C Hamano [Thu, 3 Dec 2020 08:18:06 +0000 (00:18 -0800)] 
Merge branch 'jk/stop-pack-objects-when-push-is-killed'

"git push" that is killed may leave a pack-objects process behind,
still computing to find a good compression, wasting cycles.  This
has been corrected.

* jk/stop-pack-objects-when-push-is-killed:
  send-pack: kill pack-objects helper on signal or exit

3 years agoMerge branch 'tb/repack-simplify'
Junio C Hamano [Thu, 3 Dec 2020 08:18:06 +0000 (00:18 -0800)] 
Merge branch 'tb/repack-simplify'

Simplify the logic to deal with a repack operation that ended up
creating the same packfile.

* tb/repack-simplify:
  builtin/repack.c: don't move existing packs out of the way
  builtin/repack.c: keep track of what pack-objects wrote
  repack: make "exts" array available outside cmd_repack()

3 years agoMerge branch 'pb/pull-rebase-recurse-submodules'
Junio C Hamano [Thu, 3 Dec 2020 08:18:06 +0000 (00:18 -0800)] 
Merge branch 'pb/pull-rebase-recurse-submodules'

"git pull --rebase --recurse-submodules" checked for local changes
in a wrong range and failed to run correctly when it should.

* pb/pull-rebase-recurse-submodules:
  pull: check for local submodule modifications with the right range
  t5572: describe '--rebase' tests a little more
  t5572: add notes on a peculiar test
  pull --rebase: compute rebase arguments in separate function

3 years agoMerge branch 'ab/retire-parse-remote'
Junio C Hamano [Thu, 3 Dec 2020 08:18:06 +0000 (00:18 -0800)] 
Merge branch 'ab/retire-parse-remote'

"git-parse-remote" shell script library outlived its usefulness.

* ab/retire-parse-remote:
  submodule: fix fetch_in_submodule logic
  parse-remote: remove this now-unused library
  submodule: remove sh function in favor of helper
  submodule: use "fetch" logic instead of custom remote discovery

3 years agodoc: make HTML manual reproducible
Arnout Engelen [Tue, 1 Dec 2020 09:50:37 +0000 (09:50 +0000)] 
doc: make HTML manual reproducible

Versions of docbook-xsl newer than 1.79.1 allows xsltproc to assign
IDs to nodes in the generated HTML consistently, to make the output
resulting from the same source stable and reproducible.

Pass the generate.consistent.ids parameter from the command line to
ask for this feature.  Older versions of the tool simply ignores the
parameter and produces their output the same way as before this
change, so there is no need to check for toolchain version.

Signed-off-by: Arnout Engelen <arnout@bzzt.net>
Helped-by: brian m. carlson <sandals@crustytoothpaste.net>
Helped-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoRevert "submodules: fix of regression on fetching of non-init subsub-repo"
Junio C Hamano [Wed, 2 Dec 2020 23:07:14 +0000 (15:07 -0800)] 
Revert "submodules: fix of regression on fetching of non-init subsub-repo"

This reverts commit 1b7ac4e6d4d490b224f5206af7418ed74e490608; in
<CAN0XMOLiS_8JZKF_wW70BvRRxkDHyUoa=Z3ODtB_Bd6f5Y=7JQ@mail.gmail.com>,
Ralf Thielow reports that "git fetch" with submodule.recurse set can
result in a bogus and infinitely recursive fetching of the same
submodule.

3 years agoglossary: improve "branch" definition
Sergey Organov [Mon, 23 Nov 2020 20:05:51 +0000 (23:05 +0300)] 
glossary: improve "branch" definition

The old phrasing is at least questionable, if not wrong, as there are
a lot of branches out there that didn't see active development for
years, yet they are still branches, ready to become active again any
time.

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMakefile: mark git-maintenance as a builtin
Jeff King [Wed, 2 Dec 2020 02:34:11 +0000 (21:34 -0500)] 
Makefile: mark git-maintenance as a builtin

We normally get the list of builtin commands by expanding BUILTIN_OBJS.
But for commands which are embedded inside another's source file (e.g.,
cmd_show() in builtin/log.c), the Makefile needs to be told explicitly
about them.

Since cmd_maintenance() is inside buitin/gc.c, it should be listed
explicitly in the BUILT_INS list in the Makefile. Not doing so isn't
_too_ tragic, as it simply means we will not make a git-maintenance
symlink in libexec/git-core. Since we encourage people to use the "git
foo" form, even in scripts which have put libexec into their PATH,
nobody seems to have noticed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoapply: don't use core.sharedRepository to create working tree files
Matheus Tavares [Tue, 1 Dec 2020 23:45:04 +0000 (20:45 -0300)] 
apply: don't use core.sharedRepository to create working tree files

core.sharedRepository defines which permissions Git should set when
creating files in $GIT_DIR, so that the repository may be shared with
other users. But (in its current form) the setting shouldn't affect how
files are created in the working tree. This is not respected by apply
and am (which uses apply), when creating leading directories:

$ cat d.patch
 diff --git a/d/f b/d/f
 new file mode 100644
 index 0000000..e69de29

Apply without the setting:
$ umask 0077
$ git apply d.patch
$ ls -ld d
 drwx------

Apply with the setting:
$ umask 0077
$ git -c core.sharedRepository=0770 apply d.patch
$ ls -ld d
 drwxrws---

Only the leading directories are affected. That's because they are
created with safe_create_leading_directories(), which calls
adjust_shared_perm() to set the directories' permissions based on
core.sharedRepository. To fix that, let's introduce a variant of this
function that ignores the setting, and use it in apply. Also add a
regression test and a note in the function documentation about the use
of each variant according to the destination (working tree or git
dir).

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobanned.h: mark ctime_r() and asctime_r() as banned
Jeff King [Tue, 1 Dec 2020 21:11:38 +0000 (13:11 -0800)] 
banned.h: mark ctime_r() and asctime_r() as banned

The ctime_r() and asctime_r() functions are reentrant, but have
no check that the buffer we pass in is long enough (the manpage says it
"should have room for at least 26 bytes"). Since this is such an
easy-to-get-wrong interface, and since we have the much safer strftime()
as well as its more convenient strbuf_addftime() wrapper, let's ban both
of those.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>