git
6 years agoMerge branch 'tb/config-default'
Junio C Hamano [Tue, 24 Jul 2018 21:50:46 +0000 (14:50 -0700)] 
Merge branch 'tb/config-default'

Compilation fix.

* tb/config-default:
  builtin/config: work around an unsized array forward declaration

6 years agoMerge branch 'mh/fast-import-no-diff-delta-empty'
Junio C Hamano [Tue, 24 Jul 2018 21:50:46 +0000 (14:50 -0700)] 
Merge branch 'mh/fast-import-no-diff-delta-empty'

"git fast-import" has been updated to avoid attempting to create
delta against a zero-byte-long string, which is pointless.

* mh/fast-import-no-diff-delta-empty:
  fast-import: do not call diff_delta() with empty buffer

6 years agoMerge branch 'kn/userdiff-php'
Junio C Hamano [Tue, 24 Jul 2018 21:50:46 +0000 (14:50 -0700)] 
Merge branch 'kn/userdiff-php'

The userdiff pattern for .php has been updated.

* kn/userdiff-php:
  userdiff: support new keywords in PHP hunk header
  t4018: add missing test cases for PHP

6 years agoMerge branch 'jk/fetch-all-peeled-fix'
Junio C Hamano [Tue, 24 Jul 2018 21:50:45 +0000 (14:50 -0700)] 
Merge branch 'jk/fetch-all-peeled-fix'

Test modernization.

* jk/fetch-all-peeled-fix:
  t5500: prettify non-commit tag tests

6 years agoMerge branch 'ag/rebase-p'
Junio C Hamano [Tue, 24 Jul 2018 21:50:44 +0000 (14:50 -0700)] 
Merge branch 'ag/rebase-p'

The help message shown in the editor to edit todo list in "rebase -p"
has regressed recently, which has been corrected.

* ag/rebase-p:
  git-rebase--preserve-merges: fix formatting of todo help message

6 years agoMerge branch 'jt/connectivity-check-after-unshallow'
Junio C Hamano [Tue, 24 Jul 2018 21:50:44 +0000 (14:50 -0700)] 
Merge branch 'jt/connectivity-check-after-unshallow'

"git fetch" failed to correctly validate the set of objects it
received when making a shallow history deeper, which has been
corrected.

* jt/connectivity-check-after-unshallow:
  fetch-pack: write shallow, then check connectivity
  fetch-pack: implement ref-in-want
  fetch-pack: put shallow info in output parameter
  fetch: refactor to make function args narrower
  fetch: refactor fetch_refs into two functions
  fetch: refactor the population of peer ref OIDs
  upload-pack: test negotiation with changing repository
  upload-pack: implement ref-in-want
  test-pkt-line: add unpack-sideband subcommand

6 years agoMerge branch 'jk/for-each-ref-icase'
Junio C Hamano [Tue, 24 Jul 2018 21:50:44 +0000 (14:50 -0700)] 
Merge branch 'jk/for-each-ref-icase'

The "--ignore-case" option of "git for-each-ref" (and its friends)
did not work correctly, which has been fixed.

* jk/for-each-ref-icase:
  ref-filter: avoid backend filtering with --ignore-case
  for-each-ref: consistently pass WM_IGNORECASE flag
  t6300: add a test for --ignore-case

6 years agoMerge branch 'en/t5407-rebase-m-fix'
Junio C Hamano [Tue, 24 Jul 2018 21:50:43 +0000 (14:50 -0700)] 
Merge branch 'en/t5407-rebase-m-fix'

* en/t5407-rebase-m-fix:
  t5407: fix test to cover intended arguments

6 years agoMerge branch 'en/apply-comment-fix'
Junio C Hamano [Tue, 24 Jul 2018 21:50:43 +0000 (14:50 -0700)] 
Merge branch 'en/apply-comment-fix'

* en/apply-comment-fix:
  apply: fix grammar error in comment

6 years agoMerge branch 'en/rebase-consistency'
Junio C Hamano [Tue, 24 Jul 2018 21:50:43 +0000 (14:50 -0700)] 
Merge branch 'en/rebase-consistency'

"git rebase" behaved slightly differently depending on which one of
the three backends gets used; this has been documented and an
effort to make them more uniform has begun.

* en/rebase-consistency:
  git-rebase: make --allow-empty-message the default
  t3401: add directory rename testcases for rebase and am
  git-rebase.txt: document behavioral differences between modes
  directory-rename-detection.txt: technical docs on abilities and limitations
  git-rebase.txt: address confusion between --no-ff vs --force-rebase
  git-rebase: error out when incompatible options passed
  t3422: new testcases for checking when incompatible options passed
  git-rebase.sh: update help messages a bit
  git-rebase.txt: document incompatible options

6 years agoMerge branch 'sb/submodule-move-head-error-msg'
Junio C Hamano [Tue, 24 Jul 2018 21:50:43 +0000 (14:50 -0700)] 
Merge branch 'sb/submodule-move-head-error-msg'

"git checkout --recurse-submodules another-branch" did not report
in which submodule it failed to update the working tree, which
resulted in an unhelpful error message.

* sb/submodule-move-head-error-msg:
  submodule.c: report the submodule that an error occurs in

6 years agoMerge branch 'rj/submodule-fsck-skip'
Junio C Hamano [Tue, 24 Jul 2018 21:50:42 +0000 (14:50 -0700)] 
Merge branch 'rj/submodule-fsck-skip'

"fsck.skipList" did not prevent a blob object listed there from
being inspected for is contents (e.g. we recently started to
inspect the contents of ".gitmodules" for certain malicious
patterns), which has been corrected.

* rj/submodule-fsck-skip:
  fsck: check skiplist for object in fsck_blob()

6 years agoThird batch for 2.19 cycle
Junio C Hamano [Wed, 18 Jul 2018 19:24:17 +0000 (12:24 -0700)] 
Third batch for 2.19 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'js/enhanced-version-info'
Junio C Hamano [Wed, 18 Jul 2018 19:20:35 +0000 (12:20 -0700)] 
Merge branch 'js/enhanced-version-info'

Build fix.

* js/enhanced-version-info:
  Makefile: fix the "built from commit" code

6 years agoMerge branch 'sb/mailmap'
Junio C Hamano [Wed, 18 Jul 2018 19:20:35 +0000 (12:20 -0700)] 
Merge branch 'sb/mailmap'

* sb/mailmap:
  .mailmap: merge different spellings of names

6 years agoMerge branch 'ms/core-icase-doc'
Junio C Hamano [Wed, 18 Jul 2018 19:20:35 +0000 (12:20 -0700)] 
Merge branch 'ms/core-icase-doc'

Clarify that setting core.ignoreCase to deviate from reality would
not turn a case-incapable filesystem into a case-capable one.

* ms/core-icase-doc:
  Documentation: declare "core.ignoreCase" as internal variable

6 years agoMerge branch 'ds/commit-graph'
Junio C Hamano [Wed, 18 Jul 2018 19:20:34 +0000 (12:20 -0700)] 
Merge branch 'ds/commit-graph'

Docfix.

* ds/commit-graph:
  commit-graph: fix documentation inconsistencies

6 years agoMerge branch 'tz/exclude-doc-smallfixes'
Junio C Hamano [Wed, 18 Jul 2018 19:20:34 +0000 (12:20 -0700)] 
Merge branch 'tz/exclude-doc-smallfixes'

