gitweb.git
Merge branch 'js/rebase-i-clean-msg-after-fixup-continue'Junio C Hamano Wed, 23 May 2018 05:38:18 +0000 (14:38 +0900)

Merge branch 'js/rebase-i-clean-msg-after-fixup-continue'

"git rebase -i" sometimes left intermediate "# This is a
combination of N commits" message meant for the human consumption
inside an editor in the final result in certain corner cases, which
has been fixed.

* js/rebase-i-clean-msg-after-fixup-continue:
rebase --skip: clean up commit message after a failed fixup/squash
sequencer: always commit without editing when asked for
rebase -i: Handle "combination of <n> commits" with GETTEXT_POISON
rebase -i: demonstrate bugs with fixup!/squash! commit messages

Merge branch 'tg/worktree-add-existing-branch'Junio C Hamano Wed, 23 May 2018 05:38:18 +0000 (14:38 +0900)

Merge branch 'tg/worktree-add-existing-branch'

"git worktree add" learned to check out an existing branch.

* tg/worktree-add-existing-branch:
worktree: teach "add" to check out existing branches
worktree: factor out dwim_branch function
worktree: improve message when creating a new worktree
worktree: remove extra members from struct add_opts

Merge branch 'js/deprecate-grafts'Junio C Hamano Wed, 23 May 2018 05:38:17 +0000 (14:38 +0900)

Merge branch 'js/deprecate-grafts'

The functionality of "$GIT_DIR/info/grafts" has been superseded by
the "refs/replace/" mechanism for some time now, but the internal
code had support for it in many places, which has been cleaned up
in order to drop support of the "grafts" mechanism.

* js/deprecate-grafts:
Remove obsolete script to convert grafts to replace refs
technical/shallow: describe why shallow cannot use replace refs
technical/shallow: stop referring to grafts
filter-branch: stop suggesting to use grafts
Deprecate support for .git/info/grafts
Add a test for `git replace --convert-graft-file`
replace: introduce --convert-graft-file
replace: prepare create_graft() for converting graft files wholesale
replace: "libify" create_graft() and callees
replace: avoid using die() to indicate a bug
commit: Let the callback of for_each_mergetag return on error
argv_array: offer to split a string by whitespace

Merge branch 'js/test-unset-prereq'Junio C Hamano Wed, 23 May 2018 05:38:17 +0000 (14:38 +0900)

Merge branch 'js/test-unset-prereq'

Test debugging aid.

* js/test-unset-prereq:
tests: introduce test_unset_prereq, for debugging

Merge branch 'ab/perl-python-attrs'Junio C Hamano Wed, 23 May 2018 05:38:16 +0000 (14:38 +0900)

Merge branch 'ab/perl-python-attrs'

We learned that our source files with ".pl" and ".py" extensions
are Perl and Python files respectively and changes to them are
better viewed as such with appropriate diff drivers.

* ab/perl-python-attrs:
.gitattributes: add a diff driver for Python
.gitattributes: use the "perl" differ for Perl
.gitattributes: add *.pl extension for Perl

Merge branch 'sb/oid-object-info'Junio C Hamano Wed, 23 May 2018 05:38:16 +0000 (14:38 +0900)

Merge branch 'sb/oid-object-info'

The codepath around object-info API has been taught to take the
repository object (which in turn tells the API which object store
the objects are to be located).

* sb/oid-object-info:
cache.h: allow oid_object_info to handle arbitrary repositories
packfile: add repository argument to cache_or_unpack_entry
packfile: add repository argument to unpack_entry
packfile: add repository argument to read_object
packfile: add repository argument to packed_object_info
packfile: add repository argument to packed_to_object_type
packfile: add repository argument to retry_bad_packed_offset
cache.h: add repository argument to oid_object_info
cache.h: add repository argument to oid_object_info_extended

Merge branch 'cc/perf-aggregate-unknown-option'Junio C Hamano Wed, 23 May 2018 05:38:15 +0000 (14:38 +0900)

Merge branch 'cc/perf-aggregate-unknown-option'

Perf-test helper updates.

* cc/perf-aggregate-unknown-option:
perf/aggregate: use Getopt::Long for option parsing

Merge branch 'en/git-debugger'Junio C Hamano Wed, 23 May 2018 05:38:15 +0000 (14:38 +0900)

Merge branch 'en/git-debugger'

Dev support.

* en/git-debugger:
Make running git under other debugger-like programs easy

Merge branch 'bw/server-options'Junio C Hamano Wed, 23 May 2018 05:38:15 +0000 (14:38 +0900)

Merge branch 'bw/server-options'

The transport protocol v2 is getting updated further.

* bw/server-options:
fetch: send server options when using protocol v2
ls-remote: send server options when using protocol v2
serve: introduce the server-option capability

Merge branch 'nd/repack-keep-pack'Junio C Hamano Wed, 23 May 2018 05:38:14 +0000 (14:38 +0900)

Merge branch 'nd/repack-keep-pack'

"git gc" in a large repository takes a lot of time as it considers
to repack all objects into one pack by default. The command has
been taught to pretend as if the largest existing packfile is
marked with ".keep" so that it is left untouched while objects in
other packs and loose ones are repacked.

* nd/repack-keep-pack:
pack-objects: show some progress when counting kept objects
gc --auto: exclude base pack if not enough mem to "repack -ad"
gc: handle a corner case in gc.bigPackThreshold
gc: add gc.bigPackThreshold config
gc: add --keep-largest-pack option
repack: add --keep-pack option
t7700: have closing quote of a test at the beginning of line

Merge branch 'ds/lazy-load-trees'Junio C Hamano Wed, 23 May 2018 05:38:13 +0000 (14:38 +0900)

Merge branch 'ds/lazy-load-trees'

The code has been taught to use the duplicated information stored
in the commit-graph file to learn the tree object name for a commit
to avoid opening and parsing the commit object when it makes sense
to do so.

* ds/lazy-load-trees:
coccinelle: avoid wrong transformation suggestions from commit.cocci
commit-graph: lazy-load trees for commits
treewide: replace maybe_tree with accessor methods
commit: create get_commit_tree() method
treewide: rename tree to maybe_tree

Merge branch 'nd/term-columns'Junio C Hamano Wed, 23 May 2018 05:38:13 +0000 (14:38 +0900)

Merge branch 'nd/term-columns'

The code did not propagate the terminal width to subprocesses via
COLUMNS environment variable, which it now does. This caused
trouble to "git column" helper subprocess when "git tag --column=row"
tried to list the existing tags on a display with non-default width.

* nd/term-columns:
column: fix off-by-one default width
pager: set COLUMNS to term_columns()

Merge branch 'sg/t7005-spaces-in-filenames-cleanup'Junio C Hamano Wed, 23 May 2018 05:38:12 +0000 (14:38 +0900)

Merge branch 'sg/t7005-spaces-in-filenames-cleanup'

Test update.

* sg/t7005-spaces-in-filenames-cleanup:
t7005-editor: get rid of the SPACES_IN_FILENAMES prereq

