]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
4 years agocontrib/buildsystems: error out on unknown option
Johannes Schindelin [Mon, 29 Jul 2019 20:08:08 +0000 (13:08 -0700)] 
contrib/buildsystems: error out on unknown option

One time too many did this developer call the `generate` script passing
a `--make-out=<PATH>` option that was happily ignored (because there
should be a space, not an equal sign, between `--make-out` and the
path).

And one time too many, this script not only ignored it but did not even
complain. Let's fix that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocontrib/buildsystems: optionally capture the dry-run in a file
Philip Oakley [Mon, 29 Jul 2019 20:08:07 +0000 (13:08 -0700)] 
contrib/buildsystems: optionally capture the dry-run in a file

Add an option for capturing the output of the make dry-run used in
determining the msvc-build structure for easy debugging.

You can use the output of `--make-out <path>` in subsequent runs via the
`--in <path>` option.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocontrib/buildsystems: redirect errors of the dry run into a log file
Philip Oakley [Mon, 29 Jul 2019 20:08:07 +0000 (13:08 -0700)] 
contrib/buildsystems: redirect errors of the dry run into a log file

Rather than swallowing the errors, it is better to have them in a file.

To make it obvious what this is about, use the file name
'msvc-build-makedryerrors.txt'.

Further, if the output is empty, simply delete that file. As we target
Git for Windows' SDK (which, unlike its predecessor msysGit, offers Perl
versions newer than 5.8), we can use the quite readable syntax `if -f -z
$ErrsFile` (available in Perl >=5.10).

Note that the file will contain the new values of the GIT_VERSION and
GITGUI_VERSION if they were generated by the make file. They are omitted
if the release is tagged and indentically defined in their respective
GIT_VERSION_GEN file DEF_VER variables.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocontrib/buildsystems: ignore gettext stuff
Philip Oakley [Mon, 29 Jul 2019 20:08:06 +0000 (13:08 -0700)] 
contrib/buildsystems: ignore gettext stuff

Git's build contains steps to handle internationalization. This caused
hiccups in the parser used to generate QMake/Visual Studio project files.

As those steps are irrelevant in this context, let's just ignore them.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocontrib/buildsystems: handle quoted spaces in filenames
Philip Oakley [Mon, 29 Jul 2019 20:08:05 +0000 (13:08 -0700)] 
contrib/buildsystems: handle quoted spaces in filenames

The engine.pl script expects file names not to contain spaces. However,
paths with spaces are quite prevalent on Windows. Use shellwords() rather
than split() to parse them correctly.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocontrib/buildsystems: fix misleading error message
Philip Oakley [Mon, 29 Jul 2019 20:08:05 +0000 (13:08 -0700)] 
contrib/buildsystems: fix misleading error message

The error message talked about a "lib option", but it clearly referred
to a link option.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocontrib/buildsystems: ignore irrelevant files in Generators/
Johannes Schindelin [Mon, 29 Jul 2019 20:08:04 +0000 (13:08 -0700)] 
contrib/buildsystems: ignore irrelevant files in Generators/

The Generators/ directory can contain spurious files such as editors'
backup files. Even worse, there could be .swp files which are not even
valid Perl scripts.

Let's just ignore anything but .pm files in said directory.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocontrib/buildsystems: ignore invalidcontinue.obj
Philip Oakley [Mon, 29 Jul 2019 20:08:03 +0000 (13:08 -0700)] 
contrib/buildsystems: ignore invalidcontinue.obj

Since 4b623d8 (MSVC: link in invalidcontinue.obj for better POSIX
compatibility, 2014-03-29), invalidcontinue.obj is linked in the MSVC
build, but it was not parsed correctly by the buildsystem. Ignore it, as
it is known to Visual Studio and will be handled elsewhere.

Also only substitute filenames ending with .o when generating the
source .c filename, otherwise we would start to expect .cbj files to
generate .obj files (which are not generated by our build)...

In the future there may be source files that produce .obj files
so keep the two issues (.obj files with & without source files)
separate.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Duncan Smart <duncan.smart@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoVcproj.pm: urlencode '<' and '>' when generating VC projects
Johannes Schindelin [Mon, 29 Jul 2019 20:08:03 +0000 (13:08 -0700)] 
Vcproj.pm: urlencode '<' and '>' when generating VC projects

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoVcproj.pm: do not configure VCWebServiceProxyGeneratorTool
Johannes Schindelin [Mon, 29 Jul 2019 20:08:02 +0000 (13:08 -0700)] 
Vcproj.pm: do not configure VCWebServiceProxyGeneratorTool

It is not necessary, and Visual Studio 2015 no longer supports it, anyway.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoVcproj.pm: list git.exe first to be startup project
Philip Oakley [Mon, 29 Jul 2019 20:08:01 +0000 (13:08 -0700)] 
Vcproj.pm: list git.exe first to be startup project

Visual Studio takes the first listed application/library as the default
startup project [1].

Detect the 'git' project and place it at the head of the project list,
rather than at the tail.

Export the apps list before libs list for both the projects and global
structures of the .sln file.

[1] http://stackoverflow.com/questions/1238553/
vs2008-where-is-the-startup-project-setting-stored-for-a-solution
    "In the solution file, there are a list of pseudo-XML "Project"
    entries. It turns out that whatever is the first one ends up as
    the Startup Project, unless it’s overridden in the suo file. Argh.
    I just rearranged the order in the file and it’s good."

    "just moving the pseudo-xml isn't enough. You also have to move the
    group of entries in the "GlobalSection(ProjectConfigurationPlatforms)
    = postSolution" group that has the GUID of the project you moved to
    the top. So there are two places to move lines."

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoVcproj.pm: auto-generate GUIDs
Johannes Schindelin [Mon, 29 Jul 2019 20:08:01 +0000 (13:08 -0700)] 
Vcproj.pm: auto-generate GUIDs

We ran out GUIDs. Again. But there is no need to: we can generate them
semi-randomly from the target file name of the project.

Note: the Vcproj generator is probably only interesting for historical
reasons; nevertheless, the upcoming Vcxproj generator (to support modern
Visual Studio versions) is based on the Vcproj generator and it is
better to fix this here first.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoThe fifth batch
Junio C Hamano [Thu, 11 Jul 2019 22:17:22 +0000 (15:17 -0700)] 
The fifth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'js/mingw-use-utf8'
Junio C Hamano [Thu, 11 Jul 2019 22:16:49 +0000 (15:16 -0700)] 
Merge branch 'js/mingw-use-utf8'

Windows update.

* js/mingw-use-utf8:
  mingw: fix possible buffer overrun when calling `GetUserNameW()`
  mingw: use Unicode functions explicitly
  mingw: get pw_name in UTF-8 format

4 years agoMerge branch 'sg/ci-brew-gcc-workaround'
Junio C Hamano [Thu, 11 Jul 2019 22:16:49 +0000 (15:16 -0700)] 
Merge branch 'sg/ci-brew-gcc-workaround'

Dev support update.

* sg/ci-brew-gcc-workaround:
  ci/lib.sh: update a comment about installed P4 and Git-LFS versions
  ci: disable Homebrew's auto cleanup
  ci: don't update Homebrew

4 years agoMerge branch 'kb/windows-force-utf8'
Junio C Hamano [Thu, 11 Jul 2019 22:16:49 +0000 (15:16 -0700)] 
Merge branch 'kb/windows-force-utf8'

Windows update.

* kb/windows-force-utf8:
  gettext: always use UTF-8 on native Windows

4 years agoMerge branch 'dr/progress-i18n'
Junio C Hamano [Thu, 11 Jul 2019 22:16:49 +0000 (15:16 -0700)] 
Merge branch 'dr/progress-i18n'