Doc updates.

* tz/exclude-doc-smallfixes:
  dir.c: fix typos in core.excludesfile comment
  gitignore.txt: clarify default core.excludesfile path

6 years agoMerge branch 'js/rebase-recreate-merge'
Junio C Hamano [Wed, 18 Jul 2018 19:20:33 +0000 (12:20 -0700)] 
Merge branch 'js/rebase-recreate-merge'

Docfix.

* js/rebase-recreate-merge:
  rebase: fix documentation formatting

6 years agoMerge branch 'en/rebase-i-microfixes'
Junio C Hamano [Wed, 18 Jul 2018 19:20:33 +0000 (12:20 -0700)] 
Merge branch 'en/rebase-i-microfixes'

* en/rebase-i-microfixes:
  git-rebase--merge: modernize "git-$cmd" to "git $cmd"
  Fix use of strategy options with interactive rebases
  t3418: add testcase showing problems with rebase -i and strategy options

6 years agoMerge branch 'mb/filter-branch-optim'
Junio C Hamano [Wed, 18 Jul 2018 19:20:32 +0000 (12:20 -0700)] 
Merge branch 'mb/filter-branch-optim'

"git filter-branch" when used with the "--state-branch" option
still attempted to rewrite the commits whose filtered result is
known from the previous attempt (which is recorded on the state
branch); the command has been corrected not to waste cycles doing
so.

* mb/filter-branch-optim:
  filter-branch: skip commits present on --state-branch

6 years agoMerge branch 'dj/runtime-prefix'
Junio C Hamano [Wed, 18 Jul 2018 19:20:32 +0000 (12:20 -0700)] 
Merge branch 'dj/runtime-prefix'

POSIX portability fix in Makefile to fix a glitch introduced a few
releases ago.

* dj/runtime-prefix:
  Makefile: tweak sed invocation

6 years agoMerge branch 'ao/config-from-gitmodules'
Junio C Hamano [Wed, 18 Jul 2018 19:20:31 +0000 (12:20 -0700)] 
Merge branch 'ao/config-from-gitmodules'

Tighten the API to make it harder to misuse in-tree .gitmodules
file, even though it shares the same syntax with configuration
files, to read random configuration items from it.

* ao/config-from-gitmodules:
  submodule-config: reuse config_from_gitmodules in repo_read_gitmodules
  submodule-config: pass repository as argument to config_from_gitmodules
  submodule-config: make 'config_from_gitmodules' private
  submodule-config: add helper to get 'update-clone' config from .gitmodules
  submodule-config: add helper function to get 'fetch' config from .gitmodules
  config: move config_from_gitmodules to submodule-config.c

6 years agoMerge branch 'jk/branch-l-0-deprecation'
Junio C Hamano [Wed, 18 Jul 2018 19:20:31 +0000 (12:20 -0700)] 
Merge branch 'jk/branch-l-0-deprecation'

The "-l" option in "git branch -l" is an unfortunate short-hand for
"--create-reflog", but many users, both old and new, somehow expect
it to be something else, perhaps "--list".  This step warns when "-l"
is used as a short-hand for "--create-reflog" and warns about the
future repurposing of the it when it is used.

* jk/branch-l-0-deprecation:
  branch: deprecate "-l" option
  t: switch "branch -l" to "branch --create-reflog"
  t3200: unset core.logallrefupdates when testing reflog creation

6 years agoMerge branch 'tb/grep-column'
Junio C Hamano [Wed, 18 Jul 2018 19:20:31 +0000 (12:20 -0700)] 
Merge branch 'tb/grep-column'

"git grep" learned the "--column" option that gives not just the
line number but the column number of the hit.

* tb/grep-column:
  contrib/git-jump/git-jump: jump to exact location
  grep.c: add configuration variables to show matched option
  builtin/grep.c: add '--column' option to 'git-grep(1)'
  grep.c: display column number of first match
  grep.[ch]: extend grep_opt to allow showing matched column
  grep.c: expose {,inverted} match column in match_line()
  Documentation/config.txt: camel-case lineNumber for consistency

6 years agoMerge branch 'vs/typofixes'
Junio C Hamano [Wed, 18 Jul 2018 19:20:31 +0000 (12:20 -0700)] 
Merge branch 'vs/typofixes'

Doc fix.

* vs/typofixes:
  Documentation: spelling and grammar fixes

6 years agoMerge branch 'bw/protocol-v2'
Junio C Hamano [Wed, 18 Jul 2018 19:20:30 +0000 (12:20 -0700)] 
Merge branch 'bw/protocol-v2'

Doc fix.

* bw/protocol-v2:
  protocol-v2 doc: put HTTP headers after request

6 years agoMerge branch 'jt/remove-pack-bitmap-global'
Junio C Hamano [Wed, 18 Jul 2018 19:20:30 +0000 (12:20 -0700)] 
Merge branch 'jt/remove-pack-bitmap-global'

The effort to move globals to per-repository in-core structure
continues.

* jt/remove-pack-bitmap-global:
  pack-bitmap: add free function
  pack-bitmap: remove bitmap_git global variable

6 years agoMerge branch 'bw/config-refer-to-gitsubmodules-doc'
Junio C Hamano [Wed, 18 Jul 2018 19:20:30 +0000 (12:20 -0700)] 
Merge branch 'bw/config-refer-to-gitsubmodules-doc'

Docfix.

* bw/config-refer-to-gitsubmodules-doc:
  docs: link to gitsubmodules

6 years agoMerge branch 'xy/format-patch-prereq-patch-id-fix'
Junio C Hamano [Wed, 18 Jul 2018 19:20:29 +0000 (12:20 -0700)] 
Merge branch 'xy/format-patch-prereq-patch-id-fix'

Recently added "--base" option to "git format-patch" command did
not correctly generate prereq patch ids.

* xy/format-patch-prereq-patch-id-fix:
  format-patch: clear UNINTERESTING flag before prepare_bases

6 years agoMerge branch 'pw/rebase-i-keep-reword-after-conflict'
Junio C Hamano [Wed, 18 Jul 2018 19:20:29 +0000 (12:20 -0700)] 
Merge branch 'pw/rebase-i-keep-reword-after-conflict'

Bugfix for "rebase -i" corner case regression.

* pw/rebase-i-keep-reword-after-conflict:
  sequencer: do not squash 'reword' commits when we hit conflicts

6 years agoMerge branch 'ld/p423'
Junio C Hamano [Wed, 18 Jul 2018 19:20:29 +0000 (12:20 -0700)] 
Merge branch 'ld/p423'

Code preparation to make "git p4" closer to be usable with Python 3.

* ld/p423:
  git-p4: python3: fix octal constants
  git-p4: python3: use print() function
  git-p4: python3: basestring workaround
  git-p4: python3: remove backticks
  git-p4: python3: replace dict.has_key(k) with "k in dict"
  git-p4: python3: replace <> with !=

6 years agoMerge branch 'ds/ewah-cleanup'
Junio C Hamano [Wed, 18 Jul 2018 19:20:28 +0000 (12:20 -0700)] 
Merge branch 'ds/ewah-cleanup'

Remove unused function definitions and declarations from ewah
bitmap subsystem.

