]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
6 years agofetch: don't overlay config with submodule-config
Brandon Williams [Thu, 3 Aug 2017 18:19:51 +0000 (11:19 -0700)] 
fetch: don't overlay config with submodule-config

Don't rely on overlaying the repository's config on top of the
submodule-config, instead query the repository's config directly for the
fetch_recurse field.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule--helper: don't overlay config in update-clone
Brandon Williams [Thu, 3 Aug 2017 18:19:50 +0000 (11:19 -0700)] 
submodule--helper: don't overlay config in update-clone

Don't rely on overlaying the repository's config on top of the
submodule-config, instead query the repository's config directly for the
url and the update strategy configuration.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule--helper: don't overlay config in remote_submodule_branch
Brandon Williams [Thu, 3 Aug 2017 18:19:49 +0000 (11:19 -0700)] 
submodule--helper: don't overlay config in remote_submodule_branch

Don't rely on overlaying the repository's config on top of the
submodule-config, instead query the repository's config directly for the
branch field.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoadd, reset: ensure submodules can be added or reset
Brandon Williams [Tue, 25 Jul 2017 21:39:16 +0000 (14:39 -0700)] 
add, reset: ensure submodules can be added or reset

Commit aee9c7d65 (Submodules: Add the new "ignore" config option for
diff and status) introduced the ignore configuration option for
submodules so that configured submodules could be omitted from the
status and diff commands.  Because this flag is respected in the diff
machinery it has the unintended consequence of potentially prohibiting
users from adding or resetting a submodule, even when a path to the
submodule is explicitly given.

Ensure that submodules can be added or set, even if they are configured
to be ignored, by setting the `DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG` diff
flag.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule: don't use submodule_from_name
Brandon Williams [Tue, 25 Jul 2017 21:39:15 +0000 (14:39 -0700)] 
submodule: don't use submodule_from_name

The function 'submodule_from_name()' is being used incorrectly here as a
submodule path is being used instead of a submodule name.  Since the
correct function to use with a path to a submodule is already being used
('submodule_from_path()') let's remove the call to
'submodule_from_name()'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot7411: check configuration parsing errors
Brandon Williams [Tue, 25 Jul 2017 21:39:14 +0000 (14:39 -0700)] 
t7411: check configuration parsing errors

Check for configuration parsing errors in '.gitmodules' in t7411, which
is explicitly testing the submodule-config subsystem, instead of in
t7400.  Also explicitly use the test helper instead of relying on the
gitmodules file from being read in status.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'bc/object-id' into bw/submodule-config-cleanup
Junio C Hamano [Wed, 2 Aug 2017 21:34:28 +0000 (14:34 -0700)] 
Merge branch 'bc/object-id' into bw/submodule-config-cleanup

* bc/object-id:
  sha1_name: convert uses of 40 to GIT_SHA1_HEXSZ
  sha1_name: convert GET_SHA1* flags to GET_OID*
  sha1_name: convert get_sha1* to get_oid*
  Convert remaining callers of get_sha1 to get_oid.
  builtin/unpack-file: convert to struct object_id
  bisect: convert bisect_checkout to struct object_id
  builtin/update_ref: convert to struct object_id
  sequencer: convert to struct object_id
  remote: convert struct push_cas to struct object_id
  submodule: convert submodule config lookup to use object_id
  builtin/merge-tree: convert remaining caller of get_sha1 to object_id
  builtin/fsck: convert remaining caller of get_sha1 to object_id
  tag: convert gpg_verify_tag to use struct object_id
  commit: convert lookup_commit_graft to struct object_id

6 years agoMerge branch 'bw/grep-recurse-submodules' into bw/submodule-config-cleanup
Junio C Hamano [Wed, 2 Aug 2017 21:33:47 +0000 (14:33 -0700)] 
Merge branch 'bw/grep-recurse-submodules' into bw/submodule-config-cleanup

* bw/grep-recurse-submodules:
  grep: recurse in-process using 'struct repository'
  submodule: merge repo_read_gitmodules and gitmodules_config
  submodule: check for unmerged .gitmodules outside of config parsing
  submodule: check for unstaged .gitmodules outside of config parsing
  submodule: remove fetch.recursesubmodules from submodule-config parsing
  submodule: remove submodule.fetchjobs from submodule-config parsing
  config: add config_from_gitmodules
  cache.h: add GITMODULES_FILE macro
  repository: have the_repository use the_index
  repo_read_index: don't discard the index

6 years agogrep: recurse in-process using 'struct repository'
Brandon Williams [Wed, 2 Aug 2017 19:49:23 +0000 (12:49 -0700)] 
grep: recurse in-process using 'struct repository'

Convert grep to use 'struct repository' which enables recursing into
submodules to be handled in-process.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule: merge repo_read_gitmodules and gitmodules_config
Brandon Williams [Wed, 2 Aug 2017 19:49:22 +0000 (12:49 -0700)] 
submodule: merge repo_read_gitmodules and gitmodules_config

Since 69aba5329 (submodule: add repo_read_gitmodules) there have been
two ways to load a repository's .gitmodules file:
'repo_read_gitmodules()' is used if you have a repository object you are
working with or 'gitmodules_config()' if you are implicitly working with
'the_repository'.  Merge the logic of these two functions to remove
duplicate code.

In addition, 'repo_read_gitmodules()' can segfault by passing in a NULL
pointer to 'git_config_from_file()' if a repository doesn't have a
worktree.  Instead check for the existence of a worktree before
attempting to load the .gitmodules file.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule: check for unmerged .gitmodules outside of config parsing
Brandon Williams [Wed, 2 Aug 2017 19:49:21 +0000 (12:49 -0700)] 
submodule: check for unmerged .gitmodules outside of config parsing

