]> git.neil.brown.name Git - git.git/log
git.git
6 years agoSync with 2.14-rc0 next
Junio C Hamano [Thu, 13 Jul 2017 23:26:32 +0000 (16:26 -0700)]
Sync with 2.14-rc0

* master:
  Git 2.14-rc0

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

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

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

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

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

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

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

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

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

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

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

Code cleanup.

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

6 years agoSync with master
Junio C Hamano [Wed, 12 Jul 2017 22:27:57 +0000 (15:27 -0700)]
Sync with master

* master:
  Git 2.13.3
  Hopefully the last batch before -rc0

6 years agoMerge branch 'jk/gc-pre-detach-under-hook' into next
Junio C Hamano [Wed, 12 Jul 2017 22:27:22 +0000 (15:27 -0700)]
Merge branch 'jk/gc-pre-detach-under-hook' into next

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

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

6 years agoMerge branch 'jn/hooks-pre-rebase-sample-fix' into next
Junio C Hamano [Wed, 12 Jul 2017 22:27:21 +0000 (15:27 -0700)]
Merge branch 'jn/hooks-pre-rebase-sample-fix' into next

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

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

6 years agoMerge branch 'sb/hashmap-cleanup' into next
Junio C Hamano [Wed, 12 Jul 2017 22:27:20 +0000 (15:27 -0700)]
Merge branch 'sb/hashmap-cleanup' into next

Many uses of comparision callback function the hashmap API uses
cast the callback function type when registering it to
hashmap_init(), which defeats the compile time type checking when
the callback interface changes (e.g. gaining more parameters).
The callback implementations have been updated to take "void *"
pointers and cast them to the type they expect instead.

* sb/hashmap-cleanup:
  t/helper/test-hashmap: use custom data instead of duplicate cmp functions
  name-hash.c: drop hashmap_cmp_fn cast
  submodule-config.c: drop hashmap_cmp_fn cast
  remote.c: drop hashmap_cmp_fn cast
  patch-ids.c: drop hashmap_cmp_fn cast
  convert/sub-process: drop cast to hashmap_cmp_fn
  config.c: drop hashmap_cmp_fn cast
  builtin/describe: drop hashmap_cmp_fn cast
  builtin/difftool.c: drop hashmap_cmp_fn cast
  attr.c: drop hashmap_cmp_fn cast

6 years agoSync with v2.13.3
Junio C Hamano [Wed, 12 Jul 2017 22:25:14 +0000 (15:25 -0700)]
Sync with v2.13.3

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

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

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

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

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

Typofix.

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

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

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

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

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

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

Doc update.

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

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

Code cleanup.

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

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

Code cleanup.

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

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

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

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

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

Code cleanup.

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

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

Code cleanup.

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

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

Doc update.

* sb/submodule-doc:
  submodules: overhaul documentation

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

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

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

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

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

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

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

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'rs/progress-overall-throughput-at-the-end' into next
Junio C Hamano [Tue, 11 Jul 2017 20:25:02 +0000 (13:25 -0700)]
Merge branch 'rs/progress-overall-throughput-at-the-end' into next

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

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

6 years agoMerge branch 'tb/push-to-cygwin-unc-path' into next
Junio C Hamano [Tue, 11 Jul 2017 20:25:02 +0000 (13:25 -0700)]
Merge branch 'tb/push-to-cygwin-unc-path' into next

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

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

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

6 years agopre-rebase hook: capture documentation in a <<here document
Jonathan Nieder [Mon, 10 Jul 2017 23:35:25 +0000 (16:35 -0700)]
pre-rebase hook: capture documentation in a <<here document

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

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

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'jk/build-with-asan' into next
Junio C Hamano [Mon, 10 Jul 2017 21:27:29 +0000 (14:27 -0700)]
Merge branch 'jk/build-with-asan' into next

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

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

6 years agoMerge branch 'ks/fix-rebase-doc-picture' into next
Junio C Hamano [Mon, 10 Jul 2017 21:27:29 +0000 (14:27 -0700)]
Merge branch 'ks/fix-rebase-doc-picture' into next

Doc update.

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

6 years agoMerge branch 'rs/wt-status-cleanup' into next
Junio C Hamano [Mon, 10 Jul 2017 21:27:28 +0000 (14:27 -0700)]
Merge branch 'rs/wt-status-cleanup' into next

Code cleanup.

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

6 years agoMerge branch 'kn/ref-filter-branch-list' into next
Junio C Hamano [Mon, 10 Jul 2017 21:27:28 +0000 (14:27 -0700)]
Merge branch 'kn/ref-filter-branch-list' into next

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

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

6 years agoMerge branch 'rs/use-div-round-up' into next
Junio C Hamano [Mon, 10 Jul 2017 21:27:27 +0000 (14:27 -0700)]
Merge branch 'rs/use-div-round-up' into next

Code cleanup.

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