Progress messages have been made localizable.

* dr/progress-i18n:
  l10n: localizable upload progress messages

4 years agoMerge branch 'qn/clone-doc-use-long-form'
Junio C Hamano [Thu, 11 Jul 2019 22:16:48 +0000 (15:16 -0700)] 
Merge branch 'qn/clone-doc-use-long-form'

The "git clone" documentation refers to command line options in its
description in the short form; they have been replaced with long
forms to make them more recognisable.

* qn/clone-doc-use-long-form:
  docs: git-clone: list short form of options first
  docs: git-clone: refer to long form of options

4 years agoMerge branch 'js/rebase-reschedule-applies-only-to-interactive'
Junio C Hamano [Thu, 11 Jul 2019 22:16:48 +0000 (15:16 -0700)] 
Merge branch 'js/rebase-reschedule-applies-only-to-interactive'

The configuration variable rebase.rescheduleFailedExec should be
effective only while running an interactive rebase and should not
affect anything when running an non-interactive one, which was not
the case.  This has been corrected.

* js/rebase-reschedule-applies-only-to-interactive:
  rebase --am: ignore rebase.rescheduleFailedExec

4 years agoMerge branch 'sg/git-C-empty-doc'
Junio C Hamano [Thu, 11 Jul 2019 22:16:48 +0000 (15:16 -0700)] 
Merge branch 'sg/git-C-empty-doc'

Doc update.

* sg/git-C-empty-doc:
  Document that 'git -C ""' works and doesn't change directory

4 years agoMerge branch 'jt/t5551-test-chunked'
Junio C Hamano [Thu, 11 Jul 2019 22:16:47 +0000 (15:16 -0700)] 
Merge branch 'jt/t5551-test-chunked'

Update smart-http test.

* jt/t5551-test-chunked:
  t5551: test usage of chunked encoding explicitly

4 years agoMerge branch 'js/mingw-gcc-stack-protect'
Junio C Hamano [Thu, 11 Jul 2019 22:16:47 +0000 (15:16 -0700)] 
Merge branch 'js/mingw-gcc-stack-protect'

Windows update.

* js/mingw-gcc-stack-protect:
  mingw: enable stack smashing protector

4 years agoMerge branch 'cb/windows-manifest'
Junio C Hamano [Thu, 11 Jul 2019 22:16:47 +0000 (15:16 -0700)] 
Merge branch 'cb/windows-manifest'

Windows update.

* cb/windows-manifest:
  mingw: embed a manifest to trick UAC into Doing The Right Thing

4 years agoThe fourth batch
Junio C Hamano [Tue, 9 Jul 2019 22:48:36 +0000 (15:48 -0700)] 
The fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'ds/fetch-disable-force-notice'
Junio C Hamano [Tue, 9 Jul 2019 22:25:46 +0000 (15:25 -0700)] 
Merge branch 'ds/fetch-disable-force-notice'

"git fetch" and "git pull" reports when a fetch results in
non-fast-forward updates to let the user notice unusual situation.
The commands learned "--no-shown-forced-updates" option to disable
this safety feature.

* ds/fetch-disable-force-notice:
  pull: add --[no-]show-forced-updates passthrough
  fetch: warn about forced updates in branch listing
  fetch: add --[no-]show-forced-updates argument

4 years agoMerge branch 'jh/status-aheadbehind'
Junio C Hamano [Tue, 9 Jul 2019 22:25:46 +0000 (15:25 -0700)] 
Merge branch 'jh/status-aheadbehind'

"git status" can be told a non-standard default value for the
"--[no-]ahead-behind" option with a new configuration variable
status.aheadBehind.

* jh/status-aheadbehind:
  status: ignore status.aheadbehind in porcelain formats
  status: warn when a/b calculation takes too long
  status: add status.aheadbehind setting

4 years agoMerge branch 'sg/t5551-fetch-smart-error-is-translated'
Junio C Hamano [Tue, 9 Jul 2019 22:25:46 +0000 (15:25 -0700)] 
Merge branch 'sg/t5551-fetch-smart-error-is-translated'

Test update.

* sg/t5551-fetch-smart-error-is-translated:
  t5551: use 'test_i18ngrep' to check translated output

4 years agoMerge branch 'ms/submodule-foreach-fix'
Junio C Hamano [Tue, 9 Jul 2019 22:25:46 +0000 (15:25 -0700)] 
Merge branch 'ms/submodule-foreach-fix'

"git submodule foreach" did not protect command line options passed
to the command to be run in each submodule correctly, when the
"--recursive" option was in use.

* ms/submodule-foreach-fix:
  submodule foreach: fix recursion of options

4 years agoMerge branch 'jh/msvc'
Junio C Hamano [Tue, 9 Jul 2019 22:25:45 +0000 (15:25 -0700)] 
Merge branch 'jh/msvc'

Support to build with MSVC has been updated.

* jh/msvc:
  msvc: ignore .dll and incremental compile output
  msvc: avoid debug assertion windows in Debug Mode
  msvc: do not pretend to support all signals
  msvc: add pragmas for common warnings
  msvc: add a compile-time flag to allow detailed heap debugging
  msvc: support building Git using MS Visual C++
  msvc: update Makefile to allow for spaces in the compiler path
  msvc: fix detect_msys_tty()
  msvc: define ftello()
  msvc: do not re-declare the timespec struct
  msvc: mark a variable as non-const
  msvc: define O_ACCMODE
  msvc: include sigset_t definition
  msvc: fix dependencies of compat/msvc.c
  mingw: replace mingw_startup() hack
  obstack: fix compiler warning
  cache-tree/blame: avoid reusing the DEBUG constant
  t0001 (mingw): do not expect a specific order of stdout/stderr
  Mark .bat files as requiring CR/LF endings
  mingw: fix a typo in the msysGit-specific section

4 years agoMerge branch 'sg/rebase-progress'
Junio C Hamano [Tue, 9 Jul 2019 22:25:45 +0000 (15:25 -0700)] 
Merge branch 'sg/rebase-progress'

Use "Erase in Line" CSI sequence that is already used in the editor
support to clear cruft in the progress output.

* sg/rebase-progress:
  progress: use term_clear_line()
  rebase: fix garbled progress display with '-x'
  pager: add a helper function to clear the last line in the terminal
  t3404: make the 'rebase.missingCommitsCheck=ignore' test more focused
  t3404: modernize here doc style

4 years agoMerge branch 'jw/gitweb-sample-update'
Junio C Hamano [Tue, 9 Jul 2019 22:25:45 +0000 (15:25 -0700)] 
Merge branch 'jw/gitweb-sample-update'

Doc update.

* jw/gitweb-sample-update:
  doc: don't use git.kernel.org as example gitweb URL

4 years agoMerge branch 'js/t0001-case-insensitive'
Junio C Hamano [Tue, 9 Jul 2019 22:25:44 +0000 (15:25 -0700)] 
Merge branch 'js/t0001-case-insensitive'

Test update.

* js/t0001-case-insensitive:
  t0001: fix on case-insensitive filesystems

4 years agoMerge branch 'cc/first-contrib-tutorial'
Junio C Hamano [Tue, 9 Jul 2019 22:25:44 +0000 (15:25 -0700)] 
Merge branch 'cc/first-contrib-tutorial'

Update docs used in a tutorial.

* cc/first-contrib-tutorial:
  doc: improve usage string in MyFirstContribution

4 years agoMerge branch 'ab/fail-prereqs-in-test'
Junio C Hamano [Tue, 9 Jul 2019 22:25:44 +0000 (15:25 -0700)] 
Merge branch 'ab/fail-prereqs-in-test'

Test updates.

* ab/fail-prereqs-in-test:
  tests: mark two failing tests under FAIL_PREREQS