Merge branch 'sg/t5516-fixes'Junio C Hamano Wed, 23 May 2018 05:38:12 +0000 (14:38 +0900)

Merge branch 'sg/t5516-fixes'

Test fixes.

* sg/t5516-fixes:
t5516-fetch-push: fix broken &&-chain
t5516-fetch-push: fix 'push with dry-run' test

Merge branch 'sg/t5310-jgit-bitmap-test'Junio C Hamano Wed, 23 May 2018 05:38:11 +0000 (14:38 +0900)

Merge branch 'sg/t5310-jgit-bitmap-test'

Test update.

* sg/t5310-jgit-bitmap-test:
t5310-pack-bitmaps: make JGit tests work with GIT_TEST_SPLIT_INDEX

Merge branch 'nd/pack-format-doc'Junio C Hamano Wed, 23 May 2018 05:38:11 +0000 (14:38 +0900)

Merge branch 'nd/pack-format-doc'

Doc update.

* nd/pack-format-doc:
pack-format.txt: more details on pack file format

Merge branch 'jk/apply-p-doc'Junio C Hamano Wed, 23 May 2018 05:38:11 +0000 (14:38 +0900)

Merge branch 'jk/apply-p-doc'

Doc update.

* jk/apply-p-doc:
apply: clarify "-p" documentation

Merge branch 'ao/config-api-doc'Junio C Hamano Wed, 23 May 2018 05:38:10 +0000 (14:38 +0900)

Merge branch 'ao/config-api-doc'

Doc update.

* ao/config-api-doc:
doc: fix config API documentation about config_with_options

Merge branch 'bc/mailmap-self'Junio C Hamano Wed, 23 May 2018 05:38:10 +0000 (14:38 +0900)

Merge branch 'bc/mailmap-self'

* bc/mailmap-self:
mailmap: update brian m. carlson's email address

Merge branch 'sb/object-store-replace'Junio C Hamano Wed, 23 May 2018 05:38:09 +0000 (14:38 +0900)

Merge branch 'sb/object-store-replace'

Hotfix.

* sb/object-store-replace:
get_main_ref_store: BUG() when outside a repository
object.c: clear replace map before freeing it
replace-object.c: remove the_repository from prepare_replace_object
object.c: free replace map in raw_object_store_clear

Merge branch 'hn/sort-ls-remote'Junio C Hamano Wed, 23 May 2018 05:38:09 +0000 (14:38 +0900)

Merge branch 'hn/sort-ls-remote'

Hotfix.

* hn/sort-ls-remote:
t5512: run git fetch inside test

get_main_ref_store: BUG() when outside a repositoryJeff King Fri, 18 May 2018 22:25:53 +0000 (15:25 -0700)

get_main_ref_store: BUG() when outside a repository

If we don't have a repository, then we can't initialize the
ref store. Prior to 64a741619d (refs: store the main ref
store inside the repository struct, 2018-04-11), we'd try to
access get_git_dir(), and outside a repository that would
trigger a BUG(). After that commit, though, we directly use
the_repository->git_dir; if it's NULL we'll just segfault.

Let's catch this case and restore the BUG() behavior.
Obviously we don't ever want to hit this code, but a BUG()
is a lot more helpful than a segfault if we do.

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

object.c: clear replace map before freeing itStefan Beller Thu, 17 May 2018 18:29:57 +0000 (11:29 -0700)

object.c: clear replace map before freeing it

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7005-editor: get rid of the SPACES_IN_FILENAMES prereqSZEDER Gábor Mon, 14 May 2018 10:28:12 +0000 (12:28 +0200)

t7005-editor: get rid of the SPACES_IN_FILENAMES prereq

The last two tests 'editor with a space' and 'core.editor with a
space' in 't7005-editor.sh' need the SPACES_IN_FILENAMES prereq to
ensure that they are only run on filesystems that allow, well, spaces
in filenames. However, we have been putting a space in the name of
the trash directory for just over a decade now, so we wouldn't be able
to run any of our tests on such a filesystem in the first place.

This prereq is therefore unnecessary, remove it.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5512: run git fetch inside testRené Scharfe Sat, 12 May 2018 08:45:23 +0000 (10:45 +0200)

t5512: run git fetch inside test

Do the preparatory fetch inside the test of ls-remote --symref to avoid
cluttering the test output and to be able to catch unexpected fetch
failures.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

column: fix off-by-one default widthNguyễn Thái Ngọc Duy Fri, 11 May 2018 12:13:29 +0000 (14:13 +0200)

column: fix off-by-one default width

By default we want to fill the whole screen if possible, but we do not
want to use up _all_ terminal columns because the last character is
going hit the border, push the cursor over and wrap. Keep it at
default value zero, which will make print_columns() set the width at
term_columns() - 1.

This affects the test in t7004 because effective column width before
was 40 but now 39 so we need to compensate it by one or the output at
39 columns has a different layout.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pager: set COLUMNS to term_columns()Jeff King Fri, 11 May 2018 09:25:16 +0000 (05:25 -0400)

pager: set COLUMNS to term_columns()

After we invoke the pager, our stdout goes to a pipe, not the
terminal, meaning we can no longer use an ioctl to get the
terminal width. For that reason, ad6c3739a3 (pager: find out
the terminal width before spawning the pager, 2012-02-12)
started caching the terminal width.

But that cache is only an in-process variable. Any programs
we spawn will also not be able to run that ioctl, but won't
have access to our cache. They'll end up falling back to our
80-column default.

You can see the problem with:

git tag --column=row

Since git-tag spawns a pager these days, its spawned
git-column helper will see neither the terminal on stdout
nor a useful COLUMNS value (assuming you do not export it
from your shell already). And you'll end up with 80-column
output in the pager, regardless of your terminal size.

We can fix this by setting COLUMNS right before spawning the
pager. That fixes this case, as well as any more complicated
ones (e.g., a paged program spawns another script which then
generates columnized output).

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

pack-format.txt: more details on pack file formatNguyễn Thái Ngọc Duy Fri, 11 May 2018 06:55:23 +0000 (08:55 +0200)

pack-format.txt: more details on pack file format

The current document mentions OBJ_* constants without their actual
values. A git developer would know these are from cache.h but that's
not very friendly to a person who wants to read this file to implement
a pack file parser.

Similarly, the deltified representation is not documented at all (the
"document" is basically patch-delta.c). Translate that C code to
English with a bit more about what ofs-delta and ref-delta mean.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

apply: clarify "-p" documentationJeff King Thu, 10 May 2018 14:29:24 +0000 (10:29 -0400)

apply: clarify "-p" documentation

We're not really removing slashes, but slash-separated path
components. Let's make that more clear.

Reported-by: kelly elton <its.the.doc@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5516-fetch-push: fix broken &&-chainSZEDER Gábor Thu, 10 May 2018 14:01:54 +0000 (16:01 +0200)

t5516-fetch-push: fix broken &&-chain