6 years agoMerge branch 'rs/urlmatch-cleanup' into next
Junio C Hamano [Mon, 10 Jul 2017 21:27:26 +0000 (14:27 -0700)]
Merge branch 'rs/urlmatch-cleanup' into next

Code cleanup.

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

6 years agoMerge branch 'rs/apply-avoid-over-reading' into next
Junio C Hamano [Mon, 10 Jul 2017 21:27:26 +0000 (14:27 -0700)]
Merge branch 'rs/apply-avoid-over-reading' into next

Code cleanup.

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

6 years agouse DIV_ROUND_UP
René Scharfe [Sat, 8 Jul 2017 10:35:35 +0000 (12:35 +0200)]
use DIV_ROUND_UP

Convert code that divides and rounds up to use DIV_ROUND_UP to make the
intent clearer and reduce the number of magic constants.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoSync with master
Junio C Hamano [Mon, 10 Jul 2017 21:09:15 +0000 (14:09 -0700)]
Sync with master

* master:
  Prepare for 2.13.3
  Sixteenth batch for 2.14
  l10n: de.po: fix typo

6 years agoSync with maint
Junio C Hamano [Mon, 10 Jul 2017 21:02:45 +0000 (14:02 -0700)]
Sync with maint

6 years agoPrepare for 2.13.3
Junio C Hamano [Mon, 10 Jul 2017 21:02:07 +0000 (14:02 -0700)]
Prepare for 2.13.3

6 years agoMerge branch 'sb/merge-recursive-code-cleanup' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:09 +0000 (13:59 -0700)]
Merge branch 'sb/merge-recursive-code-cleanup' into maint

Code clean-up.

* sb/merge-recursive-code-cleanup:
  merge-recursive: use DIFF_XDL_SET macro

6 years agoMerge branch 'jc/utf8-fprintf' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:08 +0000 (13:59 -0700)]
Merge branch 'jc/utf8-fprintf' into maint

Code cleanup.

* jc/utf8-fprintf:
  submodule--helper: do not call utf8_fprintf() unnecessarily

6 years agoMerge branch 'js/fsck-name-object' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:08 +0000 (13:59 -0700)]
Merge branch 'js/fsck-name-object' into maint

Test fix.

* js/fsck-name-object:
  t1450: use egrep for regexp "alternation"

6 years agoMerge branch 'js/t5534-rev-parse-gives-multi-line-output-fix' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:07 +0000 (13:59 -0700)]
Merge branch 'js/t5534-rev-parse-gives-multi-line-output-fix' into maint

A few tests that tried to verify the contents of push certificates
did not use 'git rev-parse' to formulate the line to look for in
the certificate correctly.

* js/t5534-rev-parse-gives-multi-line-output-fix:
  t5534: fix misleading grep invocation

6 years agoMerge branch 'ab/sha1dc-maint' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:06 +0000 (13:59 -0700)]
Merge branch 'ab/sha1dc-maint' into maint

Update the sha1dc again to fix portability glitches.

* ab/sha1dc-maint:
  sha1dc: update from upstream

6 years agoMerge branch 'aw/contrib-subtree-doc-asciidoctor' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:06 +0000 (13:59 -0700)]
Merge branch 'aw/contrib-subtree-doc-asciidoctor' into maint

The Makefile rule in contrib/subtree for building documentation
learned to honour USE_ASCIIDOCTOR just like the main documentation
set does.

* aw/contrib-subtree-doc-asciidoctor:
  subtree: honour USE_ASCIIDOCTOR when set

6 years agoMerge branch 'cc/shared-index-permfix' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:05 +0000 (13:59 -0700)]
Merge branch 'cc/shared-index-permfix' into maint

The split index code did not honor core.sharedrepository setting
correctly.

* cc/shared-index-permfix:
  t1700: make sure split-index respects core.sharedrepository
  t1301: move modebits() to test-lib-functions.sh
  read-cache: use shared perms when writing shared index

6 years agoMerge branch 'ah/doc-pretty-color-auto-prefix' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:05 +0000 (13:59 -0700)]
Merge branch 'ah/doc-pretty-color-auto-prefix' into maint

Doc update.

* ah/doc-pretty-color-auto-prefix:
  doc: clarify syntax for %C(auto,...) in pretty formats

6 years agoMerge branch 'mb/reword-autocomplete-message' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:04 +0000 (13:59 -0700)]
Merge branch 'mb/reword-autocomplete-message' into maint

Message update.

* mb/reword-autocomplete-message:
  auto-correct: tweak phrasing

6 years agoMerge branch 'ks/t7508-indent-fix' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:03 +0000 (13:59 -0700)]
Merge branch 'ks/t7508-indent-fix' into maint

Cosmetic update to a test.

* ks/t7508-indent-fix:
  t7508: fix a broken indentation

6 years agoMerge branch 'sb/t4005-modernize' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:02 +0000 (13:59 -0700)]
Merge branch 'sb/t4005-modernize' into maint