4 years agoMerge branch 'nd/switch-and-restore'
Junio C Hamano [Tue, 9 Jul 2019 22:25:44 +0000 (15:25 -0700)] 
Merge branch 'nd/switch-and-restore'

Two new commands "git switch" and "git restore" are introduced to
split "checking out a branch to work on advancing its history" and
"checking out paths out of the index and/or a tree-ish to work on
advancing the current history" out of the single "git checkout"
command.

* nd/switch-and-restore: (46 commits)
  completion: disable dwim on "git switch -d"
  switch: allow to switch in the middle of bisect
  t2027: use test_must_be_empty
  Declare both git-switch and git-restore experimental
  help: move git-diff and git-reset to different groups
  doc: promote "git restore"
  user-manual.txt: prefer 'merge --abort' over 'reset --hard'
  completion: support restore
  t: add tests for restore
  restore: support --patch
  restore: replace --force with --ignore-unmerged
  restore: default to --source=HEAD when only --staged is specified
  restore: reject invalid combinations with --staged
  restore: add --worktree and --staged
  checkout: factor out worktree checkout code
  restore: disable overlay mode by default
  restore: make pathspec mandatory
  restore: take tree-ish from --source option instead
  checkout: split part of it to new command 'restore'
  doc: promote "git switch"
  ...

4 years agoMerge branch 'nd/fetch-capability-tweak'
Junio C Hamano [Tue, 9 Jul 2019 22:25:43 +0000 (15:25 -0700)] 
Merge branch 'nd/fetch-capability-tweak'

Protocol capabilities that go over wire should never be translated,
but it was incorrectly marked for translation, which has been
corrected.  The output of protocol capabilities for debugging has
been tweaked a bit.

* nd/fetch-capability-tweak:
  fetch-pack: print server version at the top in -v -v
  fetch-pack: print all relevant supported capabilities with -v -v
  fetch-pack: move capability names out of i18n strings

4 years agoMerge branch 'jk/oidhash'
Junio C Hamano [Tue, 9 Jul 2019 22:25:43 +0000 (15:25 -0700)] 
Merge branch 'jk/oidhash'

Code clean-up to remove hardcoded SHA-1 hash from many places.

* jk/oidhash:
  hashmap: convert sha1hash() to oidhash()
  hash.h: move object_id definition from cache.h
  khash: rename oid helper functions
  khash: drop sha1-specific map types
  pack-bitmap: convert khash_sha1 maps into kh_oid_map
  delta-islands: convert island_marks khash to use oids
  khash: rename kh_oid_t to kh_oid_set
  khash: drop broken oid_map typedef
  object: convert create_object() to use object_id
  object: convert internal hash_obj() to object_id
  object: convert lookup_object() to use object_id
  object: convert lookup_unknown_object() to use object_id
  pack-objects: convert locate_object_entry_hash() to object_id
  pack-objects: convert packlist_find() to use object_id
  pack-bitmap-write: convert some helpers to use object_id
  upload-pack: rename a "sha1" variable to "oid"
  describe: fix accidental oid/hash type-punning

4 years agoMerge branch 'jk/delta-islands-progress-fix'
Junio C Hamano [Tue, 9 Jul 2019 22:25:43 +0000 (15:25 -0700)] 
Merge branch 'jk/delta-islands-progress-fix'

The codepath to compute delta islands used to spew progress output
without giving the callers any way to squelch it, which has been
fixed.

* jk/delta-islands-progress-fix:
  delta-islands: respect progress flag

4 years agoMerge branch 'md/sort-detached-head-first'
Junio C Hamano [Tue, 9 Jul 2019 22:25:42 +0000 (15:25 -0700)] 
Merge branch 'md/sort-detached-head-first'

"git branch --list" learned to always output the detached HEAD as
the first item (when the HEAD is detached, of course), regardless
of the locale.

* md/sort-detached-head-first:
  ref-filter: sort detached HEAD lines firstly

4 years agoMerge branch 'nd/fetch-multi-gc-once'
Junio C Hamano [Tue, 9 Jul 2019 22:25:42 +0000 (15:25 -0700)] 
Merge branch 'nd/fetch-multi-gc-once'

"git fetch" that grabs from a group of remotes learned to run the
auto-gc only once at the very end.

* nd/fetch-multi-gc-once:
  fetch: only run 'gc' once when fetching multiple remotes

4 years agoMerge branch 'es/rev-list-no-object-names'
Junio C Hamano [Tue, 9 Jul 2019 22:25:42 +0000 (15:25 -0700)] 
Merge branch 'es/rev-list-no-object-names'

"git rev-list --objects" learned with "--no-object-names" option to
squelch the path to the object that is used as a grouping hint for
pack-objects.

* es/rev-list-no-object-names:
  rev-list: teach --no-object-names to enable piping

4 years agoMerge branch 'rs/config-unit-parsing'
Junio C Hamano [Tue, 9 Jul 2019 22:25:41 +0000 (15:25 -0700)] 
Merge branch 'rs/config-unit-parsing'

The code to parse scaled numbers out of configuration files has
been made more robust and also easier to follow.

* rs/config-unit-parsing:
  config: simplify parsing of unit factors
  config: don't multiply in parse_unit_factor()
  config: use unsigned_mult_overflows to check for overflows

4 years agoMerge branch 'js/gcc-8-and-9'
Junio C Hamano [Tue, 9 Jul 2019 22:25:41 +0000 (15:25 -0700)] 
Merge branch 'js/gcc-8-and-9'

Code clean-up for new compilers.

* js/gcc-8-and-9:
  config: avoid calling `labs()` on too-large data type
  winansi: simplify loading the GetCurrentConsoleFontEx() function
  kwset: allow building with GCC 8
  poll (mingw): allow compiling with GCC 8 and DEVELOPER=1

4 years agoMerge branch 'dl/includeif-onbranch'
Junio C Hamano [Tue, 9 Jul 2019 22:25:41 +0000 (15:25 -0700)] 
Merge branch 'dl/includeif-onbranch'

The conditional inclusion mechanism learned to base the choice on
the branch the HEAD currently is on.

* dl/includeif-onbranch:
  config: learn the "onbranch:" includeIf condition

4 years agoMerge branch 'pw/rebase-abort-clean-rewritten'
Junio C Hamano [Tue, 9 Jul 2019 22:25:41 +0000 (15:25 -0700)] 
Merge branch 'pw/rebase-abort-clean-rewritten'

"git rebase --abort" used to leave refs/rewritten/ when concluding
"git rebase -r", which has been corrected.

* pw/rebase-abort-clean-rewritten:
  rebase --abort/--quit: cleanup refs/rewritten
  sequencer: return errors from sequencer_remove_state()
  rebase: warn if state directory cannot be removed
  rebase: fix a memory leak

4 years agoMerge branch 'am/p4-branches-excludes'
Junio C Hamano [Tue, 9 Jul 2019 22:25:40 +0000 (15:25 -0700)] 
Merge branch 'am/p4-branches-excludes'

"git p4" update.

* am/p4-branches-excludes:
  git-p4: respect excluded paths when detecting branches
  git-p4: add failing test for "git-p4: respect excluded paths when detecting branches"
  git-p4: don't exclude other files with same prefix
  git-p4: add failing test for "don't exclude other files with same prefix"
  git-p4: don't groom exclude path list on every commit
  git-p4: match branches case insensitively if configured
  git-p4: add failing test for "git-p4: match branches case insensitively if configured"
  git-p4: detect/prevent infinite loop in gitCommitByP4Change()

4 years agoMerge branch 'tg/stash-ref-by-index-fix'
Junio C Hamano [Tue, 9 Jul 2019 22:25:40 +0000 (15:25 -0700)] 
Merge branch 'tg/stash-ref-by-index-fix'