b2dc968e60 (t5516: refactor oddball tests, 2008-11-07) accidentaly
broke the &&-chain in the test 'push does not update local refs on
failure', but since it was in a subshell, chain-lint couldn't notice
it.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5516-fetch-push: fix 'push with dry-run' testSZEDER Gábor Thu, 10 May 2018 14:01:53 +0000 (16:01 +0200)

t5516-fetch-push: fix 'push with dry-run' test

In a while-at-it cleanup replacing a 'cd dir && <...> && cd ..' with a
subshell, commit 28391a80a9 (receive-pack: allow deletion of corrupt
refs, 2007-11-29) also moved the assignment of the $old_commit
variable to that subshell. This variable, however, is used outside of
that subshell as a parameter of check_push_result(), to check that a
ref still points to the commit where it is supposed to. With the
variable remaining unset outside the subshell check_push_result()
doesn't perform that check at all.

Use 'git -C <dir> cmd...', so we don't need to change directory, and
thus don't need the subshell either when setting $old_commit.

Furthermore, change check_push_result() to require at least three
parameters (the repo, the oid, and at least one ref), so it will catch
similar issues earlier should they ever arise.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5310-pack-bitmaps: make JGit tests work with GIT_TEST_... SZEDER Gábor Thu, 10 May 2018 13:58:52 +0000 (15:58 +0200)

t5310-pack-bitmaps: make JGit tests work with GIT_TEST_SPLIT_INDEX

The two JGit tests 'we can read jgit bitmaps' and 'jgit can read our
bitmaps' in 't5310-pack-bitmaps.sh' fail when run with
GIT_TEST_SPLIT_INDEX=YesPlease. Both tests create a clone of the test
repository to check bitmap interoperability with JGit. With split
indexes enabled the index in the clone repositories contains the
'link' extension, which JGit doesn't support and, consequently, an
exception aborts it:

<...>
org.eclipse.jgit.api.errors.JGitInternalException: DIRC extension 'link' not supported by this version.
at org.eclipse.jgit.dircache.DirCache.readFrom(DirCache.java:562)
<...>

Since testing bitmaps doesn't need a worktree in the first place,
let's just create bare clones for the two JGit tests, so the cloned
won't have an index, and these two tests can be executed even with
split index enabled.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: fix config API documentation about config_with_optionsAntonio Ospite Wed, 9 May 2018 13:16:28 +0000 (15:16 +0200)

doc: fix config API documentation about config_with_options

In commit dc8441fdb ("config: don't implicitly use gitdir or commondir",
2017-06-14) the function git_config_with_options was renamed to
config_with_options to better reflect the fact that it does not access
the git global config or the repo config by default.

However Documentation/technical/api-config.txt still refers to the
previous name, fix that.

While at it also update the documentation about the extra parameters,
because they too changed since the initial definition.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace-object.c: remove the_repository from prepare_re... Stefan Beller Wed, 9 May 2018 23:40:59 +0000 (16:40 -0700)

replace-object.c: remove the_repository from prepare_replace_object

This was missed in 5982da9d2ce (replace-object: allow
prepare_replace_object to handle arbitrary repositories, 2018-04-11)

Technically the code works correctly as the replace_map is the same
size in different repositories, however it is hard to read. So convert
the code to the familiar pattern of dereferencing the pointer that we
assign in the sizeof itself.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

object.c: free replace map in raw_object_store_clearStefan Beller Wed, 9 May 2018 23:40:58 +0000 (16:40 -0700)

object.c: free replace map in raw_object_store_clear

The replace map for objects was missed to free in the object store in
the conversion of 174774cd519 (Merge branch 'sb/object-store-replace',
2018-05-08)

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

The fifth batch for 2.18Junio C Hamano Tue, 8 May 2018 06:50:30 +0000 (15:50 +0900)

The fifth batch for 2.18

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ma/http-walker-no-partial'Junio C Hamano Tue, 8 May 2018 06:59:35 +0000 (15:59 +0900)

Merge branch 'ma/http-walker-no-partial'

"git http-fetch" (deprecated) had an optional and experimental
"feature" to fetch only commits and/or trees, which nobody used.
This has been removed.

* ma/http-walker-no-partial:
walker: drop fields of `struct walker` which are always 1
http-fetch: make `-a` standard behaviour

Merge branch 'js/runtime-prefix'Junio C Hamano Tue, 8 May 2018 06:59:34 +0000 (15:59 +0900)

Merge branch 'js/runtime-prefix'

* js/runtime-prefix:
Avoid multiple PREFIX definitions
git_setup_gettext: plug memory leak
gettext: avoid initialization if the locale dir is not present

Merge branch 'js/colored-push-errors'Junio C Hamano Tue, 8 May 2018 06:59:34 +0000 (15:59 +0900)

Merge branch 'js/colored-push-errors'

Error messages from "git push" can be painted for more visibility.

* js/colored-push-errors:
config: document the settings to colorize push errors/hints
push: test to verify that push errors are colored
push: colorize errors
color: introduce support for colorizing stderr

Merge branch 'jc/parseopt-expiry-errors'Junio C Hamano Tue, 8 May 2018 06:59:33 +0000 (15:59 +0900)

Merge branch 'jc/parseopt-expiry-errors'

"git gc --prune=nonsense" spent long time repacking and then
silently failed when underlying "git prune --expire=nonsense"
failed to parse its command line. This has been corrected.

* jc/parseopt-expiry-errors:
parseopt: handle malformed --expire arguments more nicely
gc: do not upcase error message shown with die()

Merge branch 'ma/fast-export-skip-merge-fix'Junio C Hamano Tue, 8 May 2018 06:59:33 +0000 (15:59 +0900)

Merge branch 'ma/fast-export-skip-merge-fix'

"git fast-export" had a regression in v2.15.0 era where it skipped
some merge commits in certain cases, which has been corrected.

* ma/fast-export-skip-merge-fix:
fast-export: fix regression skipping some merge-commits

Merge branch 'tz/doc-git-urls-reference'Junio C Hamano Tue, 8 May 2018 06:59:32 +0000 (15:59 +0900)

Merge branch 'tz/doc-git-urls-reference'

Doc fix.

* tz/doc-git-urls-reference:
doc/clone: update caption for GIT URLS cross-reference

Merge branch 'tg/demote-stash-save-in-completion'Junio C Hamano Tue, 8 May 2018 06:59:32 +0000 (15:59 +0900)

Merge branch 'tg/demote-stash-save-in-completion'

The command line completion (in contrib/) has been taught that "git
stash save" has been deprecated ("git stash push" is the preferred
spelling in the new world) and does not offer it as a possible
completion candidate when "git stash push" can be.

* tg/demote-stash-save-in-completion:
completion: make stash -p and alias for stash push -p
completion: stop showing 'save' for stash by default

Merge branch 'sa/send-email-dedup-some-headers'Junio C Hamano Tue, 8 May 2018 06:59:31 +0000 (15:59 +0900)

Merge branch 'sa/send-email-dedup-some-headers'