Add 'is_gitmodules_unmerged()' function which can be used to determine
in the '.gitmodules' file is unmerged based on the passed in index
instead of relying on a global variable which is set during the
submodule-config parsing.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule: check for unstaged .gitmodules outside of config parsing
Brandon Williams [Wed, 2 Aug 2017 19:49:20 +0000 (12:49 -0700)] 
submodule: check for unstaged .gitmodules outside of config parsing

Teach 'is_staging_gitmodules_ok()' to be able to determine in the
'.gitmodules' file has unstaged changes based on the passed in index
instead of relying on a global variable which is set during the
submodule-config parsing.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule: remove fetch.recursesubmodules from submodule-config parsing
Brandon Williams [Wed, 2 Aug 2017 19:49:19 +0000 (12:49 -0700)] 
submodule: remove fetch.recursesubmodules from submodule-config parsing

Remove the 'fetch.recursesubmodules' configuration option from the
general submodule-config parsing and instead rely on using
'config_from_gitmodules()' in order to maintain backwards compatibility
with this config being placed in the '.gitmodules' file.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule: remove submodule.fetchjobs from submodule-config parsing
Brandon Williams [Wed, 2 Aug 2017 19:49:18 +0000 (12:49 -0700)] 
submodule: remove submodule.fetchjobs from submodule-config parsing

The '.gitmodules' file should only contain information pertinent to
configuring individual submodules (name to path mapping, URL where to
obtain the submodule, etc.) while other configuration like the number of
jobs to use when fetching submodules should be a part of the
repository's config.

Remove the 'submodule.fetchjobs' configuration option from the general
submodule-config parsing and instead rely on using the
'config_from_gitmodules()' in order to maintain backwards compatibility
with this config being placed in the '.gitmodules' file.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoconfig: add config_from_gitmodules
Brandon Williams [Wed, 2 Aug 2017 19:49:17 +0000 (12:49 -0700)] 
config: add config_from_gitmodules

Add 'config_from_gitmodules()' function which can be used by 'fetch' and
'update_clone' in order to maintain backwards compatibility with
configuration being stored in .gitmodules' since a future patch will
remove reading these values in the submodule-config.

This function should not be used anywhere other than in 'fetch' and
'update_clone'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocache.h: add GITMODULES_FILE macro
Brandon Williams [Wed, 2 Aug 2017 19:49:16 +0000 (12:49 -0700)] 
cache.h: add GITMODULES_FILE macro

Add a macro to be used when specifying the '.gitmodules' file and
convert any existing hard coded '.gitmodules' file strings to use the
new macro.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoGit 2.14-rc1 v2.14.0-rc1
Junio C Hamano [Mon, 24 Jul 2017 21:50:35 +0000 (14:50 -0700)] 
Git 2.14-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge https://github.com/git-l10n/git-po
Junio C Hamano [Mon, 24 Jul 2017 21:01:08 +0000 (14:01 -0700)] 
Merge https://github.com/git-l10n/git-po

* https://github.com/git-l10n/git-po:
  l10n: git.pot: v2.14.0 round 2 (9 new, 2 removed)
  l10n: sv.po: Update Swedish translation (3206t0f0u)
  l10n: ko.po: Update Korean translation
  l10n: Update Catalan translation
  l10n: bg.po: Updated Bulgarian translation (3206t)
  l10n: vi.po(3206t): Update Vietnamese translation
  l10n: git.pot: v2.14.0 round 1 (34 new, 23 removed)
  l10n: ru.po: update Russian translation
  l10n: Fixes to Catalan translation

6 years agol10n: git.pot: v2.14.0 round 2 (9 new, 2 removed)
Jiang Xin [Mon, 24 Jul 2017 14:00:44 +0000 (22:00 +0800)] 
l10n: git.pot: v2.14.0 round 2 (9 new, 2 removed)

Generate po/git.pot from v2.14.0-rc0-40-g5eada8987e for git v2.14.0 l10n round 2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
6 years agoMerge branch 'master' of git://github.com/git-l10n/git-po
Jiang Xin [Mon, 24 Jul 2017 13:53:47 +0000 (21:53 +0800)] 
Merge branch 'master' of git://github.com/git-l10n/git-po

* 'master' of git://github.com/git-l10n/git-po:
  l10n: sv.po: Update Swedish translation (3206t0f0u)
  l10n: ko.po: Update Korean translation
  l10n: Update Catalan translation
  l10n: bg.po: Updated Bulgarian translation (3206t)
  l10n: vi.po(3206t): Update Vietnamese translation
  l10n: git.pot: v2.14.0 round 1 (34 new, 23 removed)
  l10n: ru.po: update Russian translation
  l10n: Fixes to Catalan translation

6 years agoMerge branch 'master' of git://github.com/nafmo/git-l10n-sv
Jiang Xin [Fri, 21 Jul 2017 22:19:21 +0000 (06:19 +0800)] 
Merge branch 'master' of git://github.com/nafmo/git-l10n-sv

* 'master' of git://github.com/nafmo/git-l10n-sv:
  l10n: sv.po: Update Swedish translation (3206t0f0u)

6 years agoSync with maint
Junio C Hamano [Fri, 21 Jul 2017 22:13:25 +0000 (15:13 -0700)] 
Sync with maint

* maint:
  fixes from 'master' for 2.13.4

6 years agofixes from 'master' for 2.13.4
Junio C Hamano [Fri, 21 Jul 2017 22:06:09 +0000 (15:06 -0700)] 
fixes from 'master' for 2.13.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ew/fd-cloexec-fix' into maint
Junio C Hamano [Fri, 21 Jul 2017 22:03:40 +0000 (15:03 -0700)] 
Merge branch 'ew/fd-cloexec-fix' into maint