"git stash show 23" used to work, but no more after getting
rewritten in C; this regression has been corrected.

* tg/stash-ref-by-index-fix:
  stash: fix show referencing stash index

4 years agoMerge branch 'cb/mkstemps-uint-type-fix'
Junio C Hamano [Tue, 9 Jul 2019 22:25:40 +0000 (15:25 -0700)] 
Merge branch 'cb/mkstemps-uint-type-fix'

Variable type fix.

* cb/mkstemps-uint-type-fix:
  wrapper: avoid undefined behaviour in macOS

4 years agoMerge branch 'jk/trailers-use-config'
Junio C Hamano [Tue, 9 Jul 2019 22:25:40 +0000 (15:25 -0700)] 
Merge branch 'jk/trailers-use-config'

"git interpret-trailers" always treated '#' as the comment
character, regardless of core.commentChar setting, which has been
corrected.

* jk/trailers-use-config:
  interpret-trailers: load default config

4 years agoMerge branch 'js/t3404-typofix'
Junio C Hamano [Tue, 9 Jul 2019 22:25:39 +0000 (15:25 -0700)] 
Merge branch 'js/t3404-typofix'

Typofix.

* js/t3404-typofix:
  t3404: fix a typo

4 years agoMerge branch 'pw/doc-synopsis-markup-opmode-options'
Junio C Hamano [Tue, 9 Jul 2019 22:25:38 +0000 (15:25 -0700)] 
Merge branch 'pw/doc-synopsis-markup-opmode-options'

Docfix.

* pw/doc-synopsis-markup-opmode-options:
  show --continue/skip etc. consistently in synopsis

4 years agoMerge branch 'rs/copy-array'
Junio C Hamano [Tue, 9 Jul 2019 22:25:38 +0000 (15:25 -0700)] 
Merge branch 'rs/copy-array'

Code clean-up.

* rs/copy-array:
  use COPY_ARRAY for copying arrays
  coccinelle: use COPY_ARRAY for copying arrays

4 years agoMerge branch 'cb/fsmonitor-intfix'
Junio C Hamano [Tue, 9 Jul 2019 22:25:38 +0000 (15:25 -0700)] 
Merge branch 'cb/fsmonitor-intfix'

Variable type fix.

* cb/fsmonitor-intfix:
  fsmonitor: avoid signed integer overflow / infinite loop

4 years agoMerge branch 'rs/avoid-overflow-in-midpoint-computation'
Junio C Hamano [Tue, 9 Jul 2019 22:25:37 +0000 (15:25 -0700)] 
Merge branch 'rs/avoid-overflow-in-midpoint-computation'

Code clean-up to avoid signed integer overlaps during binary search.

* rs/avoid-overflow-in-midpoint-computation:
  cleanup: fix possible overflow errors in binary search, part 2

4 years agoMerge branch 'pw/add-p-recount'
Junio C Hamano [Tue, 9 Jul 2019 22:25:37 +0000 (15:25 -0700)] 
Merge branch 'pw/add-p-recount'

"git checkout -p" needs to selectively apply a patch in reverse,
which did not work well.

* pw/add-p-recount:
  add -p: fix checkout -p with pathological context

4 years agoMerge branch 'ds/close-object-store'
Junio C Hamano [Tue, 9 Jul 2019 22:25:37 +0000 (15:25 -0700)] 
Merge branch 'ds/close-object-store'

The commit-graph file is now part of the "files that the runtime
may keep open file descriptors on, all of which would need to be
closed when done with the object store", and the file descriptor to
an existing commit-graph file now is closed before "gc" finalizes a
new instance to replace it.

* ds/close-object-store:
  packfile: rename close_all_packs to close_object_store
  packfile: close commit-graph in close_all_packs
  commit-graph: use raw_object_store when closing

4 years agoMerge branch 'ds/commit-graph-write-refactor'
Junio C Hamano [Tue, 9 Jul 2019 22:25:36 +0000 (15:25 -0700)] 
Merge branch 'ds/commit-graph-write-refactor'

Renamed from commit-graph-format-v2 and changed scope.

* ds/commit-graph-write-refactor:
  commit-graph: extract write_commit_graph_file()
  commit-graph: extract copy_oids_to_commits()
  commit-graph: extract count_distinct_commits()
  commit-graph: extract fill_oids_from_all_packs()
  commit-graph: extract fill_oids_from_commit_hex()
  commit-graph: extract fill_oids_from_packs()
  commit-graph: create write_commit_graph_context
  commit-graph: remove Future Work section
  commit-graph: collapse parameters into flags
  commit-graph: return with errors during write
  commit-graph: fix the_repository reference

4 years agoMerge branch 'sg/trace2-rename'
Junio C Hamano [Tue, 9 Jul 2019 22:25:36 +0000 (15:25 -0700)] 
Merge branch 'sg/trace2-rename'

Dev support update to help tracing out tests.

* sg/trace2-rename:
  trace2: correct typo in technical documentation
  Revert "test-lib: whitelist GIT_TR2_* in the environment"

4 years agoMerge branch 'nd/completion-no-cache-failure'
Junio C Hamano [Tue, 9 Jul 2019 22:25:35 +0000 (15:25 -0700)] 
Merge branch 'nd/completion-no-cache-failure'

An incorrect list of options was cached after command line
completion failed (e.g. trying to complete a command that requires
a repository outside one), which has been corrected.

* nd/completion-no-cache-failure:
  completion: do not cache if --git-completion-helper fails

4 years agoMerge branch 'js/mergetool-optim'
Junio C Hamano [Tue, 9 Jul 2019 22:25:35 +0000 (15:25 -0700)] 
Merge branch 'js/mergetool-optim'

"git mergetool" and its tests now spawn fewer subprocesses.

* js/mergetool-optim:
  mergetool: use shell variable magic instead of `awk`
  mergetool: dissect strings with shell variable magic instead of `expr`
  t7610-mergetool: use test_cmp instead of test $(cat file) = $txt
  t7610-mergetool: do not place pipelines headed by `yes` in subshells

4 years agoMerge branch 'mo/hpux-dynpath'
Junio C Hamano [Tue, 9 Jul 2019 22:25:35 +0000 (15:25 -0700)] 
Merge branch 'mo/hpux-dynpath'

Auto-detect how to tell HP-UX aCC where to use dynamically linked
libraries from at runtime.

* mo/hpux-dynpath:
  configure: Detect linking style for HP aCC on HP-UX

4 years agoMerge branch 'dl/config-alias-doc'
Junio C Hamano [Tue, 9 Jul 2019 22:25:35 +0000 (15:25 -0700)] 
Merge branch 'dl/config-alias-doc'

Doc update.

* dl/config-alias-doc:
  config/alias.txt: document alias accepting non-command first word
  config/alias.txt: change " and ' to `

4 years agoMerge branch 'tm/tag-gpgsign-config'
Junio C Hamano [Tue, 9 Jul 2019 22:25:34 +0000 (15:25 -0700)] 
Merge branch 'tm/tag-gpgsign-config'

A new tag.gpgSign configuration variable turns "git tag -a" into
"git tag -s".

* tm/tag-gpgsign-config:
  tag: add tag.gpgSign config option to force all tags be GPG-signed

4 years agoMerge branch 'fc/fetch-with-import-fix'
Junio C Hamano [Tue, 9 Jul 2019 22:25:34 +0000 (15:25 -0700)] 
Merge branch 'fc/fetch-with-import-fix'

Code restructuring during 2.20 period broke fetching tags via
"import" based transports.