Test clean-up.

* sb/t4005-modernize:
  t4005: modernize style and drop hard coded sha1

6 years agoMerge branch 'rs/apply-validate-input' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:01 +0000 (13:59 -0700)]
Merge branch 'rs/apply-validate-input' into maint

Tighten error checks for invalid "git apply" input.

* rs/apply-validate-input:
  apply: check git diffs for mutually exclusive header lines
  apply: check git diffs for invalid file modes
  apply: check git diffs for missing old filenames

6 years agoMerge branch 'jc/pack-bitmap-unaligned' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:00 +0000 (13:59 -0700)]
Merge branch 'jc/pack-bitmap-unaligned' into maint

An unaligned 32-bit access in pack-bitmap code ahs been corrected.

* jc/pack-bitmap-unaligned:
  pack-bitmap: don't perform unaligned memory access

6 years agoMerge branch 'pw/rebase-i-regression-fix-tests' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:58:59 +0000 (13:58 -0700)]
Merge branch 'pw/rebase-i-regression-fix-tests' into maint

Fix a recent regression to "git rebase -i" and add tests that would
have caught it and others.

* pw/rebase-i-regression-fix-tests:
  t3420: fix under GETTEXT_POISON build
  rebase: add more regression tests for console output
  rebase: add regression tests for console output
  rebase -i: add test for reflog message
  sequencer: print autostash messages to stderr

6 years agoMerge branch 'jk/add-p-commentchar-fix' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:58:58 +0000 (13:58 -0700)]
Merge branch 'jk/add-p-commentchar-fix' into maint

"git add -p" were updated in 2.12 timeframe to cope with custom
core.commentchar but the implementation was buggy and a
metacharacter like $ and * did not work.

* jk/add-p-commentchar-fix:
  add--interactive: quote commentChar regex
  add--interactive: handle EOF in prompt_yesno

6 years agoMerge branch 'js/alias-early-config' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:58:57 +0000 (13:58 -0700)]
Merge branch 'js/alias-early-config' into maint

The code to pick up and execute command alias definition from the
configuration used to switch to the top of the working tree and
then come back when the expanded alias was executed, which was
unnecessarilyl complex.  Attempt to simplify the logic by using the
early-config mechanism that does not chdir around.

* js/alias-early-config:
  alias: use the early config machinery to expand aliases
  t7006: demonstrate a problem with aliases in subdirectories
  t1308: relax the test verifying that empty alias values are disallowed
  help: use early config when autocorrecting aliases
  config: report correct line number upon error
  discover_git_directory(): avoid setting invalid git_dir

6 years agoMerge branch 'rs/pretty-add-again' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:58:57 +0000 (13:58 -0700)]
Merge branch 'rs/pretty-add-again' into maint

The pretty-format specifiers like '%h', '%t', etc. had an
optimization that no longer works correctly.  In preparation/hope
of getting it correctly implemented, first discard the optimization
that is broken.

* rs/pretty-add-again:
  pretty: recalculate duplicate short hashes

6 years agoMerge branch 'ah/doc-gitattributes-empty-index' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:58:56 +0000 (13:58 -0700)]
Merge branch 'ah/doc-gitattributes-empty-index' into maint

An example in documentation that does not work in multi worktree
configuration has been corrected.

* ah/doc-gitattributes-empty-index:
  doc: do not use `rm .git/index` when normalizing line endings

6 years agoMerge branch 'da/mergetools-meld-output-opt-on-macos' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:58:56 +0000 (13:58 -0700)]
Merge branch 'da/mergetools-meld-output-opt-on-macos' into maint

"git mergetool" learned to work around a wrapper MacOS X adds
around underlying meld.

* da/mergetools-meld-output-opt-on-macos:
  mergetools/meld: improve compatibiilty with Meld on macOS X

6 years agoMerge branch 'jk/diff-highlight-module' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:58:56 +0000 (13:58 -0700)]
Merge branch 'jk/diff-highlight-module' into maint

The 'diff-highlight' program (in contrib/) has been restructured
for easier reuse by an external project 'diff-so-fancy'.

* jk/diff-highlight-module:
  diff-highlight: split code into module

6 years agoSixteenth batch for 2.14
Junio C Hamano [Mon, 10 Jul 2017 20:44:30 +0000 (13:44 -0700)]
Sixteenth batch for 2.14

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'jk/reflog-walk-maint'
Junio C Hamano [Mon, 10 Jul 2017 20:42:52 +0000 (13:42 -0700)]
Merge branch 'jk/reflog-walk-maint'

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

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

6 years agoMerge branch 'bb/unicode-10.0'
Junio C Hamano [Mon, 10 Jul 2017 20:42:52 +0000 (13:42 -0700)]
Merge branch 'bb/unicode-10.0'

Update the character width tables.

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

6 years agoMerge branch 'ks/typofix-commit-c-comment'
Junio C Hamano [Mon, 10 Jul 2017 20:42:51 +0000 (13:42 -0700)]
Merge branch 'ks/typofix-commit-c-comment'