* ds/ewah-cleanup:
  ewah: delete unused 'rlwit_discharge_empty()'
  ewah: drop ewah_serialize_native function
  ewah: drop ewah_deserialize function
  ewah_io: delete unused 'ewah_serialize()'
  ewah_bitmap: delete unused 'ewah_or()'
  ewah_bitmap: delete unused 'ewah_not()'
  ewah_bitmap: delete unused 'ewah_and_not()'
  ewah_bitmap: delete unused 'ewah_and()'
  ewah/bitmap.c: delete unused 'bitmap_each_bit()'
  ewah/bitmap.c: delete unused 'bitmap_clear()'

6 years agoMerge branch 'sb/submodule-core-worktree'
Junio C Hamano [Wed, 18 Jul 2018 19:20:28 +0000 (12:20 -0700)] 
Merge branch 'sb/submodule-core-worktree'

"git submodule" did not correctly adjust core.worktree setting that
indicates whether/where a submodule repository has its associated
working tree across various state transitions, which has been
corrected.

* sb/submodule-core-worktree:
  submodule deinit: unset core.worktree
  submodule: ensure core.worktree is set after update
  submodule: unset core.worktree if no working tree is present

6 years agoMerge branch 'sb/object-store-grafts'
Junio C Hamano [Wed, 18 Jul 2018 19:20:27 +0000 (12:20 -0700)] 
Merge branch 'sb/object-store-grafts'

The conversion to pass "the_repository" and then "a_repository"
throughout the object access API continues.

* sb/object-store-grafts:
  commit: allow lookup_commit_graft to handle arbitrary repositories
  commit: allow prepare_commit_graft to handle arbitrary repositories
  shallow: migrate shallow information into the object parser
  path.c: migrate global git_path_* to take a repository argument
  cache: convert get_graft_file to handle arbitrary repositories
  commit: convert read_graft_file to handle arbitrary repositories
  commit: convert register_commit_graft to handle arbitrary repositories
  commit: convert commit_graft_pos() to handle arbitrary repositories
  shallow: add repository argument to is_repository_shallow
  shallow: add repository argument to check_shallow_file_for_update
  shallow: add repository argument to register_shallow
  shallow: add repository argument to set_alternate_shallow_file
  commit: add repository argument to lookup_commit_graft
  commit: add repository argument to prepare_commit_graft
  commit: add repository argument to read_graft_file
  commit: add repository argument to register_commit_graft
  commit: add repository argument to commit_graft_pos
  object: move grafts to object parser
  object-store: move object access functions to object-store.h

6 years agoMerge branch 'en/merge-recursive-cleanup'
Junio C Hamano [Wed, 18 Jul 2018 19:20:27 +0000 (12:20 -0700)] 
Merge branch 'en/merge-recursive-cleanup'

Code cleanup.

* en/merge-recursive-cleanup:
  merge-recursive: add pointer about unduly complex looking code
  merge-recursive: rename conflict_rename_*() family of functions
  merge-recursive: clarify the rename_dir/RENAME_DIR meaning
  merge-recursive: align labels with their respective code blocks
  merge-recursive: fix numerous argument alignment issues
  merge-recursive: fix miscellaneous grammar error in comment

6 years agouserdiff: support new keywords in PHP hunk header
Kana Natsuno [Tue, 3 Jul 2018 13:15:40 +0000 (22:15 +0900)] 
userdiff: support new keywords in PHP hunk header

Recent version of PHP supports interface, trait, abstract class and
final class.  This patch fixes the PHP hunk header regexp to support
all of these keywords.

Signed-off-by: Kana Natsuno <dev@whileimautomaton.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot4018: add missing test cases for PHP
Kana Natsuno [Tue, 3 Jul 2018 13:15:39 +0000 (22:15 +0900)] 
t4018: add missing test cases for PHP

A later patch changes the built-in PHP pattern. These test cases
demonstrate aspects of the pattern that we do not want to change.

Signed-off-by: Kana Natsuno <dev@whileimautomaton.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobuiltin/config: work around an unsized array forward declaration
Beat Bolli [Thu, 5 Jul 2018 18:34:45 +0000 (20:34 +0200)] 
builtin/config: work around an unsized array forward declaration

As reported here[0], Microsoft Visual Studio 2017.2 and "gcc -pedantic"
don't understand the forward declaration of an unsized static array.
They insist on an array size:

    d:\git\src\builtin\config.c(70,46): error C2133: 'builtin_config_options': unknown size

The thread [1] explains that this is due to the single-pass nature of
old compilers.

To work around this error, introduce the forward-declared function
usage_builtin_config() instead that uses the array
builtin_config_options only after it has been defined.

Also use this function in all other places where usage_with_options() is
called with the same arguments.

[0]: https://github.com/git-for-windows/git/issues/1735
[1]: https://groups.google.com/forum/#!topic/comp.lang.c.moderated/bmiF2xMz51U

Fixes https://github.com/git-for-windows/git/issues/1735

Reported-By: Karen Huang (via GitHub)
Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-rebase--preserve-merges: fix formatting of todo help message
Tobias Klauser [Fri, 6 Jul 2018 18:30:30 +0000 (11:30 -0700)] 
git-rebase--preserve-merges: fix formatting of todo help message

Part of the todo help message in git-rebase--preserve-merges.sh is
unnecessarily indented, making the message look weird.  Remove the
extra lines and trailing indent.

