]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
6 years agoupdate-index doc: note the caveat with "could not open..."
Ævar Arnfjörð Bjarmason [Fri, 9 Feb 2018 21:04:31 +0000 (21:04 +0000)] 
update-index doc: note the caveat with "could not open..."

Note the caveat where 2.17 is stricter about index validation
potentially causing "could not open directory" warnings when git is
upgraded. See the preceding "dir.c: stop ignoring opendir() error in
open_cached_dir()" change.

This caused some mayhem when I upgraded git to a version with this
series at Booking.com, and other users have doubtless enabled the UC
extension and are in for a surprise when they upgrade. Let's give them
a headsup in the docs.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoupdate-index doc: note a fixed bug in the untracked cache
Ævar Arnfjörð Bjarmason [Fri, 9 Feb 2018 21:04:30 +0000 (21:04 +0000)] 
update-index doc: note a fixed bug in the untracked cache

Document the bug tested for in my "status: add a failing test showing
a core.untrackedCache bug" and fixed in Duy's "dir.c: fix missing dir
invalidation in untracked code".

Since this is very likely something others will encounter in the
future on older versions, and it's not obvious how to fix it let's
document both that it exists, and how to "fix" it with a one-off
command.

As noted in that commit, even though this bug gets the untracked cache
into a bad state, we have not yet found a case where this is user
visible, and thus it makes sense for these docs to focus on the
symlink case only.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodir.c: ignore paths containing .git when invalidating untracked cache
Nguyễn Thái Ngọc Duy [Wed, 7 Feb 2018 09:21:40 +0000 (16:21 +0700)] 
dir.c: ignore paths containing .git when invalidating untracked cache

read_directory() code ignores all paths named ".git" even if it's not
a valid git repository. See treat_path() for details. Since ".git" is
basically invisible to read_directory(), when we are asked to
invalidate a path that contains ".git", we can safely ignore it
because the slow path would not consider it anyway.

This helps when fsmonitor is used and we have a real ".git" repo at
worktree top. Occasionally .git/index will be updated and if the
fsmonitor hook does not filter it, untracked cache is asked to
invalidate the path ".git/index".

Without this patch, we invalidate the root directory unncessarily,
which:

- makes read_directory() fall back to slow path for root directory
  (slower)

- makes the index dirty (because UNTR extension is updated). Depending
  on the index size, writing it down could also be slow.

A note about the new "safe_path" knob. Since this new check could be
relatively expensive, avoid it when we know it's not needed. If the
path comes from the index, it can't contain ".git". If it does
contain, we may be screwed up at many more levels, not just this one.

Noticed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodir.c: stop ignoring opendir() error in open_cached_dir()
Nguyễn Thái Ngọc Duy [Wed, 24 Jan 2018 09:30:23 +0000 (16:30 +0700)] 
dir.c: stop ignoring opendir() error in open_cached_dir()

A follow-up to the recently fixed bugs in the untracked
invalidation. If opendir() fails it should show a warning, perhaps
this should die, but if this ever happens the error is probably
recoverable for the user, and dying would just make things worse.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodir.c: fix missing dir invalidation in untracked code
Nguyễn Thái Ngọc Duy [Wed, 24 Jan 2018 09:30:21 +0000 (16:30 +0700)] 
dir.c: fix missing dir invalidation in untracked code

Let's start with how create a new directory cache after the last one
becomes invalid (e.g. because its dir mtime has changed...). In
open_cached_dir():

1. We start out with valid_cached_dir() returning false, which should
   call invalidate_directory() to put a directory state back to
   initial state, no untracked entries (untracked_nr zero), no sub
   directory traversal (dirs[].recurse zero).

2. Since the cache cannot be used, we go the slow path opendir() and
   go through items one by one via readdir(). All the directories on
   disk will be added back to the cache (if not already exist in
   dirs[]) and its flag "recurse" gets changed to one to note that
   it's part of the cached dir travesal next time.

3. By the time we reach close_cached_dir() we should have a good
   subdir list in dirs[]. Those with "recurse" flag set are the ones
   present in the on-disk directory. The directory is now marked
   "valid".

Next time read_directory() is called, since the directory is marked
valid, it will skip readdir(), go fast path and traverse through
dirs[] array instead.

Steps one and two need some tight cooperation. If a subdir is removed,
readdir() will not find it and of course we cannot examine/invalidate
it. To make sure removed directories on disk are gone from the cache,
step one must make sure recurse flag of all subdirs are zero.

But that's not true. If "valid" flag is already false, there is a
chance we go straight to the end of valid_cached_dir() without calling
invalidate_directory(). Or we fail to meet the "if (untracked-valid)"
condition and skip over the invalidate_directory().

After step 3, we mark the cache valid. Any stale subdir with incorrect
recurse flag becomes a real subdir next time we traverse the directory
using dirs[] array.

We could avoid this by making sure invalidate_directory() is always
called (therefore dirs[].recurse cleared) at the beginning of
open_cached_dir(). Which is what this patch does.

As to how we get into this situation, the key in the test is this
command

    git checkout master

where "one/file" is replaced with "one" in the index. This index
update triggers untracked_cache_invalidate_path(), which clears valid
flag of the root directory while keeping "recurse" flag on the subdir
"one" on. On the next git-status, we go through steps 1-3 above and
save an incorrect cache on disk. The second git-status blindly follows
the bad cache data and shows the problem.

This is arguably because of a bad design where "recurse" flag plays
double roles: whether a directory should be saved on disk, and whether
it is part of a directory traversal.

We need to keep recurse flag set at "checkout master" because of the
first role: we need to keep subdir caches (dir "two" for example has
not been touched at all, no reason to throw its cache away).

As long as we make sure to ignore/reset "recurse" flag at the
beginning of a directory traversal, we're good. But maybe eventually
we should separate these two roles.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodir.c: avoid stat() in valid_cached_dir()
Nguyễn Thái Ngọc Duy [Wed, 24 Jan 2018 09:30:20 +0000 (16:30 +0700)] 
dir.c: avoid stat() in valid_cached_dir()

stat() may follow a symlink and return stat data of the link's target
instead of the link itself. We are concerned about the link itself.

It's kind of hard to demonstrate the bug. I think when path->buf is a
symlink, we most likely find that its target's stat data does not
match our cached one, which means we ignore the cache and fall back to
slow path.