Typofix.

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

6 years agoMerge branch 'ab/wildmatch'
Junio C Hamano [Mon, 10 Jul 2017 20:42:51 +0000 (13:42 -0700)]
Merge branch 'ab/wildmatch'

Minor code cleanup.

* ab/wildmatch:
  wildmatch: remove unused wildopts parameter

6 years agoMerge branch 'ab/sha1dc'
Junio C Hamano [Mon, 10 Jul 2017 20:42:51 +0000 (13:42 -0700)]
Merge branch 'ab/sha1dc'

The "collission-detecting" implementation of SHA-1 hash we borrowed
from is replaced by directly binding the upstream project as our
submodule.  Glitches on minority platforms are still being worked out.

* ab/sha1dc:
  sha1collisiondetection: automatically enable when submodule is populated
  sha1dc: optionally use sha1collisiondetection as a submodule

6 years agoMerge branch 'rs/free-and-null'
Junio C Hamano [Mon, 10 Jul 2017 20:42:51 +0000 (13:42 -0700)]
Merge branch 'rs/free-and-null'

Code cleanup.

* rs/free-and-null:
  coccinelle: polish FREE_AND_NULL rules

6 years agoMerge branch 'pw/unquote-path-in-git-pm'
Junio C Hamano [Mon, 10 Jul 2017 20:42:50 +0000 (13:42 -0700)]
Merge branch 'pw/unquote-path-in-git-pm'

Code refactoring.

* pw/unquote-path-in-git-pm:
  t9700: add tests for Git::unquote_path()
  Git::unquote_path(): throw an exception on bad path
  Git::unquote_path(): handle '\a'
  add -i: move unquote_path() to Git.pm

6 years agoMerge branch 'ks/commit-assuming-only-warning-removal'
Junio C Hamano [Mon, 10 Jul 2017 20:42:50 +0000 (13:42 -0700)]
Merge branch 'ks/commit-assuming-only-warning-removal'

An old message shown in the commit log template was removed, as it
has outlived its usefulness.

* ks/commit-assuming-only-warning-removal:
  commit-template: distinguish status information unconditionally
  commit-template: remove outdated notice about explicit paths

6 years agoref-filter.c: drop return from void function
Alejandro R. Sedeño [Mon, 10 Jul 2017 19:03:03 +0000 (15:03 -0400)]
ref-filter.c: drop return from void function

Sun's C compiler errors out on this pattern:

void foo() { ... }
void bar() { return foo(); }

Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agol10n: de.po: fix typo
Ralf Thielow [Mon, 10 Jul 2017 16:23:08 +0000 (18:23 +0200)]
l10n: de.po: fix typo

Reported-by: Andre Hinrichs <andre.hinrichs@gmx.de>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMakefile: disable unaligned loads with UBSan
Jeff King [Mon, 10 Jul 2017 13:24:50 +0000 (09:24 -0400)]
Makefile: disable unaligned loads with UBSan

The undefined behavior sanitizer complains about unaligned
loads, even if they're OK for a particular platform in
practice. It's possible that they _are_ a problem, of
course, but since it's a known tradeoff the UBSan errors are
just noise.

Let's quiet it automatically by building with
NO_UNALIGNED_LOADS when SANITIZE=undefined is in use.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMakefile: turn off -fomit-frame-pointer with sanitizers
Jeff King [Mon, 10 Jul 2017 13:24:47 +0000 (09:24 -0400)]
Makefile: turn off -fomit-frame-pointer with sanitizers

The ASan manual recommends disabling this optimization, as
it can make the backtraces produced by the tool harder to
follow (and since this is a test-debug build, we don't care
about squeezing out every last drop of performance).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMakefile: add helper for compiling with -fsanitize
Jeff King [Mon, 10 Jul 2017 13:24:42 +0000 (09:24 -0400)]
Makefile: add helper for compiling with -fsanitize

You can already build and test with ASan by doing:

  make CFLAGS=-fsanitize=address test

but there are a few slight annoyances:

  1. It's a little long to type.

  2. It override your CFLAGS completely. You'd probably
     still want -O2, for instance.

  3. It's a good idea to also turn off "recovery", which
     lets the program keep running after a problem is
     detected (with the intention of finding as many bugs as
     possible in a given run). Since Git's test suite should
     generally run without triggering any problems, it's
     better to abort immediately and fail the test when we
     do find an issue.

With this patch, all of that happens automatically when you
run:

  make SANITIZE=address test

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agotest-lib: turn on ASan abort_on_error by default
Jeff King [Mon, 10 Jul 2017 13:24:39 +0000 (09:24 -0400)]
test-lib: turn on ASan abort_on_error by default

By default, ASan will exit with code 1 when it sees an
error. This means we'll notice a problem when we expected
git to succeed, but not in a test_must_fail block.