This was a minor regression introduced by d48f97aa ("rebase:
reindent function git_rebase__interactive", 2018-03-23) in the 2.18
timeframe.  The same issue exists in "rebase -i", but it is being
addressed separately as part of the rewrite of the subcommand into C.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5500: prettify non-commit tag tests
Jeff King [Tue, 3 Jul 2018 16:55:19 +0000 (12:55 -0400)] 
t5500: prettify non-commit tag tests

We don't need to use backslash continuation, as the "&&"
already provides continuation (and happily soaks up empty
lines between commands).

We can also expand the multi-line printf into a
here-document, which lets us use line breaks more naturally
(and avoids another continuation that required us to break
the natural indentation).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofast-import: do not call diff_delta() with empty buffer
Mike Hommey [Sat, 30 Jun 2018 21:41:06 +0000 (06:41 +0900)] 
fast-import: do not call diff_delta() with empty buffer

We know diff_delta() returns NULL, saying "no good delta exists for
it", when fed an empty data.  Check the length of the data in the
caller to avoid such a call.

This incidentally reduces the number of attempted deltification we
see in the final statistics.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofetch-pack: write shallow, then check connectivity
Jonathan Tan [Mon, 2 Jul 2018 22:08:43 +0000 (15:08 -0700)] 
fetch-pack: write shallow, then check connectivity

When fetching, connectivity is checked after the shallow file is
updated. There are 2 issues with this: (1) the connectivity check is
only performed up to ancestors of existing refs (which is not thorough
enough if we were deepening an existing ref in the first place), and (2)
there is no rollback of the shallow file if the connectivity check
fails.

To solve (1), update the connectivity check to check the ancestry chain
completely in the case of a deepening fetch by refraining from passing
"--not --all" when invoking rev-list in connected.c.

To solve (2), have fetch_pack() perform its own connectivity check
before updating the shallow file. To support existing use cases in which
"git fetch-pack" is used to download objects without much regard as to
the connectivity of the resulting objects with respect to the existing
repository, the connectivity check is only done if necessary (that is,
the fetch is not a clone, and the fetch involves shallow/deepen
functionality). "git fetch" still performs its own connectivity check,
preserving correctness but sometimes performing redundant work. This
redundancy is mitigated by the fact that fetch_pack() reports if it has
performed a connectivity check itself, and if the transport supports
connect or stateless-connect, it will bubble up that report so that "git
fetch" knows not to perform the connectivity check in such a case.

This was noticed when a user tried to deepen an existing repository by
fetching with --no-shallow from a server that did not send all necessary
objects - the connectivity check as run by "git fetch" succeeded, but a
subsequent "git fsck" failed.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoref-filter: avoid backend filtering with --ignore-case
Jeff King [Mon, 2 Jul 2018 21:12:42 +0000 (17:12 -0400)] 
ref-filter: avoid backend filtering with --ignore-case

When for-each-ref is used with --ignore-case, we expect
match_name_as_path() to do a case-insensitive match. But
there's an extra layer of filtering that happens before we
even get there. Since commit cfe004a5a9 (ref-filter: limit
traversal to prefix, 2017-05-22), we feed the prefix to the
ref backend so that it can optimize the ref iteration.

There's no mechanism for us to tell the backend we're matching
case-insensitively.  Nor is there likely to be one anytime soon,
since the packed backend relies on binary-searching the sorted list
of refs. Let's just punt on this case. The extra filtering is an
optimization that we simply can't do. We'll still give the correct
answer via the filtering in match_name_as_path().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofor-each-ref: consistently pass WM_IGNORECASE flag
Aleksandr Makarov [Mon, 2 Jul 2018 21:11:59 +0000 (17:11 -0400)] 
for-each-ref: consistently pass WM_IGNORECASE flag

The match_name_as_path() function learned to set
WM_IGNORECASE in the "flags" field when the user passed
--ignore-case. But it forgot to actually pass the flags to
wildmatch()!

As a result, the --ignore-case feature has been broken since
it was added in 3bb16a8bf2 (tag, branch, for-each-ref: add
--ignore-case for sorting and filtering, 2016-12-04). We
didn't notice because we added tests only for git-branch and
git-tag. Whereas git-for-each-ref has slightly different
matching rules, and thus uses a different function (the
related function match_pattern() does it correctly).

Incidentally, this also caused clang's scan-build to
complain about the code; the assignment to "flags" was dead
code.

Note that we can't flip the test in t6300 to expect_success
yet. There's another bug, which will be dealt with in the
next patch.

Commit-message-by: Jeff King <peff@peff.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot6300: add a test for --ignore-case
Jeff King [Mon, 2 Jul 2018 21:11:23 +0000 (17:11 -0400)] 
t6300: add a test for --ignore-case

The --ignore-case option was added by 3bb16a8bf2 (tag,
branch, for-each-ref: add --ignore-case for sorting and
filtering, 2016-12-04), but it was never tested. And indeed,
it does not work due to multiple bugs (which will be fixed
in subsequent patches).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofsck: check skiplist for object in fsck_blob()
Ramsay Jones [Wed, 27 Jun 2018 18:39:53 +0000 (19:39 +0100)] 
fsck: check skiplist for object in fsck_blob()

Since commit ed8b10f631 ("fsck: check .gitmodules content", 2018-05-02),
fsck will issue an error message for '.gitmodules' content that cannot
be parsed correctly. This is the case, even when the corresponding blob
object has been included on the skiplist. For example, using the cgit
repository, we see the following:

  $ git fsck
  Checking object directories: 100% (256/256), done.
  error: bad config line 5 in blob .gitmodules
  error in blob 51dd1eff1edc663674df9ab85d2786a40f7ae3a5: gitmodulesParse: could not parse gitmodules blob
  Checking objects: 100% (6626/6626), done.
  $

  $ git config fsck.skiplist '.git/skip'
  $ echo 51dd1eff1edc663674df9ab85d2786a40f7ae3a5 >.git/skip
  $

  $ git fsck
  Checking object directories: 100% (256/256), done.
  error: bad config line 5 in blob .gitmodules
  Checking objects: 100% (6626/6626), done.
  $

Note that the error message issued by the config parser is still
present, despite adding the object-id of the blob to the skiplist.

One solution would be to provide a means of suppressing the messages
issued by the config parser. However, given that (logically) we are
asking fsck to ignore this object, a simpler approach is to just not
call the config parser if the object is to be skipped. Add a check to
the 'fsck_blob()' processing function, to determine if the object is
on the skiplist and, if so, exit the function early.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years ago.mailmap: merge different spellings of names
Stefan Beller [Fri, 29 Jun 2018 02:10:48 +0000 (19:10 -0700)] 
.mailmap: merge different spellings of names

This is a continuation of 94b410bba86 (.mailmap: Map email
addresses to names, 2013-07-12), merging names that are
spelled differently but have the same author email to the
same person.

Most spellings differed in accents or the order of names.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMakefile: fix the "built from commit" code
Johannes Schindelin [Wed, 27 Jun 2018 19:35:23 +0000 (21:35 +0200)] 
Makefile: fix the "built from commit" code

In ed32b788c06 (version --build-options: report commit, too, if
possible, 2017-12-15), we introduced code to let `git version
--build-options` report the current commit from which the binaries were
built, if any.

To prevent erroneous commits from being reported (e.g. when unpacking
Git's source code from a .tar.gz file into a subdirectory of a different
Git project, as e.g. git_osx_installer does), we painstakingly set
GIT_CEILING_DIRECTORIES when trying to determine the current commit.

Except that we got the quoting wrong, and that variable therefore does
not have the desired effect.

The issue is that the $(shell) is resolved before the output is stuffed
into the command-line with -DGIT_BUILT_FROM_COMMIT, and therefore is
*not* inside quotes. And thus backslashing the quotes is wrong, as the
quote gets literally inserted into the CEILING_DIRECTORIES variable.

Let's fix that quoting, and while at it, also suppress the unhelpful
message

fatal: not a git repository (or any of the parent directories): .git

that gets printed to stderr if no current commit could be determined,
and might scare the occasional developer who simply tries to build Git
from scratch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5407: fix test to cover intended arguments
Elijah Newren [Thu, 7 Jun 2018 05:05:50 +0000 (22:05 -0700)] 
t5407: fix test to cover intended arguments

Test 8 in t5407 appears to be an accidental exact duplicate of of test 5;
the testcode is identical and has identical repo state, but the test
description is different and suggests that rebase -m followed by rebase
--skip was what was actually supposed to be tested.  Modify the test to
include the -m option.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoapply: fix grammar error in comment
Elijah Newren [Thu, 7 Jun 2018 05:05:25 +0000 (22:05 -0700)] 
apply: fix grammar error in comment

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoSecond batch for 2.19 cycle
Junio C Hamano [Thu, 28 Jun 2018 19:55:47 +0000 (12:55 -0700)] 
Second batch for 2.19 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'sb/fix-fetching-moved-submodules'
Junio C Hamano [Thu, 28 Jun 2018 19:53:34 +0000 (12:53 -0700)] 
Merge branch 'sb/fix-fetching-moved-submodules'

The code to try seeing if a fetch is necessary in a submodule
during a fetch with --recurse-submodules got confused when the path
to the submodule was changed in the range of commits in the
superproject, sometimes showing "(null)".  This has been corrected.

* sb/fix-fetching-moved-submodules:
  t5526: test recursive submodules when fetching moved submodules
  submodule: fix NULL correctness in renamed broken submodules

6 years agoMerge branch 'tz/cred-netrc-cleanup'
Junio C Hamano [Thu, 28 Jun 2018 19:53:33 +0000 (12:53 -0700)] 
Merge branch 'tz/cred-netrc-cleanup'

Build and test procedure for netrc credential helper (in contrib/)
has been updated.

* tz/cred-netrc-cleanup:
  git-credential-netrc: make "all" default target of Makefile
  git-credential-netrc: fix exit status when tests fail
  git-credential-netrc: use in-tree Git.pm for tests
  git-credential-netrc: minor whitespace cleanup in test script

6 years agoMerge branch 'jc/clean-after-sanity-tests'
Junio C Hamano [Thu, 28 Jun 2018 19:53:33 +0000 (12:53 -0700)] 
Merge branch 'jc/clean-after-sanity-tests'

test cleanup.

* jc/clean-after-sanity-tests:
  tests: clean after SANITY tests

6 years agoMerge branch 'nd/completion-negation'
Junio C Hamano [Thu, 28 Jun 2018 19:53:32 +0000 (12:53 -0700)] 
Merge branch 'nd/completion-negation'

Continuing with the idea to programmatically enumerate various
pieces of data required for command line completion, the codebase
has been taught to enumerate options prefixed with "--no-" to
negate them.

* nd/completion-negation:
  completion: collapse extra --no-.. options
  completion: suppress some -no- options
  parse-options: option to let --git-completion-helper show negative form

6 years agoMerge branch 'pw/add-p-recount'
Junio C Hamano [Thu, 28 Jun 2018 19:53:32 +0000 (12:53 -0700)] 
Merge branch 'pw/add-p-recount'

When user edits the patch in "git add -p" and the user's editor is
set to strip trailing whitespaces indiscriminately, an empty line
that is unchanged in the patch would become completely empty
(instead of a line with a sole SP on it).  The code introduced in
Git 2.17 timeframe failed to parse such a patch, but now it learned
to notice the situation and cope with it.

* pw/add-p-recount:
  add -p: fix counting empty context lines in edited patches

6 years agoMerge branch 'jk/fetch-all-peeled-fix'
Junio C Hamano [Thu, 28 Jun 2018 19:53:32 +0000 (12:53 -0700)] 
Merge branch 'jk/fetch-all-peeled-fix'

"git fetch-pack --all" used to unnecessarily fail upon seeing an
annotated tag that points at an object other than a commit.

* jk/fetch-all-peeled-fix:
  fetch-pack: test explicitly that --all can fetch tag references pointing to non-commits
  fetch-pack: don't try to fetch peel values with --all

6 years agoMerge branch 'ms/send-pack-honor-config'
Junio C Hamano [Thu, 28 Jun 2018 19:53:30 +0000 (12:53 -0700)] 
Merge branch 'ms/send-pack-honor-config'

"git send-pack --signed" (hence "git push --signed" over the http
transport) did not read user ident from the config mechanism to
determine whom to sign the push certificate as, which has been
corrected.

* ms/send-pack-honor-config:
  builtin/send-pack: populate the default configs

6 years agoMerge branch 'jh/partial-clone'
Junio C Hamano [Thu, 28 Jun 2018 19:53:30 +0000 (12:53 -0700)] 
Merge branch 'jh/partial-clone'

The recent addition of "partial clone" experimental feature kicked
in when it shouldn't, namely, when there is no partial-clone filter
defined even if extensions.partialclone is set.

* jh/partial-clone:
  list-objects: check if filter is NULL before using

6 years agoMerge branch 'sg/gpg-tests-fix'
Junio C Hamano [Thu, 28 Jun 2018 19:53:29 +0000 (12:53 -0700)] 
Merge branch 'sg/gpg-tests-fix'

Some flaky tests have been fixed.

* sg/gpg-tests-fix:
  tests: make forging GPG signed commits and tags more robust
  t7510-signed-commit: use 'test_must_fail'

6 years agoMerge branch 'as/safecrlf-quiet-fix'
Junio C Hamano [Thu, 28 Jun 2018 19:53:29 +0000 (12:53 -0700)] 
Merge branch 'as/safecrlf-quiet-fix'

Fix for 2.17-era regression around `core.safecrlf`.

* as/safecrlf-quiet-fix:
  config.c: fix regression for core.safecrlf false

6 years agoMerge branch 'ab/refspec-init-fix'
Junio C Hamano [Thu, 28 Jun 2018 19:53:29 +0000 (12:53 -0700)] 
Merge branch 'ab/refspec-init-fix'

Make refspec parsing codepath more robust.

* ab/refspec-init-fix:
  refspec: initalize `refspec_item` in `valid_fetch_refspec()`
  refspec: add back a refspec_item_init() function
  refspec: s/refspec_item_init/&_or_die/g

6 years agoDocumentation: declare "core.ignoreCase" as internal variable
Marc Strapetz [Thu, 28 Jun 2018 11:21:57 +0000 (13:21 +0200)] 
Documentation: declare "core.ignoreCase" as internal variable

The current description of "core.ignoreCase" reads like an option which
is intended to be changed by the user while it's actually expected to
be set by Git on initialization only. Subsequently, Git relies on the
proper configuration of this variable, as noted by Bryan Turner [1]:

    Git on a case-insensitive filesystem (APFS, HFS+, FAT32, exFAT,
    vFAT, NTFS, etc.) is not designed to be run with anything other
    than core.ignoreCase=true.

[1] https://marc.info/?l=git&m=152998665813997&w=2
    mid:CAGyf7-GeE8jRGPkME9rHKPtHEQ6P1+ebpMMWAtMh01uO3bfy8w@mail.gmail.com

Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocommit-graph: fix documentation inconsistencies
Derrick Stolee [Thu, 28 Jun 2018 12:52:45 +0000 (12:52 +0000)] 
commit-graph: fix documentation inconsistencies

The commit-graph feature shipped in Git 2.18 has some inconsistencies in
the constants used by the implementation and specified by the format
document.

The commit data chunk uses the key "CDAT" in the file format, but was
previously documented to say "CGET".

The commit data chunk stores commit parents using two 32-bit fields that
typically store the integer position of the parent in the list of commit
ids within the commit-graph file. When a parent does not exist, we had
documented the value 0xffffffff, but implemented the value 0x70000000.
This swap is easy to correct in the documentation, but unfortunately
reduces the number of commits that we can store in the commit-graph.
Update that estimate, too.

Reported-by: Grant Welch <gwelch925@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofetch-pack: implement ref-in-want
Brandon Williams [Wed, 27 Jun 2018 22:30:23 +0000 (15:30 -0700)] 
fetch-pack: implement ref-in-want

Implement ref-in-want on the client side so that when a server supports
the "ref-in-want" feature, a client will send "want-ref" lines for each
reference the client wants to fetch.  This feature allows clients to
tolerate inconsistencies that exist when a remote repository's refs
change during the course of negotiation.

This allows a client to request to request a particular ref without
specifying the OID of the ref.  This means that instead of hitting an
error when a ref no longer points at the OID it did at the beginning of
negotiation, negotiation can continue and the value of that ref will be
sent at the termination of negotiation, just before a packfile is sent.

More information on the ref-in-want feature can be found in
Documentation/technical/protocol-v2.txt.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofetch-pack: put shallow info in output parameter
Brandon Williams [Wed, 27 Jun 2018 22:30:22 +0000 (15:30 -0700)] 
fetch-pack: put shallow info in output parameter

Expand the transport fetch method signature, by adding an output
parameter, to allow transports to return information about the refs they
have fetched.  Then communicate shallow status information through this
mechanism instead of by modifying the input list of refs.

This does require clients to sometimes generate the ref map twice: once
from the list of refs provided by the remote (as is currently done) and
potentially once from the new list of refs that the fetch mechanism
provides.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofetch: refactor to make function args narrower
Brandon Williams [Wed, 27 Jun 2018 22:30:21 +0000 (15:30 -0700)] 
fetch: refactor to make function args narrower

Refactor find_non_local_tags and get_ref_map to only take the
information they need instead of the entire transport struct. Besides
improving code clarity, this also improves their flexibility, allowing
for a different set of refs to be used instead of relying on the ones
stored in the transport struct.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofetch: refactor fetch_refs into two functions
Brandon Williams [Wed, 27 Jun 2018 22:30:20 +0000 (15:30 -0700)] 
fetch: refactor fetch_refs into two functions

Refactor the fetch_refs function into a function that does the fetching
of refs and another function that stores them.  This is in preparation
for allowing additional processing of the fetched refs before updating
the local ref store.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofetch: refactor the population of peer ref OIDs
Brandon Williams [Wed, 27 Jun 2018 22:30:19 +0000 (15:30 -0700)] 
fetch: refactor the population of peer ref OIDs

Populate peer ref OIDs in get_ref_map instead of do_fetch. Besides
tightening scopes of variables in the code, this also prepares for
get_ref_map being able to be called multiple times within do_fetch.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoupload-pack: test negotiation with changing repository
Brandon Williams [Wed, 27 Jun 2018 22:30:18 +0000 (15:30 -0700)] 
upload-pack: test negotiation with changing repository

Add tests to check the behavior of fetching from a repository which
changes between rounds of negotiation (for example, when different
servers in a load-balancing agreement participate in the same stateless
RPC negotiation). This forms a baseline of comparison to the ref-in-want
functionality (which will be introduced to the client in subsequent
commits), and ensures that subsequent commits do not change existing
behavior.

As part of this effort, a mechanism to substitute strings in a single
HTTP response is added.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoupload-pack: implement ref-in-want
Brandon Williams [Wed, 27 Jun 2018 22:30:17 +0000 (15:30 -0700)] 
upload-pack: implement ref-in-want

Currently, while performing packfile negotiation, clients are only
allowed to specify their desired objects using object ids.  This causes
a vulnerability to failure when an object turns non-existent during
negotiation, which may happen if, for example, the desired repository is
provided by multiple Git servers in a load-balancing arrangement and
there exists replication delay.

In order to eliminate this vulnerability, implement the ref-in-want
feature for the 'fetch' command in protocol version 2.  This feature
enables the 'fetch' command to support requests in the form of ref names
through a new "want-ref <ref>" parameter.  At the conclusion of
negotiation, the server will send a list of all of the wanted references
(as provided by "want-ref" lines) in addition to the generated packfile.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-rebase--merge: modernize "git-$cmd" to "git $cmd"
Elijah Newren [Wed, 27 Jun 2018 07:46:00 +0000 (00:46 -0700)] 
git-rebase--merge: modernize "git-$cmd" to "git $cmd"

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoFix use of strategy options with interactive rebases
Elijah Newren [Wed, 27 Jun 2018 15:48:04 +0000 (08:48 -0700)] 
Fix use of strategy options with interactive rebases

git-rebase.sh wrote strategy options to .git/rebase/merge/strategy_opts
in the following format:
  '--ours'  '--renormalize'
Note the double spaces.

git-rebase--interactive uses sequencer.c to parse that file, and
sequencer.c used split_cmdline() to get the individual strategy options.
After splitting, sequencer.c prefixed each "option" with a double dash,
so, concatenating all its options would result in:
  -- --ours -- --renormalize

So, when it ended up calling try_merge_strategy(), that in turn would run
  git merge-$strategy -- --ours -- --renormalize $merge_base -- $head $remote

instead of the expected/desired
  git merge-$strategy --ours --renormalize $merge_base -- $head $remote

Remove the extra spaces so that when it goes through split_cmdline() we end
up with the desired command line.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot3418: add testcase showing problems with rebase -i and strategy options
Elijah Newren [Wed, 27 Jun 2018 15:48:03 +0000 (08:48 -0700)] 
t3418: add testcase showing problems with rebase -i and strategy options

We are not passing the same args to merge strategies when we are doing an
--interactive rebase as we do with a --merge rebase.  The merge strategy
should not need to be aware of which type of rebase is in effect.  Add a
testcase which checks for the appropriate args.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodir.c: fix typos in core.excludesfile comment
Todd Zullinger [Wed, 27 Jun 2018 04:46:52 +0000 (00:46 -0400)] 
dir.c: fix typos in core.excludesfile comment

Make it easier to find references to core.excludesfile and the default
$XDG_CONFIG_HOME/git/ignore path.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogitignore.txt: clarify default core.excludesfile path
Todd Zullinger [Wed, 27 Jun 2018 04:46:51 +0000 (00:46 -0400)] 
gitignore.txt: clarify default core.excludesfile path

The default core.excludesfile path is $XDG_CONFIG_HOME/git/ignore.
$HOME/.config/git/ignore is used if XDG_CONFIG_HOME is empty or unset,
as described later in the document.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-rebase: make --allow-empty-message the default
Elijah Newren [Wed, 27 Jun 2018 07:23:19 +0000 (00:23 -0700)] 
git-rebase: make --allow-empty-message the default

rebase backends currently behave differently with empty commit messages,
largely as a side-effect of the different underlying commands on which
they are based.  am-based rebases apply commits with an empty commit
message without stopping or requiring the user to specify an extra flag.
(It is interesting to note that am-based rebases are the default rebase
type, and no one has ever requested a --no-allow-empty-message flag to
change this behavior.)  merge-based and interactive-based rebases (which
are ultimately based on git-commit), will currently halt on any such
commits and require the user to manually specify what to do with the
commit and continue.

One possible rationale for the difference in behavior is that the purpose
of an "am" based rebase is solely to transplant an existing history, while
an "interactive" rebase is one whose purpose is to polish a series before
making it publishable.  Thus, stopping and asking for confirmation for a
possible problem is more appropriate in the latter case.  However, there
are two problems with this rationale:

  1) merge-based rebases are also non-interactive and there are multiple
     types of rebases that use the interactive machinery but are not
     explicitly interactive (e.g. when either --rebase-merges or
     --keep-empty are specified without --interactive).  These rebases are
     also used solely to transplant an existing history, and thus also
     should default to --allow-empty-message.

  2) this rationale only says that the user is more accepting of stopping
     in the case of an explicitly interactive rebase, not that stopping
     for this particular reason actually makes sense.  Exploring whether
     it makes sense, requires backing up and analyzing the underlying
     commands...

