git
5 years agoMerge branch 'as/sequencer-customizable-comment-char'
Junio C Hamano [Tue, 24 Jul 2018 21:50:51 +0000 (14:50 -0700)] 
Merge branch 'as/sequencer-customizable-comment-char'

Honor core.commentchar when preparing the list of commits to replay
in "rebase -i".

* as/sequencer-customizable-comment-char:
  sequencer: use configured comment character

5 years agoMerge branch 'sb/blame-color'
Junio C Hamano [Tue, 24 Jul 2018 21:50:50 +0000 (14:50 -0700)] 
Merge branch 'sb/blame-color'

Code clean-up.

* sb/blame-color:
  blame: prefer xsnprintf to strcpy for colors

5 years agoMerge branch 'nd/command-list'
Junio C Hamano [Tue, 24 Jul 2018 21:50:50 +0000 (14:50 -0700)] 
Merge branch 'nd/command-list'

Build doc update for Windows.

* nd/command-list:
  vcbuild/README: update to accommodate for missing common-cmds.h

5 years agoMerge branch 'es/test-lint-one-shot-export'
Junio C Hamano [Tue, 24 Jul 2018 21:50:50 +0000 (14:50 -0700)] 
Merge branch 'es/test-lint-one-shot-export'

Look for broken use of "VAR=VAL shell_func" in test scripts as part
of test-lint.

* es/test-lint-one-shot-export:
  t/check-non-portable-shell: detect "FOO=bar shell_func"
  t/check-non-portable-shell: make error messages more compact
  t/check-non-portable-shell: stop being so polite
  t6046/t9833: fix use of "VAR=VAL cmd" with a shell function

5 years agoMerge branch 'wc/find-commit-with-pattern-on-detached-head'
Junio C Hamano [Tue, 24 Jul 2018 21:50:49 +0000 (14:50 -0700)] 
Merge branch 'wc/find-commit-with-pattern-on-detached-head'

"git rev-parse ':/substring'" did not consider the history leading
only to HEAD when looking for a commit with the given substring,
when the HEAD is detached.  This has been fixed.

* wc/find-commit-with-pattern-on-detached-head:
  sha1-name.c: for ":/", find detached HEAD commits

5 years agoMerge branch 'jc/t3404-one-shot-export-fix'
Junio C Hamano [Tue, 24 Jul 2018 21:50:49 +0000 (14:50 -0700)] 
Merge branch 'jc/t3404-one-shot-export-fix'

Correct a broken use of "VAR=VAL shell_func" in a test.

* jc/t3404-one-shot-export-fix:
  t3404: fix use of "VAR=VAL cmd" with a shell function

5 years agoMerge branch 'mk/merge-in-sparse-checkout'
Junio C Hamano [Tue, 24 Jul 2018 21:50:48 +0000 (14:50 -0700)] 
Merge branch 'mk/merge-in-sparse-checkout'

"git reset --merge" (hence "git merge ---abort") and "git reset --hard"
had trouble working correctly in a sparsely checked out working
tree after a conflict, which has been corrected.

* mk/merge-in-sparse-checkout:
  unpack-trees: do not fail reset because of unmerged skipped entry

5 years agoMerge branch 'hs/push-cert-check-cleanup'
Junio C Hamano [Tue, 24 Jul 2018 21:50:48 +0000 (14:50 -0700)] 
Merge branch 'hs/push-cert-check-cleanup'

Code clean-up.

* hs/push-cert-check-cleanup:
  gpg-interface: make parse_gpg_output static and remove from interface header
  builtin/receive-pack: use check_signature from gpg-interface

5 years agoMerge branch 'jk/empty-pick-fix'
Junio C Hamano [Tue, 24 Jul 2018 21:50:48 +0000 (14:50 -0700)] 
Merge branch 'jk/empty-pick-fix'

Handling of an empty range by "git cherry-pick" was inconsistent
depending on how the range ended up to be empty, which has been
corrected.

* jk/empty-pick-fix:
  sequencer: don't say BUG on bogus input
  sequencer: handle empty-set cases consistently