Let's ask it to actually raise SIGABRT instead. That will
give us a signal death that test_must_fail will notice. As a
bonus, it may also leave a coredump, which can be handy for
digging into a failure.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agotest-lib: set ASAN_OPTIONS variable before we run git
Jeff King [Mon, 10 Jul 2017 13:24:35 +0000 (09:24 -0400)]
test-lib: set ASAN_OPTIONS variable before we run git

We turn off ASan's leak detection by default in the test
suite because it's too noisy. But we don't do so until
part-way through test-lib. This is before we've run any
tests, but after we do our initial "./git" to see if the
binary has even been built.

When built with clang, this seems to work fine. However,
using "gcc -fsanitize=address", the leak checker seems to
complain more aggressively:

  $ ./git
  ...
  ==5352==ERROR: LeakSanitizer: detected memory leaks
  Direct leak of 2 byte(s) in 1 object(s) allocated from:
      #0 0x7f120e7afcf8 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1cf8)
      #1 0x559fc2a3ce41 in do_xmalloc /home/peff/compile/git/wrapper.c:60
      #2 0x559fc2a3cf1a in do_xmallocz /home/peff/compile/git/wrapper.c:100
      #3 0x559fc2a3d0ad in xmallocz /home/peff/compile/git/wrapper.c:108
      #4 0x559fc2a3d0ad in xmemdupz /home/peff/compile/git/wrapper.c:124
      #5 0x559fc2a3d0ad in xstrndup /home/peff/compile/git/wrapper.c:130
      #6 0x559fc274535a in main /home/peff/compile/git/common-main.c:39
      #7 0x7f120dabd2b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)

This is a leak in the sense that we never free it, but it's
in a global that is meant to last the whole program. So it's
not really interesting or in need of fixing. And at any
rate, mentioning leaks outside of the test_expect blocks is
certainly unwelcome, as it pollutes stderr.

Let's bump the setting of ASAN_OPTIONS higher in test-lib.sh
to catch our initial "can we even run git?" test.  While
we're at it, we can add a comment to make it a bit less
inscrutable.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc: correct a mistake in an illustration
Kaartic Sivaraam [Mon, 10 Jul 2017 14:18:30 +0000 (19:48 +0530)]
doc: correct a mistake in an illustration

The first illustration of the "RECOVERING FROM UPSTREAM REBASE"
section in the 'git-rebase' documentation meant to depict that
there are number of commits on the 'master' branch, but it is
longer than the 'master' branch in the following illustrations
by one commit, even though there is no resetting of 'master' to
lose that commit.

Correct it.

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agowt-status: use separate variable for result of shorten_unambiguous_ref
René Scharfe [Sat, 8 Jul 2017 10:51:01 +0000 (12:51 +0200)]
wt-status: use separate variable for result of shorten_unambiguous_ref

Store the pointer to the string allocated by shorten_unambiguous_ref in
a dedicated variable, short_base, and keep base unchanged.  A non-const
variable is more appropriate for such an object.  It avoids having to
cast const away on free and stops redefining the meaning of base, making
the code slightly clearer.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'jk/reflog-walk' into next
Junio C Hamano [Sun, 9 Jul 2017 17:57:43 +0000 (10:57 -0700)]
Merge branch 'jk/reflog-walk' into next

Numerous bugs in walking of reflogs via "log -g" and friends have
been fixed.

* jk/reflog-walk:
  reflog-walk: apply --since/--until to reflog dates
  reflog-walk: stop using fake parents
  rev-list: check reflog_info before showing usage
  get_revision_1(): replace do-while with an early return
  log: do not free parents when walking reflog
  log: clarify comment about reflog cycles
  revision: disallow reflog walking with revs->limited
  t1414: document some reflog-walk oddities

6 years agoMerge branch 'sb/pull-rebase-submodule' into next
Junio C Hamano [Sun, 9 Jul 2017 17:57:43 +0000 (10:57 -0700)]
Merge branch 'sb/pull-rebase-submodule' into next

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

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

6 years agoMerge branch 'sb/submodule-doc' into next
Junio C Hamano [Sun, 9 Jul 2017 17:57:43 +0000 (10:57 -0700)]
Merge branch 'sb/submodule-doc' into next

Doc update.

* sb/submodule-doc:
  submodules: overhaul documentation

6 years agoreflog-walk: apply --since/--until to reflog dates
Jeff King [Fri, 7 Jul 2017 09:16:21 +0000 (05:16 -0400)]
reflog-walk: apply --since/--until to reflog dates

When doing a reflog walk, we use the commit's date to
do any date limiting. In earlier versions of Git, this could
lead to nonsense results, since a skipped commit would
truncate the traversal. So a sequence like:

  git commit ...
  git checkout week-old-branch
  git checkout -
  git log -g --since=1.day.ago

would stop at the week-old-branch, even though the "git
commit" entry further back is still interesting.