* fc/fetch-with-import-fix:
  fetch: fix regression with transport helpers
  fetch: make the code more understandable
  fetch: trivial cleanup
  t5801 (remote-helpers): add test to fetch tags
  t5801 (remote-helpers): cleanup refspec stuff

4 years agoMerge branch 'po/doc-branch'
Junio C Hamano [Tue, 9 Jul 2019 22:25:34 +0000 (15:25 -0700)] 
Merge branch 'po/doc-branch'

Doc update.

* po/doc-branch:
  doc branch: provide examples for listing remote tracking branches

4 years agoMerge branch 'nb/branch-show-other-worktrees-head'
Junio C Hamano [Tue, 9 Jul 2019 22:25:33 +0000 (15:25 -0700)] 
Merge branch 'nb/branch-show-other-worktrees-head'

"git branch --list" learned to show branches that are checked out
in other worktrees connected to the same repository prefixed with
'+', similar to the way the currently checked out branch is shown
with '*' in front.

* nb/branch-show-other-worktrees-head:
  branch: add worktree info on verbose output
  branch: update output to include worktree info
  ref-filter: add worktreepath atom

4 years agomingw: fix possible buffer overrun when calling `GetUserNameW()`
Johannes Schindelin [Thu, 4 Jul 2019 22:36:57 +0000 (15:36 -0700)] 
mingw: fix possible buffer overrun when calling `GetUserNameW()`

In 39a98e9b68b8 (mingw: get pw_name in UTF-8 format, 2019-06-27), this
developer missed the fact that the `GetUserNameW()` function takes the
number of characters as `len` parameter, not the number of bytes.

Reported-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoci/lib.sh: update a comment about installed P4 and Git-LFS versions
SZEDER Gábor [Sat, 6 Jul 2019 16:21:14 +0000 (18:21 +0200)] 
ci/lib.sh: update a comment about installed P4 and Git-LFS versions

A comment in 'ci/lib.sh' claims that the "OS X build installs the
latest available versions" of P4 and Git-LFS, but since f2f47150
("ci: don't update Homebrew", 2019-07-03) that's no longer the case,
as it will install the versions which were recorded in the image's
Homebrew database when the image was created.

Update this comment accordingly.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agogettext: always use UTF-8 on native Windows
Karsten Blees [Wed, 3 Jul 2019 20:46:04 +0000 (13:46 -0700)] 
gettext: always use UTF-8 on native Windows

On native Windows, Git exclusively uses UTF-8 for console output (both
with MinTTY and native Win32 Console). Gettext uses `setlocale()` to
determine the output encoding for translated text, however, MSVCRT's
`setlocale()` does not support UTF-8. As a result, translated text is
encoded in system encoding (as per `GetAPC()`), and non-ASCII chars are
mangled in console output.

Side note: There is actually a code page for UTF-8: 65001. In practice,
it does not work as expected at least on Windows 7, though, so we cannot
use it in Git. Besides, if we overrode the code page, any process
spawned from Git would inherit that code page (as opposed to the code
page configured for the current user), which would quite possibly break
e.g. diff or merge helpers. So we really cannot override the code page.

In `init_gettext_charset()`, Git calls gettext's
`bind_textdomain_codeset()` with the character set obtained via
`locale_charset()`; Let's override that latter function to force the
encoding to UTF-8 on native Windows.

In Git for Windows' SDK, there is a `libcharset.h` and therefore we
define `HAVE_LIBCHARSET_H` in the MINGW-specific section in
`config.mak.uname`, therefore we need to add the override before that
conditionally-compiled code block.

Rather than simply defining `locale_charset()` to return the string
`"UTF-8"`, though, we are careful not to break `LC_ALL=C`: the
`ab/no-kwset` patch series, for example, needs to have a way to prevent
Git from expecting UTF-8-encoded input.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoci: disable Homebrew's auto cleanup
SZEDER Gábor [Wed, 3 Jul 2019 10:47:48 +0000 (12:47 +0200)] 
ci: disable Homebrew's auto cleanup

Lately Homebrew learned to automagically clean up information about
outdated packages during other 'brew' commands, which might be useful
for the avarage user, but is a waste of time in CI build jobs, because
the next build jobs will start from the exact same image containing
the same outdated packages anyway.

Export HOMEBREW_NO_INSTALL_CLEANUP=1 to disable this auto cleanup feature,
shaving off about 20-30s from the time needed to install dependencies
in our macOS build jobs on Travis CI.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoci: don't update Homebrew
SZEDER Gábor [Wed, 3 Jul 2019 10:47:47 +0000 (12:47 +0200)] 
ci: don't update Homebrew

Lately our GCC macOS build job on Travis CI has been erroring out
while installing dependencies with:

  +brew link gcc@8
  Error: No such keg: /usr/local/Cellar/gcc@8
  The command "ci/install-dependencies.sh" failed and exited with 1 during .

Now, while gcc@8 is still pre-installed (but not linked) and would be
perfectly usable in the Travis CI macOS image we use [1], it's at
version 8.2.  However, when installing dependencies we first
explicitly run 'brew update', which spends over two minutes to update
itself and information about the available packages, and it learns
about GCC 8.3.  After that point gcc@8 exclusively refers to v8.3,
and, unfortunately, 'brew' is just too dumb to be able to do anything
with the still installed 8.2 package, and the subsequent 'brew link
gcc@8' fails.  (Even 'brew uninstall gcc@8' fails with the same
error!)

Don't run 'brew update' to keep the already installed GCC 8.2 'brew
link'-able.  Note that in addition we have to 'export
HOMEBREW_NO_AUTO_UPDATE=1' first, because 'brew' is so very helpful
that it would implicitly run update for us on the next 'brew install
<pkg>' otherwise.

Disabling 'brew update' has additional benefits:

  - It shaves off 2-3mins from the ~4mins currently spent on
    installing dependencies, and the macOS build jobs have always been
    prone to exceeding the time limit on Travis CI.

  - Our builds won't suddenly break because of the occasional Homebrew
    breakages [2].

The drawback is that we'll be stuck with slightly older versions of
the packages that we install via Homebrew (Git-LFS 2.5.2 and Perforce
2018.1; they are currently at 2.7.2 and 2019.1, respectively).  We
might want to reconsider this decision as time goes on and/or switch
to a more recent macOS image as they become available.

[1] 2000ac9fbf (travis-ci: switch to Xcode 10.1 macOS image,
    2019-01-17)

[2] See e.g. a1ccaedd62 (travis-ci: make the OSX build jobs' 'brew
    update' more quiet, 2019-02-02) or

    https://public-inbox.org/git/20180907032002.23366-1-szeder.dev@gmail.com/T/#+u

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agol10n: localizable upload progress messages
Dimitriy Ryazantcev [Tue, 2 Jul 2019 18:22:48 +0000 (21:22 +0300)] 
l10n: localizable upload progress messages

Currenly the data rate in throughput_string(...) method is
output by simple strbuf_humanise_bytes(...) call and '/s' append.
But for proper translation of such string the translator needs
full context.

Add strbuf_humanise_rate(...) method to properly print out
localizable version of data rate ('3.5 MiB/s' etc) with full context.

Strings with the units in strbuf_humanise_bytes(...) are marked
for translation.

Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agodocs: git-clone: list short form of options first
Quentin Nerden [Tue, 2 Jul 2019 14:37:41 +0000 (07:37 -0700)] 
docs: git-clone: list short form of options first

List the short form of options (e.g.: '-l') before the long form (e.g.
'--local').
This is to match the doc of git-add, git-commit, git-clean, git-branch...

Signed-off-by: Quentin Nerden <quentin.nerden@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agodocs: git-clone: refer to long form of options
Quentin Nerden [Tue, 2 Jul 2019 14:37:40 +0000 (07:37 -0700)] 
docs: git-clone: refer to long form of options

To make the doc of git-clone easier to read,
refer to the long form of the options
(it is easier to guess what '--verbose' is doing than '-v').

Signed-off-by: Quentin Nerden <quentin.nerden@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoDocument that 'git -C ""' works and doesn't change directory
SZEDER Gábor [Sat, 29 Jun 2019 08:24:57 +0000 (10:24 +0200)] 
Document that 'git -C ""' works and doesn't change directory

It's been behaving so since 6a536e2076 (git: treat "git -C '<path>'"
as a no-op when <path> is empty, 2015-03-06).

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agorebase --am: ignore rebase.rescheduleFailedExec
Johannes Schindelin [Mon, 1 Jul 2019 11:58:15 +0000 (04:58 -0700)] 
rebase --am: ignore rebase.rescheduleFailedExec