Portability/fallback fix.

* ew/fd-cloexec-fix:
  set FD_CLOEXEC properly when O_CLOEXEC is not supported

6 years agoMerge branch 'ks/fix-rebase-doc-picture' into maint
Junio C Hamano [Fri, 21 Jul 2017 22:03:39 +0000 (15:03 -0700)] 
Merge branch 'ks/fix-rebase-doc-picture' into maint

Doc update.

* ks/fix-rebase-doc-picture:
  doc: correct a mistake in an illustration

6 years agoMerge branch 'js/alias-case-sensitivity' into maint
Junio C Hamano [Fri, 21 Jul 2017 22:03:38 +0000 (15:03 -0700)] 
Merge branch 'js/alias-case-sensitivity' into maint

A recent update broke an alias that contained an uppercase letter.

* js/alias-case-sensitivity:
  alias: compare alias name *case-insensitively*
  t1300: demonstrate that CamelCased aliases regressed

6 years agoMerge branch 'bb/unicode-10.0' into maint
Junio C Hamano [Fri, 21 Jul 2017 22:03:38 +0000 (15:03 -0700)] 
Merge branch 'bb/unicode-10.0' into maint

Update the character width tables.

* bb/unicode-10.0:
  unicode: update the width tables to Unicode 10

6 years agoHopefully the final last-minute fix before -rc1
Junio C Hamano [Fri, 21 Jul 2017 22:02:51 +0000 (15:02 -0700)] 
Hopefully the final last-minute fix before -rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ks/doc-fixes'
Junio C Hamano [Fri, 21 Jul 2017 21:57:37 +0000 (14:57 -0700)] 
Merge branch 'ks/doc-fixes'

Doc clean-up.

* ks/doc-fixes:
  doc: reformat the paragraph containing the 'cut-line'
  doc: camelCase the i18n config variables to improve readability

6 years agoMerge branch 'rj/cygwin-fread-reads-directories'
Junio C Hamano [Fri, 21 Jul 2017 21:57:37 +0000 (14:57 -0700)] 
Merge branch 'rj/cygwin-fread-reads-directories'

It turns out that Cygwin also needs the fopen() wrapper that
returns failure when a directory is opened for reading.

* rj/cygwin-fread-reads-directories:
  config.mak.uname: set FREAD_READS_DIRECTORIES for cygwin

6 years agoMerge branch 'jc/po-pritime-fix'
Junio C Hamano [Fri, 21 Jul 2017 21:57:36 +0000 (14:57 -0700)] 
Merge branch 'jc/po-pritime-fix'

We started using "%" PRItime, imitating "%" PRIuMAX and friends, as
a way to format the internal timestamp value, but this does not
play well with gettext(1) i18n framework, and causes "make pot"
that is run by the l10n coordinator to create a broken po/git.pot
file.  This is a possible workaround for that problem.

* jc/po-pritime-fix:
  Makefile: help gettext tools to cope with our custom PRItime format

6 years agoconfig.mak.uname: set FREAD_READS_DIRECTORIES for cygwin
Ramsay Jones [Fri, 21 Jul 2017 18:43:17 +0000 (19:43 +0100)] 
config.mak.uname: set FREAD_READS_DIRECTORIES for cygwin

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoA few more topics while waiting for the po/PRItime resolution
Junio C Hamano [Thu, 20 Jul 2017 23:31:56 +0000 (16:31 -0700)] 
A few more topics while waiting for the po/PRItime resolution

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'mt/p4-parse-G-output'
Junio C Hamano [Thu, 20 Jul 2017 23:30:00 +0000 (16:30 -0700)] 
Merge branch 'mt/p4-parse-G-output'

Use "p4 -G" to make "p4 changes" output more Python-friendly
to parse.

* mt/p4-parse-G-output:
  git-p4: filter for {'code':'info'} in p4CmdList
  git-p4: parse marshal output "p4 -G" in p4 changes
  git-p4: git-p4 tests with p4 triggers

6 years agoMerge branch 'ew/fd-cloexec-fix'
Junio C Hamano [Thu, 20 Jul 2017 23:30:00 +0000 (16:30 -0700)] 
Merge branch 'ew/fd-cloexec-fix'

Portability/fallback fix.

* ew/fd-cloexec-fix:
  set FD_CLOEXEC properly when O_CLOEXEC is not supported

6 years agoMerge branch 'jk/build-with-asan'
Junio C Hamano [Thu, 20 Jul 2017 23:29:59 +0000 (16:29 -0700)] 
Merge branch 'jk/build-with-asan'

A recent update made it easier to use "-fsanitize=" option while
compiling but supported only one sanitize option.  Allow more than
one to be combined, joined with a comma, like "make SANITIZE=foo,bar".

* jk/build-with-asan:
  Makefile: allow combining UBSan with other sanitizers

6 years agoMerge branch 'jk/test-copy-bytes-fix'
Junio C Hamano [Thu, 20 Jul 2017 23:29:59 +0000 (16:29 -0700)] 
Merge branch 'jk/test-copy-bytes-fix'

A test fix.

* jk/test-copy-bytes-fix:
  t: handle EOF in test_copy_bytes()

6 years agoMerge branch 'js/alias-case-sensitivity'
Junio C Hamano [Thu, 20 Jul 2017 23:29:59 +0000 (16:29 -0700)] 
Merge branch 'js/alias-case-sensitivity'

A recent update broke an alias that contained an uppercase letter.

* js/alias-case-sensitivity:
  alias: compare alias name *case-insensitively*
  t1300: demonstrate that CamelCased aliases regressed