If git-commit did not error out on empty commits by default, accidental
creation of commits with empty messages would be a very common occurrence
(this check has caught me many times).  Further, nearly all such empty
commit messages would be considered an accidental error (as evidenced by a
huge amount of documentation across version control systems and in various
blog posts explaining how important commit messages are).  A simple check
for what would otherwise be a common error thus made a lot of sense, and
git-commit gained an --allow-empty-message flag for special case
overrides.  This has made commits with empty messages very rare.

There are two sources for commits with empty messages for rebase (and
cherry-pick): (a) commits created in git where the user previously
specified --allow-empty-message to git-commit, and (b) commits imported
into git from other version control systems.  In case (a), the user has
already explicitly specified that there is something special about this
commit that makes them not want to specify a commit message; forcing them
to re-specify with every cherry-pick or rebase seems more likely to be
infuriating than helpful.  In case (b), the commit is highly unlikely to
have been authored by the person who has imported the history and is doing
the rebase or cherry-pick, and thus the user is unlikely to be the
appropriate person to write a commit message for it.  Stopping and
expecting the user to modify the commit before proceeding thus seems
counter-productive.

Further, note that while empty commit messages was a common error case for
git-commit to deal with, it is a rare case for rebase (or cherry-pick).
The fact that it is rare raises the question of why it would be worth
checking and stopping on this particular condition and not others.  For
example, why doesn't an interactive rebase automatically stop if the
commit message's first line is 2000 columns long, or is missing a blank
line after the first line, or has every line indented with five spaces, or
any number of other myriad problems?