The `exec` command is specific to the interactive backend, therefore it
does not make sense for non-interactive rebases to heed that config
setting.

We still want to error out if a non-interactive rebase is started with
`--reschedule-failed-exec`, of course.

Reported by Vas Sudanagunta via:
https://github.com/git/git/commit/969de3ff0e0#commitcomment-33257187

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoprogress: use term_clear_line()
SZEDER Gábor [Mon, 24 Jun 2019 18:13:18 +0000 (20:13 +0200)] 
progress: use term_clear_line()

To make sure that the previously displayed progress line is completely
covered up when the new line is shorter, commit 545dc345eb (progress:
break too long progress bar lines, 2019-04-12) added a bunch of
calculations to figure out how many characters it needs to overwrite
with spaces.

Use the just introduced term_clear_line() helper function to, well,
clear the last line, making all these calculations unnecessary, and
thus simplifying the code considerably.

Three tests in 't5541-http-push-smart.sh' 'grep' for specific text
shown in the progress lines at the beginning of the line, but now
those lines begin either with the ANSI escape sequence or with the
terminal width worth of space characters clearing the line.  Relax the
'grep' patterns to match anywhere on the line.  Note that only two of
these three tests fail without relaxing their 'grep' pattern, but the
third looks for the absence of the pattern, so it still succeeds, but
without the adjustment would potentially hide future regressions.

Note also that with this change we no longer need the length of the
previously displayed progress line, so the strbuf added to 'struct
progress' in d53ba841d4 (progress: assemble percentage and counters in
a strbuf before printing, 2019-04-05) is not strictly necessary
anymore.  We still keep it, though, as it avoids allocating and
releasing a strbuf each time the progress is updated.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agorebase: fix garbled progress display with '-x'
SZEDER Gábor [Thu, 27 Jun 2019 13:42:48 +0000 (15:42 +0200)] 
rebase: fix garbled progress display with '-x'

When running a command with the 'exec' instruction during an
interactive rebase session, or for a range of commits using 'git
rebase -x', the output can be a bit garbled when the name of the
command is short enough:

  $ git rebase -x true HEAD~5
  Executing: true
  Executing: true
  Executing: true
  Executing: true
  Executing: true)
  Successfully rebased and updated refs/heads/master.

Note the ')' at the end of the last line.  It gets more garbled as the
range of commits increases:

  $ git rebase -x true HEAD~50
  Executing: true)
  [ repeated 3 more times ]
  Executing: true0)
  [ repeated 44 more times ]
  Executing: true00)
  Successfully rebased and updated refs/heads/master.

Those extra numbers and ')' are remnants of the previously displayed
"Rebasing (N/M)" progress lines that are usually completely
overwritten by the "Executing: <cmd>" lines, unless 'cmd' is short and
the "N/M" part is long.

Make sure that the previously displayed "Rebasing (N/M)" line is
cleared by using the term_clear_line() helper function added in the
previous patch.  Do so only when not being '--verbose', because in
that case these "Rebasing (N/M)" lines are not printed as progress
(i.e. as lines with '\r' at the end), but as "regular" output (with
'\n' at the end).

A couple of other rebase commands print similar messages, e.g.
"Stopped at <abbrev-oid>... <subject>" for the 'edit' or 'break'
commands, or the "Successfully rebased and updated <full-ref>." at the
very end.  These are so long that they practically always overwrite
that "Rebasing (N/M)" progress line, but let's be prudent, and clear
the last line before printing these, too.

In 't3420-rebase-autostash.sh' two helper functions prepare the
expected output of four tests that check the full output of 'git
rebase' and thus are affected by this change, so adjust their
expectations to account for the new line clearing.

Note that this patch doesn't completely eliminate the possibility of
similar garbled outputs, e.g. some error messages from rebase or the
"Auto-merging <file>" message from within the depths of the merge
machinery might not be long enough to completely cover the last
"Rebasing (N/M)" line.  This patch doesn't do anything about them,
because dealing with them individually would result in way too much
churn, while having a catch-all term_clear_line() call in the common
code path of pick_commits() would hide the "Rebasing (N/M)" line way
too soon, and it would either flicker or be invisible.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomingw: use Unicode functions explicitly
Johannes Schindelin [Thu, 27 Jun 2019 09:37:19 +0000 (02:37 -0700)] 
mingw: use Unicode functions explicitly

Many Win32 API functions actually exist in two variants: one with
the `A` suffix that takes ANSI parameters (`char *` or `const char *`)
and one with the `W` suffix that takes Unicode parameters (`wchar_t *`
or `const wchar_t *`).

The ANSI variant assumes that the strings are encoded according to
whatever is the current locale. This is not what Git wants to use on
Windows: we assume that `char *` variables point to strings encoded in
UTF-8.

There is a pseudo UTF-8 locale on Windows, but it does not work
as one might expect. In addition, if we overrode the user's locale, that
would modify the behavior of programs spawned by Git (such as editors,
difftools, etc), therefore we cannot use that pseudo locale.

Further, it is actually highly encouraged to use the Unicode versions
instead of the ANSI versions, so let's do precisely that.

Note: when calling the Win32 API functions _without_ any suffix, it
depends whether the `UNICODE` constant is defined before the relevant
headers are #include'd. Without that constant, the ANSI variants are
used. Let's be explicit and avoid that ambiguity.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomingw: get pw_name in UTF-8 format
Johannes Schindelin [Thu, 27 Jun 2019 09:37:18 +0000 (02:37 -0700)] 
mingw: get pw_name in UTF-8 format

Previously, we would have obtained the user name encoded in whatever the
current code page is.

Note: the "user name" here does not denote the full name but instead the
short logon name.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomingw: embed a manifest to trick UAC into Doing The Right Thing
Cesar Eduardo Barros [Thu, 27 Jun 2019 08:49:33 +0000 (01:49 -0700)] 
mingw: embed a manifest to trick UAC into Doing The Right Thing

On Windows >= Vista, not having an application manifest with a
requestedExecutionLevel can cause several kinds of confusing behavior.

The first and more obvious behavior is "Installer Detection" of the
"User Account Control" (also known as "UAC") feature, where Windows
sometimes decides (by looking at things like the file name and even
sequences of bytes within the executable) that an executable is an
installer and should run elevated (causing the well-known popup dialog
to appear). In Git's context, subcommands such as "git patch-id" or "git
update-index" fall prey to this behavior.

The second and more confusing behavior is "File Virtualization". It
means that when files are written without having write permission, it
does not fail (as expected), but they are instead redirected to
somewhere else. When the files are read, the original contents are
returned, though, not the ones that were just written somewhere else.
Even more confusing, not all write accesses are redirected; Trying to
write to write-protected .exe files, for example, will fail instead of
redirecting.