5 years agoMerge branch 'bp/log-ref-write-fd-with-strbuf'
Junio C Hamano [Tue, 24 Jul 2018 21:50:47 +0000 (14:50 -0700)] 
Merge branch 'bp/log-ref-write-fd-with-strbuf'

Code clean-up.

* bp/log-ref-write-fd-with-strbuf:
  convert log_ref_write_fd() to use strbuf

5 years agoMerge branch 'jt/partial-clone-fsck-connectivity'
Junio C Hamano [Tue, 24 Jul 2018 21:50:47 +0000 (14:50 -0700)] 
Merge branch 'jt/partial-clone-fsck-connectivity'

Partial clone support of "git clone" has been updated to correctly
validate the objects it receives from the other side.  The server
side has been corrected to send objects that are directly
requested, even if they may match the filtering criteria (e.g. when
doing a "lazy blob" partial clone).

* jt/partial-clone-fsck-connectivity:
  clone: check connectivity even if clone is partial
  upload-pack: send refs' objects despite "filter"

5 years agoMerge branch 'bc/send-email-auto-cte'
Junio C Hamano [Tue, 24 Jul 2018 21:50:47 +0000 (14:50 -0700)] 
Merge branch 'bc/send-email-auto-cte'

The content-transfer-encoding of the message "git send-email" sends
out by default was 8bit, which can cause trouble when there is an
overlong line to bust RFC 5322/2822 limit.  A new option 'auto' to
automatically switch to quoted-printable when there is such a line
in the payload has been introduced and is made the default.

* bc/send-email-auto-cte:
  docs: correct RFC specifying email line length
  send-email: automatically determine transfer-encoding
  send-email: accept long lines with suitable transfer encoding
  send-email: add an auto option for transfer encoding

5 years agoMerge branch 'bb/unicode-11-width'
Junio C Hamano [Tue, 24 Jul 2018 21:50:47 +0000 (14:50 -0700)] 
Merge branch 'bb/unicode-11-width'

The character display width table has been updated to match the
latest Unicode standard.

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

5 years agoMerge branch 'bb/pedantic'
Junio C Hamano [Tue, 24 Jul 2018 21:50:47 +0000 (14:50 -0700)] 
Merge branch 'bb/pedantic'

The codebase has been updated to compile cleanly with -pedantic
option.

* bb/pedantic:
  utf8.c: avoid char overflow
  string-list.c: avoid conversion from void * to function pointer
  sequencer.c: avoid empty statements at top level
  convert.c: replace "\e" escapes with "\033".
  fixup! refs/refs-internal.h: avoid forward declaration of an enum
  refs/refs-internal.h: avoid forward declaration of an enum
  fixup! connect.h: avoid forward declaration of an enum
  connect.h: avoid forward declaration of an enum

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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()

5 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>
5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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 !=

5 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()'

5 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

5 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

5 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

5 years agot/check-non-portable-shell: detect "FOO=bar shell_func"
Eric Sunshine [Fri, 13 Jul 2018 05:52:05 +0000 (01:52 -0400)] 
t/check-non-portable-shell: detect "FOO=bar shell_func"

One-shot environment variable assignments, such as 'FOO' in
"FOO=bar cmd", exist only during the invocation of 'cmd'. However, if
'cmd' happens to be a shell function, then 'FOO' is assigned in the
executing shell itself, and that assignment remains until the process
exits (unless explicitly unset). Since this side-effect of
"FOO=bar shell_func" is unlikely to be intentional, detect and report
such usage.