Finally, note that if a user doing an interactive rebase does have the
necessary knowledge to add a message for any such commit and wants to do
so, it is rather simple for them to change the appropriate line from
'pick' to 'reword'.  The fact that the subject is empty in the todo list
that the user edits should even serve as a way to notify them.

As far as I can tell, the fact that merge-based and interactive-based
rebases stop on commits with empty commit messages is solely a by-product
of having been based on git-commit.  It went without notice for a long
time precisely because such cases are rare.  The rareness of this
situation made it difficult to reason about, so when folks did eventually
notice this behavior, they assumed it was there for a good reason and just
added an --allow-empty-message flag.  In my opinion, stopping on such
messages not desirable in any of these cases, even the (explicitly)
interactive case.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot3401: add directory rename testcases for rebase and am
Elijah Newren [Wed, 27 Jun 2018 07:23:18 +0000 (00:23 -0700)] 
t3401: add directory rename testcases for rebase and am

Add a simple directory rename testcase, in conjunction with each of the
types of rebases:
  git-rebase--interactive
  git-rebase--am
  git-rebase--merge
and also use the same testcase for
  git am --3way

This demonstrates a difference in behavior between the different rebase
backends in regards to directory rename detection.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-rebase.txt: document behavioral differences between modes
Elijah Newren [Wed, 27 Jun 2018 07:23:17 +0000 (00:23 -0700)] 
git-rebase.txt: document behavioral differences between modes