This is performance issue, not correctness (though we could still
catch it by verifying test-dump-untracked-cache. The less unlikely
case is, link target stat data matches the cached version and we
incorrectly go fast path, ignoring real data on disk. A test for this
may involve manipulating stat data, which may be not portable.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agostatus: add a failing test showing a core.untrackedCache bug
Ævar Arnfjörð Bjarmason [Wed, 24 Jan 2018 09:30:19 +0000 (16:30 +0700)] 
status: add a failing test showing a core.untrackedCache bug

The untracked cache gets confused when a directory is swapped out for
a file. It is easiest to reproduce this by swapping out a directory
with a symlink to another directory, and as the tests show the symlink
case is the only case we've found where "git status" will subsequently
report incorrect information, even though it's possible to otherwise
get the untracked cache into a state where its internal data
structures don't reflect reality.

In the symlink case, whatever files are inside the target of the
symlink will be incorrectly shown as untracked. This issue does not
happen if the symlink links to another file, only if it links to
another directory.

A stand-alone testcase for copying into a terminal:

    (
        rm -rf /tmp/testrepo &&
        git init /tmp/testrepo &&
        cd /tmp/testrepo &&
        mkdir x y &&
        touch x/a y/b &&
        git add x/a y/b &&
        git commit -msnap &&
        git rm -rf y &&
        ln -s x y &&
        git add y &&
        git commit -msnap2 &&
        git checkout HEAD~ &&
        git status &&
        git checkout master &&
        sleep 1 &&
        git status &&
        git status
    )

This will incorrectly show y/a as an untracked file. Both the "git
status" call right before "git checkout master" and the "sleep 1"
after the "checkout master" are needed to reproduce this, presumably
due to the untracked cache tracking on the basis of cached whole
seconds from stat(2).

When git gets into this state, a workaround to fix it is to issue a
one-off:

    git -c core.untrackedCache=false status

For the non-symlink case, the bug is that the output of
test-dump-untracked-cache should not include:

   /one/ 0000000000000000000000000000000000000000 recurse valid

It being in the output implies that cached traversal of root includes
the directory "one" which does not exist on disk anymore.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoRelNotes: the tenth batch
Junio C Hamano [Tue, 19 Dec 2017 19:34:35 +0000 (11:34 -0800)] 
RelNotes: the tenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ls/editor-waiting-message'
Junio C Hamano [Tue, 19 Dec 2017 19:33:59 +0000 (11:33 -0800)] 
Merge branch 'ls/editor-waiting-message'

Git shows a message to tell the user that it is waiting for the
user to finish editing when spawning an editor, in case the editor
opens to a hidden window or somewhere obscure and the user gets
lost.

* ls/editor-waiting-message:
  launch_editor(): indicate that Git waits for user input
  refactor "dumb" terminal determination

6 years agoMerge branch 'sg/setup-doc-update'
Junio C Hamano [Tue, 19 Dec 2017 19:33:58 +0000 (11:33 -0800)] 
Merge branch 'sg/setup-doc-update'

Comment update.

* sg/setup-doc-update:
  setup.c: fix comment about order of .git directory discovery

6 years agoMerge branch 'ar/unconfuse-three-dots'
Junio C Hamano [Tue, 19 Dec 2017 19:33:58 +0000 (11:33 -0800)] 
Merge branch 'ar/unconfuse-three-dots'

Ancient part of codebase still shows dots after an abbreviated
object name just to show that it is not a full object name, but
these ellipses are confusing to people who newly discovered Git
who are used to seeing abbreviated object names and find them
confusing with the range syntax.

* ar/unconfuse-three-dots:
  t2020: test variations that matter
  t4013: test new output from diff --abbrev --raw
  diff: diff_aligned_abbrev: remove ellipsis after abbreviated SHA-1 value
  t4013: prepare for upcoming "diff --raw --abbrev" output format change
  checkout: describe_detached_head: remove ellipsis after committish
  print_sha1_ellipsis: introduce helper
  Documentation: user-manual: limit usage of ellipsis
  Documentation: revisions: fix typo: "three dot" ---> "three-dot" (in line with "two-dot").

6 years agoMerge branch 'tg/worktree-create-tracking'
Junio C Hamano [Tue, 19 Dec 2017 19:33:57 +0000 (11:33 -0800)] 
Merge branch 'tg/worktree-create-tracking'

The way "git worktree add" determines what branch to create from
where and checkout in the new worktree has been updated a bit.

* tg/worktree-create-tracking:
  add worktree.guessRemote config option
  worktree: add --guess-remote flag to add subcommand
  worktree: make add <path> <branch> dwim
  worktree: add --[no-]track option to the add subcommand
  worktree: add can be created from any commit-ish
  checkout: factor out functions to new lib file

6 years agoMerge branch 'gk/tracing-optimization'
Junio C Hamano [Tue, 19 Dec 2017 19:33:57 +0000 (11:33 -0800)] 
Merge branch 'gk/tracing-optimization'

The tracing infrastructure has been optimized for cases where no
tracing is requested.

* gk/tracing-optimization:
  trace: improve performance while category is disabled
  trace: remove trace key normalization

6 years agoMerge branch 'bw/submodule-config-cleanup'
Junio C Hamano [Tue, 19 Dec 2017 19:33:57 +0000 (11:33 -0800)] 
Merge branch 'bw/submodule-config-cleanup'

Recent update to the submodule configuration code broke "diff-tree"
by accidentally stopping to read from the index upfront.

* bw/submodule-config-cleanup:
  diff-tree: read the index so attribute checks work in bare repositories

6 years agoMerge branch 'sb/clone-recursive-submodule-doc'
Junio C Hamano [Tue, 19 Dec 2017 19:33:56 +0000 (11:33 -0800)] 
Merge branch 'sb/clone-recursive-submodule-doc'

Doc update.

* sb/clone-recursive-submodule-doc:
  Documentation/git-clone: improve description for submodule recursing

6 years agoMerge branch 'ls/git-gui-no-double-utf8-author-name'
Junio C Hamano [Tue, 19 Dec 2017 19:33:56 +0000 (11:33 -0800)] 
Merge branch 'ls/git-gui-no-double-utf8-author-name'

Amending commits in git-gui broke the author name that is non-ascii
due to incorrect enconding conversion.

* ls/git-gui-no-double-utf8-author-name:
  git-gui: prevent double UTF-8 conversion

6 years agoMerge branch 'bw/pathspec-match-submodule-boundary'
Junio C Hamano [Tue, 19 Dec 2017 19:33:56 +0000 (11:33 -0800)] 
Merge branch 'bw/pathspec-match-submodule-boundary'

An v2.12-era regression in pathspec match logic, which made it look
into submodule tree even when it is not desired, has been fixed.

* bw/pathspec-match-submodule-boundary:
  pathspec: only match across submodule boundaries when requested

6 years agoMerge branch 'jt/diff-anchored-patience'
Junio C Hamano [Tue, 19 Dec 2017 19:33:56 +0000 (11:33 -0800)] 
Merge branch 'jt/diff-anchored-patience'

"git diff" learned a variant of the "--patience" algorithm, to
which the user can specify which 'unique' line to be used as
anchoring points.

* jt/diff-anchored-patience:
  diff: support anchoring line(s)

6 years agoMerge branch 'en/merge-recursive-icase-removal'
Junio C Hamano [Tue, 19 Dec 2017 19:33:55 +0000 (11:33 -0800)] 
Merge branch 'en/merge-recursive-icase-removal'

The code internal to the recursive merge strategy was not fully
prepared to see a path that is renamed to try overwriting another
path that is only different in case on case insensitive systems.
This does not matter in the current code, but will start to matter
once the rename detection logic starts taking hints from nearby
paths moving to some directory and moves a new path along with them.

* en/merge-recursive-icase-removal:
  merge-recursive: ignore_case shouldn't reject intentional removals

6 years agoMerge branch 'en/rename-progress'
Junio C Hamano [Tue, 19 Dec 2017 19:33:55 +0000 (11:33 -0800)] 
Merge branch 'en/rename-progress'

Historically, the diff machinery for rename detection had a
hardcoded limit of 32k paths; this is being lifted to allow users
trade cycles with a (possibly) easier to read result.

* en/rename-progress:
  diffcore-rename: make diff-tree -l0 mean -l<large>
  sequencer: show rename progress during cherry picks
  diff: remove silent clamp of renameLimit
  progress: fix progress meters when dealing with lots of work
  sequencer: warn when internal merge may be suboptimal due to renameLimit

6 years agoRelNotes: minor typo fixes in 2.16.0 draft
Todd Zullinger [Thu, 14 Dec 2017 02:42:44 +0000 (21:42 -0500)] 
RelNotes: minor typo fixes in 2.16.0 draft

Signed-off-by: Todd Zullinger <tmz@pobox.com>
6 years agoRelNotes: the ninth batch
Junio C Hamano [Wed, 13 Dec 2017 21:32:34 +0000 (13:32 -0800)] 
RelNotes: the ninth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'js/hashmap-update-sample'
Junio C Hamano [Wed, 13 Dec 2017 21:28:58 +0000 (13:28 -0800)] 
Merge branch 'js/hashmap-update-sample'

Code comment update.

* js/hashmap-update-sample:
  hashmap: adjust documentation to reflect reality

6 years agoMerge branch 'en/remove-stripspace'
Junio C Hamano [Wed, 13 Dec 2017 21:28:58 +0000 (13:28 -0800)] 
Merge branch 'en/remove-stripspace'

An internal function that was left for backward compatibility has
been removed, as there is no remaining callers.

* en/remove-stripspace:
  strbuf: remove unused stripspace function alias

6 years agoMerge branch 'jk/no-optional-locks'
Junio C Hamano [Wed, 13 Dec 2017 21:28:58 +0000 (13:28 -0800)] 
Merge branch 'jk/no-optional-locks'

Doc update for a feature available in Git v2.14 and upwards.

* jk/no-optional-locks:
  git-status.txt: mention --no-optional-locks

6 years agoMerge branch 'ds/for-each-file-in-obj-micro-optim'
Junio C Hamano [Wed, 13 Dec 2017 21:28:57 +0000 (13:28 -0800)] 
Merge branch 'ds/for-each-file-in-obj-micro-optim'

The code to iterate over loose object files got optimized.

* ds/for-each-file-in-obj-micro-optim:
  sha1_file: use strbuf_add() instead of strbuf_addf()

6 years agoMerge branch 'jk/progress-delay-fix'
Junio C Hamano [Wed, 13 Dec 2017 21:28:57 +0000 (13:28 -0800)] 
Merge branch 'jk/progress-delay-fix'

A regression in the progress eye-candy was fixed.

* jk/progress-delay-fix:
  progress: drop delay-threshold code
  progress: set default delay threshold to 100%, not 0%

6 years agoMerge branch 'ks/doc-checkout-previous'
Junio C Hamano [Wed, 13 Dec 2017 21:28:57 +0000 (13:28 -0800)] 
Merge branch 'ks/doc-checkout-previous'

@{-N} in "git checkout @{-N}" may refer to a detached HEAD state,
but the documentation was not clear about it, which has been fixed.

* ks/doc-checkout-previous:
  Doc/checkout: checking out using @{-N} can lead to detached state

6 years agoMerge branch 'fk/sendmail-from-path'
Junio C Hamano [Wed, 13 Dec 2017 21:28:56 +0000 (13:28 -0800)] 
Merge branch 'fk/sendmail-from-path'

"git send-email" tries to see if the sendmail program is available
in /usr/lib and /usr/sbin; extend the list of locations to be
checked to also include directories on $PATH.

* fk/sendmail-from-path:
  git-send-email: honor $PATH for sendmail binary

6 years agoMerge branch 'tg/t-readme-updates'
Junio C Hamano [Wed, 13 Dec 2017 21:28:56 +0000 (13:28 -0800)] 
Merge branch 'tg/t-readme-updates'

Developer doc updates.

* tg/t-readme-updates:
  t/README: document test_cmp_rev
  t/README: remove mention of adding copyright notices

6 years agoMerge branch 'pc/submodule-helper'
Junio C Hamano [Wed, 13 Dec 2017 21:28:56 +0000 (13:28 -0800)] 
Merge branch 'pc/submodule-helper'

A message fix.

* pc/submodule-helper:
  submodule--helper.c: i18n: add a missing space in message

6 years agoMerge branch 'jc/receive-pack-hook-doc'
Junio C Hamano [Wed, 13 Dec 2017 21:28:55 +0000 (13:28 -0800)] 
Merge branch 'jc/receive-pack-hook-doc'

Doc update.

* jc/receive-pack-hook-doc:
  hooks doc: clarify when receive-pack invokes its hooks

6 years agoMerge branch 'ab/pcre2-grep'
Junio C Hamano [Wed, 13 Dec 2017 21:28:54 +0000 (13:28 -0800)] 
Merge branch 'ab/pcre2-grep'

"git grep" compiled with libpcre2 sometimes triggered a segfault,
which is being fixed.

* ab/pcre2-grep:
  grep: fix segfault under -P + PCRE2 <=10.30 + (*NO_JIT)
  test-lib: add LIBPCRE1 & LIBPCRE2 prerequisites

6 years agoMerge branch 'ra/decorate-limit-refs'
Junio C Hamano [Wed, 13 Dec 2017 21:28:54 +0000 (13:28 -0800)] 
Merge branch 'ra/decorate-limit-refs'

The tagnames "git log --decorate" uses to annotate the commits can
now be limited to subset of available refs with the two additional
options, --decorate-refs[-exclude]=<pattern>.

* ra/decorate-limit-refs:
  log: add option to choose which refs to decorate

6 years agoMerge branch 'bc/hash-algo'
Junio C Hamano [Wed, 13 Dec 2017 21:28:54 +0000 (13:28 -0800)] 
Merge branch 'bc/hash-algo'

An infrastructure to define what hash function is used in Git is
introduced, and an effort to plumb that throughout various
codepaths has been started.

* bc/hash-algo:
  repository: fix a sparse 'using integer as NULL pointer' warning
  Switch empty tree and blob lookups to use hash abstraction
  Integrate hash algorithm support with repo setup
  Add structure representing hash algorithm
  setup: expose enumerated repo info

6 years agolaunch_editor(): indicate that Git waits for user input
Lars Schneider [Thu, 7 Dec 2017 15:16:41 +0000 (16:16 +0100)] 
launch_editor(): indicate that Git waits for user input

When a graphical GIT_EDITOR is spawned by a Git command that opens
and waits for user input (e.g. "git rebase -i"), then the editor window
might be obscured by other windows. The user might be left staring at
the original Git terminal window without even realizing that s/he needs
to interact with another window before Git can proceed. To this user Git
appears hanging.

Print a message that Git is waiting for editor input in the original
terminal and get rid of it when the editor returns, if the terminal
supports erasing the last line.  Also, make sure that our message is
terminated with a whitespace so that any message the editor may show
upon starting up will be kept separate from our message.

Power users might not want to see this message or their editor might
already print such a message (e.g. emacsclient). Allow these users to
suppress the message by disabling the "advice.waitingForEditor" config.

The standard advise() function is not used here as it would always add
a newline which would make deleting the message harder.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosetup.c: fix comment about order of .git directory discovery
SZEDER Gábor [Thu, 7 Dec 2017 08:59:49 +0000 (09:59 +0100)] 
setup.c: fix comment about order of .git directory discovery

Since gitfiles were introduced in b44ebb19e (Add platform-independent
.git "symlink", 2008-02-20) the order of checks during .git directory
discovery is: gitfile, gitdir, bare repo.  However, that commit did
only partially update the in-code comment describing this order,
missing the last line which still puts gitdir before gitfile.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodiff-tree: read the index so attribute checks work in bare repositories
Brandon Williams [Wed, 6 Dec 2017 22:02:56 +0000 (14:02 -0800)] 
diff-tree: read the index so attribute checks work in bare repositories

A regression was introduced in 557a5998d (submodule: remove
gitmodules_config, 2017-08-03) to how attribute processing was handled
in bare repositories when running the diff-tree command.

By default the attribute system will first try to read ".gitattribute"
files from the working tree and then falls back to reading them from the
index if there isn't a copy checked out in the worktree.  Prior to
557a5998d the index was read as a side effect of the call to
'gitmodules_config()' which ensured that the index was already populated
before entering the attribute subsystem.

Since the call to 'gitmodules_config()' was removed the index is no
longer being read so when the attribute system tries to read from the
in-memory index it doesn't find any ".gitattribute" entries effectively
ignoring any configured attributes.

Fix this by explicitly reading the index during the setup of diff-tree.

Reported-by: Ben Boeckel <ben.boeckel@kitware.com>
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoadd worktree.guessRemote config option
Thomas Gummerer [Wed, 29 Nov 2017 20:04:51 +0000 (20:04 +0000)] 
add worktree.guessRemote config option

Some users might want to have the --guess-remote option introduced in
the previous commit on by default, so they don't have to type it out
every time they create a new worktree.

Add a config option worktree.guessRemote that allows users to configure
the default behaviour for themselves.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoworktree: add --guess-remote flag to add subcommand
Thomas Gummerer [Wed, 29 Nov 2017 20:04:50 +0000 (20:04 +0000)] 
worktree: add --guess-remote flag to add subcommand

Currently 'git worktree add <path>' creates a new branch named after the
basename of the <path>, that matches the HEAD of whichever worktree we
were on when calling "git worktree add <path>".

It's sometimes useful to have 'git worktree add <path> behave more like
the dwim machinery in 'git checkout <new-branch>', i.e. check if the new
branch name, derived from the basename of the <path>, uniquely matches
the branch name of a remote-tracking branch, and if so check out that
branch and set the upstream to the remote-tracking branch.

Add a new --guess-remote option that enables exactly that behaviour.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agotrace: improve performance while category is disabled
Gennady Kupava [Sun, 26 Nov 2017 20:11:19 +0000 (20:11 +0000)] 
trace: improve performance while category is disabled

Move just enough code from trace.c into trace.h header so all code
necessary to determine that trace is disabled could be inlined to
calling functions.  Then perform the check if the trace key is
enabled sooner in call chain.

Signed-off-by: Gennady Kupava <gkupava@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoRelNotes: the eighth batch
Junio C Hamano [Wed, 6 Dec 2017 17:29:50 +0000 (09:29 -0800)] 
RelNotes: the eighth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoSync with maint
Junio C Hamano [Wed, 6 Dec 2017 17:27:59 +0000 (09:27 -0800)] 
Sync with maint

6 years agoMerge branch 'jn/ssh-wrappers'
Junio C Hamano [Wed, 6 Dec 2017 17:23:45 +0000 (09:23 -0800)] 
Merge branch 'jn/ssh-wrappers'

The ssh-variant 'simple' introduced earlier broke existing
installations by not passing --port/-4/-6 and not diagnosing an
attempt to pass these as an error.  Instead, default to
automatically detect how compatible the GIT_SSH/GIT_SSH_COMMAND is
to OpenSSH convention and then error out an invocation to make it
easier to diagnose connection errors.

* jn/ssh-wrappers:
  connect: correct style of C-style comment
  ssh: 'simple' variant does not support --port
  ssh: 'simple' variant does not support -4/-6
  ssh: 'auto' variant to select between 'ssh' and 'simple'
  connect: split ssh option computation to its own function
  connect: split ssh command line options into separate function
  connect: split git:// setup into a separate function
  connect: move no_fork fallback to git_tcp_connect
  ssh test: make copy_ssh_wrapper_as clean up after itself

6 years agoMerge branch 'bw/protocol-v1'
Junio C Hamano [Wed, 6 Dec 2017 17:23:44 +0000 (09:23 -0800)] 
Merge branch 'bw/protocol-v1'

A new mechanism to upgrade the wire protocol in place is proposed
and demonstrated that it works with the older versions of Git
without harming them.

* bw/protocol-v1:
  Documentation: document Extra Parameters
  ssh: introduce a 'simple' ssh variant
  i5700: add interop test for protocol transition
  http: tell server that the client understands v1
  connect: tell server that the client understands v1
  connect: teach client to recognize v1 server response
  upload-pack, receive-pack: introduce protocol version 1
  daemon: recognize hidden request arguments
  protocol: introduce protocol extension mechanisms
  pkt-line: add packet_write function
  connect: in ref advertisement, shallows are last

6 years agoMerge branch 'sp/doc-info-attributes'
Junio C Hamano [Wed, 6 Dec 2017 17:23:43 +0000 (09:23 -0800)] 
Merge branch 'sp/doc-info-attributes'

Doc update.

* sp/doc-info-attributes:
  doc: Mention info/attributes in gitrepository-layout

6 years agoMerge branch 'ph/stash-save-m-option-fix'
Junio C Hamano [Wed, 6 Dec 2017 17:23:42 +0000 (09:23 -0800)] 
Merge branch 'ph/stash-save-m-option-fix'

In addition to "git stash -m message", the command learned to
accept "git stash -mmessage" form.

* ph/stash-save-m-option-fix:
  stash: learn to parse -m/--message like commit does

6 years agoMerge branch 'jk/fewer-pack-rescan'
Junio C Hamano [Wed, 6 Dec 2017 17:23:42 +0000 (09:23 -0800)] 
Merge branch 'jk/fewer-pack-rescan'

Internaly we use 0{40} as a placeholder object name to signal the
codepath that there is no such object (e.g. the fast-forward check
while "git fetch" stores a new remote-tracking ref says "we know
there is no 'old' thing pointed at by the ref, as we are creating
it anew" by passing 0{40} for the 'old' side), and expect that a
codepath to locate an in-core object to return NULL as a sign that
the object does not exist.  A look-up for an object that does not
exist however is quite costly with a repository with large number
of packfiles.  This access pattern has been optimized.

* jk/fewer-pack-rescan:
  sha1_file: fast-path null sha1 as a missing object
  everything_local: use "quick" object existence check
  p5551: add a script to test fetch pack-dir rescans
  t/perf/lib-pack: use fast-import checkpoint to create packs
  p5550: factor out nonsense-pack creation

6 years agoMerge branch 'tg/deprecate-stash-save'
Junio C Hamano [Wed, 6 Dec 2017 17:23:41 +0000 (09:23 -0800)] 
Merge branch 'tg/deprecate-stash-save'

Doc update.

* tg/deprecate-stash-save:
  doc: prefer 'stash push' over 'stash save'

6 years agoMerge branch 'rd/doc-notes-prune-fix'
Junio C Hamano [Wed, 6 Dec 2017 17:23:40 +0000 (09:23 -0800)] 
Merge branch 'rd/doc-notes-prune-fix'

Doc update.

* rd/doc-notes-prune-fix:
  notes: correct 'git notes prune' options to '[-n] [-v]'

6 years agoMerge branch 'rd/man-reflog-add-n'
Junio C Hamano [Wed, 6 Dec 2017 17:23:39 +0000 (09:23 -0800)] 
Merge branch 'rd/man-reflog-add-n'

Doc update.

* rd/man-reflog-add-n:
  doc: add missing "-n" (dry-run) option to reflog man page

6 years agoMerge branch 'rd/man-prune-progress'
Junio C Hamano [Wed, 6 Dec 2017 17:23:39 +0000 (09:23 -0800)] 
Merge branch 'rd/man-prune-progress'

Doc update.

* rd/man-prune-progress:
  prune: add "--progress" to man page and usage msg

6 years agoMerge branch 'jt/submodule-tests-cleanup'
Junio C Hamano [Wed, 6 Dec 2017 17:23:38 +0000 (09:23 -0800)] 
Merge branch 'jt/submodule-tests-cleanup'

Further test clean-up.

* jt/submodule-tests-cleanup:
  Tests: clean up submodule recursive helpers

6 years agoMerge branch 'jn/reproducible-build'
Junio C Hamano [Wed, 6 Dec 2017 17:23:37 +0000 (09:23 -0800)] 
Merge branch 'jn/reproducible-build'

The build procedure has been taught to avoid some unnecessary
instability in the build products.

* jn/reproducible-build:
  generate-cmdlist: avoid non-deterministic output
  git-gui: sort entries in optimized tclIndex

6 years agoMerge branch 'cc/git-packet-pm'
Junio C Hamano [Wed, 6 Dec 2017 17:23:37 +0000 (09:23 -0800)] 
Merge branch 'cc/git-packet-pm'

Code clean-up.

* cc/git-packet-pm:
  Git/Packet.pm: use 'if' instead of 'unless'
  Git/Packet: clarify that packet_required_key_val_read allows EOF

6 years agoMerge branch 'ac/complete-pull-autostash'
Junio C Hamano [Wed, 6 Dec 2017 17:23:37 +0000 (09:23 -0800)] 
Merge branch 'ac/complete-pull-autostash'

The shell completion (in contrib/) learned that "git pull" can take
the "--autostash" option.

* ac/complete-pull-autostash:
  completion: add --autostash and --no-autostash to pull

6 years agoMerge branch 'hm/config-parse-expiry-date'
Junio C Hamano [Wed, 6 Dec 2017 17:23:37 +0000 (09:23 -0800)] 
Merge branch 'hm/config-parse-expiry-date'

"git config --expiry-date gc.reflogexpire" can read "2.weeks" from
the configuration and report it as a timestamp, just like "--int"
would read "1k" and report 1024, to help consumption by scripts.

* hm/config-parse-expiry-date:
  config: add --expiry-date

6 years agoMerge branch 'tz/branch-doc-remove-set-upstream'
Junio C Hamano [Wed, 6 Dec 2017 17:23:36 +0000 (09:23 -0800)] 
Merge branch 'tz/branch-doc-remove-set-upstream'

"git branch --set-upstream" has been deprecated and (sort of)
removed, as "--set-upstream-to" is the preferred one these days.
The documentation still had "--set-upstream" listed on its
synopsys section, which has been corrected.

* tz/branch-doc-remove-set-upstream:
  branch doc: remove --set-upstream from synopsis

6 years agoMerge branch 'cc/perf-run-config'
Junio C Hamano [Wed, 6 Dec 2017 17:23:36 +0000 (09:23 -0800)] 
Merge branch 'cc/perf-run-config'

* cc/perf-run-config:
  perf: store subsection results in "test-results/$GIT_PERF_SUBSECTION/"
  perf/run: show name of rev being built
  perf/run: add run_subsection()
  perf/run: update get_var_from_env_or_config() for subsections
  perf/run: add get_subsections()
  perf/run: add calls to get_var_from_env_or_config()
  perf/run: add GIT_PERF_DIRS_OR_REVS
  perf/run: add get_var_from_env_or_config()
  perf/run: add '--config' option to the 'run' script

6 years agoMerge branch 'sb/submodule-recursive-checkout-detach-head'
Junio C Hamano [Wed, 6 Dec 2017 17:23:35 +0000 (09:23 -0800)] 
Merge branch 'sb/submodule-recursive-checkout-detach-head'

"git checkout --recursive" may overwrite and rewind the history of
the branch that happens to be checked out in submodule
repositories, which might not be desirable.  Detach the HEAD but
still allow the recursive checkout to succeed in such a case.

* sb/submodule-recursive-checkout-detach-head:
  Documentation/checkout: clarify submodule HEADs to be detached
  recursive submodules: detach HEAD from new state

6 years agoPrepare for 2.15.2
Junio C Hamano [Wed, 6 Dec 2017 17:10:35 +0000 (09:10 -0800)] 
Prepare for 2.15.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'jc/merge-base-fork-point-doc' into maint
Junio C Hamano [Wed, 6 Dec 2017 17:09:05 +0000 (09:09 -0800)] 
Merge branch 'jc/merge-base-fork-point-doc' into maint

Clarify and enhance documentation for "merge-base --fork-point", as
it was clear what it computed but not why/what for.

* jc/merge-base-fork-point-doc:
  merge-base --fork-point doc: clarify the example and failure modes

6 years agoMerge branch 'tz/redirect-fix' into maint
Junio C Hamano [Wed, 6 Dec 2017 17:09:04 +0000 (09:09 -0800)] 
Merge branch 'tz/redirect-fix' into maint

A few scripts (both in production and tests) incorrectly redirected
their error output.  These have been corrected.

* tz/redirect-fix:
  rebase: fix stderr redirect in apply_autostash()
  t/lib-gpg: fix gpgconf stderr redirect to /dev/null

6 years agoMerge branch 'tz/notes-error-to-stderr' into maint
Junio C Hamano [Wed, 6 Dec 2017 17:09:04 +0000 (09:09 -0800)] 
Merge branch 'tz/notes-error-to-stderr' into maint

"git notes" sent its error message to its standard output stream,
which was corrected.

* tz/notes-error-to-stderr:
  notes: send "Automatic notes merge failed" messages to stderr

6 years agoMerge branch 'sb/test-cherry-pick-submodule-getting-in-a-way' into maint
Junio C Hamano [Wed, 6 Dec 2017 17:09:03 +0000 (09:09 -0800)] 
Merge branch 'sb/test-cherry-pick-submodule-getting-in-a-way' into maint

The three-way merge performed by "git cherry-pick" was confused
when a new submodule was added in the meantime, which has been
fixed (or "papered over").

* sb/test-cherry-pick-submodule-getting-in-a-way:
  merge-recursive: handle addition of submodule on our side of history
  t/3512: demonstrate unrelated submodule/file conflict as cherry-pick failure

6 years agoMerge branch 'pw/sequencer-recover-from-unlockable-index' into maint
Junio C Hamano [Wed, 6 Dec 2017 17:09:03 +0000 (09:09 -0800)] 
Merge branch 'pw/sequencer-recover-from-unlockable-index' into maint

The sequencer machinery (used by "git cherry-pick A..B", and "git
rebase -i", among other things) would have lost a commit if stopped
due to an unlockable index file, which has been fixed.

* pw/sequencer-recover-from-unlockable-index:
  sequencer: reschedule pick if index can't be locked

6 years agoMerge branch 'rs/apply-inaccurate-eof-with-incomplete-line' into maint
Junio C Hamano [Wed, 6 Dec 2017 17:09:03 +0000 (09:09 -0800)] 
Merge branch 'rs/apply-inaccurate-eof-with-incomplete-line' into maint

"git apply --inaccurate-eof" when used with "--ignore-space-change"
triggered an internal sanity check, which has been fixed.

* rs/apply-inaccurate-eof-with-incomplete-line:
  apply: update line lengths for --inaccurate-eof

6 years agoMerge branch 'tz/complete-branch-copy' into maint
Junio C Hamano [Wed, 6 Dec 2017 17:09:02 +0000 (09:09 -0800)] 
Merge branch 'tz/complete-branch-copy' into maint

Command line completion (in contrib/) has been taught about the
"--copy" option of "git branch".

* tz/complete-branch-copy:
  completion: add '--copy' option to 'git branch'

6 years agoMerge branch 'ew/rebase-mboxrd' into maint
Junio C Hamano [Wed, 6 Dec 2017 17:09:01 +0000 (09:09 -0800)] 
Merge branch 'ew/rebase-mboxrd' into maint

When "git rebase" prepared an mailbox of changes and fed it to "git
am" to replay them, it was confused when a stray "From " happened
to be in the log message of one of the replayed changes.  This has
been corrected.

* ew/rebase-mboxrd:
  rebase: use mboxrd format to avoid split errors

6 years agoMerge branch 'sd/branch-copy' into maint
Junio C Hamano [Wed, 6 Dec 2017 17:09:01 +0000 (09:09 -0800)] 
Merge branch 'sd/branch-copy' into maint

Code clean-up.

* sd/branch-copy:
  config: avoid "write_in_full(fd, buf, len) != len" pattern

6 years agoMerge branch 'sw/pull-ipv46-passthru' into maint
Junio C Hamano [Wed, 6 Dec 2017 17:09:00 +0000 (09:09 -0800)] 
Merge branch 'sw/pull-ipv46-passthru' into maint

Contrary to the documentation, "git pull -4/-6 other-args" did not
ask the underlying "git fetch" to go over IPv4/IPv6, which has been
corrected.

* sw/pull-ipv46-passthru:
  pull: pass -4/-6 option to 'git fetch'

6 years agoMerge branch 'bc/submitting-patches-in-asciidoc' into maint
Junio C Hamano [Wed, 6 Dec 2017 17:08:59 +0000 (09:08 -0800)] 
Merge branch 'bc/submitting-patches-in-asciidoc' into maint

The SubmittingPatches document has been converted to produce an
HTML version via AsciiDoc/Asciidoctor.

* bc/submitting-patches-in-asciidoc:
  Documentation: convert SubmittingPatches to AsciiDoc
  Documentation: enable compat-mode for Asciidoctor

6 years agoMerge branch 'mh/avoid-rewriting-packed-refs' into maint
Junio C Hamano [Wed, 6 Dec 2017 17:08:20 +0000 (09:08 -0800)] 
Merge branch 'mh/avoid-rewriting-packed-refs' into maint

Recent update to the refs infrastructure implementation started
rewriting packed-refs file more often than before; this has been
optimized again for most trivial cases.

* mh/avoid-rewriting-packed-refs:
  files-backend: don't rewrite the `packed-refs` file unnecessarily
  t1409: check that `packed-refs` is not rewritten unnecessarily

6 years agot2020: test variations that matter
Junio C Hamano [Wed, 6 Dec 2017 16:10:07 +0000 (08:10 -0800)] 
t2020: test variations that matter

Because our test suite is not about validating the working of the
shell, it is pointless to test variations of how a literal string
'yes' is quoted when assigned to an environment variable.

Instead, test various ways to spell 'yes' (we use strcasecmp() so
uppercased and capitalized variant should work just like 'yes'
spelled in all lowercase) and make sure we take them as 'yes'.  That
is more relevant in testing Git.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot4013: test new output from diff --abbrev --raw
Ann T Ropea [Sun, 3 Dec 2017 21:27:43 +0000 (22:27 +0100)] 
t4013: test new output from diff --abbrev --raw

Use newly-introduced finely-grained control to teach the diff-family to
honor the new environment GIT_PRINT_SHA1_ELLIPSIS and remove the
ellipses when it is not set.

Mentored-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodiff: diff_aligned_abbrev: remove ellipsis after abbreviated SHA-1 value
Ann T Ropea [Sun, 3 Dec 2017 21:27:42 +0000 (22:27 +0100)] 
diff: diff_aligned_abbrev: remove ellipsis after abbreviated SHA-1 value

Neither Git nor the user are in need of this (visual) aid anymore, but
we must offer a transition period.

A follow-up patch (series) will rectify the situation by covering the
new output format as well as the backward compatible one.

Also, fix a typo: "abbbreviated" ---> "abbreviated".

Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot4013: prepare for upcoming "diff --raw --abbrev" output format change
Ann T Ropea [Sun, 3 Dec 2017 21:27:41 +0000 (22:27 +0100)] 
t4013: prepare for upcoming "diff --raw --abbrev" output format change

Most of the t4013 tests go through a list of sample command lines,
and each of them is executed and its output compared with an
expected one stored in t4013/ directory.  Allow these lines to begin
with a colon followed by magic word(s) so that test conditions can
easily be tweaked.

The expected use that will happen in later steps of this is to run
tests expecting the traditional output and run the same test without
the GIT_PRINT_SHA1_ELLIPSIS=yes environment exported for (perhaps
some of) them, which will have to expect different output.  Since
all of the existing tests are meant to run with the environment,
use the magic word "noellipses" to cause the variable not to be set
and exported.

As this step does not add any new test with the magic word, all
tests still run with the environment variable, expecting the
traditional output, but it will change soon.

Based-on-patch-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocheckout: describe_detached_head: remove ellipsis after committish
Ann T Ropea [Wed, 6 Dec 2017 00:20:42 +0000 (01:20 +0100)] 
checkout: describe_detached_head: remove ellipsis after committish

We do not want an ellipsis displayed following an (abbreviated) SHA-1
value.

The days when this was necessary to indicate the truncation to
lower-level Git commands and/or the user are bygone.

However, to ease the transition, the ellipsis will still be printed if
the user sets the environment variable GIT_PRINT_SHA1_ELLIPSIS to "yes".

Correct documentation with respect to what describe_detached_head prints
when GIT_PRINT_SHA1_ELLIPSIS is not set as indicated above.

Add tests for the old and new behaviour.

Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agohashmap: adjust documentation to reflect reality
Johannes Schindelin [Wed, 29 Nov 2017 23:51:41 +0000 (00:51 +0100)] 
hashmap: adjust documentation to reflect reality

The hashmap API is just complicated enough that even at least one
long-time Git contributor has to look up how to use it every time he
finds a new use case. When that happens, it is really useful if the
provided example code is correct...

While at it, "fix a memory leak", avoid statements before variable
declarations, fix a const -> no-const cast, several %l specifiers (which
want to be %ld), avoid using an undefined constant, call scanf()
correctly, use FLEX_ALLOC_STR() where appropriate, and adjust the style
here and there.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoDocumentation/git-clone: improve description for submodule recursing
Stefan Beller [Tue, 5 Dec 2017 02:53:32 +0000 (18:53 -0800)] 
Documentation/git-clone: improve description for submodule recursing

There have been a few complaints on the mailing list that git-clone doesn't
respect the `submodule.recurse` setting, which every other command (that
potentially knows how to deal with submodules) respects.  In case of clone
this is not beneficial to respect as the user may not want to obtain all
submodules (assuming a pathspec of '.').

Improve the documentation such that the pathspec is mentioned in the
synopsis to alleviate the confusion around the submodule recursion flag
in git-clone.

While at it clarify that the option can be given multiple times for complex
pathspecs.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopathspec: only match across submodule boundaries when requested
Brandon Williams [Tue, 5 Dec 2017 00:07:34 +0000 (16:07 -0800)] 
pathspec: only match across submodule boundaries when requested

Commit 74ed43711fd (grep: enable recurse-submodules to work on <tree>
objects, 2016-12-16) taught 'tree_entry_interesting()' to be able to
match across submodule boundaries in the presence of wildcards.  This is
done by performing literal matching up to the first wildcard and then
punting to the submodule itself to perform more accurate pattern
matching.  Instead of introducing a new flag to request this behavior,
commit 74ed43711fd overloaded the already existing 'recursive' flag in
'struct pathspec' to request this behavior.

This leads to a bug where whenever any other caller has the 'recursive'
flag set as well as a pathspec with wildcards that all submodules will
be indicated as matches.  One simple example of this is:

git init repo
cd repo

git init submodule
git -C submodule commit -m initial --allow-empty

touch "[bracket]"
git add "[bracket]"
git commit -m bracket
git add submodule
git commit -m submodule

git rev-list HEAD -- "[bracket]"

Fix this by introducing the new flag 'recurse_submodules' in 'struct
pathspec' and using this flag to determine if matches should be allowed
to cross submodule boundaries.

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

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ls/no-double-utf8-author-name' of ../git-gui into ls/git-gui-no-double...
Junio C Hamano [Tue, 5 Dec 2017 17:20:12 +0000 (09:20 -0800)] 
Merge branch 'ls/no-double-utf8-author-name' of ../git-gui into ls/git-gui-no-double-utf8-author-name

* 'ls/no-double-utf8-author-name' of ../git-gui:
  git-gui: prevent double UTF-8 conversion

6 years agogit-gui: prevent double UTF-8 conversion
Łukasz Stelmach [Tue, 5 Dec 2017 14:23:26 +0000 (15:23 +0100)] 
git-gui: prevent double UTF-8 conversion

Convert author's name and e-mail address from the UTF-8 (or any other)
encoding in load_last_commit function the same way commit message is
converted.

Amending commits in git-gui without such conversion breaks UTF-8
strings. For example, "\305\201ukasz" (as written by git cat-file) becomes
"\303\205\302\201ukasz" in an amended commit.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agostrbuf: remove unused stripspace function alias
Elijah Newren [Wed, 29 Nov 2017 01:45:59 +0000 (17:45 -0800)] 
strbuf: remove unused stripspace function alias

In commit 63af4a8446 ("strbuf: make stripspace() part of strbuf",
2015-10-16), stripspace() was moved to strbuf and renamed to
strbuf_stripspace().  A "temporary" alias was added for the old name until
all topic branches had time to switch over.  They have had time, so remove
the old alias.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoprogress: drop delay-threshold code
Lars Schneider [Mon, 4 Dec 2017 22:07:00 +0000 (17:07 -0500)] 
progress: drop delay-threshold code

Since 180a9f2268 (provide a facility for "delayed" progress
reporting, 2007-04-20), the progress code has allowed
callers to skip showing progress if they have reached a
percentage-threshold of the total work before the delay
period passes.

But since 8aade107dd (progress: simplify "delayed" progress
API, 2017-08-19), that parameter is not available to outside
callers (we always passed zero after that commit, though
that was corrected in the previous commit to "100%").

Let's drop the threshold code, which never triggers in
any meaningful way.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoprogress: set default delay threshold to 100%, not 0%
Jeff King [Mon, 4 Dec 2017 22:05:23 +0000 (17:05 -0500)] 
progress: set default delay threshold to 100%, not 0%

Commit 8aade107dd (progress: simplify "delayed" progress
API, 2017-08-19) dropped the parameter by which callers
could say "show my progress only if I haven't passed M%
progress after N seconds". The intent was to just show
nothing for 2 seconds, and then always progress after that.

But we flipped the logic in the wrapper: it sets M=0,
meaning that we'd almost _never_ show progress after 2
seconds, since we'd generally have made some progress. This
should have been 100%, not 0%.

We were fooled by existing calls like:

  start_progress_delay("foo", 0, 0, 2);

which behaved this way. The trick is that the first "0"
there is "how many items total", and there zero means "we
don't know". And without knowing that, we cannot compute a
completed percent at all, and we ignored the threshold
parameter entirely! Modeling our wrapper after that broke
callers which pass a non-zero value for "total".

We can switch to the intended behavior by using "100" in the
wrapper call.

Reported-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: use strbuf_add() instead of strbuf_addf()
Derrick Stolee [Mon, 4 Dec 2017 14:06:03 +0000 (09:06 -0500)] 
sha1_file: use strbuf_add() instead of strbuf_addf()

Replace use of strbuf_addf() with strbuf_add() when enumerating
loose objects in for_each_file_in_obj_subdir(). Since we already
check the length and hex-values of the string before consuming
the path, we can prevent extra computation by using the lower-
level method.

One consumer of for_each_file_in_obj_subdir() is the abbreviation
code. OID abbreviations use a cached list of loose objects (per
object subdirectory) to make repeated queries fast, but there is
significant cache load time when there are many loose objects.

Most repositories do not have many loose objects before repacking,
but in the GVFS case the repos can grow to have millions of loose
objects. Profiling 'git log' performance in GitForWindows on a
GVFS-enabled repo with ~2.5 million loose objects revealed 12% of
the CPU time was spent in strbuf_addf().

Add a new performance test to p4211-line-log.sh that is more
sensitive to this cache-loading. By limiting to 1000 commits, we
more closely resemble user wait time when reading history into a
pager.

For a copy of the Linux repo with two ~512 MB packfiles and ~572K
loose objects, running 'git log --oneline --parents --raw -1000'
had the following performance:

 HEAD~1            HEAD
----------------------------------------
 7.70(7.15+0.54)   7.44(7.09+0.29) -3.4%

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorefactor "dumb" terminal determination
Lars Schneider [Wed, 29 Nov 2017 14:37:51 +0000 (15:37 +0100)] 
refactor "dumb" terminal determination

Move the code to detect "dumb" terminals into a single location. This
avoids duplicating the terminal detection code yet again in a subsequent
commit.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoprint_sha1_ellipsis: introduce helper
Ann T Ropea [Sun, 3 Dec 2017 21:27:39 +0000 (22:27 +0100)] 
print_sha1_ellipsis: introduce helper

Introduce a helper print_sha1_ellipsis() that pays attention to the
GIT_PRINT_SHA1_ELLIPSIS environment variable, and prepare the tests to
unconditionally set it for the test pieces that will be broken once the code
stops showing the extra dots by default.

The removal of these dots is merely a plan at this step and has not happened
yet but soon will.

Document GIT_PRINT_SHA1_ELLIPSIS.

Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoDocumentation: user-manual: limit usage of ellipsis
Ann T Ropea [Sun, 3 Dec 2017 21:27:38 +0000 (22:27 +0100)] 
Documentation: user-manual: limit usage of ellipsis

There is no need to use full 40-hex to identify the object names like
the examples hint at by omitting the tail part of an object name as if
that has to be spelled out but the example omits them only for brevity.
Give examples using abbreviated object names without ellipses just like
how people do in real life.

Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoDocumentation: revisions: fix typo: "three dot" ---> "three-dot" (in line with "two...
Ann T Ropea [Sun, 3 Dec 2017 21:27:37 +0000 (22:27 +0100)] 
Documentation: revisions: fix typo: "three dot" ---> "three-dot" (in line with "two-dot").

Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodiffcore-rename: make diff-tree -l0 mean -l<large>
Jonathan Tan [Wed, 29 Nov 2017 20:11:54 +0000 (12:11 -0800)] 
diffcore-rename: make diff-tree -l0 mean -l<large>

In the documentation of diff-tree, it is stated that the -l option
"prevents rename/copy detection from running if the number of
rename/copy targets exceeds the specified number". The documentation
does not mention any special handling for the number 0, but the
implementation before commit 9f7e4bfa3b ("diff: remove silent clamp of
renameLimit", 2017-11-13) treated 0 as a special value indicating that
the rename limit is to be a very large number instead.

The commit 9f7e4bfa3b changed that behavior, treating 0 as 0. Revert
this behavior to what it was previously. This allows existing scripts
and tools that use "-l0" to continue working. The alternative (to have
"-l0" suppress rename detection) is probably much less useful, since
users can just refrain from specifying -M and/or -C to have the same
effect.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoSync with v2.15.1
Junio C Hamano [Tue, 28 Nov 2017 04:43:55 +0000 (13:43 +0900)] 
Sync with v2.15.1

6 years agoRelNotes: the seventh batch
Junio C Hamano [Tue, 28 Nov 2017 04:43:32 +0000 (13:43 +0900)] 
RelNotes: the seventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'rs/include-comments-before-the-function-header'
Junio C Hamano [Tue, 28 Nov 2017 04:41:50 +0000 (13:41 +0900)] 
Merge branch 'rs/include-comments-before-the-function-header'

"git grep -W", "git diff -W" and their friends learned a heuristic
to extend a pre-context beyond the line that matches the "function
pattern" (aka "diff.*.xfuncname") to include a comment block, if
exists, that immediately precedes it.

* rs/include-comments-before-the-function-header:
  grep: show non-empty lines before functions with -W
  grep: update boundary variable for pre-context
  t7810: improve check of -W with user-defined function lines
  xdiff: show non-empty lines before functions with -W
  xdiff: factor out is_func_rec()
  t4051: add test for comments preceding function lines

6 years agoMerge branch 'ma/branch-list-paginate'
Junio C Hamano [Tue, 28 Nov 2017 04:41:49 +0000 (13:41 +0900)] 
Merge branch 'ma/branch-list-paginate'

"git branch --list" learned to show its output through the pager by
default when the output is going to a terminal, which is controlled
by the pager.branch configuration variable.  This is similar to a
recent change to "git tag --list".

* ma/branch-list-paginate:
  branch: change default of `pager.branch` to "on"
  branch: respect `pager.branch` in list-mode only
  t7006: add tests for how git branch paginates

6 years agoMerge branch 'jc/branch-name-sanity'
Junio C Hamano [Tue, 28 Nov 2017 04:41:49 +0000 (13:41 +0900)] 
Merge branch 'jc/branch-name-sanity'

"git branch" and "git checkout -b" are now forbidden from creating
a branch whose name is "HEAD".

* jc/branch-name-sanity:
  builtin/branch: remove redundant check for HEAD
  branch: correctly reject refs/heads/{-dash,HEAD}
  branch: split validate_new_branchname() into two
  branch: streamline "attr_only" handling in validate_new_branchname()

6 years agoGit 2.15.1 v2.15.1
Junio C Hamano [Tue, 28 Nov 2017 04:39:14 +0000 (13:39 +0900)] 
Git 2.15.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'rs/config-write-section-fix' into maint
Junio C Hamano [Tue, 28 Nov 2017 04:38:33 +0000 (13:38 +0900)] 
Merge branch 'rs/config-write-section-fix' into maint

There was a recent semantic mismerge in the codepath to write out a
section of a configuration section, which has been corrected.

* rs/config-write-section-fix:
  config: flip return value of write_section()

6 years agorepository: fix a sparse 'using integer as NULL pointer' warning
Ramsay Jones [Tue, 28 Nov 2017 03:01:19 +0000 (03:01 +0000)] 
repository: fix a sparse 'using integer as NULL pointer' warning

Commit 78a6766802 ("Integrate hash algorithm support with repo setup",
2017-11-12) added a 'const struct git_hash_algo *hash_algo' field to the
repository structure, without modifying the initializer of the 'the_repo'
variable. This does not actually introduce a bug, since the '0' initializer
for the 'ignore_env:1' bit-field is interpreted as a NULL pointer (hence
the warning), and the final field (now with no initializer) receives a
default '0'.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>