In addition to being unwanted behavior, File Virtualization causes
dramatic slowdowns in Git (see for instance
http://code.google.com/p/msysgit/issues/detail?id=320).

A third unwanted behavior of Windows >= Vista is that it lies about the
Windows version when calling `GetWindowsVersionEx()`.

There are two ways to prevent these unwanted behaviors: Either you embed
an application manifest (which really is an XML document conforming to a
specific schema) within all your executables, or you add an external
manifest (a file with the same name followed by `.manifest`) to all your
executables. Since Git's builtins are hardlinked (or copied), it is
simpler and more robust to embed a manifest.

Recent enough MSVC compilers already embed a working internal manifest,
and building with mingw-w64 (which is the case in Git for Windows' SDK)
does it, too, but for MinGW you have to do so by hand.

In any case, it is better to be explicit about this manifest, that way
changes in the compiler toolchain won't surprise us (as mingw-w64 once
did when it broke `GetWindowsVersionEx()` by mistake).

References:
  - New UAC Technologies for Windows Vista
    http://msdn.microsoft.com/en-us/library/bb756960.aspx
  - Create and Embed an Application Manifest (UAC)
    http://msdn.microsoft.com/en-us/library/bb756929.aspx

Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomingw: enable stack smashing protector
Johannes Schindelin [Thu, 27 Jun 2019 09:29:02 +0000 (02:29 -0700)] 
mingw: enable stack smashing protector

To reduce Git for Windows' attack surface, we started using the Address
Space Layout Randomization and Data Execution Prevention features in
ce6a158561f9 (mingw: enable DEP and ASLR, 2019-05-08).

To remove yet another attack vector, let's make use of gcc's stack
smashing protector that helps detect stack buffer overruns early.

Rather than using -fstack-protector, we use -fstack-protector-strong
because on Windows: The latter appears to strike a better balance
between the performance impact and the provided safety.

In a non-scientific test (time git log --grep=is -p), best of 5 timings
went from 23.009s to 22.997s, i.e. the performance impact was *well*
lost in the noise.

This fixes https://github.com/git-for-windows/git/issues/501

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotrace2: correct typo in technical documentation
Carlo Marcelo Arenas Belón [Wed, 26 Jun 2019 20:03:03 +0000 (13:03 -0700)] 
trace2: correct typo in technical documentation

an apparent typo for the environment variable was included with 81567caf87
("trace2: update docs to describe system/global config settings",
2019-04-15), and was missed when renamed variables by e4b75d6a1d
("trace2: rename environment variables to GIT_TRACE2*", 2019-05-19)

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot5551: test usage of chunked encoding explicitly
Jonathan Tan [Wed, 5 Jun 2019 19:26:24 +0000 (12:26 -0700)] 
t5551: test usage of chunked encoding explicitly

When run using GIT_TEST_PROTOCOL_VERSION=2, a test in t5551 fails
because 4 POSTs (probe, ls-refs, probe, fetch) are sent instead of 2
(probe, fetch).

One way to resolve this would be to relax the condition (from "= 2" to
greater than 1, say), but upon further inspection, the test probably
shouldn't be counting the number of POSTs. This test states that large
requests are split across POSTs, but this is not correct; the main
change is that chunked transfer encoding is used, but the request is
still contained within one POST. (The test coincidentally works because
Git indeed sends 2 POSTs in the case of a large request, but that is
because, as stated above, the first POST is a probing RPC - see
post_rpc() in remote-curl.c for more information.)

Therefore, instead of counting POSTs, check that chunked transfer
encoding is used. This also has the desirable side effect of passing
with GIT_TEST_PROTOCOL_VERSION=2.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Acked-by: Derrick Stolee <dstolee@microsoft.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot5551: use 'test_i18ngrep' to check translated output
SZEDER Gábor [Mon, 24 Jun 2019 12:44:46 +0000 (14:44 +0200)] 
t5551: use 'test_i18ngrep' to check translated output

The two tests 'invalid Content-Type rejected' and 'server-side error
detected' in 't5551-http-fetch-smart.sh' use "plain" 'grep' to check
that 'git clone' failed with the expected error message, but the
messages they are checking are translated, and, consequently, these
tests fail when the test script is run with GIT_TEST_GETTEXT_POISON
enabled.

Use 'test_i18ngrep' instead.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosubmodule foreach: fix recursion of options
Morian Sonnet [Mon, 24 Jun 2019 20:26:55 +0000 (22:26 +0200)] 
submodule foreach: fix recursion of options

Calling

    git submodule foreach --recursive <subcommand> --<option>

leads to an error stating that the option --<option> is unknown to
submodule--helper. That is of course only, when <option> is not a valid
option for git submodule foreach.

The reason for this is, that above call is internally translated into a
call to submodule--helper:

    git submodule--helper foreach --recursive \
        -- <subcommand> --<option>

This call starts by executing the subcommand with its option inside the
first level submodule and continues by calling the next iteration of
the submodule foreach call

    git --super-prefix <submodulepath> submodule--helper \
      foreach --recursive <subcommand> --<option>

inside the first level submodule. Note that the double dash in front of
the subcommand is missing.

This problem starts to arise only recently, as the
PARSE_OPT_KEEP_UNKNOWN flag for the argument parsing of git submodule
foreach was removed in commit a282f5a906. Hence, the unknown option is
complained about now, as the argument parsing is not properly ended by
the double dash.

This commit fixes the problem by adding the double dash in front of the
subcommand during the recursion.

Signed-off-by: Morian Sonnet <moriansonnet@googlemail.com>
Acked-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomsvc: ignore .dll and incremental compile output
Jeff Hostetler [Tue, 25 Jun 2019 14:49:42 +0000 (07:49 -0700)] 
msvc: ignore .dll and incremental compile output

Ignore .dll files copied into the top-level directory.
Ignore MSVC incremental compiler output files.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomsvc: avoid debug assertion windows in Debug Mode
Johannes Schindelin [Tue, 25 Jun 2019 14:49:42 +0000 (07:49 -0700)] 
msvc: avoid debug assertion windows in Debug Mode

For regular debugging, it is pretty helpful when a debug assertion in a
running application triggers a window that offers to start the debugger.

However, when running the test suite, it is not so helpful, in
particular when the debug assertions are then suppressed anyway because
we disable the invalid parameter checking (via invalidcontinue.obj, see
the comment in config.mak.uname about that object for more information).

So let's simply disable that window in Debug Mode (it is already
disabled in Release Mode).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomsvc: do not pretend to support all signals
Jeff Hostetler [Tue, 25 Jun 2019 14:49:41 +0000 (07:49 -0700)] 
msvc: do not pretend to support all signals

This special-cases various signals that are not supported on Windows,
such as SIGPIPE. These cause the UCRT to throw asserts (at least in
debug mode).

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomsvc: add pragmas for common warnings
Philip Oakley [Tue, 25 Jun 2019 14:49:40 +0000 (07:49 -0700)] 
msvc: add pragmas for common warnings

MSVC can be overzealous about some warnings. Disable them.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomsvc: add a compile-time flag to allow detailed heap debugging
Jeff Hostetler [Tue, 25 Jun 2019 14:49:40 +0000 (07:49 -0700)] 
msvc: add a compile-time flag to allow detailed heap debugging

MS Visual C comes with a few neat features we can use to analyze the
heap consumption (i.e. leaks, max memory, etc).

With this patch, we introduce support via the build-time flag
`USE_MSVC_CRTDBG`.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomsvc: support building Git using MS Visual C++
Jeff Hostetler [Tue, 25 Jun 2019 14:49:39 +0000 (07:49 -0700)] 
msvc: support building Git using MS Visual C++

With this patch, Git can be built using the Microsoft toolchain, via:

make MSVC=1 [DEBUG=1]

Third party libraries are built from source using the open source
"vcpkg" tool set. See https://github.com/Microsoft/vcpkg

