]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
6 years agorebase -i: introduce --rebase-merges=[no-]rebase-cousins
Johannes Schindelin [Wed, 25 Apr 2018 12:29:40 +0000 (14:29 +0200)] 
rebase -i: introduce --rebase-merges=[no-]rebase-cousins

When running `git rebase --rebase-merges` non-interactively with an
ancestor of HEAD as <upstream> (or leaving the todo list unmodified),
we would ideally recreate the exact same commits as before the rebase.

However, if there are commits in the commit range <upstream>.. that do not
have <upstream> as direct ancestor (i.e. if `git log <upstream>..` would
show commits that are omitted by `git log --ancestry-path <upstream>..`),
this is currently not the case: we would turn them into commits that have
<upstream> as direct ancestor.

Let's illustrate that with a diagram:

        C
      /   \
A - B - E - F
  \   /
    D

Currently, after running `git rebase -i --rebase-merges B`, the new branch
structure would be (pay particular attention to the commit `D`):

       --- C' --
      /         \
A - B ------ E' - F'
      \    /
        D'

This is not really preserving the branch topology from before! The
reason is that the commit `D` does not have `B` as ancestor, and
therefore it gets rebased onto `B`.

This is unintuitive behavior. Even worse, when recreating branch
structure, most use cases would appear to want cousins *not* to be
rebased onto the new base commit. For example, Git for Windows (the
heaviest user of the Git garden shears, which served as the blueprint
for --rebase-merges) frequently merges branches from `next` early, and
these branches certainly do *not* want to be rebased. In the example
above, the desired outcome would look like this:

       --- C' --
      /         \
A - B ------ E' - F'
  \        /
   -- D' --

Let's introduce the term "cousins" for such commits ("D" in the
example), and let's not rebase them by default. For hypothetical
use cases where cousins *do* need to be rebased, `git rebase
--rebase=merges=rebase-cousins` needs to be used.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopull: accept --rebase=merges to recreate the branch topology
Johannes Schindelin [Wed, 25 Apr 2018 12:29:38 +0000 (14:29 +0200)] 
pull: accept --rebase=merges to recreate the branch topology

Similar to the `preserve` mode simply passing the `--preserve-merges`
option to the `rebase` command, the `merges` mode simply passes the
`--rebase-merges` option.

This will allow users to conveniently rebase non-trivial commit
topologies when pulling new commits, without flattening them.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase --rebase-merges: avoid "empty merges"
Johannes Schindelin [Wed, 25 Apr 2018 12:29:31 +0000 (14:29 +0200)] 
rebase --rebase-merges: avoid "empty merges"

The `git merge` command does not allow merging commits that are already
reachable from HEAD: `git merge HEAD^`, for example, will report that we
are already up to date and not change a thing.

In an interactive rebase, such a merge could occur previously, e.g. when
competing (or slightly modified) versions of a patch series were applied
upstream, and the user had to `git rebase --skip` all of the local
commits, and the topic branch becomes "empty" as a consequence.

Let's teach the todo command `merge` to behave the same as `git merge`.

Seeing as it requires some low-level trickery to create such merges with
Git's commands in the first place, we do not even have to bother to
introduce an option to force `merge` to create such merge commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosequencer: handle post-rewrite for merge commands
Johannes Schindelin [Wed, 25 Apr 2018 12:29:29 +0000 (14:29 +0200)] 
sequencer: handle post-rewrite for merge commands

In the previous patches, we implemented the basic functionality of the
`git rebase -i --rebase-merges` command, in particular the `merge`
command to create merge commits in the sequencer.

The interactive rebase is a lot more these days, though, than a simple
cherry-pick in a loop. For example, it calls the post-rewrite hook (if
any) after rebasing with a mapping of the old->new commits.

This patch implements the post-rewrite handling for the `merge` command
we just introduced. The other commands that were added recently (`label`
and `reset`) do not create new commits, therefore post-rewrite hooks do
not need to handle them.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosequencer: make refs generated by the `label` command worktree-local
Johannes Schindelin [Wed, 25 Apr 2018 12:29:16 +0000 (14:29 +0200)] 
sequencer: make refs generated by the `label` command worktree-local

This allows for rebases to be run in parallel in separate worktrees
(think: interrupted in the middle of one rebase, being asked to perform
a different rebase, adding a separate worktree just for that job).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase --rebase-merges: add test for --keep-empty
Phillip Wood [Wed, 25 Apr 2018 12:29:14 +0000 (14:29 +0200)] 
rebase --rebase-merges: add test for --keep-empty

If there are empty commits on the left hand side of $upstream...HEAD
then the empty commits on the right hand side that we want to keep are
being pruned.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase: introduce the --rebase-merges option
Johannes Schindelin [Wed, 25 Apr 2018 12:29:04 +0000 (14:29 +0200)] 
rebase: introduce the --rebase-merges option

Once upon a time, this here developer thought: wouldn't it be nice if,
say, Git for Windows' patches on top of core Git could be represented as
a thicket of branches, and be rebased on top of core Git in order to
maintain a cherry-pick'able set of patch series?

The original attempt to answer this was: git rebase --preserve-merges.

However, that experiment was never intended as an interactive option,
and it only piggy-backed on git rebase --interactive because that
command's implementation looked already very, very familiar: it was
designed by the same person who designed --preserve-merges: yours truly.