As of the prior commit, which uses a parent-less traversal
of the reflog, you get the whole reflog minus any commits
whose dates do not match the specified options. This is
arguably useful, as you could scan the reflogs for commits
that originated in a certain range.

But more likely a user doing a reflog walk wants to limit
based on the reflog entries themselves. You can simulate
--until with:

  git log -g @{1.day.ago}

but there's no way to ask Git to traverse only back to a
certain date. E.g.:

  # show me reflog entries from the past day
  git log -g --since=1.day.ago

This patch teaches the revision machinery to prefer the
reflog entry dates to the commit dates when doing a reflog
walk. Technically this is a change in behavior that affects
plumbing, but the previous behavior was so buggy that it's
unlikely anyone was relying on it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreflog-walk: stop using fake parents
Jeff King [Fri, 7 Jul 2017 09:14:07 +0000 (05:14 -0400)]
reflog-walk: stop using fake parents

The reflog-walk system works by putting a ref's tip into the
pending queue, and then "traversing" the reflog by
pretending that the parent of each commit is the previous
reflog entry.

This causes a number of user-visible oddities, as documented
in t1414 (and the commit message which introduced it). We
can fix all of them in one go by replacing the fake-reflog
system with a much simpler one: just keeping a list of
reflogs to show, and walking through them entry by entry.

The implementation is fairly straight-forward, but there are
a few items to note:

  1. We obviously must skip calling add_parents_to_list()
     when we are traversing reflogs, since we do not want to
     walk the original parents at all.  As a result, we must call
     try_to_simplify_commit() ourselves.

     There are other parts of add_parents_to_list() we skip,
     as well, but none of them should matter for a reflog
     traversal:

       -  We do not allow UNINTERESTING commits, nor
          symmetric ranges (and we bail when these are used
          with "-g").

       - Using --source makes no sense, since we aren't
         traversing. The reflog selector shows the same
         information with more detail.

       - Using --first-parent is still sensible, since you
         may want to see the first-parent diff for each
         entry. But since we're not traversing, we don't
         need to cull the parent list here.

  2. Since we now just walk the reflog entries themselves,
     rather than starting with the ref tip, we now look at
     the "new" field of each entry rather than the "old"
     (i.e., we are showing entries, not faking parents).
     This removes all of the tricky logic around skipping
     past root commits.

     But note that we have no way to show an entry with the
     null sha1 in its "new" field (because such a commit
     obviously does not exist). Normally this would not
     happen, since we delete reflogs along with refs, but
     there is one special case. When we rename the currently
     checked out branch, we write two reflog entries into
     the HEAD log: one where the commit goes away, and
     another where it comes back.

     Prior to this commit, we show both entries with
     identical reflog messages. After this commit, we show
     only the "comes back" entry. See the update in t3200
     which demonstrates this.

     Arguably either is fine, as the whole double-entry
     thing is a bit hacky in the first place. And until a
     recent fix, we truncated the traversal in such a case
     anyway, which was _definitely_ wrong.

  3. We show individual reflogs in order, but choose which
     reflog to show at each stage based on which has the
     most recent timestamp.  This interleaves the output
     from multiple reflogs based on date order, which is
     probably what you'd want with limiting like "-n 30".

     Note that the implementation aims for simplicity. It
     does a linear walk over the reflog queue for each
     commit it pulls, which may perform badly if you
     interleave an enormous number of reflogs. That seems
     like an unlikely use case; if we did want to handle it,
     we could probably keep a priority queue of reflogs,
     ordered by the timestamp of their current tip entry.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorev-list: check reflog_info before showing usage
Jeff King [Fri, 7 Jul 2017 09:08:30 +0000 (05:08 -0400)]
rev-list: check reflog_info before showing usage

When git-rev-list sees no pending commits, it shows a usage
message. This works even when reflog-walking is requested,
because the reflog-walk code currently puts the reflog tips
into the pending queue.

In preparation for refactoring the reflog-walk code, let's
explicitly check whether we have any reflogs to walk. For
now this is a noop, but the existing reflog tests will make
sure that it kicks in after the refactoring. Likewise, we'll
add a test that "rev-list -g" without specifying any reflogs
continues to fail (so that we know our check does not kick
in too aggressively).

Note that the implementation needs to go into its own
sub-function, as the walk code does not expose its innards
outside of reflog-walk.c.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoget_revision_1(): replace do-while with an early return
Jeff King [Fri, 7 Jul 2017 09:07:58 +0000 (05:07 -0400)]
get_revision_1(): replace do-while with an early return

The get_revision_1() function tries to avoid entering its
main loop at all when there are no commits to look at. But
it's perfectly safe to call pop_commit() on an empty list
(in which case it will return NULL). Switching to an early
return from the loop lets us skip repeating the loop
condition before we enter the do-while. That will get more
important when we start pulling reflog-walk commits from a
source besides the revs->commits queue, as that condition
will get much more complicated.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agolog: do not free parents when walking reflog
Jeff King [Fri, 7 Jul 2017 09:07:34 +0000 (05:07 -0400)]
log: do not free parents when walking reflog