To distinguish shell functions from other commands, perform a pre-scan
of shell scripts named as input, gleaning a list of function names by
recognizing lines of the form (loosely matching whitespace):

    shell_func () {

and later report suspect lines of the form (loosely matching quoted
values):

    FOO=bar [BAR=foo ...] shell_func

Also take care to stitch together incomplete lines (those ending with
"\") since suspect invocations may be split over multiple lines:

    FOO=bar BAR=foo \
    shell_func

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot/check-non-portable-shell: make error messages more compact
Eric Sunshine [Fri, 13 Jul 2018 05:52:04 +0000 (01:52 -0400)] 
t/check-non-portable-shell: make error messages more compact

Error messages emitted by this linting script are long and noisy,
consisting of several sections:

    <test-script>:<line#>: error: <explanation>: <failed-shell-text>

The line of failed shell text, usually coming from within a test body,
is often indented by one or two TABs, with the result that the actual
(important) text is separated from <explanation> by a good deal of empty
space. This can make for a difficult read, especially on typical
80-column terminals.

Make the messages more compact and perhaps a bit easier to digest by
folding out the leading whitespace from <failed-shell-text>.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot/check-non-portable-shell: stop being so polite
Eric Sunshine [Fri, 13 Jul 2018 05:52:03 +0000 (01:52 -0400)] 
t/check-non-portable-shell: stop being so polite

Error messages emitted by this linting script are long and noisy,
consisting of several sections:

    <test-script>:<line#>: error: <explanation>: <failed-shell-text>

Many problem explanations ask the reader to "please" use a suggested
alternative, however, such politeness is unnecessary and just adds to
the noise and length of the line, so drop "please" to make the message a
bit more concise.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot6046/t9833: fix use of "VAR=VAL cmd" with a shell function
Eric Sunshine [Fri, 13 Jul 2018 05:52:02 +0000 (01:52 -0400)] 
t6046/t9833: fix use of "VAR=VAL cmd" with a shell function

Unlike "FOO=bar cmd" one-shot environment variable assignments
which exist only for the invocation of 'cmd', those assigned by
"FOO=bar shell_func" exist within the running shell and continue to
do so until the process exits (or are explicitly unset). It is
unlikely that this behavior was intended by the test author.

In these particular tests, the "FOO=bar shell_func" invocations are
already in subshells, so the assignments don't last too long, don't
appear to harm subsequent commands in the same subshells, and don't
affect other tests in the same scripts, however, the usage is
nevertheless misleading and poor practice, so fix the tests to assign
and export the environment variables in the usual fashion.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'jc/t3404-one-shot-export-fix' into es/test-lint-one-shot-export
Junio C Hamano [Mon, 16 Jul 2018 21:54:55 +0000 (14:54 -0700)] 
Merge branch 'jc/t3404-one-shot-export-fix' into es/test-lint-one-shot-export

* jc/t3404-one-shot-export-fix:
  t3404: fix use of "VAR=VAL cmd" with a shell function

5 years agovcbuild/README: update to accommodate for missing common-cmds.h
Johannes Schindelin [Fri, 22 Jun 2018 11:09:11 +0000 (13:09 +0200)] 
vcbuild/README: update to accommodate for missing common-cmds.h

In 60f487ac0ef (Remove common-cmds.h, 2018-05-10), we forgot to adjust
this README when removing the common-cmds.h file.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoblame: prefer xsnprintf to strcpy for colors
Jeff King [Fri, 13 Jul 2018 20:43:50 +0000 (16:43 -0400)] 
blame: prefer xsnprintf to strcpy for colors

Our color buffers are all COLOR_MAXLEN, which fits the
largest possible color. So we can never overflow the buffer
by copying an existing color. However, using strcpy() makes
it harder to audit the code-base for calls that _are_
problems. We should use something like xsnprintf(), which
shows the reader that we expect this never to fail (and
provides a run-time assertion if it does, just in case).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agosequencer: use configured comment character
Aaron Schrab [Mon, 16 Jul 2018 04:59:02 +0000 (00:59 -0400)] 
sequencer: use configured comment character

Use the configured comment character when generating comments about
branches in a todo list.  Failure to honor this configuration causes a
failure to parse the resulting todo list.

Setting core.commentChar to "auto" will not be honored here, and the
previously configured or default value will be used instead. But, since
the todo list will consist of only generated content, there should not
be any non-comment lines beginning with that character.

Signed-off-by: Aaron Schrab <aaron@schrab.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot3404: fix use of "VAR=VAL cmd" with a shell function
Junio C Hamano [Thu, 12 Jul 2018 20:07:51 +0000 (13:07 -0700)] 
t3404: fix use of "VAR=VAL cmd" with a shell function

Bash may take it happily but running test with dash reveals a breakage.

This was not discovered for a long time as no tests after this test
depended on GIT_AUTHOR_NAME to be reverted correctly back to the
original value after this step is done.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agosha1-name.c: for ":/", find detached HEAD commits
William Chargin [Thu, 12 Jul 2018 05:49:09 +0000 (22:49 -0700)] 
sha1-name.c: for ":/", find detached HEAD commits

This patch broadens the set of commits matched by ":/<pattern>" to
include commits reachable from HEAD but not any named ref. This avoids
surprising behavior when working with a detached HEAD and trying to
refer to a commit that was recently created and only exists within the
detached state.

If multiple worktrees exist, only the current worktree's HEAD is
considered reachable. This is consistent with the existing behavior for
other per-worktree refs: e.g., bisect refs are considered reachable, but
only within the relevant worktree.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: William Chargin <wchargin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agogpg-interface: make parse_gpg_output static and remove from interface header
Henning Schild [Wed, 11 Jul 2018 08:38:25 +0000 (10:38 +0200)] 
gpg-interface: make parse_gpg_output static and remove from interface header

Turn parse_gpg_output into a static function, the only outside user was
migrated in an earlier commit.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agobuiltin/receive-pack: use check_signature from gpg-interface
Henning Schild [Wed, 11 Jul 2018 08:38:24 +0000 (10:38 +0200)] 
builtin/receive-pack: use check_signature from gpg-interface

The combination of verify_signed_buffer followed by parse_gpg_output is
available as check_signature. Use that instead of implementing it again.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agounpack-trees: do not fail reset because of unmerged skipped entry
Max Kirillov [Tue, 10 Jul 2018 19:17:48 +0000 (22:17 +0300)] 
unpack-trees: do not fail reset because of unmerged skipped entry

After modify/delete merge conflict happens in a file skipped by sparse
checkout, "git reset --merge", which implements the "--abort" actions,
and "git reset --hard" fail with message "Entry * not uptodate. Cannot
update sparse checkout."

As explained in [1], the up-to-date checker mistakenly treats conflicted
entry which does not exist in HEAD as still skipped by sparse checkout.

Use the fix suggested in [1]. Also, add test case which verifies the
issue is fixed.

[1] https://public-inbox.org/git/20180616051444.GA29754@duynguyen.home/

Signed-off-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Max Kirillov <max@max630.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agosequencer: don't say BUG on bogus input
Jeff King [Tue, 10 Jul 2018 04:32:08 +0000 (00:32 -0400)] 
sequencer: don't say BUG on bogus input

When cherry-picking a single commit, we go through a special
code path that avoids creating a sequencer todo list at all.
This path expects our revision parsing to turn up exactly
one commit, and dies with a BUG if it doesn't.

But it's actually quite easy to fool. For example:

  $ git cherry-pick --author=no.such.person HEAD
  error: BUG: expected exactly one commit from walk
  fatal: cherry-pick failed

This isn't a bug; it's just bogus input.

The condition to trigger this message actually has two
parts:

  1. We saw no commits. That's the case in the example
     above. Let's drop the "BUG" here to make it clear that
     the input is the problem. And let's also use the phrase
     "empty commit set passed", which matches what we say
     when we do a real revision walk and it turns up empty.

  2. We saw more than one commit. That one _should_ be
     impossible to trigger, since we fed at most one tip and
     provided the no_walk option (and we'll have already
     expanded options like "--branches" that can turn into
     multiple tips). If this ever triggers, it's an
     indication that the conditional added by 7acaaac275
     (revert: allow single-pick in the middle of cherry-pick
     sequence, 2011-12-10) needs to more carefully define
     the single-pick case.

     So this can remain a bug, but we'll upgrade it to use
     the BUG() macro, which would make it easier to detect
     and analyze if it does trigger.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agosequencer: handle empty-set cases consistently
Jeff King [Mon, 9 Jul 2018 19:48:19 +0000 (15:48 -0400)] 
sequencer: handle empty-set cases consistently

If the user gives us a set that prepare_revision_walk()
takes to be empty, like:

  git cherry-pick base..base

then we report an error. It's nonsense, and there's nothing
to pick.

But if they use revision options that later cull the list,
like:

  git cherry-pick --author=nobody base~2..base

then we quietly create an empty todo list and return
success.

Arguably either behavior is acceptable, but we should
definitely be consistent about it. Reporting an error
seems to match the original intent, which dates all the way
back to 7e2bfd3f99 (revert: allow cherry-picking more than
one commit, 2010-06-02). That in turn was trying to match
the single-commit case that existed before then (and which
continues to issue an error).

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoconvert log_ref_write_fd() to use strbuf
Ben Peart [Tue, 10 Jul 2018 21:08:22 +0000 (21:08 +0000)] 
convert log_ref_write_fd() to use strbuf

Since we don't care about how many bytes were written, simplify the return
value logic.

log_ref_write_fd() was written long before strbuf was fleshed out. Remove
the old manual buffer management code and replace it with strbuf(). Also
update copy_reflog_msg() which is called only by log_ref_write_fd() to use
strbuf as it keeps things consistent.

Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoutf8.c: avoid char overflow
Beat Bolli [Mon, 9 Jul 2018 19:25:37 +0000 (21:25 +0200)] 
utf8.c: avoid char overflow

In ISO C, char constants must be in the range -128..127. Change the BOM
constants to char literals to avoid overflow.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agostring-list.c: avoid conversion from void * to function pointer
Beat Bolli [Mon, 9 Jul 2018 19:25:36 +0000 (21:25 +0200)] 
string-list.c: avoid conversion from void * to function pointer

ISO C forbids the conversion of void pointers to function pointers.
Introduce a context struct that encapsulates the function pointer.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agosequencer.c: avoid empty statements at top level
Beat Bolli [Mon, 9 Jul 2018 19:25:35 +0000 (21:25 +0200)] 
sequencer.c: avoid empty statements at top level

The macro GIT_PATH_FUNC expands to a function definition that ends with
a closing brace. Remove two extra semicolons.

While at it, fix the example in path.h.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoconvert.c: replace "\e" escapes with "\033".
Beat Bolli [Mon, 9 Jul 2018 19:25:34 +0000 (21:25 +0200)] 
convert.c: replace "\e" escapes with "\033".

The "\e" escape is not defined in ISO C.

While on this line, add a missing space after the comma.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agofixup! refs/refs-internal.h: avoid forward declaration of an enum
Junio C Hamano [Mon, 9 Jul 2018 21:36:12 +0000 (14:36 -0700)] 
fixup! refs/refs-internal.h: avoid forward declaration of an enum

5 years agorefs/refs-internal.h: avoid forward declaration of an enum
Beat Bolli [Mon, 9 Jul 2018 19:25:33 +0000 (21:25 +0200)] 
refs/refs-internal.h: avoid forward declaration of an enum

Include iterator.h to define enum iterator_selection.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agofixup! connect.h: avoid forward declaration of an enum
Junio C Hamano [Mon, 9 Jul 2018 21:35:39 +0000 (14:35 -0700)] 
fixup! connect.h: avoid forward declaration of an enum

5 years agoconnect.h: avoid forward declaration of an enum
Beat Bolli [Mon, 9 Jul 2018 19:25:32 +0000 (21:25 +0200)] 
connect.h: avoid forward declaration of an enum

Include protocol.h to define enum protocol_version.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agounicode: update the width tables to Unicode 11
Beat Bolli [Mon, 9 Jul 2018 19:44:52 +0000 (21:44 +0200)] 
unicode: update the width tables to Unicode 11

Now that Unicode 11 has been announced[0], update the character
width tables to the new version.

[0] http://blog.unicode.org/2018/06/announcing-unicode-standard-version-110.html

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoclone: check connectivity even if clone is partial
Jonathan Tan [Fri, 6 Jul 2018 19:34:10 +0000 (12:34 -0700)] 
clone: check connectivity even if clone is partial

The commit that introduced the partial clone feature - 548719fbdc
("clone: partial clone", 2017-12-08) - excluded connectivity checks
for partial clones, but this also meant that it is possible for a clone
to succeed, yet not have all objects either present or promised.
Specifically, if cloning with --filter=blob:none from a repository that
has a tag pointing to a blob, and the blob is not sent in the packfile,
the clone will pass, even if the blob is not referenced by any tree in
the packfile.

Turn on connectivity checks for partial clone.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoupload-pack: send refs' objects despite "filter"
Jonathan Tan [Fri, 6 Jul 2018 19:34:09 +0000 (12:34 -0700)] 
upload-pack: send refs' objects despite "filter"

A filter line in a request to upload-pack filters out objects regardless
of whether they are directly referenced by a "want" line or not. This
means that cloning with "--filter=blob:none" (or another filter that
excludes blobs) from a repository with at least one ref pointing to a
blob (for example, the Git repository itself) results in output like the
following:

    error: missing object referenced by 'refs/tags/junio-gpg-pub'

and if that particular blob is not referenced by a fetched tree, the
resulting clone fails fsck because there is no object from the remote to
vouch that the missing object is a promisor object.

Update both the protocol and the upload-pack implementation to include
all explicitly specified "want" objects in the packfile regardless of
the filter specification.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodocs: correct RFC specifying email line length
brian m. carlson [Sun, 8 Jul 2018 22:17:13 +0000 (22:17 +0000)] 
docs: correct RFC specifying email line length

The git send-email documentation specifies RFC 2821 (the SMTP RFC) as
providing line length limits, but the specification that restricts line
length to 998 octets is RFC 2822 (the email message format RFC).  Since
RFC 2822 has been obsoleted by RFC 5322, update the text to refer to RFC
5322 instead of RFC 2821.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agosend-email: automatically determine transfer-encoding
brian m. carlson [Sun, 8 Jul 2018 22:17:12 +0000 (22:17 +0000)] 
send-email: automatically determine transfer-encoding

git send-email, when invoked without a --transfer-encoding option, sends
8bit data without a MIME version or a transfer encoding.  This has
several downsides.

First, unless the transfer encoding is specified, it defaults to 7bit,
meaning that non-ASCII data isn't allowed.  Second, if lines longer than
998 bytes are used, we will send an message that is invalid according to
RFC 5322.  The --validate option, which is the default, catches this
issue, but it isn't clear to many people how to resolve this.

To solve these issues, default the transfer encoding to "auto", so that
we explicitly specify 8bit encoding when lines don't exceed 998 bytes
and quoted-printable otherwise.  This means that we now always emit
Content-Transfer-Encoding and MIME-Version headers, so remove the
conditionals from this portion of the code.

It is unlikely that the unconditional inclusion of these two headers
will affect the deliverability of messages in anything but a positive
way, since MIME is already widespread and well understood by most email
programs.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agosend-email: accept long lines with suitable transfer encoding
brian m. carlson [Sun, 8 Jul 2018 22:17:11 +0000 (22:17 +0000)] 
send-email: accept long lines with suitable transfer encoding

With --validate (which is the default), we warn about lines exceeding
998 characters due to the limits specified in RFC 5322.  However, if
we're using a suitable transfer encoding (quoted-printable or base64),
we're guaranteed not to have lines exceeding 76 characters, so there's
no need to fail in this case.  The auto transfer encoding handles this
specific case, so accept it as well.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agosend-email: add an auto option for transfer encoding
brian m. carlson [Sun, 8 Jul 2018 22:17:10 +0000 (22:17 +0000)] 
send-email: add an auto option for transfer encoding

For most patches, using a transfer encoding of 8bit provides good
compatibility with most servers and makes it as easy as possible to view
patches.  However, there are some patches for which 8bit is not a valid
encoding: RFC 5322 specifies that a message must not have lines
exceeding 998 octets.

Add a transfer encoding value, auto, which indicates that a patch should
use 8bit where allowed and quoted-printable otherwise.  Choose
quoted-printable instead of base64, since base64-encoded plain text is
treated as suspicious by some spam filters.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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

5 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

5 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