6 years agol10n: sv.po: Update Swedish translation (3206t0f0u)
Peter Krefting [Thu, 20 Jul 2017 21:00:16 +0000 (23:00 +0200)] 
l10n: sv.po: Update Swedish translation (3206t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
6 years agoRelNotes: mention "sha1dc: optionally use sha1collisiondetection as a submodule"
Ævar Arnfjörð Bjarmason [Thu, 20 Jul 2017 14:19:24 +0000 (14:19 +0000)] 
RelNotes: mention "sha1dc: optionally use sha1collisiondetection as a submodule"

To note that merely cloning git.git without --recurse-submodules
doesn't get you a full copy of the code anymore. See
5f6482d642 ("RelNotes: mention "log: make --regexp-ignore-case work
with --perl-regexp"", 2017-07-20).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoRelNotes: mention "log: make --regexp-ignore-case work with --perl-regexp"
Ævar Arnfjörð Bjarmason [Thu, 20 Jul 2017 14:19:23 +0000 (14:19 +0000)] 
RelNotes: mention "log: make --regexp-ignore-case work with --perl-regexp"

To inform users that they can use --regexp-ignore-case now, and that
existing scripts which relied on that + PCRE may be buggy. See
9e3cbc59d5 ("log: make --regexp-ignore-case work with --perl-regexp",
2017-05-20).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoRelNotes: mention "log: add -P as a synonym for --perl-regexp"
Ævar Arnfjörð Bjarmason [Thu, 20 Jul 2017 14:19:22 +0000 (14:19 +0000)] 
RelNotes: mention "log: add -P as a synonym for --perl-regexp"

To inform users that they can use the short form now. See
7531a2dd87 ("log: add -P as a synonym for --perl-regexp", 2017-05-25).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMakefile: help gettext tools to cope with our custom PRItime format
Junio C Hamano [Thu, 20 Jul 2017 18:57:01 +0000 (11:57 -0700)] 
Makefile: help gettext tools to cope with our custom PRItime format

We started using our own timestamp_t type and PRItime format
specifier to go along with it, so that we can later change the
underlying type and output format more easily, but this does not
play well with gettext tools.

Because gettext tools need to keep the *.po file portable across
platforms, they have to special-case the format specifiers like
PRIuMAX that are known types in inttypes.h, instead of letting CPP
handle strings like

    "%" PRIuMAX " seconds ago"

as an ordinary string concatenation.  They fundamentally cannot do
the same for our own custom type/format.

Given that po/git.pot needs to be generated only once every release
and by only one person, i.e. the l10n coordinator, let's update the
Makefile rule to generate po/git.pot so that gettext tools are run
on a munged set of sources in which all mentions of PRItime are
replaced with PRIuMAX, which is what we happen to use right now.

This way, developers do not have to care that PRItime does not play
well with gettext, and translators do not have to care that we use
our own PRItime.

The credit for the idea to munge the source files goes to Dscho.
Possible bugs are mine.

Helped-by: Jiang Xin <worldhello.net@gmail.com>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agol10n: ko.po: Update Korean translation
Changwoo Ryu [Wed, 19 Jul 2017 08:15:28 +0000 (17:15 +0900)] 
l10n: ko.po: Update Korean translation

Signed-off-by: Changwoo Ryu <cwryu@debian.org>
6 years agodoc: reformat the paragraph containing the 'cut-line'
Kaartic Sivaraam [Tue, 18 Jul 2017 14:34:27 +0000 (20:04 +0530)] 
doc: reformat the paragraph containing the 'cut-line'

The paragraph that describes the 'scissors' cleanup mode of
'commit' had the 'cut-line' in the middle of a sentence. This
made it possible for the line to get wrapped on smaler windows.
This shouldn't be the case as it makes it hard for the user to
understand the structure of the cut-line.

Reformat the pragraph to make the 'cut-line' stand on a line of
it's own thus distinguishing it from the rest of the paragraph.
This further prevents it from getting wrapped to some extent.

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorepository: have the_repository use the_index
Brandon Williams [Tue, 18 Jul 2017 19:05:19 +0000 (12:05 -0700)] 
repository: have the_repository use the_index

Have the index state which is stored in 'the_repository' be a pointer to
the in-core index 'the_index'.  This makes it easier to begin
transitioning more parts of the code base to operate on a 'struct
repository'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorepo_read_index: don't discard the index
Brandon Williams [Tue, 18 Jul 2017 19:05:18 +0000 (12:05 -0700)] 
repo_read_index: don't discard the index

Have 'repo_read_index()' behave more like the other read_index family of
functions and don't discard the index if it has already been populated
and instead rely on the quick return of read_index_from which has:

  /* istate->initialized covers both .git/index and .git/sharedindex.xxx */
  if (istate->initialized)
    return istate->cache_nr;

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoA few more topics before 2.14-rc1
Junio C Hamano [Tue, 18 Jul 2017 19:52:49 +0000 (12:52 -0700)] 
A few more topics before 2.14-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'jk/gc-pre-detach-under-hook'
Junio C Hamano [Tue, 18 Jul 2017 19:48:10 +0000 (12:48 -0700)] 
Merge branch 'jk/gc-pre-detach-under-hook'

We run an early part of "git gc" that deals with refs before
daemonising (and not under lock) even when running a background
auto-gc, which caused multiple gc processes attempting to run the
early part at the same time.  This is now prevented by running the
early part also under the GC lock.

* jk/gc-pre-detach-under-hook:
  gc: run pre-detach operations under lock

6 years agoMerge branch 'jn/hooks-pre-rebase-sample-fix'
Junio C Hamano [Tue, 18 Jul 2017 19:48:10 +0000 (12:48 -0700)] 
Merge branch 'jn/hooks-pre-rebase-sample-fix'

Code clean-up, that makes us in sync with Debian by one patch.

* jn/hooks-pre-rebase-sample-fix:
  pre-rebase hook: capture documentation in a <<here document

6 years agoMerge branch 'rs/progress-overall-throughput-at-the-end'
Junio C Hamano [Tue, 18 Jul 2017 19:48:09 +0000 (12:48 -0700)] 
Merge branch 'rs/progress-overall-throughput-at-the-end'

The progress meter did not give a useful output when we haven't had
0.5 seconds to measure the throughput during the interval.  Instead
show the overall throughput rate at the end, which is a much more
useful number.

* rs/progress-overall-throughput-at-the-end:
  progress: show overall rate in last update

6 years agoMerge branch 'tb/push-to-cygwin-unc-path'
Junio C Hamano [Tue, 18 Jul 2017 19:48:09 +0000 (12:48 -0700)] 
Merge branch 'tb/push-to-cygwin-unc-path'

On Cygwin, similar to Windows, "git push //server/share/repository"
ought to mean a repository on a network share that can be accessed
locally, but this did not work correctly due to stripping the double
slashes at the beginning.

This may need to be heavily tested before it gets unleashed to the
wild, as the change is at a fairly low-level code and would affect
not just the code to decide if the push destination is local.  There
may be unexpected fallouts in the path normalization.

* tb/push-to-cygwin-unc-path:
  cygwin: allow pushing to UNC paths

6 years agol10n: Update Catalan translation
Jordi Mas [Tue, 18 Jul 2017 19:06:06 +0000 (21:06 +0200)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
6 years agodoc: camelCase the i18n config variables to improve readability
Kaartic Sivaraam [Mon, 17 Jul 2017 15:39:00 +0000 (21:09 +0530)] 
doc: camelCase the i18n config variables to improve readability

The i18n config variable used weren't readable as they were in
the crude form of how git stores/uses it's config variables.

Improve it's readability by replacing them with camelCased versions
of config variables as it doesn't have any impact on it's usage.

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot: handle EOF in test_copy_bytes()
Jeff King [Sun, 16 Jul 2017 10:45:32 +0000 (06:45 -0400)] 
t: handle EOF in test_copy_bytes()

The test_copy_bytes() function claims to read up to N bytes,
or until it gets EOF. But we never handle EOF in our loop,
and a short input will cause perl to go into an infinite
loop of read() getting zero bytes.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoset FD_CLOEXEC properly when O_CLOEXEC is not supported
Eric Wong [Sat, 15 Jul 2017 18:55:40 +0000 (18:55 +0000)] 
set FD_CLOEXEC properly when O_CLOEXEC is not supported

FD_CLOEXEC only applies to the file descriptor, so it needs to be
manipuluated via F_GETFD/F_SETFD.  F_GETFL/F_SETFL are for file
description flags.

Verified via strace with o_cloexec set to zero.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMakefile: allow combining UBSan with other sanitizers
René Scharfe [Sat, 15 Jul 2017 17:18:56 +0000 (19:18 +0200)] 
Makefile: allow combining UBSan with other sanitizers

Multiple sanitizers can be specified as a comma-separated list.  Set
the flag NO_UNALIGNED_LOADS even if UndefinedBehaviorSanitizer is not
the only sanitizer to build with.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoalias: compare alias name *case-insensitively*
Johannes Schindelin [Fri, 14 Jul 2017 08:39:38 +0000 (10:39 +0200)] 
alias: compare alias name *case-insensitively*

It is totally legitimate to add CamelCased aliases, but due to the way
config keys are compared, the case does not matter.

Therefore, we must compare the alias name insensitively to the config
keys.

This fixes a regression introduced by a9bcf6586d1 (alias: use
the early config machinery to expand aliases, 2017-06-14).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1300: demonstrate that CamelCased aliases regressed
Johannes Schindelin [Fri, 14 Jul 2017 08:39:29 +0000 (10:39 +0200)] 
t1300: demonstrate that CamelCased aliases regressed

It is totally legitimate to add CamelCased aliases, but due to the way
config keys are compared, the case does not matter.

Except that now it does: the alias name is expected to be all
lower-case. This is a regression introduced by a9bcf6586d1 (alias: use
the early config machinery to expand aliases, 2017-06-14).

Noticed by Alejandro Pauly, diagnosed by Kevin Willford.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_name: convert uses of 40 to GIT_SHA1_HEXSZ
brian m. carlson [Thu, 13 Jul 2017 23:49:30 +0000 (23:49 +0000)] 
sha1_name: convert uses of 40 to GIT_SHA1_HEXSZ

There are several uses of the constant 40 in find_unique_abbrev_r.
Convert them to GIT_SHA1_HEXSZ.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_name: convert GET_SHA1* flags to GET_OID*
brian m. carlson [Thu, 13 Jul 2017 23:49:29 +0000 (23:49 +0000)] 
sha1_name: convert GET_SHA1* flags to GET_OID*

Convert the flags for get_oid_with_context and friends to use "OID"
instead of "SHA1" in their names.

This transform was made by running the following one-liner on the
affected files:

  perl -pi -e 's/GET_SHA1/GET_OID/g'

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_name: convert get_sha1* to get_oid*
brian m. carlson [Thu, 13 Jul 2017 23:49:28 +0000 (23:49 +0000)] 
sha1_name: convert get_sha1* to get_oid*

Now that all the callers of get_sha1 directly or indirectly use struct
object_id, rename the functions starting with get_sha1 to start with
get_oid.  Convert the internals in sha1_name.c to use struct object_id
as well, and eliminate explicit length checks where possible.  Convert a
use of 40 in get_oid_basic to GIT_SHA1_HEXSZ.

Outside of sha1_name.c and cache.h, this transition was made with the
following semantic patch:

@@
expression E1, E2;
@@
- get_sha1(E1, E2.hash)
+ get_oid(E1, &E2)

@@
expression E1, E2;
@@
- get_sha1(E1, E2->hash)
+ get_oid(E1, E2)

@@
expression E1, E2;
@@
- get_sha1_committish(E1, E2.hash)
+ get_oid_committish(E1, &E2)

@@
expression E1, E2;
@@
- get_sha1_committish(E1, E2->hash)
+ get_oid_committish(E1, E2)

@@
expression E1, E2;
@@
- get_sha1_treeish(E1, E2.hash)
+ get_oid_treeish(E1, &E2)

@@
expression E1, E2;
@@
- get_sha1_treeish(E1, E2->hash)
+ get_oid_treeish(E1, E2)

@@
expression E1, E2;
@@
- get_sha1_commit(E1, E2.hash)
+ get_oid_commit(E1, &E2)

@@
expression E1, E2;
@@
- get_sha1_commit(E1, E2->hash)
+ get_oid_commit(E1, E2)

@@
expression E1, E2;
@@
- get_sha1_tree(E1, E2.hash)
+ get_oid_tree(E1, &E2)

@@
expression E1, E2;
@@
- get_sha1_tree(E1, E2->hash)
+ get_oid_tree(E1, E2)

@@
expression E1, E2;
@@
- get_sha1_blob(E1, E2.hash)
+ get_oid_blob(E1, &E2)

@@
expression E1, E2;
@@
- get_sha1_blob(E1, E2->hash)
+ get_oid_blob(E1, E2)

@@
expression E1, E2, E3, E4;
@@
- get_sha1_with_context(E1, E2, E3.hash, E4)
+ get_oid_with_context(E1, E2, &E3, E4)

@@
expression E1, E2, E3, E4;
@@
- get_sha1_with_context(E1, E2, E3->hash, E4)
+ get_oid_with_context(E1, E2, E3, E4)

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoConvert remaining callers of get_sha1 to get_oid.
brian m. carlson [Thu, 13 Jul 2017 23:49:27 +0000 (23:49 +0000)] 
Convert remaining callers of get_sha1 to get_oid.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobuiltin/unpack-file: convert to struct object_id
brian m. carlson [Thu, 13 Jul 2017 23:49:25 +0000 (23:49 +0000)] 
builtin/unpack-file: convert to struct object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobisect: convert bisect_checkout to struct object_id
brian m. carlson [Thu, 13 Jul 2017 23:49:24 +0000 (23:49 +0000)] 
bisect: convert bisect_checkout to struct object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobuiltin/update_ref: convert to struct object_id
brian m. carlson [Thu, 13 Jul 2017 23:49:23 +0000 (23:49 +0000)] 
builtin/update_ref: convert to struct object_id

Convert the uses of unsigned char * to struct object_id.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosequencer: convert to struct object_id
brian m. carlson [Thu, 13 Jul 2017 23:49:22 +0000 (23:49 +0000)] 
sequencer: convert to struct object_id

Convert the remaining instances of unsigned char * to struct object_id.
This removes several calls to get_sha1.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoremote: convert struct push_cas to struct object_id
brian m. carlson [Thu, 13 Jul 2017 23:49:21 +0000 (23:49 +0000)] 
remote: convert struct push_cas to struct object_id

This gets rid of one use of get_sha1.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule: convert submodule config lookup to use object_id
brian m. carlson [Thu, 13 Jul 2017 23:49:20 +0000 (23:49 +0000)] 
submodule: convert submodule config lookup to use object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobuiltin/merge-tree: convert remaining caller of get_sha1 to object_id
brian m. carlson [Thu, 13 Jul 2017 23:49:19 +0000 (23:49 +0000)] 
builtin/merge-tree: convert remaining caller of get_sha1 to object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobuiltin/fsck: convert remaining caller of get_sha1 to object_id
brian m. carlson [Thu, 13 Jul 2017 23:49:18 +0000 (23:49 +0000)] 
builtin/fsck: convert remaining caller of get_sha1 to object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agol10n: bg.po: Updated Bulgarian translation (3206t)
Alexander Shopov [Wed, 5 Jul 2017 08:17:59 +0000 (11:17 +0300)] 
l10n: bg.po: Updated Bulgarian translation (3206t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
6 years agol10n: vi.po(3206t): Update Vietnamese translation
Tran Ngoc Quan [Sat, 15 Jul 2017 06:53:33 +0000 (13:53 +0700)] 
l10n: vi.po(3206t): Update Vietnamese translation

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
6 years agol10n: git.pot: v2.14.0 round 1 (34 new, 23 removed)
Jiang Xin [Sat, 15 Jul 2017 03:58:14 +0000 (11:58 +0800)] 
l10n: git.pot: v2.14.0 round 1 (34 new, 23 removed)

Generate po/git.pot from v2.14.0-rc0 for git v2.14.0 l10n round 1.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
6 years agoMerge branch 'maint' of git://github.com/git-l10n/git-po
Jiang Xin [Sat, 15 Jul 2017 01:26:40 +0000 (09:26 +0800)] 
Merge branch 'maint' of git://github.com/git-l10n/git-po

* 'maint' of git://github.com/git-l10n/git-po:
  l10n: ru.po: update Russian translation
  l10n: Fixes to Catalan translation

6 years agoGit 2.14-rc0 v2.14.0-rc0
Junio C Hamano [Thu, 13 Jul 2017 23:22:29 +0000 (16:22 -0700)] 
Git 2.14-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'jk/build-with-asan'
Junio C Hamano [Thu, 13 Jul 2017 23:14:54 +0000 (16:14 -0700)] 
Merge branch 'jk/build-with-asan'

The build procedure has been improved to allow building and testing
Git with address sanitizer more easily.

* jk/build-with-asan:
  Makefile: disable unaligned loads with UBSan
  Makefile: turn off -fomit-frame-pointer with sanitizers
  Makefile: add helper for compiling with -fsanitize
  test-lib: turn on ASan abort_on_error by default
  test-lib: set ASAN_OPTIONS variable before we run git

6 years agoMerge branch 'sb/pull-rebase-submodule'
Junio C Hamano [Thu, 13 Jul 2017 23:14:54 +0000 (16:14 -0700)] 
Merge branch 'sb/pull-rebase-submodule'

"git pull --rebase --recurse-submodules" learns to rebase the
branch in the submodules to an updated base.

* sb/pull-rebase-submodule:
  builtin/fetch cleanup: always set default value for submodule recursing
  pull: optionally rebase submodules (remote submodule changes only)
  builtin/fetch: parse recurse-submodules-default at default options parsing
  builtin/fetch: factor submodule recurse parsing out to submodule config

6 years agoMerge branch 'sb/hashmap-customize-comparison'
Junio C Hamano [Thu, 13 Jul 2017 23:14:54 +0000 (16:14 -0700)] 
Merge branch 'sb/hashmap-customize-comparison'

Update the hashmap API so that data to customize the behaviour of
the comparison function can be specified at the time a hashmap is
initialized.

* sb/hashmap-customize-comparison:
  hashmap: migrate documentation from Documentation/technical into header
  patch-ids.c: use hashmap correctly
  hashmap.h: compare function has access to a data field

6 years agoMerge branch 'ab/grep-lose-opt-regflags'
Junio C Hamano [Thu, 13 Jul 2017 23:14:54 +0000 (16:14 -0700)] 
Merge branch 'ab/grep-lose-opt-regflags'

Code cleanup.

* ab/grep-lose-opt-regflags:
  grep: remove redundant REG_NEWLINE when compiling fixed regex
  grep: remove regflags from the public grep_opt API
  grep: remove redundant and verbose re-assignments to 0
  grep: remove redundant "fixed" field re-assignment to 0
  grep: adjust a redundant grep pattern type assignment
  grep: remove redundant double assignment to 0

6 years agotag: convert gpg_verify_tag to use struct object_id
Stefan Beller [Thu, 13 Jul 2017 00:44:15 +0000 (17:44 -0700)] 
tag: convert gpg_verify_tag to use struct object_id

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocommit: convert lookup_commit_graft to struct object_id
Stefan Beller [Thu, 13 Jul 2017 00:44:14 +0000 (17:44 -0700)] 
commit: convert lookup_commit_graft to struct object_id

With this patch, commit.h doesn't contain the string 'sha1' any more.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-p4: filter for {'code':'info'} in p4CmdList
Miguel Torroja [Thu, 13 Jul 2017 07:00:35 +0000 (09:00 +0200)] 
git-p4: filter for {'code':'info'} in p4CmdList

The function p4CmdList accepts a new argument: skip_info. When set to
True it ignores any 'code':'info' entry (skip_info=False by default).

That allows us to fix some of the tests in t9831-git-p4-triggers.sh
known to be broken with verobse p4 triggers

Signed-off-by: Miguel Torroja <miguel.torroja@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-p4: parse marshal output "p4 -G" in p4 changes
Miguel Torroja [Thu, 13 Jul 2017 07:00:34 +0000 (09:00 +0200)] 
git-p4: parse marshal output "p4 -G" in p4 changes

The option -G of p4 (python marshal output) gives more context about the
data being output. That's useful when using the command "change -o" as
we can distinguish between warning/error line and real change description.

This fixes the case where a p4 trigger for  "p4 change" is set and the command git-p4 submit is run.

Signed-off-by: Miguel Torroja <miguel.torroja@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-p4: git-p4 tests with p4 triggers
Miguel Torroja [Thu, 13 Jul 2017 07:00:33 +0000 (09:00 +0200)] 
git-p4: git-p4 tests with p4 triggers

Some p4 triggers in the server side generate some warnings when
executed. Unfortunately those messages are mixed with the output of
p4 commands. A few git-p4 commands don't expect extra messages or output
lines and may fail with verbose triggers.
New tests added are known to be broken.

Signed-off-by: Miguel Torroja <miguel.torroja@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoSync with v2.13.3
Junio C Hamano [Wed, 12 Jul 2017 22:25:14 +0000 (15:25 -0700)] 
Sync with v2.13.3

6 years agoGit 2.13.3 v2.13.3
Junio C Hamano [Wed, 12 Jul 2017 22:24:15 +0000 (15:24 -0700)] 
Git 2.13.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'kn/ref-filter-branch-list' into maint
Junio C Hamano [Wed, 12 Jul 2017 22:23:09 +0000 (15:23 -0700)] 
Merge branch 'kn/ref-filter-branch-list' into maint

The rewrite of "git branch --list" using for-each-ref's internals
that happened in v2.13 regressed its handling of color.branch.local;
this has been fixed.

* kn/ref-filter-branch-list:
  ref-filter.c: drop return from void function
  branch: set remote color in ref-filter branch immediately
  branch: use BRANCH_COLOR_LOCAL in ref-filter format
  branch: only perform HEAD check for local branches

6 years agoMerge branch 'ks/typofix-commit-c-comment' into maint
Junio C Hamano [Wed, 12 Jul 2017 22:20:48 +0000 (15:20 -0700)] 
Merge branch 'ks/typofix-commit-c-comment' into maint

Typofix.

* ks/typofix-commit-c-comment:
  builtin/commit.c: fix a typo in the comment

6 years agoMerge branch 'jk/reflog-walk-maint' into maint
Junio C Hamano [Wed, 12 Jul 2017 22:20:35 +0000 (15:20 -0700)] 
Merge branch 'jk/reflog-walk-maint' into maint

After "git branch --move" of the currently checked out branch, the
code to walk the reflog of HEAD via "log -g" and friends
incorrectly stopped at the reflog entry that records the renaming
of the branch.

* jk/reflog-walk-maint:
  reflog-walk: include all fields when freeing complete_reflogs
  reflog-walk: don't free reflogs added to cache
  reflog-walk: duplicate strings in complete_reflogs list
  reflog-walk: skip over double-null oid due to HEAD rename

6 years agoHopefully the last batch before -rc0
Junio C Hamano [Wed, 12 Jul 2017 22:19:27 +0000 (15:19 -0700)] 
Hopefully the last batch before -rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ks/fix-rebase-doc-picture'
Junio C Hamano [Wed, 12 Jul 2017 22:18:24 +0000 (15:18 -0700)] 
Merge branch 'ks/fix-rebase-doc-picture'

Doc update.

* ks/fix-rebase-doc-picture:
  doc: correct a mistake in an illustration

6 years agoMerge branch 'rs/wt-status-cleanup'
Junio C Hamano [Wed, 12 Jul 2017 22:18:23 +0000 (15:18 -0700)] 
Merge branch 'rs/wt-status-cleanup'

Code cleanup.

* rs/wt-status-cleanup:
  wt-status: use separate variable for result of shorten_unambiguous_ref

6 years agoMerge branch 'rs/use-div-round-up'
Junio C Hamano [Wed, 12 Jul 2017 22:18:23 +0000 (15:18 -0700)] 
Merge branch 'rs/use-div-round-up'

Code cleanup.

* rs/use-div-round-up:
  use DIV_ROUND_UP

6 years agoMerge branch 'kn/ref-filter-branch-list'
Junio C Hamano [Wed, 12 Jul 2017 22:18:23 +0000 (15:18 -0700)] 
Merge branch 'kn/ref-filter-branch-list'

The rewrite of "git branch --list" using for-each-ref's internals
that happened in v2.13 regressed its handling of color.branch.local;
this has been fixed.

* kn/ref-filter-branch-list:
  ref-filter.c: drop return from void function
  branch: set remote color in ref-filter branch immediately
  branch: use BRANCH_COLOR_LOCAL in ref-filter format
  branch: only perform HEAD check for local branches

6 years agoMerge branch 'rs/urlmatch-cleanup'
Junio C Hamano [Wed, 12 Jul 2017 22:18:22 +0000 (15:18 -0700)] 
Merge branch 'rs/urlmatch-cleanup'

Code cleanup.

* rs/urlmatch-cleanup:
  urlmatch: use hex2chr() in append_normalized_escapes()

6 years agoMerge branch 'rs/apply-avoid-over-reading'
Junio C Hamano [Wed, 12 Jul 2017 22:18:22 +0000 (15:18 -0700)] 
Merge branch 'rs/apply-avoid-over-reading'

Code cleanup.

* rs/apply-avoid-over-reading:
  apply: use strcmp(3) for comparing strings in gitdiff_verify_name()

6 years agoMerge branch 'sb/submodule-doc'
Junio C Hamano [Wed, 12 Jul 2017 22:18:21 +0000 (15:18 -0700)] 
Merge branch 'sb/submodule-doc'

Doc update.

* sb/submodule-doc:
  submodules: overhaul documentation

6 years agogc: run pre-detach operations under lock
Jeff King [Tue, 11 Jul 2017 09:06:35 +0000 (05:06 -0400)] 
gc: run pre-detach operations under lock

We normally try to avoid having two auto-gc operations run
at the same time, because it wastes resources. This was done
long ago in 64a99eb47 (gc: reject if another gc is running,
unless --force is given, 2013-08-08).

When we do a detached auto-gc, we run the ref-related
commands _before_ detaching, to avoid confusing lock
contention. This was done by 62aad1849 (gc --auto: do not
lock refs in the background, 2014-05-25).

These two features do not interact well. The pre-detach
operations are run before we check the gc.pid lock, meaning
that on a busy repository we may run many of them
concurrently. Ideally we'd take the lock before spawning any
operations, and hold it for the duration of the program.

This is tricky, though, with the way the pid-file interacts
with the daemonize() process.  Other processes will check
that the pid recorded in the pid-file still exists. But
detaching causes us to fork and continue running under a
new pid. So if we take the lock before detaching, the
pid-file will have a bogus pid in it. We'd have to go back
and update it with the new pid after detaching. We'd also
have to play some tricks with the tempfile subsystem to
tweak the "owner" field, so that the parent process does not
clean it up on exit, but the child process does.

Instead, we can do something a bit simpler: take the lock
only for the duration of the pre-detach work, then detach,
then take it again for the post-detach work. Technically,
this means that the post-detach lock could lose to another
process doing pre-detach work. But in the long run this
works out.

That second process would then follow-up by doing
post-detach work. Unless it was in turn blocked by a third
process doing pre-detach work, and so on. This could in
theory go on indefinitely, as the pre-detach work does not
repack, and so need_to_gc() will continue to trigger.  But
in each round we are racing between the pre- and post-detach
locks. Eventually, one of the post-detach locks will win the
race and complete the full gc. So in the worst case, we may
racily repeat the pre-detach work, but we would never do so
simultaneously (it would happen via a sequence of serialized
race-wins).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopre-rebase hook: capture documentation in a <<here document
Jonathan Nieder [Mon, 10 Jul 2017 23:35:25 +0000 (16:35 -0700)] 
pre-rebase hook: capture documentation in a <<here document

Without this change, the sample hook does not pass a syntax check
(sh -n):

  $ sh -n hooks--pre-rebase.sample
  hooks--pre-rebase.sample: line 101: syntax error near unexpected token `('
  hooks--pre-rebase.sample: line 101: `   merged into it again (either directly or indirectly).'

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>