When fed input that already has In-Reply-To: and/or References:
headers and told to add the same information, "git send-email"
added these headers separately, instead of appending to an existing
one, which is a violation of the RFC. This has been corrected.

* sa/send-email-dedup-some-headers:
send-email: avoid duplicate In-Reply-To/References

Merge branch 'nd/submodule-status-fix'Junio C Hamano Tue, 8 May 2018 06:59:31 +0000 (15:59 +0900)

Merge branch 'nd/submodule-status-fix'

"git submodule status" did not check the symbolic revision name it
computed for the submodule HEAD is not the NULL, and threw it at
printf routines, which has been corrected.

* nd/submodule-status-fix:
submodule--helper: don't print null in 'submodule status'

Merge branch 'js/ident-date-fix'Junio C Hamano Tue, 8 May 2018 06:59:30 +0000 (15:59 +0900)

Merge branch 'js/ident-date-fix'

During a "rebase -i" session, the code could give older timestamp
to commits created by later "pick" than an earlier "reword", which
has been corrected.

* js/ident-date-fix:
sequencer: reset the committer date before commits

Merge branch 'bt/gpg-interface'Junio C Hamano Tue, 8 May 2018 06:59:29 +0000 (15:59 +0900)

Merge branch 'bt/gpg-interface'

What is queued here is only the obviously correct and
uncontroversial code clean-up part, which is an earlier 7 patches,
of a larger series.

The remainder that is not queued introduces a few configuration
variables to deal with e-signature backends with different
signature format.

* bt/gpg-interface:
gpg-interface: find the last gpg signature line
gpg-interface: extract gpg line matching helper
gpg-interface: fix const-correctness of "eol" pointer
gpg-interface: use size_t for signature buffer size
gpg-interface: modernize function declarations
gpg-interface: handle bool user.signingkey
t7004: fix mistaken tag name

Merge branch 'hn/sort-ls-remote'Junio C Hamano Tue, 8 May 2018 06:59:29 +0000 (15:59 +0900)

Merge branch 'hn/sort-ls-remote'

"git ls-remote" learned an option to allow sorting its output based
on the refnames being shown.

* hn/sort-ls-remote:
ls-remote: create '--sort' option

Merge branch 'ab/git-svn-get-record-typofix'Junio C Hamano Tue, 8 May 2018 06:59:28 +0000 (15:59 +0900)

Merge branch 'ab/git-svn-get-record-typofix'

"git svn" had a minor thinko/typo which has been fixed.

* ab/git-svn-get-record-typofix:
git-svn: avoid warning on undef readline()

Merge branch 'tb/config-default'Junio C Hamano Tue, 8 May 2018 06:59:27 +0000 (15:59 +0900)

Merge branch 'tb/config-default'

"git config --get" learned the "--default" option, to help the
calling script. Building on top of the tb/config-type topic, the
"git config" learns "--type=color" type. Taken together, you can
do things like "git config --get foo.color --default blue" and get
the ANSI color sequence for the color given to foo.color variable,
or "blue" if the variable does not exist.

* tb/config-default:
builtin/config: introduce `color` type specifier
config.c: introduce 'git_config_color' to parse ANSI colors
builtin/config: introduce `--default`

Merge branch 'tb/config-type'Junio C Hamano Tue, 8 May 2018 06:59:26 +0000 (15:59 +0900)

Merge branch 'tb/config-type'

The "git config" command uses separate options e.g. "--int",
"--bool", etc. to specify what type the caller wants the value to
be interpreted as. A new "--type=<typename>" option has been
introduced, which would make it cleaner to define new types.

* tb/config-type:
builtin/config.c: support `--type=<type>` as preferred alias for `--<type>`
builtin/config.c: treat type specifiers singularly

Merge branch 'sg/doc-gc-quote-mismatch-fix'Junio C Hamano Tue, 8 May 2018 06:59:26 +0000 (15:59 +0900)

Merge branch 'sg/doc-gc-quote-mismatch-fix'

Doc formatting fix.

* sg/doc-gc-quote-mismatch-fix:
docs/git-gc: fix minor rendering issue

Merge branch 'sg/completion-clear-cached'Junio C Hamano Tue, 8 May 2018 06:59:25 +0000 (15:59 +0900)

Merge branch 'sg/completion-clear-cached'

The completion script (in contrib/) learned to clear cached list of
command line options upon dot-sourcing it again in a more efficient
way.

* sg/completion-clear-cached:
completion: reduce overhead of clearing cached --options

Merge branch 'sb/worktree-remove-opt-force'Junio C Hamano Tue, 8 May 2018 06:59:24 +0000 (15:59 +0900)

Merge branch 'sb/worktree-remove-opt-force'

"git worktree remove" learned that "-f" is a shorthand for
"--force" option, just like for "git worktree add".

* sb/worktree-remove-opt-force:
worktree: accept -f as short for --force for removal

Merge branch 'ma/double-dashes-in-docs'Junio C Hamano Tue, 8 May 2018 06:59:24 +0000 (15:59 +0900)

Merge branch 'ma/double-dashes-in-docs'

Doc formatting updates.

* ma/double-dashes-in-docs:
git-submodule.txt: quote usage in monospace, drop backslash
git-[short]log.txt: unify quoted standalone --
doc: convert [\--] to [--]
doc: convert \--option to --option

Merge branch 'tq/t1510'Junio C Hamano Tue, 8 May 2018 06:59:23 +0000 (15:59 +0900)

Merge branch 'tq/t1510'

Test cleanup.

* tq/t1510:
t1510-repo-setup.sh: remove useless mkdir

Merge branch 'so/glossary-ancestor'Junio C Hamano Tue, 8 May 2018 06:59:23 +0000 (15:59 +0900)

Merge branch 'so/glossary-ancestor'

Docfix.

* so/glossary-ancestor:
glossary: substitute "ancestor" for "direct ancestor" in 'push' description.

Merge branch 'ls/checkout-encoding'Junio C Hamano Tue, 8 May 2018 06:59:22 +0000 (15:59 +0900)

Merge branch 'ls/checkout-encoding'

The new "checkout-encoding" attribute can ask Git to convert the
contents to the specified encoding when checking out to the working
tree (and the other way around when checking in).

* ls/checkout-encoding:
convert: add round trip check based on 'core.checkRoundtripEncoding'
convert: add tracing for 'working-tree-encoding' attribute
convert: check for detectable errors in UTF encodings
convert: add 'working-tree-encoding' attribute
utf8: add function to detect a missing UTF-16/32 BOM
utf8: add function to detect prohibited UTF-16/32 BOM
utf8: teach same_encoding() alternative UTF encoding names
strbuf: add a case insensitive starts_with()
strbuf: add xstrdup_toupper()
strbuf: remove unnecessary NUL assignment in xstrdup_tolower()

Merge branch 'ab/nuke-emacs-contrib'Junio C Hamano Tue, 8 May 2018 06:59:22 +0000 (15:59 +0900)

Merge branch 'ab/nuke-emacs-contrib'

The scripts in contrib/emacs/ have outlived their usefulness and
have been replaced with a stub that errors out and tells the user
there are replacements.