There are a variety of aspects that are common to all rebases regardless
of which backend is in use; however, the behavior for these different
aspects varies in ways that could surprise users.  (In fact, it's not
clear -- to me at least -- that these differences were even desirable or
intentional.)  Document these differences.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodirectory-rename-detection.txt: technical docs on abilities and limitations
Elijah Newren [Wed, 27 Jun 2018 07:23:16 +0000 (00:23 -0700)] 
directory-rename-detection.txt: technical docs on abilities and limitations

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-rebase.txt: address confusion between --no-ff vs --force-rebase
Elijah Newren [Wed, 27 Jun 2018 07:23:15 +0000 (00:23 -0700)] 
git-rebase.txt: address confusion between --no-ff vs --force-rebase

rebase was taught the --force-rebase option in commit b2f82e05de ("Teach
rebase to rebase even if upstream is up to date", 2009-02-13).  This flag
worked for the am and merge backends, but wasn't a valid option for the
interactive backend.

rebase was taught the --no-ff option for interactive rebases in commit
b499549401cb ("Teach rebase the --no-ff option.", 2010-03-24), to do the
exact same thing as --force-rebase does for non-interactive rebases.  This
commit explicitly documented the fact that --force-rebase was incompatible
with --interactive, though it made --no-ff a synonym for --force-rebase
for non-interactive rebases.  The choice of a new option was based on the
fact that "force rebase" didn't sound like an appropriate term for the
interactive machinery.

In commit 6bb4e485cff8 ("rebase: align variable names", 2011-02-06), the
separate parsing of command line options in the different rebase scripts
was removed, and whether on accident or because the author noticed that
these options did the same thing, the options became synonyms and both
were accepted by all three rebase types.

In commit 2d26d533a012 ("Documentation/git-rebase.txt: -f forces a rebase
that would otherwise be a no-op", 2014-08-12), which reworded the
description of the --force-rebase option, the (no-longer correct) sentence
stating that --force-rebase was incompatible with --interactive was
finally removed.

Finally, as explained at
https://public-inbox.org/git/98279912-0f52-969d-44a6-22242039387f@xiplink.com

    In the original discussion around this option [1], at one point I
    proposed teaching rebase--interactive to respect --force-rebase
    instead of adding a new option [2].  Ultimately --no-ff was chosen as
    the better user interface design [3], because an interactive rebase
    can't be "forced" to run.

We have accepted both --no-ff and --force-rebase as full synonyms for all
three rebase types for over seven years.  Documenting them differently
and in ways that suggest they might not be quite synonyms simply leads to
confusion.  Adjust the documentation to match reality.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-rebase: error out when incompatible options passed
Elijah Newren [Wed, 27 Jun 2018 07:23:14 +0000 (00:23 -0700)] 
git-rebase: error out when incompatible options passed

git rebase has three different types: am, merge, and interactive, all of
which are implemented in terms of separate scripts.  am builds on git-am,
merge builds on git-merge-recursive, and interactive builds on
git-cherry-pick.  We make use of features in those lower-level commands in
the different rebase types, but those features don't exist in all of the
lower level commands so we have a range of incompatibilities.  Previously,
we just accepted nearly any argument and silently ignored whichever ones
weren't implemented for the type of rebase specified.  Change this so the
incompatibilities are documented, included in the testsuite, and tested
for at runtime with an appropriate error message shown.

Some exceptions I left out:

  * --merge and --interactive are technically incompatible since they are
    supposed to run different underlying scripts, but with a few small
    changes, --interactive can do everything that --merge can.  In fact,
    I'll shortly be sending another patch to remove git-rebase--merge and
    reimplement it on top of git-rebase--interactive.

  * One could argue that --interactive and --quiet are incompatible since
    --interactive doesn't implement a --quiet mode (perhaps since
    cherry-pick itself does not implement one).  However, the interactive
    mode is more quiet than the other modes in general with progress
    messages, so one could argue that it's already quiet.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot3422: new testcases for checking when incompatible options passed
Elijah Newren [Wed, 27 Jun 2018 07:23:13 +0000 (00:23 -0700)] 
t3422: new testcases for checking when incompatible options passed

git rebase is split into three types: am, merge, and interactive.  Various
options imply different types, and which mode we are using determine which
sub-script (git-rebase--$type) is executed to finish the work.  Not all
options work with all types, so add tests for combinations where we expect
to receive an error rather than having options be silently ignored.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase: fix documentation formatting
Vladimir Parfinenko [Wed, 27 Jun 2018 08:57:43 +0000 (15:57 +0700)] 
rebase: fix documentation formatting

Last sections are squashed into non-formatted block after adding
"REBASING MERGES".
To reproduce the error see bottom of page:
https://git-scm.com/docs/git-rebase

Signed-off-by: Vladimir Parfinenko <vparfinenko@excelsior-usa.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofilter-branch: skip commits present on --state-branch
Michael Barabanov [Tue, 26 Jun 2018 04:07:33 +0000 (21:07 -0700)] 
filter-branch: skip commits present on --state-branch

The commits in state:filter.map have already been processed, so don't
filter them again. This makes incremental git filter-branch much faster.

Also add tests for --state-branch option.

Signed-off-by: Michael Barabanov <michael.barabanov@gmail.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule-config: reuse config_from_gitmodules in repo_read_gitmodules
Antonio Ospite [Tue, 26 Jun 2018 10:47:10 +0000 (12:47 +0200)] 
submodule-config: reuse config_from_gitmodules in repo_read_gitmodules

Reuse config_from_gitmodules in repo_read_gitmodules to remove some
duplication and also have a single point where the .gitmodules file is
read.

The change does not introduce any new behavior, the same gitmodules_cb
config callback is still used, which only deals with configuration
specific to submodules.

The check about the repo's worktree is removed from repo_read_gitmodules
because it's already performed in config_from_gitmodules.

The config_from_gitmodules function is moved up in the file —unchanged—
before its users to avoid a forward declaration.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Acked-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule-config: pass repository as argument to config_from_gitmodules
Antonio Ospite [Tue, 26 Jun 2018 10:47:09 +0000 (12:47 +0200)] 
submodule-config: pass repository as argument to config_from_gitmodules

Generalize config_from_gitmodules() to accept a repository as an argument.

This is in preparation to reuse the function in repo_read_gitmodules in
order to have a single point where the '.gitmodules' file is accessed.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Acked-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule-config: make 'config_from_gitmodules' private
Antonio Ospite [Tue, 26 Jun 2018 10:47:08 +0000 (12:47 +0200)] 
submodule-config: make 'config_from_gitmodules' private

Now that 'config_from_gitmodules' is not used in the open, it can be
marked as private.

Hopefully this will prevent its usage for retrieving arbitrary
configuration form the '.gitmodules' file.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Acked-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule-config: add helper to get 'update-clone' config from .gitmodules
Antonio Ospite [Tue, 26 Jun 2018 10:47:07 +0000 (12:47 +0200)] 
submodule-config: add helper to get 'update-clone' config from .gitmodules

Add a helper function to make it clearer that retrieving 'update-clone'
configuration from the .gitmodules file is a special case supported
solely for backward compatibility purposes.

This change removes one direct use of 'config_from_gitmodules' for
options not strictly related to submodules: "submodule.fetchjobs" does
not describe a property of a submodule, but a behavior of other commands
when dealing with submodules, so it does not really belong to the
.gitmodules file.

This is in the effort to communicate better that .gitmodules is not to
be used as a mechanism to store arbitrary configuration in the
repository that any command can retrieve.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Acked-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule-config: add helper function to get 'fetch' config from .gitmodules
Antonio Ospite [Tue, 26 Jun 2018 10:47:06 +0000 (12:47 +0200)] 
submodule-config: add helper function to get 'fetch' config from .gitmodules

Add a helper function to make it clearer that retrieving 'fetch'
configuration from the .gitmodules file is a special case supported
solely for backward compatibility purposes.

This change removes one direct use of 'config_from_gitmodules' in code
not strictly related to submodules, in the effort to communicate better
that .gitmodules is not to be used as a mechanism to store arbitrary
configuration in the repository that any command can retrieve.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Acked-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoconfig: move config_from_gitmodules to submodule-config.c
Antonio Ospite [Tue, 26 Jun 2018 10:47:05 +0000 (12:47 +0200)] 
config: move config_from_gitmodules to submodule-config.c

The .gitmodules file is not meant as a place to store arbitrary
configuration to distribute with the repository.

Move config_from_gitmodules() out of config.c and into
submodule-config.c to make it even clearer that it is not a mechanism to
retrieve arbitrary configuration from the .gitmodules file.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Acked-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMakefile: tweak sed invocation
Alejandro R. Sedeño [Mon, 25 Jun 2018 19:13:25 +0000 (15:13 -0400)] 
Makefile: tweak sed invocation

With GNU sed, the r command doesn't care if a space separates it and
the filename it reads from.

With SunOS sed, the space is required.

Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-rebase.sh: update help messages a bit
Elijah Newren [Mon, 25 Jun 2018 16:12:53 +0000 (09:12 -0700)] 
git-rebase.sh: update help messages a bit

signoff is not specific to the am-backend.  Also, re-order a few options
to make like things (e.g. strategy and strategy-option) be near each
other.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-rebase.txt: document incompatible options
Elijah Newren [Mon, 25 Jun 2018 16:12:52 +0000 (09:12 -0700)] 
git-rebase.txt: document incompatible options

git rebase has many options that only work with one of its three backends.
It also has a few other pairs of incompatible options.  Document these.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoFirst batch for 2.19 cycle
Junio C Hamano [Mon, 25 Jun 2018 20:27:15 +0000 (13:27 -0700)] 
First batch for 2.19 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'sb/plug-misc-leaks'
Junio C Hamano [Mon, 25 Jun 2018 20:22:41 +0000 (13:22 -0700)] 
Merge branch 'sb/plug-misc-leaks'

Misc leak plugging.

* sb/plug-misc-leaks:
  sequencer.c: plug mem leak in git_sequencer_config
  sequencer.c: plug leaks in do_pick_commit
  submodule--helper: plug mem leak in print_default_remote
  refs/packed-backend.c: close fd of empty file

6 years agoMerge branch 'cc/tests-without-assuming-ref-files-backend'
Junio C Hamano [Mon, 25 Jun 2018 20:22:41 +0000 (13:22 -0700)] 
Merge branch 'cc/tests-without-assuming-ref-files-backend'

Instead of mucking with filesystem directly, use plumbing commands
update-ref etc. to manipulate the refs in the tests.

* cc/tests-without-assuming-ref-files-backend:
  t9104: kosherly remove remote refs

6 years agoMerge branch 'sg/update-ref-stdin-cleanup'
Junio C Hamano [Mon, 25 Jun 2018 20:22:40 +0000 (13:22 -0700)] 
Merge branch 'sg/update-ref-stdin-cleanup'

Code cleanup.

* sg/update-ref-stdin-cleanup:
  update-ref --stdin: use skip_prefix()

6 years agoMerge branch 'nd/reject-empty-shallow-request'
Junio C Hamano [Mon, 25 Jun 2018 20:22:40 +0000 (13:22 -0700)] 
Merge branch 'nd/reject-empty-shallow-request'

"git fetch --shallow-since=<cutoff>" that specifies the cut-off
point that is newer than the existing history used to end up
grabbing the entire history.  Such a request now errors out.

* nd/reject-empty-shallow-request:
  upload-pack: reject shallow requests that would return nothing