When we're doing a reflog walk (instead of walking the
actual parent pointers), we may see commits multiple times.
For this reason, we hold on to the commit buffer for each
commit rather than freeing it after we've showed the commit.

We should do the same for the parent list. Right now this is
just a minor optimization. But once we refactor how reflog
walks are performed, keeping the parents will avoid
confusing us the second time we see the commit.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agolog: clarify comment about reflog cycles
Jeff King [Sun, 9 Jul 2017 10:13:51 +0000 (06:13 -0400)]
log: clarify comment about reflog cycles

When we're walking reflogs, we leave the commit buffer and
parents in place. A comment explains that this is due to
"cycles". But the interesting thing is the unsaid
implication: that the cycles (plus our clearing of the SEEN
flag) will cause us to show commits multiple times. Let's
spell it out.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoprogress: show overall rate in last update
René Scharfe [Sat, 8 Jul 2017 16:43:42 +0000 (18:43 +0200)]
progress: show overall rate in last update

The values in struct throughput are only updated every 0.5 seconds.  If
we're all done before that time span then the final update will show a
rate of 0 bytes/s, which is misleading if some bytes had been handled.
Remember the start time and show the total throughput instead.

And avoid division by zero by enforcing a minimum time span value of 1
(unit: 1/1024th of a second).  That makes the resulting rate an
underestimation, but it's closer to the actual value than the currently
shown 0 bytes/s.

Reported-by: 積丹尼 Dan Jacobson <jidanni@jidanni.org>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agourlmatch: use hex2chr() in append_normalized_escapes()
René Scharfe [Sat, 8 Jul 2017 08:59:19 +0000 (10:59 +0200)]
urlmatch: use hex2chr() in append_normalized_escapes()

Simplify the code by using hex2chr() to convert and check for invalid
characters at the same time instead of doing that sequentially with
one table lookup for each.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoapply: use strcmp(3) for comparing strings in gitdiff_verify_name()
René Scharfe [Sat, 8 Jul 2017 08:58:42 +0000 (10:58 +0200)]
apply: use strcmp(3) for comparing strings in gitdiff_verify_name()

We don't know the length of the C string "another".  It could be
shorter than "name", which we compare it to using memchr(3).  Call
strcmp(3) instead to avoid running over the end of the former, and
get rid of a strlen(3) call as a bonus.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobranch: set remote color in ref-filter branch immediately
Jeff King [Sun, 9 Jul 2017 10:00:45 +0000 (06:00 -0400)]
branch: set remote color in ref-filter branch immediately

We set the current and local branch colors at the top of the
build_format() function. Let's do the same for the remote
color. This saves a little bit of repetition, but more
importantly it puts all of the color-setting in the same
place. That makes it easier to see that we are coloring all
possibilities.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobranch: use BRANCH_COLOR_LOCAL in ref-filter format
Jeff King [Sun, 9 Jul 2017 09:59:33 +0000 (05:59 -0400)]
branch: use BRANCH_COLOR_LOCAL in ref-filter format

Since 949af0684 (branch: use ref-filter printing APIs,
2017-01-10), git-branch's output is generated by passing a
custom format to the ref-filter code. This format forgot to
pass BRANCH_COLOR_LOCAL, meaning that local branches
(besides the current one) were never colored at all.

We can add it in the %(if) block where we decide whether the
branch is "current" or merely "local".  Note that this means
the current/local coloring is either/or. You can't set:

  [color "branch"]
  local = blue
  current = bold

and expect the current branch to be "bold blue". This
matches the pre-949af0684 behavior.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobranch: only perform HEAD check for local branches
Jeff King [Sun, 9 Jul 2017 09:58:10 +0000 (05:58 -0400)]
branch: only perform HEAD check for local branches

When assembling the ref-filter format to show "git branch"
output, we put the "%(if)%(HEAD)" conditional at the start
of the overall format. But there's no point in checking
whether a remote branch matches HEAD, as it never will.
The check should go inside the local conditional; we
assemble that format inside the "local" strbuf.

By itself, this is just a minor optimization. But in a
future patch, we'll need this refactoring to fix
local-branch coloring.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'bb/unicode-10.0' into next
Junio C Hamano [Fri, 7 Jul 2017 18:10:41 +0000 (11:10 -0700)]
Merge branch 'bb/unicode-10.0' into next

Update the character width tables.

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

6 years agoMerge branch 'ks/typofix-commit-c-comment' into next
Junio C Hamano [Fri, 7 Jul 2017 18:10:40 +0000 (11:10 -0700)]
Merge branch 'ks/typofix-commit-c-comment' into next

Typofix.

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

6 years agoMerge branch 'ab/wildmatch' into next
Junio C Hamano [Fri, 7 Jul 2017 18:10:40 +0000 (11:10 -0700)]
Merge branch 'ab/wildmatch' into next