Some time later, some other developer (I am looking at you, Andreas!
;-)) decided that it would be a good idea to allow --preserve-merges to
be combined with --interactive (with caveats!) and the Git maintainer
(well, the interim Git maintainer during Junio's absence, that is)
agreed, and that is when the glamor of the --preserve-merges design
started to fall apart rather quickly and unglamorously.

The reason? In --preserve-merges mode, the parents of a merge commit (or
for that matter, of *any* commit) were not stated explicitly, but were
*implied* by the commit name passed to the `pick` command.

This made it impossible, for example, to reorder commits. Not to mention
to move commits between branches or, deity forbid, to split topic branches
into two.

Alas, these shortcomings also prevented that mode (whose original
purpose was to serve Git for Windows' needs, with the additional hope
that it may be useful to others, too) from serving Git for Windows'
needs.

Five years later, when it became really untenable to have one unwieldy,
big hodge-podge patch series of partly related, partly unrelated patches
in Git for Windows that was rebased onto core Git's tags from time to
time (earning the undeserved wrath of the developer of the ill-fated
git-remote-hg series that first obsoleted Git for Windows' competing
approach, only to be abandoned without maintainer later) was really
untenable, the "Git garden shears" were born [*1*/*2*]: a script,
piggy-backing on top of the interactive rebase, that would first
determine the branch topology of the patches to be rebased, create a
pseudo todo list for further editing, transform the result into a real
todo list (making heavy use of the `exec` command to "implement" the
missing todo list commands) and finally recreate the patch series on
top of the new base commit.

That was in 2013. And it took about three weeks to come up with the
design and implement it as an out-of-tree script. Needless to say, the
implementation needed quite a few years to stabilize, all the while the
design itself proved itself sound.

With this patch, the goodness of the Git garden shears comes to `git
rebase -i` itself. Passing the `--rebase-merges` option will generate
a todo list that can be understood readily, and where it is obvious
how to reorder commits. New branches can be introduced by inserting
`label` commands and calling `merge <label>`. And once this mode will
have become stable and universally accepted, we can deprecate the design
mistake that was `--preserve-merges`.

Link *1*:
https://github.com/msysgit/msysgit/blob/master/share/msysGit/shears.sh
Link *2*:
https://github.com/git-for-windows/build-extra/blob/master/shears.sh

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase-helper --make-script: introduce a flag to rebase merges
Johannes Schindelin [Wed, 25 Apr 2018 12:29:03 +0000 (14:29 +0200)] 
rebase-helper --make-script: introduce a flag to rebase merges

The sequencer just learned new commands intended to recreate branch
structure (similar in spirit to --preserve-merges, but with a
substantially less-broken design).

Let's allow the rebase--helper to generate todo lists making use of
these commands, triggered by the new --rebase-merges option. For a
commit topology like this (where the HEAD points to C):

- A - B - C
    \   /
      D

the generated todo list would look like this:

# branch D
pick 0123 A
label branch-point
pick 1234 D
label D

reset branch-point
pick 2345 B
merge -C 3456 D # C

To keep things simple, we first only implement support for merge commits
with exactly two parents, leaving support for octopus merges to a later
patch series.

All merge-rebasing todo lists start with a hard-coded `label onto` line.
This makes it convenient to refer later on to the revision onto which
everything is rebased, e.g. as starting point for branches other than
the very first one.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosequencer: fast-forward `merge` commands, if possible
Johannes Schindelin [Wed, 25 Apr 2018 12:28:56 +0000 (14:28 +0200)] 
sequencer: fast-forward `merge` commands, if possible

Just like with regular `pick` commands, if we are trying to rebase a
merge commit, we now test whether the parents of said commit match HEAD
and the commits to be merged, and fast-forward if possible.

This is not only faster, but also avoids unnecessary proliferation of
new objects.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosequencer: introduce the `merge` command
Johannes Schindelin [Wed, 25 Apr 2018 12:28:54 +0000 (14:28 +0200)] 
sequencer: introduce the `merge` command

This patch is part of the effort to reimplement `--preserve-merges` with
a substantially improved design, a design that has been developed in the
Git for Windows project to maintain the dozens of Windows-specific patch
series on top of upstream Git.

The previous patch implemented the `label` and `reset` commands to label
commits and to reset to labeled commits. This patch adds the `merge`
command, with the following syntax:

merge [-C <commit>] <rev> # <oneline>

The <commit> parameter in this instance is the *original* merge commit,
whose author and message will be used for the merge commit that is about
to be created.

The <rev> parameter refers to the (possibly rewritten) revision to
merge. Let's see an example of a todo list (the initial `label onto`
command is an auto-generated convenience so that the label `onto` can be
used to refer to the revision onto which we rebase):

label onto

# Branch abc
reset onto
pick deadbeef Hello, world!
label abc

reset onto
pick cafecafe And now for something completely different
merge -C baaabaaa abc # Merge the branch 'abc' into master

To edit the merge commit's message (a "reword" for merges, if you will),
use `-c` (lower-case) instead of `-C`; this convention was borrowed from
`git commit` that also supports `-c` and `-C` with similar meanings.

To create *new* merges, i.e. without copying the commit message from an
existing commit, simply omit the `-C <commit>` parameter (which will
open an editor for the merge message):

merge abc

This comes in handy when splitting a branch into two or more branches.

Note: this patch only adds support for recursive merges, to keep things
simple. Support for octopus merges will be added later in a separate
patch series, support for merges using strategies other than the
recursive merge is left for the future.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosequencer: introduce new commands to reset the revision
Johannes Schindelin [Wed, 25 Apr 2018 12:28:47 +0000 (14:28 +0200)] 
sequencer: introduce new commands to reset the revision

In the upcoming commits, we will teach the sequencer to rebase merges.
This will be done in a very different way from the unfortunate design of
`git rebase --preserve-merges` (which does not allow for reordering
commits, or changing the branch topology).

The main idea is to introduce new todo list commands, to support
labeling the current revision with a given name, resetting the current
revision to a previous state, and  merging labeled revisions.

This idea was developed in Git for Windows' Git garden shears (that are
used to maintain Git for Windows' "thicket of branches" on top of
upstream Git), and this patch is part of the effort to make it available
to a wider audience, as well as to make the entire process more robust
(by implementing it in a safe and portable language rather than a Unix
shell script).

This commit implements the commands to label, and to reset to, given
revisions. The syntax is:

label <name>
reset <name>

Internally, the `label <name>` command creates the ref
`refs/rewritten/<name>`. This makes it possible to work with the labeled
revisions interactively, or in a scripted fashion (e.g. via the todo
list command `exec`).

These temporary refs are removed upon sequencer_remove_state(), so that
even a `git rebase --abort` cleans them up.

We disallow '#' as label because that character will be used as separator
in the upcoming `merge` command.

Later in this patch series, we will mark the `refs/rewritten/` refs as
worktree-local, to allow for interactive rebases to be run in parallel in
worktrees linked to the same repository.

As typos happen, a failed `label` or `reset` command will be rescheduled
immediately. As the previous code to reschedule a command is embedded
deeply in the pick/fixup/squash code path, we simply duplicate the few
lines. This will allow us to extend the new code path easily for the
upcoming `merge` command.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-rebase--interactive: clarify arguments
Stefan Beller [Wed, 25 Apr 2018 12:28:45 +0000 (14:28 +0200)] 
git-rebase--interactive: clarify arguments

Up to now each command took a commit as its first argument and ignored
the rest of the line (usually the subject of the commit)

Now that we are about to introduce commands that take different
arguments, clarify each command by giving the argument list.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosequencer: offer helpful advice when a command was rescheduled
Johannes Schindelin [Wed, 25 Apr 2018 12:28:33 +0000 (14:28 +0200)] 
sequencer: offer helpful advice when a command was rescheduled

Previously, we did that just magically, and potentially left some users
quite puzzled. Let's err on the safe side instead, telling the user what
is happening, and how they are supposed to continue.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosequencer: refactor how original todo list lines are accessed
Johannes Schindelin [Wed, 25 Apr 2018 12:28:29 +0000 (14:28 +0200)] 
sequencer: refactor how original todo list lines are accessed

Previously, we did a lot of arithmetic gymnastics to get at the line in
the todo list (as stored in todo_list.buf). This might have been fast,
but only in terms of execution speed, not in terms of developer time.

Let's refactor this to make it a lot easier to read, and hence to
reason about the correctness of the code. It is not performance-critical
code anyway.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosequencer: make rearrange_squash() a bit more obvious
Johannes Schindelin [Wed, 25 Apr 2018 12:28:25 +0000 (14:28 +0200)] 
sequencer: make rearrange_squash() a bit more obvious

There are some commands that have to be skipped from rearranging by virtue
of not handling any commits.

However, the logic was not quite obvious: it skipped commands based on
their position in the enum todo_command.

Instead, let's make it explicit that we skip all commands that do not
handle any commit. With one exception: the `drop` command, because it,
well, drops the commit and is therefore not eligible to rearranging.

Note: this is a bit academic at the moment because the only time we call
`rearrange_squash()` is directly after generating the todo list, when we
have nothing but `pick` commands anyway.

However, the upcoming `merge` command *will* want to be handled by that
function, and it *can* handle commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosequencer: avoid using errno clobbered by rollback_lock_file()
Johannes Schindelin [Wed, 25 Apr 2018 12:28:17 +0000 (14:28 +0200)] 
sequencer: avoid using errno clobbered by rollback_lock_file()

As pointed out in a review of the `--rebase-merges` patch series,
`rollback_lock_file()` clobbers errno. Therefore, we have to report the
error message that uses errno before calling said function.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoThe fourth batch for 2.18
Junio C Hamano [Wed, 25 Apr 2018 04:44:42 +0000 (13:44 +0900)] 
The fourth batch for 2.18

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'jm/mem-pool'
Junio C Hamano [Wed, 25 Apr 2018 04:29:06 +0000 (13:29 +0900)] 
Merge branch 'jm/mem-pool'

An reusable "memory pool" implementation has been extracted from
fast-import.c, which in turn has become the first user of the
mem-pool API.

* jm/mem-pool:
  mem-pool: move reusable parts of memory pool into its own file
  fast-import: introduce mem_pool type
  fast-import: rename mem_pool type to mp_block

6 years agoMerge branch 'tg/use-git-contacts'
Junio C Hamano [Wed, 25 Apr 2018 04:29:05 +0000 (13:29 +0900)] 
Merge branch 'tg/use-git-contacts'

Doc update.

* tg/use-git-contacts:
  SubmittingPatches: mention the git contacts command

6 years agoMerge branch 'sb/filenames-with-dashes'
Junio C Hamano [Wed, 25 Apr 2018 04:29:05 +0000 (13:29 +0900)] 
Merge branch 'sb/filenames-with-dashes'

Rename bunch of source files to more consistently use dashes
instead of underscores to connect words.

* sb/filenames-with-dashes:
  replace_object.c: rename to use dash in file name
  sha1_file.c: rename to use dash in file name
  sha1_name.c: rename to use dash in file name
  exec_cmd: rename to use dash in file name
  unicode_width.h: rename to use dash in file name
  write_or_die.c: rename to use dashes in file name

6 years agoMerge branch 'cc/perf-bisect'
Junio C Hamano [Wed, 25 Apr 2018 04:29:04 +0000 (13:29 +0900)] 
Merge branch 'cc/perf-bisect'

Performance measuring framework in t/perf learned to help bisecting
performance regressions.

* cc/perf-bisect:
  t/perf: add scripts to bisect performance regressions
  perf/run: add --subsection option

6 years agoMerge branch 'bp/fsmonitor-prime-index'
Junio C Hamano [Wed, 25 Apr 2018 04:29:04 +0000 (13:29 +0900)] 
Merge branch 'bp/fsmonitor-prime-index'

The index file is updated to record the fsmonitor section after a
full scan was made, to avoid wasting the effort that has already
spent.

* bp/fsmonitor-prime-index:
  fsmonitor: force index write after full scan

6 years agoMerge branch 'bp/fsmonitor-bufsize-fix'
Junio C Hamano [Wed, 25 Apr 2018 04:29:03 +0000 (13:29 +0900)] 
Merge branch 'bp/fsmonitor-bufsize-fix'

Fix an unexploitable (because the oversized contents are not under
attacker's control) buffer overflow.

* bp/fsmonitor-bufsize-fix:
  fsmonitor: fix incorrect buffer size when printing version number

6 years agoMerge branch 'cb/bash-completion-ls-files-processing'
Junio C Hamano [Wed, 25 Apr 2018 04:29:02 +0000 (13:29 +0900)] 
Merge branch 'cb/bash-completion-ls-files-processing'

Shell completion (in contrib) that gives list of paths have been
optimized somewhat.

* cb/bash-completion-ls-files-processing:
  completion: improve ls-files filter performance

6 years agoMerge branch 'es/worktree-docs'
Junio C Hamano [Wed, 25 Apr 2018 04:29:02 +0000 (13:29 +0900)] 
Merge branch 'es/worktree-docs'

Doc updates.

* es/worktree-docs:
  git-worktree.txt: unify command-line prompt in example blocks
  git-worktree.txt: recommend 'git worktree remove' over manual deletion

6 years agoMerge branch 'es/fread-reads-dir-autoconf-fix'
Junio C Hamano [Wed, 25 Apr 2018 04:29:01 +0000 (13:29 +0900)] 
Merge branch 'es/fread-reads-dir-autoconf-fix'

Small fix to the autoconf build procedure.

* es/fread-reads-dir-autoconf-fix:
  configure.ac: fix botched FREAD_READS_DIRECTORIES check

6 years agoMerge branch 'ps/test-chmtime-get'
Junio C Hamano [Wed, 25 Apr 2018 04:29:00 +0000 (13:29 +0900)] 
Merge branch 'ps/test-chmtime-get'

Test cleanup.

* ps/test-chmtime-get:
  t/helper: 'test-chmtime (--get|-g)' to print only the mtime

6 years agoMerge branch 'js/t5404-path-fix'
Junio C Hamano [Wed, 25 Apr 2018 04:29:00 +0000 (13:29 +0900)] 
Merge branch 'js/t5404-path-fix'

Test fix.

* js/t5404-path-fix:
  t5404: relax overzealous test

6 years agoMerge branch 'jk/ref-array-push'
Junio C Hamano [Wed, 25 Apr 2018 04:28:59 +0000 (13:28 +0900)] 
Merge branch 'jk/ref-array-push'

API clean-up aournd ref-filter code.

* jk/ref-array-push:
  ref-filter: factor ref_array pushing into its own function
  ref-filter: make ref_array_item allocation more consistent
  ref-filter: use "struct object_id" consistently

6 years agoMerge branch 'en/doc-typoes'
Junio C Hamano [Wed, 25 Apr 2018 04:28:58 +0000 (13:28 +0900)] 
Merge branch 'en/doc-typoes'

Docfix.

* en/doc-typoes:
  Documentation: normalize spelling of 'normalised'
  Documentation: fix several one-character-off spelling errors

6 years agoMerge branch 'lw/daemon-log-destination'
Junio C Hamano [Wed, 25 Apr 2018 04:28:58 +0000 (13:28 +0900)] 
Merge branch 'lw/daemon-log-destination'

Recent introduction of "--log-destination" option to "git daemon"
did not work well when the daemon was run under "--inetd" mode.

* lw/daemon-log-destination:
  daemon.c: fix condition for redirecting stderr

6 years agoMerge branch 'mn/send-email-credential-doc'
Junio C Hamano [Wed, 25 Apr 2018 04:28:57 +0000 (13:28 +0900)] 
Merge branch 'mn/send-email-credential-doc'

Doc update.

* mn/send-email-credential-doc:
  send-email: simplify Gmail example in the documentation

6 years agoMerge branch 'ak/bisect-doc-typofix'
Junio C Hamano [Wed, 25 Apr 2018 04:28:56 +0000 (13:28 +0900)] 
Merge branch 'ak/bisect-doc-typofix'

Docfix.

* ak/bisect-doc-typofix:
  Documentation/git-bisect.txt: git bisect term â†’ git bisect terms

6 years agoMerge branch 'br/mergetools-guiffy'
Junio C Hamano [Wed, 25 Apr 2018 04:28:54 +0000 (13:28 +0900)] 
Merge branch 'br/mergetools-guiffy'

"git mergetools" learned talking to guiffy.

* br/mergetools-guiffy:
  mergetools: add support for guiffy

6 years agoMerge branch 'nd/worktree-move'
Junio C Hamano [Wed, 25 Apr 2018 04:28:54 +0000 (13:28 +0900)] 
Merge branch 'nd/worktree-move'

Test update.

* nd/worktree-move:
  t2028: tighten grep expression to make "move worktree" test more robust

6 years agoMerge branch 'ks/branch-list-detached-rebase-i'
Junio C Hamano [Wed, 25 Apr 2018 04:28:53 +0000 (13:28 +0900)] 
Merge branch 'ks/branch-list-detached-rebase-i'

"git branch --list" during an interrupted "rebase -i" now lets
users distinguish the case where a detached HEAD is being rebased
and a normal branch is being rebased.

* ks/branch-list-detached-rebase-i:
  t3200: verify "branch --list" sanity when rebasing from detached HEAD
  branch --list: print useful info whilst interactive rebasing a detached HEAD

6 years agoMerge branch 'jk/t5561-missing-curl'
Junio C Hamano [Wed, 25 Apr 2018 04:28:53 +0000 (13:28 +0900)] 
Merge branch 'jk/t5561-missing-curl'

Test fixes.

* jk/t5561-missing-curl:
  t5561: skip tests if curl is not available
  t5561: drop curl stderr redirects

6 years agoMerge branch 'bw/commit-partial-from-subdirectory-fix'
Junio C Hamano [Wed, 25 Apr 2018 04:28:53 +0000 (13:28 +0900)] 
Merge branch 'bw/commit-partial-from-subdirectory-fix'

"cd sub/dir && git commit ../path" ought to record the changes to
the file "sub/path", but this regressed long time ago.

* bw/commit-partial-from-subdirectory-fix:
  commit: allow partial commits with relative paths

6 years agoMerge branch 'jk/relative-directory-fix'
Junio C Hamano [Wed, 25 Apr 2018 04:28:52 +0000 (13:28 +0900)] 
Merge branch 'jk/relative-directory-fix'

Some codepaths, including the refs API, get and keep relative
paths, that go out of sync when the process does chdir(2).  The
chdir-notify API is introduced to let these codepaths adjust these
cached paths to the new current directory.

* jk/relative-directory-fix:
  refs: use chdir_notify to update cached relative paths
  set_work_tree: use chdir_notify
  add chdir-notify API
  trace.c: export trace_setup_key
  set_git_dir: die when setenv() fails

6 years agoMerge branch 'jk/flockfile-stdio'
Junio C Hamano [Wed, 25 Apr 2018 04:28:52 +0000 (13:28 +0900)] 
Merge branch 'jk/flockfile-stdio'

Code clean-up.

* jk/flockfile-stdio:
  config: move flockfile() closer to unlocked functions

6 years agoMerge branch 'pw/rebase-signoff'
Junio C Hamano [Wed, 25 Apr 2018 04:28:51 +0000 (13:28 +0900)] 
Merge branch 'pw/rebase-signoff'

"git rebase" has learned to honor "--signoff" option when using
backends other than "am" (but not "--preserve-merges").

* pw/rebase-signoff:
  rebase --keep-empty: always use interactive rebase
  rebase -p: error out if --signoff is given
  rebase: extend --signoff support

6 years agoMerge branch 'pw/rebase-keep-empty-fixes'
Junio C Hamano [Wed, 25 Apr 2018 04:28:49 +0000 (13:28 +0900)] 
Merge branch 'pw/rebase-keep-empty-fixes'

"git rebase --keep-empty" still removed an empty commit if the
other side contained an empty commit (due to the "does an
equivalent patch exist already?" check), which has been corrected.

* pw/rebase-keep-empty-fixes:
  rebase: respect --no-keep-empty
  rebase -i --keep-empty: don't prune empty commits
  rebase --root: stop assuming squash_onto is unset

6 years agoMerge branch 'cb/git-gui-ttk-style'
Junio C Hamano [Wed, 25 Apr 2018 04:28:49 +0000 (13:28 +0900)] 
Merge branch 'cb/git-gui-ttk-style'

"git gui" has been taught to work with old versions of tk (like
8.5.7) that do not support "ttk::style theme use" as a way to query
the current theme.

* cb/git-gui-ttk-style:
  git-gui: workaround ttk:style theme use

6 years agoMerge branch 'bp/git-gui-bind-kp-enter'
Junio C Hamano [Wed, 25 Apr 2018 04:28:48 +0000 (13:28 +0900)] 
Merge branch 'bp/git-gui-bind-kp-enter'

"git gui" performs commit upon CTRL/CMD+ENTER but the
CTRL/CMD+KP_ENTER (i.e. enter key on the numpad) did not have the
same key binding.  It now does.

* bp/git-gui-bind-kp-enter:
  git-gui: bind CTRL/CMD+numpad ENTER to do_commit

6 years agoMerge branch 'bb/git-gui-ssh-key-files'
Junio C Hamano [Wed, 25 Apr 2018 04:28:48 +0000 (13:28 +0900)] 
Merge branch 'bb/git-gui-ssh-key-files'

"git gui" learned that "~/.ssh/id_ecdsa.pub" and
"~/.ssh/id_ed25519.pub" are also possible SSH key files.

* bb/git-gui-ssh-key-files:
  git-gui: search for all current SSH key types

6 years agomem-pool: move reusable parts of memory pool into its own file
Jameson Miller [Wed, 11 Apr 2018 18:37:55 +0000 (18:37 +0000)] 
mem-pool: move reusable parts of memory pool into its own file

This moves the reusable parts of the memory pool logic used by
fast-import.c into its own file for use by other components.

Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoSubmittingPatches: mention the git contacts command
Thomas Gummerer [Wed, 11 Apr 2018 20:20:00 +0000 (21:20 +0100)] 
SubmittingPatches: mention the git contacts command

Instead of just mentioning 'git blame' and 'git shortlog', which make it
quite hard for new contributors to pick out the appropriate list of
people to cc on their patch series, mention the 'git contacts' utility,
which makes it much easier to get a reasonable list of contacts for a
change.

This should help new contributors pick out a reasonable cc list by
simply using a single command.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofast-import: introduce mem_pool type
Jameson Miller [Wed, 11 Apr 2018 18:37:54 +0000 (18:37 +0000)] 
fast-import: introduce mem_pool type

Introduce the mem_pool type which encapsulates all the information necessary to
manage a pool of memory. This change moves the existing variables in
fast-import used to support the global memory pool to use this structure. It
also renames variables that are no longer used by memory pools to reflect their
more scoped usage.

These changes allow for the multiple instances of a memory pool to
exist and be reused outside of fast-import. In a future commit the
mem_pool type will be moved to its own file.

Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofast-import: rename mem_pool type to mp_block
Jameson Miller [Wed, 11 Apr 2018 18:37:53 +0000 (18:37 +0000)] 
fast-import: rename mem_pool type to mp_block

This is part of a patch series to extract the memory pool logic in
fast-import into a more generalized version. The existing mem_pool type
maps more closely to a "block of memory" (mp_block) in the more
generalized memory pool. This commit renames the mem_pool to mp_block to
reduce churn in future patches.

Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'svn/authors-prog-2' of git://bogomips.org/git-svn
Junio C Hamano [Wed, 11 Apr 2018 23:05:28 +0000 (08:05 +0900)] 
Merge branch 'svn/authors-prog-2' of git://bogomips.org/git-svn

* 'svn/authors-prog-2' of git://bogomips.org/git-svn:
  git-svn: allow empty email-address using authors-prog and authors-file
  git-svn: search --authors-prog in PATH too

6 years agoreplace_object.c: rename to use dash in file name
Stefan Beller [Tue, 10 Apr 2018 21:26:21 +0000 (14:26 -0700)] 
replace_object.c: rename to use dash in file name

This is more consistent with the project style. The majority of
Git's source files use dashes in preference to underscores in their file
names.

Noticed while adding a header corresponding to this file.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
6 years agosha1_file.c: rename to use dash in file name
Stefan Beller [Tue, 10 Apr 2018 21:26:20 +0000 (14:26 -0700)] 
sha1_file.c: rename to use dash in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Signed-off-by: Stefan Beller <sbeller@google.com>
6 years agosha1_name.c: rename to use dash in file name
Stefan Beller [Tue, 10 Apr 2018 21:26:19 +0000 (14:26 -0700)] 
sha1_name.c: rename to use dash in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Signed-off-by: Stefan Beller <sbeller@google.com>
6 years agoexec_cmd: rename to use dash in file name
Stefan Beller [Tue, 10 Apr 2018 21:26:18 +0000 (14:26 -0700)] 
exec_cmd: rename to use dash in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Signed-off-by: Stefan Beller <sbeller@google.com>
6 years agounicode_width.h: rename to use dash in file name
Stefan Beller [Tue, 10 Apr 2018 21:26:17 +0000 (14:26 -0700)] 
unicode_width.h: rename to use dash in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Also adjust contrib/update-unicode as well.

Signed-off-by: Stefan Beller <sbeller@google.com>
6 years agowrite_or_die.c: rename to use dashes in file name
Stefan Beller [Tue, 10 Apr 2018 21:26:16 +0000 (14:26 -0700)] 
write_or_die.c: rename to use dashes in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Signed-off-by: Stefan Beller <sbeller@google.com>
6 years agofsmonitor: force index write after full scan
Ben Peart [Tue, 10 Apr 2018 18:14:31 +0000 (14:14 -0400)] 
fsmonitor: force index write after full scan

fsmonitor currently only flags the index as dirty if the extension is being
added or removed. This is a performance optimization that recognizes you can
stat() a lot of files in less time than it takes to write out an updated index.

This patch makes a small enhancement and flags the index dirty if we end up
having to stat() all files and scan the entire working directory.  The assumption
being that must be expensive or you would not have turned on the feature.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoRevert "Merge branch 'en/rename-directory-detection'"
Junio C Hamano [Wed, 11 Apr 2018 09:07:11 +0000 (18:07 +0900)] 
Revert "Merge branch 'en/rename-directory-detection'"

This reverts commit e4bb62fa1eeee689744b413e29a50b4d1dae6886, reversing
changes made to 468165c1d8a442994a825f3684528361727cd8c0.

The topic appears to inflict severe regression in renaming merges,
even though the promise of it was that it would improve them.

We do not yet know which exact change in the topic was wrong, but in
the meantime, let's play it safe and revert it out of 'master'
before real Git-using projects are harmed.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofsmonitor: fix incorrect buffer size when printing version number
Ben Peart [Tue, 10 Apr 2018 18:43:43 +0000 (18:43 +0000)] 
fsmonitor: fix incorrect buffer size when printing version number

This is a trivial bug fix for passing the incorrect size to snprintf() when
outputting the version.  It should be passing the size of the destination buffer
rather than the size of the value being printed.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot/perf: add scripts to bisect performance regressions
Christian Couder [Sun, 8 Apr 2018 09:35:13 +0000 (11:35 +0200)] 
t/perf: add scripts to bisect performance regressions

The new bisect_regression script can be used to automatically bisect
performance regressions. It will pass the new bisect_run_script to
`git bisect run`.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoperf/run: add --subsection option
Christian Couder [Sun, 8 Apr 2018 09:35:12 +0000 (11:35 +0200)] 
perf/run: add --subsection option

This new option makes it possible to run perf tests as defined
in only one subsection of a config file.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoThe third batch for 2.18
Junio C Hamano [Wed, 11 Apr 2018 04:13:49 +0000 (13:13 +0900)] 
The third batch for 2.18

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'eb/cred-helper-ignore-sigpipe'
Junio C Hamano [Wed, 11 Apr 2018 04:09:57 +0000 (13:09 +0900)] 
Merge branch 'eb/cred-helper-ignore-sigpipe'

When credential helper exits very quickly without reading its
input, it used to cause Git to die with SIGPIPE, which has been
fixed.

* eb/cred-helper-ignore-sigpipe:
  credential: ignore SIGPIPE when writing to credential helpers

6 years agoMerge branch 'lv/tls-1.3'
Junio C Hamano [Wed, 11 Apr 2018 04:09:57 +0000 (13:09 +0900)] 
Merge branch 'lv/tls-1.3'

When built with more recent cURL, GIT_SSL_VERSION can now specify
"tlsv1.3" as its value.

* lv/tls-1.3:
  http: allow use of TLS 1.3

6 years agoMerge branch 'pk/test-avoid-pipe-hiding-exit-status'
Junio C Hamano [Wed, 11 Apr 2018 04:09:56 +0000 (13:09 +0900)] 
Merge branch 'pk/test-avoid-pipe-hiding-exit-status'

Test cleanup.

* pk/test-avoid-pipe-hiding-exit-status:
  test: avoid pipes in git related commands for test

6 years agoMerge branch 'rs/status-with-removed-submodule'
Junio C Hamano [Wed, 11 Apr 2018 04:09:56 +0000 (13:09 +0900)] 
Merge branch 'rs/status-with-removed-submodule'

"git submodule status" misbehaved on a submodule that has been
removed from the working tree.

* rs/status-with-removed-submodule:
  submodule: check for NULL return of get_submodule_ref_store()

6 years agoMerge branch 'nd/combined-test-helper'
Junio C Hamano [Wed, 11 Apr 2018 04:09:56 +0000 (13:09 +0900)] 
Merge branch 'nd/combined-test-helper'

Small test-helper programs have been consolidated into a single
binary.

* nd/combined-test-helper: (36 commits)
  t/helper: merge test-write-cache into test-tool
  t/helper: merge test-wildmatch into test-tool
  t/helper: merge test-urlmatch-normalization into test-tool
  t/helper: merge test-subprocess into test-tool
  t/helper: merge test-submodule-config into test-tool
  t/helper: merge test-string-list into test-tool
  t/helper: merge test-strcmp-offset into test-tool
  t/helper: merge test-sigchain into test-tool
  t/helper: merge test-sha1-array into test-tool
  t/helper: merge test-scrap-cache-tree into test-tool
  t/helper: merge test-run-command into test-tool
  t/helper: merge test-revision-walking into test-tool
  t/helper: merge test-regex into test-tool
  t/helper: merge test-ref-store into test-tool
  t/helper: merge test-read-cache into test-tool
  t/helper: merge test-prio-queue into test-tool
  t/helper: merge test-path-utils into test-tool
  t/helper: merge test-online-cpus into test-tool
  t/helper: merge test-mktemp into test-tool
  t/helper: merge (unused) test-mergesort into test-tool
  ...

6 years agoMerge branch 'sb/packfiles-in-repository'
Junio C Hamano [Wed, 11 Apr 2018 04:09:55 +0000 (13:09 +0900)] 
Merge branch 'sb/packfiles-in-repository'

Refactoring of the internal global data structure continues.

* sb/packfiles-in-repository:
  packfile: keep prepare_packed_git() private
  packfile: allow find_pack_entry to handle arbitrary repositories
  packfile: add repository argument to find_pack_entry
  packfile: allow reprepare_packed_git to handle arbitrary repositories
  packfile: allow prepare_packed_git to handle arbitrary repositories
  packfile: allow prepare_packed_git_one to handle arbitrary repositories
  packfile: add repository argument to reprepare_packed_git
  packfile: add repository argument to prepare_packed_git
  packfile: add repository argument to prepare_packed_git_one
  packfile: allow install_packed_git to handle arbitrary repositories
  packfile: allow rearrange_packed_git to handle arbitrary repositories
  packfile: allow prepare_packed_git_mru to handle arbitrary repositories

6 years agoMerge branch 'sb/object-store'
Junio C Hamano [Wed, 11 Apr 2018 04:09:55 +0000 (13:09 +0900)] 
Merge branch 'sb/object-store'

Refactoring the internal global data structure to make it possible
to open multiple repositories, work with and then close them.

Rerolled by Duy on top of a separate preliminary clean-up topic.
The resulting structure of the topics looked very sensible.

* sb/object-store: (27 commits)
  sha1_file: allow sha1_loose_object_info to handle arbitrary repositories
  sha1_file: allow map_sha1_file to handle arbitrary repositories
  sha1_file: allow map_sha1_file_1 to handle arbitrary repositories
  sha1_file: allow open_sha1_file to handle arbitrary repositories
  sha1_file: allow stat_sha1_file to handle arbitrary repositories
  sha1_file: allow sha1_file_name to handle arbitrary repositories
  sha1_file: add repository argument to sha1_loose_object_info
  sha1_file: add repository argument to map_sha1_file
  sha1_file: add repository argument to map_sha1_file_1
  sha1_file: add repository argument to open_sha1_file
  sha1_file: add repository argument to stat_sha1_file
  sha1_file: add repository argument to sha1_file_name
  sha1_file: allow prepare_alt_odb to handle arbitrary repositories
  sha1_file: allow link_alt_odb_entries to handle arbitrary repositories
  sha1_file: add repository argument to prepare_alt_odb
  sha1_file: add repository argument to link_alt_odb_entries
  sha1_file: add repository argument to read_info_alternates
  sha1_file: add repository argument to link_alt_odb_entry
  sha1_file: add raw_object_store argument to alt_odb_usable
  pack: move approximate object count to object store
  ...

6 years agoMerge branch 'jc/test-must-be-empty'
Junio C Hamano [Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)] 
Merge branch 'jc/test-must-be-empty'

Test helper update.

* jc/test-must-be-empty:
  test_must_be_empty: simplify file existence check

6 years agoMerge branch 'cc/perf-aggregate-sort'
Junio C Hamano [Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)] 
Merge branch 'cc/perf-aggregate-sort'

Perf-test update.

* cc/perf-aggregate-sort:
  perf/aggregate: add --sort-by=regression option
  perf/aggregate: add display_dir()

6 years agoMerge branch 'ab/doc-hash-brokenness'
Junio C Hamano [Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)] 
Merge branch 'ab/doc-hash-brokenness'

Doc updates.

* ab/doc-hash-brokenness:
  doc hash-function-transition: clarify what SHAttered means
  doc hash-function-transition: clarify how older gits die on NewHash

6 years agoMerge branch 'bc/hash-independent-tests'
Junio C Hamano [Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)] 
Merge branch 'bc/hash-independent-tests'

Tests that rely on the exact hardcoded values of object names have
been updated in preparation for hash function migration.

* bc/hash-independent-tests:
  t2107: abstract away SHA-1-specific constants
  t2101: abstract away SHA-1-specific constants
  t2101: modernize test style
  t2020: abstract away SHA-1 specific constants
  t1507: abstract away SHA-1-specific constants
  t1411: abstract away SHA-1-specific constants
  t1405: sort reflog entries in a hash-independent way
  t1300: abstract away SHA-1-specific constants
  t1304: abstract away SHA-1-specific constants
  t1011: abstract away SHA-1-specific constants

6 years agoMerge branch 'ab/drop-contrib-examples'
Junio C Hamano [Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)] 
Merge branch 'ab/drop-contrib-examples'

* ab/drop-contrib-examples:
  Remove contrib/examples/*

6 years agoThe second batch for 2.18
Junio C Hamano [Tue, 10 Apr 2018 07:32:45 +0000 (16:32 +0900)] 
The second batch for 2.18

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ys/bisect-object-id-missing-conversion-fix'
Junio C Hamano [Tue, 10 Apr 2018 07:28:24 +0000 (16:28 +0900)] 
Merge branch 'ys/bisect-object-id-missing-conversion-fix'

Code clean-up.

* ys/bisect-object-id-missing-conversion-fix:
  bisect: use oid_to_hex() for converting object_id hashes to hex strings

6 years agoMerge branch 'yk/filter-branch-non-committish-refs'
Junio C Hamano [Tue, 10 Apr 2018 07:28:23 +0000 (16:28 +0900)] 
Merge branch 'yk/filter-branch-non-committish-refs'

when refs that do not point at committish are given, "git
filter-branch" gave a misleading error messages.  This has been
corrected.

* yk/filter-branch-non-committish-refs:
  filter-branch: fix errors caused by refs that point at non-committish

6 years agoMerge branch 'nd/trace-with-env'
Junio C Hamano [Tue, 10 Apr 2018 07:28:22 +0000 (16:28 +0900)] 
Merge branch 'nd/trace-with-env'

Code cleanup.

* nd/trace-with-env:
  run-command: use strbuf_addstr() for adding a string to a strbuf

6 years agoMerge branch 'nd/parseopt-completion-more'
Junio C Hamano [Tue, 10 Apr 2018 07:28:22 +0000 (16:28 +0900)] 
Merge branch 'nd/parseopt-completion-more'

The mechanism to use parse-options API to automate the command line
completion continues to get extended and polished.

* nd/parseopt-completion-more:
  completion: use __gitcomp_builtin in _git_cherry
  completion: use __gitcomp_builtin in _git_ls_tree
  completion: delete option-only completion commands
  completion: add --option completion for most builtin commands
  completion: factor out _git_xxx calling code
  completion: mention the oldest version we need to support
  git.c: add hidden option --list-parseopt-builtins
  git.c: move cmd_struct declaration up

6 years agoMerge branch 'ds/bsearch-hash'
Junio C Hamano [Tue, 10 Apr 2018 07:28:22 +0000 (16:28 +0900)] 
Merge branch 'ds/bsearch-hash'

Code to find the length to uniquely abbreviate object names based
on packfile content, which is a relatively recent addtion, has been
optimized to use the same fan-out table.

* ds/bsearch-hash:
  sha1_name: use bsearch_pack() in unique_in_pack()
  sha1_name: use bsearch_pack() for abbreviations
  packfile: define and use bsearch_pack()
  sha1_name: convert struct min_abbrev_data to object_id

6 years agoMerge branch 'ws/rebase-p'
Junio C Hamano [Tue, 10 Apr 2018 07:28:21 +0000 (16:28 +0900)] 
Merge branch 'ws/rebase-p'

Code clean-up.

* ws/rebase-p:
  rebase: remove merges_option and a blank line
  rebase: remove unused code paths from git_rebase__interactive__preserve_merges
  rebase: remove unused code paths from git_rebase__interactive
  rebase: add and use git_rebase__interactive__preserve_merges
  rebase: extract functions out of git_rebase__interactive
  rebase: reindent function git_rebase__interactive
  rebase: update invocation of rebase dot-sourced scripts
  rebase-interactive: simplify pick_on_preserving_merges

6 years agoMerge branch 'jk/diff-highlight-graph-fix'
Junio C Hamano [Tue, 10 Apr 2018 07:28:21 +0000 (16:28 +0900)] 
Merge branch 'jk/diff-highlight-graph-fix'

"diff-highlight" filter (in contrib/) learned to undertand "git log
--graph" output better.

* jk/diff-highlight-graph-fix:
  diff-highlight: detect --graph by indent
  diff-highlight: use flush() helper consistently
  diff-highlight: test graphs with --color
  diff-highlight: test interleaved parallel lines of history
  diff-highlight: prefer "echo" to "cat" in tests
  diff-highlight: use test_tick in graph test
  diff-highlight: correct test graph diagram

6 years agoMerge branch 'nd/remove-ignore-env-field'
Junio C Hamano [Tue, 10 Apr 2018 07:28:20 +0000 (16:28 +0900)] 
Merge branch 'nd/remove-ignore-env-field'

Code clean-up for the "repository" abstraction.

* nd/remove-ignore-env-field:
  repository.h: add comment and clarify repo_set_gitdir
  repository: delete ignore_env member
  sha1_file.c: move delayed getenv(altdb) back to setup_git_env()
  repository.c: delete dead functions
  repository.c: move env-related setup code back to environment.c
  repository: initialize the_repository in main()

6 years agoMerge branch 'ps/contains-id-error-message'
Junio C Hamano [Tue, 10 Apr 2018 07:28:20 +0000 (16:28 +0900)] 
Merge branch 'ps/contains-id-error-message'

"git tag --contains no-such-commit" gave a full list of options
after giving an error message.

* ps/contains-id-error-message:
  parse-options: do not show usage upon invalid option value

6 years agocompletion: improve ls-files filter performance
Clemens Buchacher [Wed, 4 Apr 2018 07:46:58 +0000 (09:46 +0200)] 
completion: improve ls-files filter performance

From the output of ls-files, we remove all but the leftmost path
component and then we eliminate duplicates. We do this in a while loop,
which is a performance bottleneck when the number of iterations is large
(e.g. for 60000 files in linux.git).

$ COMP_WORDS=(git status -- ar) COMP_CWORD=3; time _git

real    0m11.876s
user    0m4.685s
sys     0m6.808s

Replacing the loop with the cut command improves performance
significantly:

$ COMP_WORDS=(git status -- ar) COMP_CWORD=3; time _git

real    0m1.372s
user    0m0.263s
sys     0m0.167s

The measurements were done with Msys2 bash, which is used by Git for
Windows.

When filtering the ls-files output we take care not to touch absolute
paths. This is redundant, because ls-files will never output absolute
paths. Remove the unnecessary operations.

The issue was reported here:
https://github.com/git-for-windows/git/issues/1533

Signed-off-by: Clemens Buchacher <drizzd@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoThe first batch for 2.18 cycle
Junio C Hamano [Mon, 9 Apr 2018 23:31:10 +0000 (08:31 +0900)] 
The first batch for 2.18 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'tg/stash-untracked-with-pathspec-fix'
Junio C Hamano [Mon, 9 Apr 2018 23:25:45 +0000 (08:25 +0900)] 
Merge branch 'tg/stash-untracked-with-pathspec-fix'

"git stash push -u -- <pathspec>" gave an unnecessary and confusing
error message when there was no tracked files that match the
<pathspec>, which has been fixed.

* tg/stash-untracked-with-pathspec-fix:
  stash: drop superfluos pathspec parameter
  stash push -u: don't create empty stash
  stash push: avoid printing errors
  stash: fix nonsense pipeline

6 years agoMerge branch 'nd/worktree-prune'
Junio C Hamano [Mon, 9 Apr 2018 23:25:45 +0000 (08:25 +0900)] 
Merge branch 'nd/worktree-prune'

The way "git worktree prune" worked internally has been simplified,
by assuming how "git worktree move" moves an existing worktree to a
different place.

* nd/worktree-prune:
  worktree prune: improve prune logic when worktree is moved
  worktree: delete dead code
  gc.txt: more details about what gc does

6 years agoMerge branch 'bc/object-id'
Junio C Hamano [Mon, 9 Apr 2018 23:25:45 +0000 (08:25 +0900)] 
Merge branch 'bc/object-id'

Conversion from uchar[20] to struct object_id continues.

* bc/object-id: (36 commits)
  convert: convert to struct object_id
  sha1_file: introduce a constant for max header length
  Convert lookup_replace_object to struct object_id
  sha1_file: convert read_sha1_file to struct object_id
  sha1_file: convert read_object_with_reference to object_id
  tree-walk: convert tree entry functions to object_id
  streaming: convert istream internals to struct object_id
  tree-walk: convert get_tree_entry_follow_symlinks internals to object_id
  builtin/notes: convert static functions to object_id
  builtin/fmt-merge-msg: convert remaining code to object_id
  sha1_file: convert sha1_object_info* to object_id
  Convert remaining callers of sha1_object_info_extended to object_id
  packfile: convert unpack_entry to struct object_id
  sha1_file: convert retry_bad_packed_offset to struct object_id
  sha1_file: convert assert_sha1_type to object_id
  builtin/mktree: convert to struct object_id
  streaming: convert open_istream to use struct object_id
  sha1_file: convert check_sha1_signature to struct object_id
  sha1_file: convert read_loose_object to use struct object_id
  builtin/index-pack: convert struct ref_delta_entry to object_id
  ...

6 years agoMerge branch 'ma/shortlog-revparse'
Junio C Hamano [Mon, 9 Apr 2018 23:25:44 +0000 (08:25 +0900)] 
Merge branch 'ma/shortlog-revparse'

"git shortlog cruft" aborted with a BUG message when run outside a
Git repository.  The command has been taught to complain about
extra and unwanted arguments on its command line instead in such a
case.

* ma/shortlog-revparse:
  shortlog: disallow left-over arguments outside repo
  shortlog: add usage-string for stdin-reading
  git-shortlog.txt: reorder usages

6 years agoMerge branch 'ab/install-symlinks'
Junio C Hamano [Mon, 9 Apr 2018 23:25:44 +0000 (08:25 +0900)] 
Merge branch 'ab/install-symlinks'

The build procedure learned to optionally use symbolic links
(instead of hardlinks and copies) to install "git-foo" for built-in
commands, whose binaries are all identical.

* ab/install-symlinks:
  Makefile: optionally symlink libexec/git-core binaries to bin/git
  Makefile: add a gitexecdir_relative variable
  Makefile: fix broken bindir_relative variable

6 years agoMerge branch 'ml/filter-branch-no-op-error'
Junio C Hamano [Mon, 9 Apr 2018 23:25:44 +0000 (08:25 +0900)] 
Merge branch 'ml/filter-branch-no-op-error'

"git filter-branch" learned to use a different exit code to allow
the callers to tell the case where there was no new commits to
rewrite from other error cases.

* ml/filter-branch-no-op-error:
  filter-branch: return 2 when nothing to rewrite

6 years agoMerge branch 'ab/pcre-v2'
Junio C Hamano [Mon, 9 Apr 2018 23:25:43 +0000 (08:25 +0900)] 
Merge branch 'ab/pcre-v2'

Git can be built to use either v1 or v2 of the PCRE library, and so
far, the build-time configuration USE_LIBPCRE=YesPlease instructed
the build procedure to use v1, but now it means v2.  USE_LIBPCRE1
and USE_LIBPCRE2 can be used to explicitly choose which version to
use, as before.

* ab/pcre-v2:
  Makefile: make USE_LIBPCRE=YesPlease mean v2, not v1
  configure: detect redundant --with-libpcre & --with-libpcre1
  configure: fix a regression in PCRE v1 detection

6 years agoMerge branch 'ti/fetch-everything-local-optim'
Junio C Hamano [Mon, 9 Apr 2018 23:25:43 +0000 (08:25 +0900)] 
Merge branch 'ti/fetch-everything-local-optim'

A "git fetch" from a repository with insane number of refs into a
repository that is already up-to-date still wasted too many cycles
making many lstat(2) calls to see if these objects at the tips
exist as loose objects locally.  These lstat(2) calls are optimized
away by enumerating all loose objects beforehand.

It is unknown if the new strategy negatively affects existing use
cases, fetching into a repository with many loose objects from a
repository with small number of refs.

* ti/fetch-everything-local-optim:
  fetch-pack.c: use oidset to check existence of loose object

6 years agoMerge branch 'en/rename-directory-detection'
Junio C Hamano [Mon, 9 Apr 2018 23:25:43 +0000 (08:25 +0900)] 
Merge branch 'en/rename-directory-detection'

Rename detection logic in "diff" family that is used in "merge" has
learned to guess when all of x/a, x/b and x/c have moved to z/a,
z/b and z/c, it is likely that x/d added in the meantime would also
want to move to z/d by taking the hint that the entire directory
'x' moved to 'z'.  A bug causing dirty files involved in a rename
to be overwritten during merge has also been fixed as part of this
work.

* en/rename-directory-detection: (29 commits)
  merge-recursive: ensure we write updates for directory-renamed file
  merge-recursive: avoid spurious rename/rename conflict from dir renames
  directory rename detection: new testcases showcasing a pair of bugs
  merge-recursive: fix remaining directory rename + dirty overwrite cases
  merge-recursive: fix overwriting dirty files involved in renames
  merge-recursive: avoid clobbering untracked files with directory renames
  merge-recursive: apply necessary modifications for directory renames
  merge-recursive: when comparing files, don't include trees
  merge-recursive: check for file level conflicts then get new name
  merge-recursive: add computation of collisions due to dir rename & merging
  merge-recursive: check for directory level conflicts
  merge-recursive: add get_directory_renames()
  merge-recursive: make a helper function for cleanup for handle_renames
  merge-recursive: split out code for determining diff_filepairs
  merge-recursive: make !o->detect_rename codepath more obvious
  merge-recursive: fix leaks of allocated renames and diff_filepairs
  merge-recursive: introduce new functions to handle rename logic
  merge-recursive: move the get_renames() function
  directory rename detection: tests for handling overwriting dirty files
  directory rename detection: tests for handling overwriting untracked files
  ...

6 years agoconfigure.ac: fix botched FREAD_READS_DIRECTORIES check
Eric Sunshine [Mon, 9 Apr 2018 08:50:42 +0000 (04:50 -0400)] 
configure.ac: fix botched FREAD_READS_DIRECTORIES check

3adf9fdecf (configure.ac: loosen FREAD_READS_DIRECTORIES test program,
2017-06-14) broke the test program for the FREAD_READS_DIRECTORIES check
by making it syntactically invalid (a dangling ")") and by botching the
type returned from 'main' (a FILE* rather than int). As a consequence,
the test program won't even compile, thus the check fails
unconditionally. Fix these problems.

Reported-by: Jonathan Primrose <jprimros@gmail.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-worktree.txt: unify command-line prompt in example blocks
Eric Sunshine [Mon, 9 Apr 2018 07:34:00 +0000 (03:34 -0400)] 
git-worktree.txt: unify command-line prompt in example blocks

The command-line prompt in the "EXAMPLES" section is "$", however,
examples in the 'git worktree list' section (oddly) use "S" as a
prompt. Fix this inconsistency by settling on "$" as prompt in all
examples.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-worktree.txt: recommend 'git worktree remove' over manual deletion
Eric Sunshine [Mon, 9 Apr 2018 07:33:59 +0000 (03:33 -0400)] 
git-worktree.txt: recommend 'git worktree remove' over manual deletion

When cc73385cf6 (worktree remove: new command, 2018-02-12) implemented
and documented 'git worktree remove', it forgot to update existing
instructions suggesting manual deletion. Fix this oversight by
recommending 'git worktree remove' instead.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoDocumentation: normalize spelling of 'normalised'
Elijah Newren [Thu, 5 Apr 2018 17:20:27 +0000 (10:20 -0700)] 
Documentation: normalize spelling of 'normalised'

This could be a localization issue, but we had about four dozen
"normalize"s (or variants, e.g. normalized, renormalize, etc.), and only
one "normalised" (no other variants), so normalize normalised into
normalized.

Signed-off-by: Elijah Newren <newren@gmail.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoDocumentation: fix several one-character-off spelling errors
Elijah Newren [Thu, 5 Apr 2018 17:20:26 +0000 (10:20 -0700)] 
Documentation: fix several one-character-off spelling errors

Signed-off-by: Elijah Newren <newren@gmail.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>