On a first build, the vcpkg tools and the third party libraries are
automatically downloaded and built. DLLs for the third party libraries
are copied to the top-level (and t/helper) directory to facilitate
debugging. See compat/vcbuild/README.

A series of .bat files are invoked by the Makefile to find the location
of the installed version of Visual Studio and the associated compiler
tools (essentially replicating the environment setup performed by a
"Developer Command Prompt"). This should find the most recent VS2015 or
VS2017 installation. Output from these scripts are used by the Makefile
to define compiler and linker pathnames and -I and -L arguments.

The build produces .pdb files for both debug and release builds.

Note: This commit was squashed from an organic series of commits
developed between 2016 and 2018 in Git for Windows' `master` branch.
This combined commit eliminates the obsolete commits related to fetching
NuGet packages for third party libraries. It is difficult to use NuGet
packages for C/C++ sources because they may be built by earlier versions
of the MSVC compiler and have CRT version and linking issues.

Additionally, the C/C++ NuGet packages that we were using tended to not
be updated concurrently with the sources.  And in the case of cURL and
OpenSSL, this could expose us to security issues.

Helped-by: Yue Lin Ho <b8732003@student.nsysu.edu.tw>
Helped-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agopager: add a helper function to clear the last line in the terminal
SZEDER Gábor [Mon, 24 Jun 2019 18:13:16 +0000 (20:13 +0200)] 
pager: add a helper function to clear the last line in the terminal

There are a couple of places where we want to clear the last line on
the terminal, e.g. when a progress bar line is overwritten by a
shorter line, then the end of that progress line would remain visible,
unless we cover it up.

In 'progress.c' we did this by always appending a fixed number of
space characters to the next line (even if it was not shorter than the
previous), but as it turned out that fixed number was not quite large
enough, see the fix in 9f1fd84e15 (progress: clear previous progress
update dynamically, 2019-04-12).  From then on we've been keeping
track of the length of the last displayed progress line and appending
the appropriate number of space characters to the next line, if
necessary, but, alas, this approach turned out to be error prone, see
the fix in 1aed1a5f25 (progress: avoid empty line when breaking the
progress line, 2019-05-19).  The next patch in this series is about to
fix a case where we don't clear the last line, and on occasion do end
up with such garbage at the end of the line.  It would be great if we
could do that without the need to deal with that without meticulously
computing the necessary number of space characters.

So add a helper function to clear the last line on the terminal using
an ANSI escape sequence, which has the advantage to clear the whole
line no matter how wide it is, even after the terminal width changed.
Such an escape sequence is not available on dumb terminals, though, so
in that case fall back to simply print a whole terminal width (as
reported by term_columns()) worth of space characters.

In 'editor.c' launch_specified_editor() already used this ANSI escape
sequence, so replace it with a call to this function.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot3404: make the 'rebase.missingCommitsCheck=ignore' test more focused
SZEDER Gábor [Mon, 24 Jun 2019 18:13:15 +0000 (20:13 +0200)] 
t3404: make the 'rebase.missingCommitsCheck=ignore' test more focused

The test 'rebase -i respects rebase.missingCommitsCheck = warn' is
mainly interested in the warning about the dropped commits, but it
checks the whole output of 'git rebase', including progress lines and
what not that are not at all relevant to 'rebase.missingCommitsCheck',
but make it necessary to update this test whenever e.g. the way we
show progress is updated (as it will happen in one of the later
patches of this series).

Modify the test to verify only the first four lines of 'git rebase's
output that contain all the important lines, notably the line
containing the "Warning:" itself and the oneline log of the dropped
commit.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot3404: modernize here doc style
SZEDER Gábor [Mon, 24 Jun 2019 18:13:14 +0000 (20:13 +0200)] 
t3404: modernize here doc style

In 't3404-rebase-interactive.sh' the expected output of several tests
is prepared from here documents, which are outside of
'test_expect_success' blocks and have spaces around redirection
operators.

Move these here documents into the corresponding 'test_expect_success'
block and avoid spaces between filename and redition operators.
Furthermore, quote the here docs' delimiter word to prevent parameter
expansions and what not, where applicable.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agodoc: don't use git.kernel.org as example gitweb URL
Jakub Wilk [Sat, 22 Jun 2019 16:48:57 +0000 (18:48 +0200)] 
doc: don't use git.kernel.org as example gitweb URL

git.kernel.org uses cgit, not gitweb, these days:

    $ w3m -dump 'http://git.kernel.org/?p=git/git.git;a=tree;f=gitweb' | grep -w generated
    generated by cgit 1.2-0.3.lf.el7 (git 2.18.0) at 2019-06-22 16:14:38 +0000

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoconfig: simplify parsing of unit factors
René Scharfe [Sat, 22 Jun 2019 10:03:40 +0000 (12:03 +0200)] 
config: simplify parsing of unit factors

Just return the value of the factor or zero for unrecognized strings
instead of using an output reference and a separate return value to
indicate success.  This is shorter and simpler.

It basically reverts that function to before c8deb5a146 ("Improve error
messages when int/long cannot be parsed from config", 2007-12-25), while
keeping the better messages, so restore its old name, get_unit_factor(),
as well.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoconfig: don't multiply in parse_unit_factor()
René Scharfe [Sat, 22 Jun 2019 10:03:36 +0000 (12:03 +0200)] 
config: don't multiply in parse_unit_factor()

parse_unit_factor() multiplies the number that is passed to it with the
value of a recognized unit factor (K, M or G for 2^10, 2^20 and 2^30,
respectively).  All callers pass in 1 as a number, though, which allows
them to check the actual multiplication for overflow before they are
doing it themselves.

Ignore the passed in number and don't multiply, as this feature of
parse_unit_factor() is not used anymore.  Rename the output parameter to
reflect that it's not about the end result anymore, but just about the
unit factor.

Suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoconfig: use unsigned_mult_overflows to check for overflows
René Scharfe [Sat, 22 Jun 2019 10:03:30 +0000 (12:03 +0200)] 
config: use unsigned_mult_overflows to check for overflows

parse_unit_factor() checks if a K, M or G is present after a number and
multiplies it by 2^10, 2^20 or 2^30, respectively.  One of its callers
checks if the result is smaller than the number alone to detect
overflows.  The other one passes 1 as the number and does multiplication
and overflow check itself in a similar manner.

This works, but is inconsistent, and it would break if we added support
for a bigger unit factor.  E.g. 16777217T is 2^64 + 2^40, i.e. too big
for a 64-bit number.  Modulo 2^64 we get 2^40 == 1TB, which is bigger
than the raw number 16777217 == 2^24 + 1, so the overflow would go
undetected by that method.

Let both callers pass 1 and handle overflow check and multiplication
themselves.  Do the check before the multiplication, using
unsigned_mult_overflows, which is simpler and can deal with larger unit
factors.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot0001: fix on case-insensitive filesystems
Johannes Schindelin [Mon, 24 Jun 2019 17:40:05 +0000 (19:40 +0200)] 
t0001: fix on case-insensitive filesystems

On a case-insensitive filesystem, such as HFS+ or NTFS, it is possible
that the idea Bash has of the current directory differs in case from
what Git thinks it is. That's totally okay, though, and we should not
expect otherwise.

On Windows, for example, when you call

cd C:\GIT-SDK-64

in a PowerShell and there exists a directory called `C:\git-sdk-64`, the
current directory will be reported in all upper-case. Even in a Bash
that you might call from that PowerShell. Git, however, will have
normalized this via `GetFinalPathByHandle()`, and the expectation in
t0001 that the recorded gitdir will match what `pwd` says will be
violated.

Let's address this by comparing these paths in a case-insensitive
manner when `core.ignoreCase` is `true`.

Reported by Jameson Miller.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>