* ab/nuke-emacs-contrib:
git{,-blame}.el: remove old bitrotting Emacs code

Merge branch 'nd/warn-more-for-devs'Junio C Hamano Tue, 8 May 2018 06:59:21 +0000 (15:59 +0900)

Merge branch 'nd/warn-more-for-devs'

The build procedure "make DEVELOPER=YesPlease" learned to enable a
bit more warning options depending on the compiler used to help
developers more. There also is "make DEVOPTS=tokens" knob
available now, for those who want to help fixing warnings we
usually ignore, for example.

* nd/warn-more-for-devs:
Makefile: add a DEVOPTS to get all of -Wextra
Makefile: add a DEVOPTS to suppress -Werror under DEVELOPER
Makefile: detect compiler and enable more warnings in DEVELOPER=1
connect.c: mark die_initial_contact() NORETURN

Merge branch 'sb/object-store-replace'Junio C Hamano Tue, 8 May 2018 06:59:21 +0000 (15:59 +0900)

Merge branch 'sb/object-store-replace'

The effort to pass the repository in-core structure throughout the
API continues. This round deals with the code that implements the
refs/replace/ mechanism.

* sb/object-store-replace:
replace-object: allow lookup_replace_object to handle arbitrary repositories
replace-object: allow do_lookup_replace_object to handle arbitrary repositories
replace-object: allow prepare_replace_object to handle arbitrary repositories
refs: allow for_each_replace_ref to handle arbitrary repositories
refs: store the main ref store inside the repository struct
replace-object: add repository argument to lookup_replace_object
replace-object: add repository argument to do_lookup_replace_object
replace-object: add repository argument to prepare_replace_object
refs: add repository argument to for_each_replace_ref
refs: add repository argument to get_main_ref_store
replace-object: check_replace_refs is safe in multi repo environment
replace-object: eliminate replace objects prepared flag
object-store: move lookup_replace_object to replace-object.h
replace-object: move replace_map to object store
replace_object: use oidmap

Merge branch 'ds/commit-graph'Junio C Hamano Tue, 8 May 2018 06:59:20 +0000 (15:59 +0900)

Merge branch 'ds/commit-graph'

Precompute and store information necessary for ancestry traversal
in a separate file to optimize graph walking.

* ds/commit-graph:
commit-graph: implement "--append" option
commit-graph: build graph from starting commits
commit-graph: read only from specific pack-indexes
commit: integrate commit graph with commit parsing
commit-graph: close under reachability
commit-graph: add core.commitGraph setting
commit-graph: implement git commit-graph read
commit-graph: implement git-commit-graph write
commit-graph: implement write_commit_graph()
commit-graph: create git-commit-graph builtin
graph: add commit graph design document
commit-graph: add format document
csum-file: refactor finalize_hashfile() method
csum-file: rename hashclose() to finalize_hashfile()

Merge branch 'js/empty-config-section-fix'Junio C Hamano Tue, 8 May 2018 06:59:18 +0000 (15:59 +0900)

Merge branch 'js/empty-config-section-fix'

"git config --unset a.b", when "a.b" is the last variable in an
otherwise empty section "a", left an empty section "a" behind, and
worse yet, a subsequent "git config a.c value" did not reuse that
empty shell and instead created a new one. These have been
(partially) corrected.

* js/empty-config-section-fix:
git_config_set: reuse empty sections
git config --unset: remove empty sections (in the common case)
git_config_set: make use of the config parser's event stream
git_config_set: do not use a state machine
config_set_store: rename some fields for consistency
config: avoid using the global variable `store`
config: introduce an optional event stream while parsing
t1300: `--unset-all` can leave an empty section behind (bug)
t1300: add a few more hairy examples of sections becoming empty
t1300: remove unreasonable expectation from TODO
t1300: avoid relying on a bug
config --replace-all: avoid extra line breaks
t1300: demonstrate that --replace-all can "invent" newlines
t1300: rename it to reflect that `repo-config` was deprecated
git_config_set: fix off-by-two

Merge branch 'ot/libify-get-ref-atom-value'Junio C Hamano Tue, 8 May 2018 06:59:18 +0000 (15:59 +0900)

Merge branch 'ot/libify-get-ref-atom-value'

Code restructuring, in preparation for further work.

* ot/libify-get-ref-atom-value:
ref-filter: libify get_ref_atom_value()
ref-filter: add return value to parsers
ref-filter: change parsing function error handling
ref-filter: add return value && strbuf to handlers
ref-filter: start adding strbufs with errors
ref-filter: add shortcut to work with strbufs

Merge branch 'sb/submodule-move-nested'Junio C Hamano Tue, 8 May 2018 06:59:17 +0000 (15:59 +0900)

Merge branch 'sb/submodule-move-nested'

Moving a submodule that itself has submodule in it with "git mv"
forgot to make necessary adjustment to the nested sub-submodules;
now the codepath learned to recurse into the submodules.

* sb/submodule-move-nested:
submodule: fixup nested submodules after moving the submodule
submodule-config: remove submodule_from_cache
submodule-config: add repository argument to submodule_from_{name, path}
submodule-config: allow submodule_free to handle arbitrary repositories
grep: remove "repo" arg from non-supporting funcs
submodule.h: drop declaration of connect_work_tree_and_git_dir

Merge branch 'dj/runtime-prefix'Junio C Hamano Tue, 8 May 2018 06:59:17 +0000 (15:59 +0900)

Merge branch 'dj/runtime-prefix'

A build-time option has been added to allow Git to be told to refer
to its associated files relative to the main binary, in the same
way that has been possible on Windows for quite some time, for
Linux, BSDs and Darwin.

* dj/runtime-prefix:
Makefile: quote $INSTLIBDIR when passing it to sed
Makefile: remove unused @@PERLLIBDIR@@ substitution variable
mingw/msvc: use the new-style RUNTIME_PREFIX helper
exec_cmd: provide a new-style RUNTIME_PREFIX helper for Windows
exec_cmd: RUNTIME_PREFIX on some POSIX systems
Makefile: add Perl runtime prefix support
Makefile: generate Perl header from template file

Merge branch 'ab/simplify-perl-makefile'Junio C Hamano Tue, 8 May 2018 06:59:16 +0000 (15:59 +0900)

Merge branch 'ab/simplify-perl-makefile'

Recent simplification of build procedure forgot a bit of tweak to
the build procedure of contrib/mw-to-git/

* ab/simplify-perl-makefile:
Makefile: mark perllibdir as a .PHONY target
perl: fix installing modules from contrib

Merge branch 'bw/protocol-v2'Junio C Hamano Tue, 8 May 2018 06:59:15 +0000 (15:59 +0900)

Merge branch 'bw/protocol-v2'

The beginning of the next-gen transfer protocol.