Minor code cleanup.

* ab/wildmatch:
  wildmatch: remove unused wildopts parameter

6 years agoMerge branch 'jk/reflog-walk-maint' into next
Junio C Hamano [Fri, 7 Jul 2017 18:10:40 +0000 (11:10 -0700)]
Merge branch 'jk/reflog-walk-maint' into next

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

* jk/reflog-walk-maint:
  reflog-walk: include all fields when freeing complete_reflogs
  reflog-walk: don't free reflogs added to cache
  reflog-walk: duplicate strings in complete_reflogs list

6 years agounicode: update the width tables to Unicode 10
Beat Bolli [Fri, 7 Jul 2017 12:08:44 +0000 (14:08 +0200)]
unicode: update the width tables to Unicode 10

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

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

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorevision: disallow reflog walking with revs->limited
Jeff King [Fri, 7 Jul 2017 09:07:16 +0000 (05:07 -0400)]
revision: disallow reflog walking with revs->limited

The reflog-walk code doesn't work with limit_list().  That
function traverses down the real history graph, not the fake
reflog history that get_revision() returns. So it's not
going to actually examine all of the commits we're going to
show, because we'd add them to the pending list only during
the actual traversal.

In practice this limitation doesn't really matter, because
the options that require list-limiting generally need
UNINTERESTING endpoints or symmetric ranges, which already
are forbidden for reflog walks. Still, there are likely some
corner cases that would behave oddly. We're better off to
warn the user that we can't fulfill their request than to
generate potentially wrong output.

This will also make it easier to refactor the reflog-walking
code, because it eliminates a whole area of corner cases
we'd have to consider (that already don't work anyway).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1414: document some reflog-walk oddities
Jeff King [Fri, 7 Jul 2017 09:06:10 +0000 (05:06 -0400)]
t1414: document some reflog-walk oddities

Since its inception, the general strategy of the reflog-walk
code has been to start with the tip commit for the ref, and
as we traverse replace each commit's parent pointers with
fake parents pointing to the previous reflog entry.

This lets us traverse the reflog as if it were a real
history, but it has some user-visible oddities. Namely:

  1. The fake parents are used for commit selection and
     display. So for example, "--merges" or "--no-merges"
     are not useful, because the history appears as a linear
     string of commits. Likewise, pathspec limiting is based
     on the diff between adjacent entries, not the changes
     actually introduced by a commit.

     These are often the same (e.g., because the entry was
     just running "git commit" and the adjacent entry _is_
     the true parent), but it may not be in several common
     cases. For instance, using "git reset" to jump around
     history, or "git checkout" to move HEAD.

  2. We reverse-map each commit back to its reflog. So when
     it comes time to show commit X, we say "a-ha, we added
     X because it was at the tip of the 'foo' reflog, so
     let's show the foo reflog". But this leads to nonsense
     results when you ask to traverse multiple reflogs: if
     two reflogs have the same tip commit, we only map back
     to one of them.  Instead, we should show both.

  3. If the tip of the reflog and the ref tip disagree on
     the current value, we show the ref tip but give no
     indication of the value in the reflog.  This situation
     isn't supposed to happen (since any ref update should
     touch the reflog). But if it does, given that the
     requested operation is to show the reflog, it makes
     sense to prefer that.

This commit adds a new script with several expect_failure
tests to demonstrate the problems.  This could be part of
the existing t1411, but it's a bit easier to start from a
fresh state, where we know exactly what will be in the log.

Since the new multiple-reflog tests are checking the actual
output, we can drop the "make sure we don't segfault" tests
from t1411, which are a strict subset of what we're doing
here.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'jk/reflog-walk-maint' into jk/reflog-walk
Junio C Hamano [Fri, 7 Jul 2017 17:02:42 +0000 (10:02 -0700)]
Merge branch 'jk/reflog-walk-maint' into jk/reflog-walk

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

6 years agoreflog-walk: include all fields when freeing complete_reflogs
Jeff King [Fri, 7 Jul 2017 08:43:16 +0000 (04:43 -0400)]
reflog-walk: include all fields when freeing complete_reflogs

When we encounter an error adding reflogs for a walk, we try
to free any logs we have read. But we didn't free all
fields, meaning that we could in theory leak all of the
"items" array (which would consitute the bulk of the
allocated memory).

This patch adds a helper which frees all of the entries and
uses it as appropriate.

As it turns out, the leak seems impossible to trigger with
the current code. Of the three error paths that free the
complete_reflogs struct, two only kick in when the items
array is empty, and the third was removed entirely in the
previous commit.

So this patch should be a noop in terms of behavior, but it
fixes a potential maintenance headache should anybody add a
new error path and copy the partial-free code. Which is
what happened in 5026b47175 (add_reflog_for_walk: avoid
memory leak, 2017-05-04), though its leaky call was the
third one that was recently removed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>