* bw/protocol-v2: (35 commits)
remote-curl: don't request v2 when pushing
remote-curl: implement stateless-connect command
http: eliminate "# service" line when using protocol v2
http: don't always add Git-Protocol header
http: allow providing extra headers for http requests
remote-curl: store the protocol version the server responded with
remote-curl: create copy of the service name
pkt-line: add packet_buf_write_len function
transport-helper: introduce stateless-connect
transport-helper: refactor process_connect_service
transport-helper: remove name parameter
connect: don't request v2 when pushing
connect: refactor git_connect to only get the protocol version once
fetch-pack: support shallow requests
fetch-pack: perform a fetch using v2
upload-pack: introduce fetch server command
push: pass ref prefixes when pushing
fetch: pass ref prefixes when fetching
ls-remote: pass ref prefixes when requesting a remote's refs
transport: convert transport_get_remote_refs to take a list of ref prefixes
...

mailmap: update brian m. carlson's email addressbrian m. carlson Tue, 8 May 2018 01:58:45 +0000 (01:58 +0000)

mailmap: update brian m. carlson's email address

An earlier change, cdb6b5ac (".mailmap: Combine more (name, email) to
individual persons", 2013-08-12), noted that there were two name
spellings and two email addresses and mapped the crustytoothpaste.net
address to the crustytoothpaste.ath.cx address. The latter is an older,
obsolete address, while the former is current, so switch the order of
the addresses so that git log displays the correct address.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

coccinelle: avoid wrong transformation suggestions... SZEDER Gábor Mon, 30 Apr 2018 09:31:53 +0000 (11:31 +0200)

coccinelle: avoid wrong transformation suggestions from commit.cocci

The semantic patch 'contrib/coccinelle/commit.cocci' added in
2e27bd7731 (treewide: replace maybe_tree with accessor methods,
2018-04-06) is supposed to "ensure that all references to the
'maybe_tree' member of struct commit are either mutations or accesses
through get_commit_tree()". So get_commit_tree() clearly must be able
to directly access the 'maybe_tree' member, and 'commit.cocci' has a
bit of a roundabout workaround to ensure that get_commit_tree()'s
direct access in its return statement is not transformed: after all
references to 'maybe_tree' have been transformed to a call to
get_commit_tree(), including the reference in get_commit_tree()
itself, the last rule transforms back a 'return get_commit_tree()'
statement, back then found only in get_commit_tree() itself, to a
direct access.

Unfortunately, already the very next commit shows that this workaround
is insufficient: 7b8a21dba1 (commit-graph: lazy-load trees for
commits, 2018-04-06) extends get_commit_tree() with a condition
directly accessing the 'maybe_tree' member, and Coccinelle with
'commit.cocci' promptly detects it and suggests a transformation to
avoid it. This transformation is clearly wrong, because calling
get_commit_tree() to access 'maybe_tree' _in_ get_commit_tree() would
obviously lead to recursion. Furthermore, the same commit added
another, more specialized getter function get_commit_tree_in_graph(),
whose legitimate direct access to 'maybe_tree' triggers a similar
wrong transformation suggestion.

Exclude both of these getter functions from the general rule in
'commit.cocci' that matches their direct accesses to 'maybe_tree'.
Also exclude load_tree_for_commit(), which, as static helper funcion
of get_commit_tree_in_graph(), has legitimate direct access to
'maybe_tree' as well.

The last rule transforming back 'return get_commit_tree()' statements
to direct accesses thus became unnecessary, remove it.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Acked-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase --skip: clean up commit message after a failed... Johannes Schindelin Fri, 27 Apr 2018 20:48:30 +0000 (22:48 +0200)

rebase --skip: clean up commit message after a failed fixup/squash

During a series of fixup/squash commands, the interactive rebase builds
up a commit message with comments. This will be presented to the user in
the editor if at least one of those commands was a `squash`.

In any case, the commit message will be cleaned up eventually, removing
all those intermediate comments, in the final step of such a
fixup/squash chain.

However, if the last fixup/squash command in such a chain fails with
merge conflicts, and if the user then decides to skip it (or resolve it
to a clean worktree and then continue the rebase), the current code
fails to clean up the commit message.

This commit fixes that behavior.

The fix is quite a bit more involved than meets the eye because it is
not only about the question whether we are `git rebase --skip`ing a
fixup or squash. It is also about removing the skipped fixup/squash's
commit message from the accumulated commit message. And it is also about
the question whether we should let the user edit the final commit
message or not ("Was there a squash in the chain *that was not
skipped*?").

For example, in this case we will want to fix the commit message, but
not open it in an editor:

pick <- succeeds
fixup <- succeeds
squash <- fails, will be skipped

This is where the newly-introduced `current-fixups` file comes in real
handy. A quick look and we can determine whether there was a non-skipped
squash. We only need to make sure to keep it up to date with respect to
skipped fixup/squash commands. As a bonus, we can even avoid committing
unnecessarily, e.g. when there was only one fixup, and it failed, and
was skipped.

To fix only the bug where the final commit message was not cleaned up
properly, but without fixing the rest, would have been more complicated
than fixing it all in one go, hence this commit lumps together more than
a single concern.

For the same reason, this commit also adds a bit more to the existing
test case for the regression we just fixed.

The diff is best viewed with --color-moved.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: always commit without editing when asked forJohannes Schindelin Fri, 27 Apr 2018 20:48:28 +0000 (22:48 +0200)

sequencer: always commit without editing when asked for

Previously, we only called run_git_commit() without EDIT_MSG when we also
passed in a default message.

However, an upcoming caller will want to commit without EDIT_MSG and
*without* a default message: to clean up fixup/squash comments in HEAD's
commit message.

Let's prepare for that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: Handle "combination of <n> commits" with... Johannes Schindelin Fri, 27 Apr 2018 20:48:21 +0000 (22:48 +0200)

rebase -i: Handle "combination of <n> commits" with GETTEXT_POISON

We previously relied on the localized versions of

# This is a combination of <N> commits

(which we write into the commit messages during fixup/squash chains)
to contain <N> encoded in ASCII.

This is not true in general, and certainly not true when compiled with
GETTEXT_POISON=TryToKillMe, as demonstrated by the regression test we
just introduced in t3418.

So let's decouple keeping track of the count from the (localized) commit
messages by introducing a new file called 'current-fixups' that keeps
track of the current fixup/squash chain. This file contains a bit more
than just the count (it contains a list of "fixup <commit>"/"squash
<commit>" lines). This is done on purpose, as it will come in handy for
a fix for the bug where `git rebase --skip` on a final fixup/squash will
leave the commit message in limbo.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: demonstrate bugs with fixup!/squash! commit... Johannes Schindelin Fri, 27 Apr 2018 20:48:16 +0000 (22:48 +0200)

rebase -i: demonstrate bugs with fixup!/squash! commit messages

When multiple fixup/squash commands are processed and the last one
causes merge conflicts and is skipped, we leave the "This is a
combination of ..." comments in the commit message.

Noticed by Eric Sunshine.

This regression test also demonstrates that we rely on the localized
version of

# This is a combination of <number> commits

to contain the <number> in ASCII, which breaks under GETTEXT_POISON.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Remove obsolete script to convert grafts to replace... Johannes Schindelin Sat, 28 Apr 2018 22:45:22 +0000 (00:45 +0200)

Remove obsolete script to convert grafts to replace refs

The functionality is now implemented as `git replace
--convert-graft-file`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

technical/shallow: describe why shallow cannot use... Johannes Schindelin Sat, 28 Apr 2018 22:45:21 +0000 (00:45 +0200)

technical/shallow: describe why shallow cannot use replace refs

It is tempting to do away with commit_graft altogether (in the long
haul), now that grafts are deprecated.

However, the shallow feature needs a couple of things that the replace
refs cannot fulfill. Let's point that out in the documentation.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

technical/shallow: stop referring to graftsJohannes Schindelin Sat, 28 Apr 2018 22:45:13 +0000 (00:45 +0200)

technical/shallow: stop referring to grafts

Now that grafts are deprecated, we should start to assume that readers
have no idea what grafts are. So it makes more sense to make the
description of the "shallow" feature stand on its own.

Suggested-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Junio Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

filter-branch: stop suggesting to use graftsJohannes Schindelin Sat, 28 Apr 2018 22:44:53 +0000 (00:44 +0200)

filter-branch: stop suggesting to use grafts

The graft file is deprecated now, so let's use replace refs in the example
in filter-branch's man page instead.

Suggested-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Deprecate support for .git/info/graftsJohannes Schindelin Sat, 28 Apr 2018 22:44:44 +0000 (00:44 +0200)

Deprecate support for .git/info/grafts

The grafts feature was a convenient way to "stitch together" ancient
history to the fresh start of linux.git.

Its implementation is, however, not up to Git's standards, as there are
too many ways where it can lead to surprising and unwelcome behavior.

For example, when pushing from a repository with active grafts, it is
possible to miss commits that have been "grafted out", resulting in a
broken state on the other side.

Also, the grafts feature is limited to "rewriting" commits' list of
parents, it cannot replace anything else.

The much younger feature implemented as `git replace` set out to remedy
those limitations and dangerous bugs.

Seeing as `git replace` is pretty mature by now (since 4228e8bc98
(replace: add --graft option, 2014-07-19) it can perform the graft
file's duties), it is time to deprecate support for the graft file, and
to retire it eventually.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add a test for `git replace --convert-graft-file`Johannes Schindelin Sat, 28 Apr 2018 22:44:42 +0000 (00:44 +0200)

Add a test for `git replace --convert-graft-file`

The proof, as the saying goes, lies in the pudding. So here is a
regression test that not only demonstrates what the option is supposed to
accomplish, but also demonstrates that it does accomplish it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace: introduce --convert-graft-fileJohannes Schindelin Sat, 28 Apr 2018 22:44:35 +0000 (00:44 +0200)

replace: introduce --convert-graft-file

This option is intended to help with the transition away from the
now-deprecated graft file.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace: prepare create_graft() for converting graft... Johannes Schindelin Sat, 28 Apr 2018 22:44:32 +0000 (00:44 +0200)

replace: prepare create_graft() for converting graft files wholesale

When converting all grafts in a graft file to replace refs, and one of
them happens to leave the original commit's parents unchanged, we do not
want to error out. Instead, we would like to issue a warning.

Prepare the create_graft() function for such a use case by adding a
`gentle` parameter. If set, we do not return an error when the replace ref
is unchanged, but a mere warning.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace: "libify" create_graft() and calleesJohannes Schindelin Sat, 28 Apr 2018 22:44:26 +0000 (00:44 +0200)

replace: "libify" create_graft() and callees

File this away as yet another patch in the "libification" category.

As with all useful functions, in the next commit we want to use
create_graft() from a higher-level function where it would be
inconvenient if the called function simply die()s: if there is a
problem, we want to let the user know how to proceed, and the callee
simply has no way of knowing what to say.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: introduce test_unset_prereq, for debuggingJohannes Schindelin Sat, 28 Apr 2018 22:33:36 +0000 (00:33 +0200)

tests: introduce test_unset_prereq, for debugging

While working on the --convert-graft-file test, I missed that I was
relying on the GPG prereq, by using output of test cases that were only
run under that prereq.

For debugging, it was really convenient to force that prereq to be
unmet, but there was no easy way to do that. So I came up with a way,
and this patch reflects the cleaned-up version of that way.

For convenience, the following two methods are now supported ways to
pretend that a prereq is not met:

test_set_prereq !GPG

and

test_unset_prereq GPG

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree: teach "add" to check out existing branchesThomas Gummerer Tue, 24 Apr 2018 21:56:35 +0000 (22:56 +0100)

worktree: teach "add" to check out existing branches

Currently 'git worktree add <path>' creates a new branch named after the
basename of the path by default. If a branch with that name already
exists, the command refuses to do anything, unless the '--force' option
is given.

However we can do a little better than that, and check the branch out if
it is not checked out anywhere else. This will help users who just want
to check an existing branch out into a new worktree, and save a few
keystrokes.

As the current behaviour is to simply 'die()' when a branch with the name
of the basename of the path already exists, there are no backwards
compatibility worries here.

We will still 'die()' if the branch is checked out in another worktree,
unless the --force flag is passed.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree: factor out dwim_branch functionThomas Gummerer Tue, 24 Apr 2018 21:56:34 +0000 (22:56 +0100)

worktree: factor out dwim_branch function

Factor out a dwim_branch function, which takes care of the dwim'ery in
'git worktree add <path>'. It's not too much code currently, but we're
adding a new kind of dwim in a subsequent patch, at which point it makes
more sense to have it as a separate function.

Factor it out now to reduce the patch noise in the next patch.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree: improve message when creating a new worktreeThomas Gummerer Tue, 24 Apr 2018 21:56:33 +0000 (22:56 +0100)

worktree: improve message when creating a new worktree

Currently 'git worktree add' produces output like the following:

Preparing ../foo (identifier foo)
HEAD is now at 26da330922 <title>

The '../foo' is the path where the worktree is created, which the user
has just given on the command line. The identifier is an internal
implementation detail, which is not particularly relevant for the user
and indeed isn't mentioned explicitly anywhere in the man page.

Instead of this message, print a message that gives the user a bit more
detail of what exactly 'git worktree' is doing. There are various dwim
modes which perform some magic under the hood, which should be
helpful to users. Just from the output of the command it is not always
visible to users what exactly has happened.

Help the users a bit more by modifying the "Preparing ..." message and
adding some additional information of what 'git worktree add' did under
the hood, while not displaying the identifier anymore.

Currently there are several different cases:

- 'git worktree add -b ...' or 'git worktree add <path>', both of
which create a new branch, either through the user explicitly
requesting it, or through 'git worktree add' implicitly creating
it. This will end up with the following output:

Preparing worktree (new branch '<branch>')
HEAD is now at 26da330922 <title>

- 'git worktree add -B ...', which may either create a new branch if
the branch with the given name does not exist yet, or resets an
existing branch to the current HEAD, or the commit-ish given.
Depending on which action is taken, we'll end up with the following
output:

Preparing worktree (resetting branch '<branch>'; was at caa68db14)
HEAD is now at 26da330922 <title>

or:

Preparing worktree (new branch '<branch>')
HEAD is now at 26da330922 <title>

- 'git worktree add --detach' or 'git worktree add <path>
<commit-ish>', both of which create a new worktree with a detached
HEAD, for which we will print the following output:

Preparing worktree (detached HEAD 26da330922)
HEAD is now at 26da330922 <title>

- 'git worktree add <path> <local-branch>', which checks out the
branch and prints the following output:

Preparing worktree (checking out '<local-branch>')
HEAD is now at 47007d5 <title>

Additionally currently the "Preparing ..." line is printed to stderr,
while the "HEAD is now at ..." line is printed to stdout by 'git reset
--hard', which is used internally by 'git worktree add'. Fix this
inconsistency by printing the "Preparing ..." message to stdout as
well. As "Preparing ..." is not an error, stdout also seems like the
more appropriate output stream.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree: remove extra members from struct add_optsThomas Gummerer Tue, 24 Apr 2018 21:56:32 +0000 (22:56 +0100)

worktree: remove extra members from struct add_opts

There are two members of 'struct add_opts', which are only used inside
the 'add()' function, but being part of 'struct add_opts' they are
needlessly also passed to the 'add_worktree' function.

Make them local to the 'add()' function to make it clearer where they
are used.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

.gitattributes: add a diff driver for PythonÆvar Arnfjörð Bjarmason Thu, 26 Apr 2018 07:50:58 +0000 (07:50 +0000)

.gitattributes: add a diff driver for Python

Declare that the *.py files in our tree are Python for the purposes of
diffing, and as in 00ddc9d13c ("Fix build with core.autocrlf=true",
2017-05-09) set eol=lf on them, which makes sense like with the *.perl
files.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

.gitattributes: use the "perl" differ for PerlÆvar Arnfjörð Bjarmason Thu, 26 Apr 2018 07:50:57 +0000 (07:50 +0000)

.gitattributes: use the "perl" differ for Perl

As noted in gitattributes(5) this gives better patch context for these
types of files.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

.gitattributes: add *.pl extension for PerlÆvar Arnfjörð Bjarmason Thu, 26 Apr 2018 07:50:56 +0000 (07:50 +0000)

.gitattributes: add *.pl extension for Perl

Change the list of Perl extensions added in 00ddc9d13c ("Fix build
with core.autocrlf=true", 2017-05-09) to also include *.pl, we have
some of those in the tree, e.g. in t/.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace: avoid using die() to indicate a bugJohannes Schindelin Wed, 25 Apr 2018 09:54:06 +0000 (11:54 +0200)

replace: avoid using die() to indicate a bug

We have the BUG() macro for that purpose.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: Let the callback of for_each_mergetag return... Johannes Schindelin Wed, 25 Apr 2018 09:54:04 +0000 (11:54 +0200)

commit: Let the callback of for_each_mergetag return on error

This is yet another patch to be filed under the keyword "libification".

There is one subtle change in behavior here, where a `git log` that has
been asked to show the mergetags would now stop reporting the mergetags
upon the first failure, whereas previously, it would have continued to the
next mergetag, if any.

In practice, that change should not matter, as it is 1) uncommon to
perform octopus merges using multiple tags as merge heads, and 2) when the
user asks to be shown those tags, they really should be there.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

argv_array: offer to split a string by whitespaceJohannes Schindelin Wed, 25 Apr 2018 09:53:57 +0000 (11:53 +0200)

argv_array: offer to split a string by whitespace

This is a simple function that will interpret a string as a whitespace
delimited list of values, and add those values into the array.

Note: this function does not (yet) offer to split by arbitrary delimiters,
or keep empty values in case of runs of whitespace, or de-quote Unix shell
style. All fo this functionality can be added later, when and if needed.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

perf/aggregate: use Getopt::Long for option parsingChristian Couder Wed, 25 Apr 2018 16:10:25 +0000 (18:10 +0200)

perf/aggregate: use Getopt::Long for option parsing

When passing an option '--foo' that it does not recognize, the
aggregate.perl script should die with an helpful error message
like:

Unknown option: foo
./aggregate.perl [options] [--] [<dir_or_rev>...] [--] \
[<test_script>...] >

Options:
--codespeed * Format output for Codespeed
--reponame <str> * Send given reponame to codespeed
--sort-by <str> * Sort output (only "regression" \
criteria is supported)

rather than:

fatal: Needed a single revision
rev-parse --verify --foo: command returned error: 128

To implement that let's use Getopt::Long for option parsing
instead of the current manual and sloppy parsing. This should
save some code and make option parsing simpler, tighter and
safer.

This will avoid something like 'foo--sort-by=regression' to
be handled as if '--sort-by=regression' had been used, for
example.

As Getopt::Long eats '--' at the end of options, this changes
a bit the way '--' is handled as we can now have '--' both
after the options and before the scripts.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

cache.h: allow oid_object_info to handle arbitrary... Stefan Beller Wed, 25 Apr 2018 18:21:06 +0000 (11:21 -0700)

cache.h: allow oid_object_info to handle arbitrary repositories

This involves also adapting oid_object_info_extended and a some
internal functions that are used to implement these. It all has to
happen in one patch, because of a single recursive chain of calls visits
all these functions.

oid_object_info_extended is also used in partial clones, which allow
fetching missing objects. As this series will not add the repository
struct to the transport code and fetch_object(), add a TODO note and
omit fetching if a user tries to use a partial clone in a repository
other than the_repository.

Among the functions modified to handle arbitrary repositories,
unpack_entry() is one of them. Note that it still references the globals
"delta_base_cache" and "delta_base_cached", but those are safe to be
referenced (the former is indexed partly by "struct packed_git *", which
is repo-specific, and the latter is only used to limit the size of the
former as an optimization).

Helped-by: Brandon Williams <bmwill@google.com>
Helped-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

packfile: add repository argument to cache_or_unpack_entryStefan Beller Wed, 25 Apr 2018 18:21:05 +0000 (11:21 -0700)

packfile: add repository argument to cache_or_unpack_entry

Add a repository argument to allow the callers of cache_or_unpack_entry
to be more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

packfile: add repository argument to unpack_entryStefan Beller Wed, 25 Apr 2018 18:21:04 +0000 (11:21 -0700)

packfile: add repository argument to unpack_entry

Add a repository argument to allow the callers of unpack_entry
to be more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

packfile: add repository argument to read_objectStefan Beller Wed, 25 Apr 2018 18:21:03 +0000 (11:21 -0700)

packfile: add repository argument to read_object

Add a repository argument to allow the callers of read_object
to be more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

packfile: add repository argument to packed_object_infoJonathan Nieder Wed, 25 Apr 2018 18:21:02 +0000 (11:21 -0700)

packfile: add repository argument to packed_object_info

Add a repository argument to allow callers of packed_object_info to be
more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>