git/git.git
2 years agocommit-graph: verify objects exist
Derrick Stolee [Wed, 27 Jun 2018 13:24:36 +0000 (09:24 -0400)]
commit-graph: verify objects exist

In the 'verify' subcommand, load commits directly from the object
database to ensure they exist. Parse by skipping the commit-graph.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocommit-graph: verify corrupt OID fanout and lookup
Derrick Stolee [Wed, 27 Jun 2018 13:24:35 +0000 (09:24 -0400)]
commit-graph: verify corrupt OID fanout and lookup

In the commit-graph file, the OID fanout chunk provides an index into
the OID lookup. The 'verify' subcommand should find incorrect values
in the fanout.

Similarly, the 'verify' subcommand should find out-of-order values in
the OID lookup.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocommit-graph: verify required chunks are present
Derrick Stolee [Wed, 27 Jun 2018 13:24:34 +0000 (09:24 -0400)]
commit-graph: verify required chunks are present

The commit-graph file requires the following three chunks:

* OID Fanout
* OID Lookup
* Commit Data

If any of these are missing, then the 'verify' subcommand should
report a failure. This includes the chunk IDs malformed or the
chunk count is truncated.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocommit-graph: verify catches corrupt signature
Derrick Stolee [Wed, 27 Jun 2018 13:24:33 +0000 (09:24 -0400)]
commit-graph: verify catches corrupt signature

This is the first of several commits that add a test to check that
'git commit-graph verify' catches corruption in the commit-graph
file. The first test checks that the command catches an error in
the file signature. This is a check that exists in the existing
commit-graph reading code.

Add a helper method 'corrupt_graph_and_verify' to the test script
t5318-commit-graph.sh. This helper corrupts the commit-graph file
at a certain location, runs 'git commit-graph verify', and reports
the output to the 'err' file. This data is filtered to remove the
lines added by 'test_must_fail' when the test is run verbosely.
Then, the output is checked to contain a specific error message.

Most messages from 'git commit-graph verify' will not be marked
for translation. There will be one exception: the message that
reports an invalid checksum will be marked for translation, as that
is the only message that is intended for a typical user.

Helped-by: Szeder Gábor <szeder.dev@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocommit-graph: add 'verify' subcommand
Derrick Stolee [Wed, 27 Jun 2018 13:24:32 +0000 (09:24 -0400)]
commit-graph: add 'verify' subcommand

If the commit-graph file becomes corrupt, we need a way to verify
that its contents match the object database. In the manner of
'git fsck' we will implement a 'git commit-graph verify' subcommand
to report all issues with the file.

Add the 'verify' subcommand to the 'commit-graph' builtin and its
documentation. The subcommand is currently a no-op except for
loading the commit-graph into memory, which may trigger run-time
errors that would be caught by normal use. Add a simple test that
ensures the command returns a zero error code.

If no commit-graph file exists, this is an acceptable state. Do
not report any errors.

Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocommit-graph: load a root tree from specific graph
Derrick Stolee [Wed, 27 Jun 2018 13:24:31 +0000 (09:24 -0400)]
commit-graph: load a root tree from specific graph

When lazy-loading a tree for a commit, it will be important to select
the tree from a specific struct commit_graph. Create a new method that
specifies the commit-graph file and use that in
get_commit_tree_in_graph().

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocommit: force commit to parse from object database
Derrick Stolee [Wed, 27 Jun 2018 13:24:30 +0000 (09:24 -0400)]
commit: force commit to parse from object database

In anticipation of verifying commit-graph file contents against the
object database, create parse_commit_internal() to allow side-stepping
the commit-graph file and parse directly from the object database.

Due to the use of generation numbers, this method should not be called
unless the intention is explicit in avoiding commits from the
commit-graph file.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocommit-graph: parse commit from chosen graph
Derrick Stolee [Wed, 27 Jun 2018 13:24:29 +0000 (09:24 -0400)]
commit-graph: parse commit from chosen graph

Before verifying a commit-graph file against the object database, we
need to parse all commits from the given commit-graph file. Create
parse_commit_in_graph_one() to target a given struct commit_graph.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocommit-graph: fix GRAPH_MIN_SIZE
Derrick Stolee [Wed, 27 Jun 2018 13:24:28 +0000 (09:24 -0400)]
commit-graph: fix GRAPH_MIN_SIZE

The GRAPH_MIN_SIZE macro should be the smallest size of a parsable
commit-graph file. However, the minimum number of chunks was wrong.
It is possible to write a commit-graph file with zero commits, and
that violates this macro's value.

Rewrite the macro, and use extra macros to better explain the magic
constants.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocommit-graph: UNLEAK before die()
Derrick Stolee [Wed, 27 Jun 2018 13:24:27 +0000 (09:24 -0400)]
commit-graph: UNLEAK before die()

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot5318-commit-graph.sh: use core.commitGraph
Derrick Stolee [Wed, 27 Jun 2018 13:24:26 +0000 (09:24 -0400)]
t5318-commit-graph.sh: use core.commitGraph

The commit-graph tests should be checking that normal Git operations
succeed and have matching output with and without the commit-graph
feature enabled. However, the test was toggling 'core.graph' instead
of the correct 'core.commitGraph' variable.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoFirst batch for 2.19 cycle
Junio C Hamano [Mon, 25 Jun 2018 20:27:15 +0000 (13:27 -0700)]
First batch for 2.19 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'sb/plug-misc-leaks'
Junio C Hamano [Mon, 25 Jun 2018 20:22:41 +0000 (13:22 -0700)]
Merge branch 'sb/plug-misc-leaks'

Misc leak plugging.

* sb/plug-misc-leaks:
  sequencer.c: plug mem leak in git_sequencer_config
  sequencer.c: plug leaks in do_pick_commit
  submodule--helper: plug mem leak in print_default_remote
  refs/packed-backend.c: close fd of empty file

2 years agoMerge branch 'cc/tests-without-assuming-ref-files-backend'
Junio C Hamano [Mon, 25 Jun 2018 20:22:41 +0000 (13:22 -0700)]
Merge branch 'cc/tests-without-assuming-ref-files-backend'

Instead of mucking with filesystem directly, use plumbing commands
update-ref etc. to manipulate the refs in the tests.

* cc/tests-without-assuming-ref-files-backend:
  t9104: kosherly remove remote refs

2 years agoMerge branch 'sg/update-ref-stdin-cleanup'
Junio C Hamano [Mon, 25 Jun 2018 20:22:40 +0000 (13:22 -0700)]
Merge branch 'sg/update-ref-stdin-cleanup'

Code cleanup.

* sg/update-ref-stdin-cleanup:
  update-ref --stdin: use skip_prefix()

2 years agoMerge branch 'nd/reject-empty-shallow-request'
Junio C Hamano [Mon, 25 Jun 2018 20:22:40 +0000 (13:22 -0700)]
Merge branch 'nd/reject-empty-shallow-request'

"git fetch --shallow-since=<cutoff>" that specifies the cut-off
point that is newer than the existing history used to end up
grabbing the entire history.  Such a request now errors out.

* nd/reject-empty-shallow-request:
  upload-pack: reject shallow requests that would return nothing

2 years agoMerge branch 'ls/complete-remote-update-names'
Junio C Hamano [Mon, 25 Jun 2018 20:22:39 +0000 (13:22 -0700)]
Merge branch 'ls/complete-remote-update-names'

"git remote update" can take both a single remote nickname and a
nickname for remote groups, and the completion script (in contrib/)
has been taught about it.

* ls/complete-remote-update-names:
  completion: complete remote names too

2 years agoMerge branch 'ag/rebase-p'
Junio C Hamano [Mon, 25 Jun 2018 20:22:39 +0000 (13:22 -0700)]
Merge branch 'ag/rebase-p'

Separate "rebase -p" codepath out of "rebase -i" implementation to
slim down the latter and make it easier to manage.

* ag/rebase-p:
  rebase: remove -p code from git-rebase--interactive.sh
  rebase: use the new git-rebase--preserve-merges.sh
  rebase: strip unused code in git-rebase--preserve-merges.sh
  rebase: introduce a dedicated backend for --preserve-merges

2 years agoMerge branch 'nd/complete-config-vars'
Junio C Hamano [Mon, 25 Jun 2018 20:22:38 +0000 (13:22 -0700)]
Merge branch 'nd/complete-config-vars'

Continuing with the idea to programatically enumerate various
pieces of data required for command line completion, teach the
codebase to report the list of configuration variables
subcommands care about to help complete them.

* nd/complete-config-vars:
  completion: complete general config vars in two steps
  log-tree: allow to customize 'grafted' color
  completion: support case-insensitive config vars
  completion: keep other config var completion in camelCase
  completion: drop the hard coded list of config vars
  am: move advice.amWorkDir parsing back to advice.c
  advice: keep config name in camelCase in advice_config[]
  fsck: produce camelCase config key names
  help: add --config to list all available config
  fsck: factor out msg_id_info[] lazy initialization code
  grep: keep all colors in an array
  Add and use generic name->id mapping code for color slot parsing

2 years agoMerge branch 'sb/object-store-alloc'
Junio C Hamano [Mon, 25 Jun 2018 20:22:38 +0000 (13:22 -0700)]
Merge branch 'sb/object-store-alloc'

The conversion to pass "the_repository" and then "a_repository"
throughout the object access API continues.

* sb/object-store-alloc:
  alloc: allow arbitrary repositories for alloc functions
  object: allow create_object to handle arbitrary repositories
  object: allow grow_object_hash to handle arbitrary repositories
  alloc: add repository argument to alloc_commit_index
  alloc: add repository argument to alloc_report
  alloc: add repository argument to alloc_object_node
  alloc: add repository argument to alloc_tag_node
  alloc: add repository argument to alloc_commit_node
  alloc: add repository argument to alloc_tree_node
  alloc: add repository argument to alloc_blob_node
  object: add repository argument to grow_object_hash
  object: add repository argument to create_object
  repository: introduce parsed objects field

2 years agoMerge branch 'jk/show-index'
Junio C Hamano [Mon, 25 Jun 2018 20:22:37 +0000 (13:22 -0700)]
Merge branch 'jk/show-index'

Modernize a less often used command.

* jk/show-index:
  show-index: update documentation for index v2
  make show-index a builtin

2 years agoMerge branch 'en/merge-recursive-tests'
Junio C Hamano [Mon, 25 Jun 2018 20:22:36 +0000 (13:22 -0700)]
Merge branch 'en/merge-recursive-tests'

Clean up tests in t6xxx series about 'merge' command.

* en/merge-recursive-tests:
  t6036: prefer test_when_finished to manual cleanup in following test
  t6036, t6042: prefer test_cmp to sequences of test
  t6036, t6042: prefer test_path_is_file, test_path_is_missing
  t6036, t6042: use test_line_count instead of wc -l
  t6036, t6042: use test_create_repo to keep tests independent

2 years agoMerge branch 'nd/diff-apply-ita'
Junio C Hamano [Mon, 25 Jun 2018 20:22:36 +0000 (13:22 -0700)]
Merge branch 'nd/diff-apply-ita'

"git diff" compares the index and the working tree.  For paths
added with intent-to-add bit, the command shows the full contents
of them as added, but the paths themselves were not marked as new
files.  They are now shown as new by default.

"git apply" learned the "--intent-to-add" option so that an
otherwise working-tree-only application of a patch will add new
paths to the index marked with the "intent-to-add" bit.

* nd/diff-apply-ita:
  apply: add --intent-to-add
  t2203: add a test about "diff HEAD" case
  diff: turn --ita-invisible-in-index on by default
  diff: ignore --ita-[in]visible-in-index when diffing worktree-to-tree

2 years agoMerge branch 'ds/commit-graph-lockfile-fix'
Junio C Hamano [Mon, 25 Jun 2018 20:22:36 +0000 (13:22 -0700)]
Merge branch 'ds/commit-graph-lockfile-fix'

Update to ds/generation-numbers topic.

* ds/commit-graph-lockfile-fix:
  commit-graph: fix UX issue when .lock file exists
  commit-graph.txt: update design document
  merge: check config before loading commits
  commit: use generation number in remove_redundant()
  commit: add short-circuit to paint_down_to_common()
  commit: use generation numbers for in_merge_bases()
  ref-filter: use generation number for --contains
  commit-graph: always load commit-graph information
  commit: use generations in paint_down_to_common()
  commit-graph: compute generation numbers
  commit: add generation number to struct commit
  ref-filter: fix outdated comment on in_commit_list

2 years agoMerge branch 'nd/commit-util-to-slab'
Junio C Hamano [Mon, 25 Jun 2018 20:22:35 +0000 (13:22 -0700)]
Merge branch 'nd/commit-util-to-slab'

The in-core "commit" object had an all-purpose "void *util" field,
which was tricky to use especially in library-ish part of the
code.  All of the existing uses of the field has been migrated to a
more dedicated "commit-slab" mechanism and the field is eliminated.

* nd/commit-util-to-slab:
  commit.h: delete 'util' field in struct commit
  merge: use commit-slab in merge remote desc instead of commit->util
  log: use commit-slab in prepare_bases() instead of commit->util
  show-branch: note about its object flags usage
  show-branch: use commit-slab for commit-name instead of commit->util
  name-rev: use commit-slab for rev-name instead of commit->util
  bisect.c: use commit-slab for commit weight instead of commit->util
  revision.c: use commit-slab for show_source
  sequencer.c: use commit-slab to associate todo items to commits
  sequencer.c: use commit-slab to mark seen commits
  shallow.c: use commit-slab for commit depth instead of commit->util
  describe: use commit-slab for commit names instead of commit->util
  blame: use commit-slab for blame suspects instead of commit->util
  commit-slab: support shared commit-slab
  commit-slab.h: code split

2 years agoMerge branch 'pc/submodule-helper-foreach'
Junio C Hamano [Mon, 25 Jun 2018 20:22:35 +0000 (13:22 -0700)]
Merge branch 'pc/submodule-helper-foreach'

The bulk of "git submodule foreach" has been rewritten in C.

* pc/submodule-helper-foreach:
  submodule: port submodule subcommand 'foreach' from shell to C
  submodule foreach: document variable '$displaypath'
  submodule foreach: document '$sm_path' instead of '$path'
  submodule foreach: correct '$path' in nested submodules from a subdirectory

2 years agoPrepare to start 2.19 cycle
Junio C Hamano [Mon, 25 Jun 2018 20:22:27 +0000 (13:22 -0700)]
Prepare to start 2.19 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosequencer.c: plug mem leak in git_sequencer_config
Stefan Beller [Fri, 1 Jun 2018 20:01:46 +0000 (13:01 -0700)]
sequencer.c: plug mem leak in git_sequencer_config

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoGit 2.18 v2.18.0
Junio C Hamano [Thu, 21 Jun 2018 17:00:06 +0000 (10:00 -0700)]
Git 2.18

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'en/rename-directory-detection-reboot'
Junio C Hamano [Tue, 19 Jun 2018 18:11:03 +0000 (11:11 -0700)]
Merge branch 'en/rename-directory-detection-reboot'

* en/rename-directory-detection-reboot:
  merge-recursive: use xstrdup() instead of fixed buffer

2 years agoMerge tag 'l10n-2.18.0-rnd3.1' of git://github.com/git-l10n/git-po
Junio C Hamano [Tue, 19 Jun 2018 16:29:23 +0000 (09:29 -0700)]
Merge tag 'l10n-2.18.0-rnd3.1' of git://github.com/git-l10n/git-po

Merge Korean translation for l10n of Git 2.18.0 round 3

* tag 'l10n-2.18.0-rnd3.1' of git://github.com/git-l10n/git-po:
  l10n: ko.po: Update Korean translation

2 years agoMerge branch 'cf/submodule-progress-dissociate'
Junio C Hamano [Tue, 19 Jun 2018 16:26:59 +0000 (09:26 -0700)]
Merge branch 'cf/submodule-progress-dissociate'

* cf/submodule-progress-dissociate:
  t7400: encapsulate setup code in test_expect_success

2 years agoMerge branch 'js/rebase-i-root-fix'
Junio C Hamano [Tue, 19 Jun 2018 16:26:28 +0000 (09:26 -0700)]
Merge branch 'js/rebase-i-root-fix'

* js/rebase-i-root-fix:
  t3404: check root commit in 'rebase -i --root reword root commit'

2 years agot7400: encapsulate setup code in test_expect_success
Stefan Beller [Mon, 18 Jun 2018 23:41:48 +0000 (16:41 -0700)]
t7400: encapsulate setup code in test_expect_success

When running t7400 in a shell you observe more output than expected:

    ...
    ok 8 - setup - hide init subdirectory
    ok 9 - setup - repository to add submodules to
    ok 10 - submodule add
    [master (root-commit) d79ce16] one
     Author: A U Thor <author@example.com>
     1 file changed, 1 insertion(+)
     create mode 100644 one.t
    ok 11 - redirected submodule add does not show progress
    ok 12 - redirected submodule add --progress does show progress
    ok 13 - submodule add to .gitignored path fails
    ...

Fix the output by encapsulating the setup code in test_expect_success

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot3404: check root commit in 'rebase -i --root reword root commit'
Todd Zullinger [Mon, 18 Jun 2018 22:19:42 +0000 (18:19 -0400)]
t3404: check root commit in 'rebase -i --root reword root commit'

When testing a reworded root commit, ensure that the squash-onto commit
which is created and amended is still the root commit.

Suggested-by: Phillip Wood <phillip.wood@talktalk.net>
Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodoc: fix typos in documentation and release notes
Karthikeyan Singaravelan [Sun, 17 Jun 2018 04:35:54 +0000 (04:35 +0000)]
doc: fix typos in documentation and release notes

Signed-off-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoAlmost 2.18 final
Junio C Hamano [Mon, 18 Jun 2018 18:24:21 +0000 (11:24 -0700)]
Almost 2.18 final

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'es/make-no-iconv'
Junio C Hamano [Mon, 18 Jun 2018 18:23:24 +0000 (11:23 -0700)]
Merge branch 'es/make-no-iconv'

"make NO_ICONV=NoThanks" did not override NEEDS_LIBICONV
(i.e. linkage of -lintl, -liconv, etc. that are platform-specific
tweaks), which has been corrected.

* es/make-no-iconv:
  Makefile: make NO_ICONV really mean "no iconv"

2 years agoMerge branch 'sg/t7406-chain-fix'
Junio C Hamano [Mon, 18 Jun 2018 18:23:23 +0000 (11:23 -0700)]
Merge branch 'sg/t7406-chain-fix'

Test fix.

* sg/t7406-chain-fix:
  t7406-submodule-update: fix broken &&-chains

2 years agoMerge branch 'ks/branch-set-upstream'
Junio C Hamano [Mon, 18 Jun 2018 18:23:23 +0000 (11:23 -0700)]
Merge branch 'ks/branch-set-upstream'

A test title has been reworded to clarify it.

* ks/branch-set-upstream:
  t3200: clarify description of --set-upstream test

2 years agoMerge branch 'js/rebase-i-root-fix'
Junio C Hamano [Mon, 18 Jun 2018 18:23:22 +0000 (11:23 -0700)]
Merge branch 'js/rebase-i-root-fix'

A regression to "rebase -i --root" introduced during this cycle has
been fixed.

* js/rebase-i-root-fix:
  rebase --root: fix amending root commit messages
  rebase --root: demonstrate a bug while amending root commit messages

2 years agoMerge branch 'jk/ewah-bounds-check'
Junio C Hamano [Mon, 18 Jun 2018 18:23:22 +0000 (11:23 -0700)]
Merge branch 'jk/ewah-bounds-check'

The code to read compressed bitmap was not careful to avoid reading
past the end of the file, which has been corrected.

* jk/ewah-bounds-check:
  ewah: adjust callers of ewah_read_mmap()
  ewah_read_mmap: bounds-check mmap reads

2 years agoMerge tag 'l10n-2.18.0-rnd3' of git://github.com/git-l10n/git-po
Junio C Hamano [Mon, 18 Jun 2018 17:21:24 +0000 (10:21 -0700)]
Merge tag 'l10n-2.18.0-rnd3' of git://github.com/git-l10n/git-po

l10n for Git 2.18.0 round 3

* tag 'l10n-2.18.0-rnd3' of git://github.com/git-l10n/git-po:
  l10n: zh_CN: for git v2.18.0 l10n round 1 to 3
  l10n: bg.po: Updated Bulgarian translation (3608t)
  l10n: vi.po(3608t): Update Vietnamese translation for v2.18.0 round 3
  l10n: fr.po v2.18.0 round 3
  l10n: es.po: Spanish update for v2.18.0 round 3
  l10n: git.pot: v2.18.0 round 3 (1 new, 1 removed)
  l10n: vi.po(3608t): Update Vietnamese translation for v2.18.0 round2
  l10n: bg.po: Updated Bulgarian translation (3608t)
  l10n: es.po: Spanish update for v2.18.0 round 2
  l10n: sv.po: Update Swedish translation (3608t0f0u)
  l10n: sv.po: Update Swedish translation (3470t0f0u)
  l10n: git.pot: v2.18.0 round 2 (144 new, 6 removed)
  l10n: fr.po v2.18 round 1
  l10n: vi(3470t): Updated Vietnamese translation for v2.18.0
  l10n: es.po: Spanish update for v2.18.0 round 1
  l10n: git.pot: v2.18.0 round 1 (108 new, 14 removed)
  l10n: TEAMS: remove inactive de team members
  l10n: de.po: fix typos
  l10n: Update Catalan translation

2 years agoA bunch of micro-fixes before going 2.18 final
Junio C Hamano [Mon, 18 Jun 2018 17:20:42 +0000 (10:20 -0700)]
A bunch of micro-fixes before going 2.18 final

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: ko.po: Update Korean translation
Changwoo Ryu [Mon, 18 Jun 2018 17:07:46 +0000 (02:07 +0900)]
l10n: ko.po: Update Korean translation

Update the Korean translation and change the team leader to Gwan-gyeong
Mun.

Signed-off-by: Gwan-gyeong Mun <elongbug@gmail.com>
Signed-off-by: Changwoo Ryu <cwryu@debian.org>
Reviewed-by: Gwan-gyeong Mun <elongbug@gmail.com>
2 years agoMerge branch 'sb/blame-color'
Junio C Hamano [Mon, 18 Jun 2018 17:18:45 +0000 (10:18 -0700)]
Merge branch 'sb/blame-color'

Leakfix.

* sb/blame-color:
  blame: release string_list after use in parse_color_fields()

2 years agoMerge branch 'mw/doc-merge-enumfix'
Junio C Hamano [Mon, 18 Jun 2018 17:18:45 +0000 (10:18 -0700)]
Merge branch 'mw/doc-merge-enumfix'

Fix old merge glitch in Documentation during v2.13-rc0 era.

* mw/doc-merge-enumfix:
  doc: update the order of the syntax `git merge --continue`

2 years agoMerge branch 'en/rename-directory-detection'
Junio C Hamano [Mon, 18 Jun 2018 17:18:44 +0000 (10:18 -0700)]
Merge branch 'en/rename-directory-detection'

Newly added codepath in merge-recursive had potential buffer
overrun, which has been fixed.

* en/rename-directory-detection:
  merge-recursive: use xstrdup() instead of fixed buffer

2 years agoMerge branch 'rd/doc-remote-tracking-with-hyphen'
Junio C Hamano [Mon, 18 Jun 2018 17:18:43 +0000 (10:18 -0700)]
Merge branch 'rd/doc-remote-tracking-with-hyphen'

Doc update.

* rd/doc-remote-tracking-with-hyphen:
  Use hyphenated "remote-tracking branch" (docs and comments)

2 years agoMerge branch 'jl/zlib-restore-nul-termination'
Junio C Hamano [Mon, 18 Jun 2018 17:18:43 +0000 (10:18 -0700)]
Merge branch 'jl/zlib-restore-nul-termination'

Make zlib inflate codepath more robust against versions of zlib
that clobber unused portion of outbuf.

* jl/zlib-restore-nul-termination:
  packfile: correct zlib buffer handling

2 years agoMerge branch 'ab/cred-netrc-no-autodie'
Junio C Hamano [Mon, 18 Jun 2018 17:18:42 +0000 (10:18 -0700)]
Merge branch 'ab/cred-netrc-no-autodie'

Hotfix for contrib/ stuff broken by this cycle.

* ab/cred-netrc-no-autodie:
  git-credential-netrc: remove use of "autodie"

2 years agoMerge branch 'km/doc-workflows-typofix'
Junio C Hamano [Mon, 18 Jun 2018 17:18:42 +0000 (10:18 -0700)]
Merge branch 'km/doc-workflows-typofix'

Typofix.

* km/doc-workflows-typofix:
  gitworkflows: fix grammar in 'Merge upwards' rule

2 years agoMerge branch 'ld/git-p4-updates'
Junio C Hamano [Mon, 18 Jun 2018 17:18:41 +0000 (10:18 -0700)]
Merge branch 'ld/git-p4-updates'

"git p4" updates.

* ld/git-p4-updates:
  git-p4: auto-size the block
  git-p4: narrow the scope of exceptions caught when parsing an int
  git-p4: raise exceptions from p4CmdList based on error from p4 server
  git-p4: better error reporting when p4 fails
  git-p4: add option to disable syncing of p4/master with p4
  git-p4: disable-rebase: allow setting this via configuration
  git-p4: add options --commit and --disable-rebase

2 years agoMerge branch 'rd/diff-options-typofix'
Junio C Hamano [Mon, 18 Jun 2018 17:18:41 +0000 (10:18 -0700)]
Merge branch 'rd/diff-options-typofix'

Typofix.

* rd/diff-options-typofix:
  diff-options.txt: fix minor typos, font inconsistencies, in docs

2 years agoMerge branch 'rd/comment-typofix-in-sha1-file'
Junio C Hamano [Mon, 18 Jun 2018 17:18:40 +0000 (10:18 -0700)]
Merge branch 'rd/comment-typofix-in-sha1-file'

In code comment typofix

* rd/comment-typofix-in-sha1-file:
  sha1-file.c: correct $GITDIR to $GIT_DIR in a comment

2 years agomerge-recursive: use xstrdup() instead of fixed buffer
René Scharfe [Sun, 10 Jun 2018 10:56:31 +0000 (12:56 +0200)]
merge-recursive: use xstrdup() instead of fixed buffer

Paths can be longer than PATH_MAX.  Avoid a buffer overrun in
check_dir_renamed() by using xstrdup() to make a private copy safely.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoRelNotes 2.18: minor fix to entry about dynamically loading completions
SZEDER Gábor [Mon, 18 Jun 2018 10:46:09 +0000 (12:46 +0200)]
RelNotes 2.18: minor fix to entry about dynamically loading completions

It was not "newer versions of bash" but newer versions of
bash-completion that made commit 085e2ee0e6 (completion: load
completion file for external subcommand, 2018-04-29) both necessary
and possible.

Update the corresponding RelNotes entry accordingly.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot7406-submodule-update: fix broken &&-chains
SZEDER Gábor [Sat, 16 Jun 2018 20:33:19 +0000 (22:33 +0200)]
t7406-submodule-update: fix broken &&-chains

Three tests in 't7406-submodule-update' contain broken &&-chains, but
since they are all in subshells, chain-lint couldn't notice them.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorebase --root: fix amending root commit messages
Johannes Schindelin [Sat, 16 Jun 2018 19:00:38 +0000 (21:00 +0200)]
rebase --root: fix amending root commit messages

The code path that triggered that "BUG" really does not want to run
without an explicit commit message. In the case where we want to amend a
commit message, we have an *implicit* commit message, though: the one of
the commit to amend. Therefore, this code path should not even be
entered.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorebase --root: demonstrate a bug while amending root commit messages
Todd Zullinger [Fri, 15 Jun 2018 04:31:11 +0000 (00:31 -0400)]
rebase --root: demonstrate a bug while amending root commit messages

When splitting a repository, running `git rebase -i --root` to reword
the initial commit, Git dies with

BUG: sequencer.c:795: root commit without message.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoewah: adjust callers of ewah_read_mmap()
Jeff King [Fri, 15 Jun 2018 03:44:43 +0000 (23:44 -0400)]
ewah: adjust callers of ewah_read_mmap()

The return value of ewah_read_mmap() is now an ssize_t,
since we could (in theory) process up to 32GB of data. This
would never happen in practice, but a corrupt or malicious
.bitmap or index file could convince us to do so.

Let's make sure that we don't stuff the value into an int,
which would cause us to incorrectly move our pointer
forward.  We'd always move too little, since negative values
are used for reporting errors. So the worst case is just
that we end up reporting a corrupt file, not an
out-of-bounds read.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoewah_read_mmap: bounds-check mmap reads
Jeff King [Fri, 15 Jun 2018 03:31:13 +0000 (23:31 -0400)]
ewah_read_mmap: bounds-check mmap reads

The on-disk ewah format tells us how big the ewah data is,
and we blindly read that much from the buffer without
considering whether the mmap'd data is long enough, which
can lead to out-of-bound reads.

Let's make sure we have data available before reading it,
both for the ewah header/footer as well as for the bit data
itself. In particular:

  - keep our ptr/len pair in sync as we move through the
    buffer, and check it before each read

  - check the size for integer overflow (this should be
    impossible on 64-bit, as the size is given as a 32-bit
    count of 8-byte words, but is possible on a 32-bit
    system)

  - return the number of bytes read as an ssize_t instead of
    an int, again to prevent integer overflow

  - compute the return value using a pointer difference;
    this should yield the same result as the existing code,
    but makes it more obvious that we got our computations
    right

The included test is far from comprehensive, as it just
picks a static point at which to truncate the generated
bitmap. But in practice this will hit in the middle of an
ewah and make sure we're at least exercising this code.

Reported-by: Luat Nguyen <root@l4w.io>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot3200: clarify description of --set-upstream test
Kaartic Sivaraam [Sun, 17 Jun 2018 11:56:27 +0000 (17:26 +0530)]
t3200: clarify description of --set-upstream test

Support for the --set-upstream option was removed in 52668846ea
(builtin/branch: stop supporting the "--set-upstream" option,
2017-08-17). The change did not completely remove the command
due to an issue noted in the commit's log message.

So, a test was added to ensure that a command which uses the
'--set-upstream' option fails instead of silently acting as an alias
for the '--set-upstream-to' option due to option parsing features.

To avoid confusion, clarify that the option is disabled intentionally
in the corresponding test description.

The test is expected to be around as long as we intentionally fail
on seeing the '--set-upstream' option which in turn we expect to
do for a period of time after which we can be sure that existing
users of '--set-upstream' are aware that the option is no
longer supported.

Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: zh_CN: for git v2.18.0 l10n round 1 to 3
Jiang Xin [Mon, 28 May 2018 01:11:57 +0000 (09:11 +0800)]
l10n: zh_CN: for git v2.18.0 l10n round 1 to 3

Translate 251 new messages (3608t0f0u) for git 2.18.0.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 years agoMerge branch 'master' of git://github.com/nafmo/git-l10n-sv
Jiang Xin [Sun, 17 Jun 2018 14:44:08 +0000 (22:44 +0800)]
Merge branch 'master' of git://github.com/nafmo/git-l10n-sv

* 'master' of git://github.com/nafmo/git-l10n-sv:
  l10n: sv.po: Update Swedish translation (3608t0f0u)
  l10n: sv.po: Update Swedish translation (3470t0f0u)

2 years agoMerge branch 'master' of https://github.com/vnwildman/git
Jiang Xin [Sun, 17 Jun 2018 14:41:43 +0000 (22:41 +0800)]
Merge branch 'master' of https://github.com/vnwildman/git

* 'master' of https://github.com/vnwildman/git:
  l10n: vi.po(3608t): Update Vietnamese translation for v2.18.0 round 3

2 years agoMerge branch 'master' of git://github.com/alshopov/git-po
Jiang Xin [Sun, 17 Jun 2018 14:37:53 +0000 (22:37 +0800)]
Merge branch 'master' of git://github.com/alshopov/git-po

* 'master' of git://github.com/alshopov/git-po:
  l10n: bg.po: Updated Bulgarian translation (3608t)

2 years agoMerge branch 'fr_2.18_rnd3' of git://github.com/jnavila/git
Jiang Xin [Sun, 17 Jun 2018 14:36:41 +0000 (22:36 +0800)]
Merge branch 'fr_2.18_rnd3' of git://github.com/jnavila/git

* 'fr_2.18_rnd3' of git://github.com/jnavila/git:
  l10n: fr.po v2.18.0 round 3

2 years agol10n: bg.po: Updated Bulgarian translation (3608t)
Alexander Shopov [Sun, 17 Jun 2018 11:16:40 +0000 (13:16 +0200)]
l10n: bg.po: Updated Bulgarian translation (3608t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2 years agol10n: vi.po(3608t): Update Vietnamese translation for v2.18.0 round 3
Tran Ngoc Quan [Sun, 17 Jun 2018 00:06:44 +0000 (07:06 +0700)]
l10n: vi.po(3608t): Update Vietnamese translation for v2.18.0 round 3

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2 years agol10n: fr.po v2.18.0 round 3
Jean-Noël Avila [Sat, 16 Jun 2018 18:35:01 +0000 (20:35 +0200)]
l10n: fr.po v2.18.0 round 3

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
2 years agol10n: es.po: Spanish update for v2.18.0 round 3
Christopher Diaz Riveros [Sat, 16 Jun 2018 14:58:53 +0000 (09:58 -0500)]
l10n: es.po: Spanish update for v2.18.0 round 3

Signed-off-by: Christopher Diaz Riveros <chrisadr@gentoo.org>
2 years agol10n: git.pot: v2.18.0 round 3 (1 new, 1 removed)
Jiang Xin [Sat, 16 Jun 2018 14:06:45 +0000 (22:06 +0800)]
l10n: git.pot: v2.18.0 round 3 (1 new, 1 removed)

Generate po/git.pot from v2.18.0-rc2 for git v2.18.0 l10n round 3.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2 years agoMerge branch 'master' of git://github.com/git-l10n/git-po
Jiang Xin [Sat, 16 Jun 2018 14:05:21 +0000 (22:05 +0800)]
Merge branch 'master' of git://github.com/git-l10n/git-po

* 'master' of git://github.com/git-l10n/git-po:
  l10n: vi.po(3608t): Update Vietnamese translation for v2.18.0 round2
  l10n: bg.po: Updated Bulgarian translation (3608t)
  l10n: es.po: Spanish update for v2.18.0 round 2
  l10n: git.pot: v2.18.0 round 2 (144 new, 6 removed)
  l10n: fr.po v2.18 round 1
  l10n: vi(3470t): Updated Vietnamese translation for v2.18.0
  l10n: es.po: Spanish update for v2.18.0 round 1
  l10n: git.pot: v2.18.0 round 1 (108 new, 14 removed)
  l10n: TEAMS: remove inactive de team members
  l10n: de.po: fix typos
  l10n: Update Catalan translation

2 years agoMakefile: make NO_ICONV really mean "no iconv"
Eric Sunshine [Fri, 15 Jun 2018 02:25:03 +0000 (22:25 -0400)]
Makefile: make NO_ICONV really mean "no iconv"

The Makefile tweak NO_ICONV is meant to allow Git to be built without
iconv in case iconv is not installed or is otherwise dysfunctional.
However, NO_ICONV's disabling of iconv is incomplete and can incorrectly
allow "-liconv" to slip into the linker flags when NEEDS_LIBICONV is
defined, which breaks the build when iconv is not installed.

On some platforms, iconv lives directly in libc, whereas, on others it
resides in libiconv. For the latter case, NEEDS_LIBICONV instructs the
Makefile to add "-liconv" to the linker flags. config.mak.uname
automatically defines NEEDS_LIBICONV for platforms which require it.
The adding of "-liconv" is done unconditionally, despite NO_ICONV.

Work around this problem by making NO_ICONV take precedence over
NEEDS_LIBICONV.

Reported by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'master' of https://github.com/vnwildman/git
Jiang Xin [Fri, 15 Jun 2018 02:04:25 +0000 (10:04 +0800)]
Merge branch 'master' of https://github.com/vnwildman/git

* 'master' of https://github.com/vnwildman/git:
  l10n: vi.po(3608t): Update Vietnamese translation for v2.18.0 round2

2 years agodoc: update the order of the syntax `git merge --continue`
Meng-Sung Wu [Thu, 14 Jun 2018 01:33:34 +0000 (09:33 +0800)]
doc: update the order of the syntax `git merge --continue`

The syntax "git merge <message> HEAD <commit>" has been removed. The
order of the syntax should also be updated.

Signed-off-by: Meng-Sung Wu <mengsungwu@fortunewhite.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoblame: release string_list after use in parse_color_fields()
René Scharfe [Sat, 9 Jun 2018 11:26:53 +0000 (13:26 +0200)]
blame: release string_list after use in parse_color_fields()

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomerge-recursive: use xstrdup() instead of fixed buffer
René Scharfe [Sun, 10 Jun 2018 10:56:31 +0000 (12:56 +0200)]
merge-recursive: use xstrdup() instead of fixed buffer

Paths can be longer than PATH_MAX.  Avoid a buffer overrun in
check_dir_renamed() by using xstrdup() to make a private copy safely.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: vi.po(3608t): Update Vietnamese translation for v2.18.0 round2
Tran Ngoc Quan [Thu, 14 Jun 2018 07:19:56 +0000 (14:19 +0700)]
l10n: vi.po(3608t): Update Vietnamese translation for v2.18.0 round2

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2 years agoGit 2.18-rc2 v2.18.0-rc2
Junio C Hamano [Wed, 13 Jun 2018 19:57:07 +0000 (12:57 -0700)]
Git 2.18-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jk/index-pack-maint'
Junio C Hamano [Wed, 13 Jun 2018 19:50:46 +0000 (12:50 -0700)]
Merge branch 'jk/index-pack-maint'

"index-pack --strict" has been taught to make sure that it runs the
final object integrity checks after making the freshly indexed
packfile available to itself.

* jk/index-pack-maint:
  index-pack: correct install_packed_git() args
  index-pack: handle --strict checks of non-repo packs
  prepare_commit_graft: treat non-repository as a noop

2 years agoMerge branch 'sg/completion-zsh-workaround'
Junio C Hamano [Wed, 13 Jun 2018 19:50:45 +0000 (12:50 -0700)]
Merge branch 'sg/completion-zsh-workaround'

Work around zsh segfaulting when loading git-completion.zsh

* sg/completion-zsh-workaround:
  completion: correct zsh detection when run from git-completion.zsh

2 years agoMerge branch 'sb/submodule-merge-in-merge-recursive'
Junio C Hamano [Wed, 13 Jun 2018 19:50:44 +0000 (12:50 -0700)]
Merge branch 'sb/submodule-merge-in-merge-recursive'

Finishing touches to a topic that already is in 'master'.

* sb/submodule-merge-in-merge-recursive:
  merge-submodule: reduce output verbosity

2 years agoMerge branch 'jk/submodule-fsck-loose-fixup'
Junio C Hamano [Wed, 13 Jun 2018 19:50:44 +0000 (12:50 -0700)]
Merge branch 'jk/submodule-fsck-loose-fixup'

Finishing touches to a topic that already is in 'maint'.

* jk/submodule-fsck-loose-fixup:
  fsck: avoid looking at NULL blob->object
  t7415: don't bother creating commit for symlink test

2 years agopackfile: correct zlib buffer handling
Jeremy Linton [Wed, 13 Jun 2018 14:22:07 +0000 (09:22 -0500)]
packfile: correct zlib buffer handling

The buffer being passed to zlib includes a NUL terminator that git
needs to keep in place. unpack_compressed_entry() attempts to detect
the case that the source buffer hasn't been fully consumed by
checking to see if the destination buffer has been over consumed.

This causes a problem, that more recent zlib patches have been
poisoning the unconsumed portions of the buffer which overwrites
the NUL byte, while correctly returning length and status.

Let's place the NUL at the end of the buffer after inflate returns
to assure that it doesn't result in problems for git even if its
been overwritten by zlib.

Signed-off-by: Jeremy Linton <lintonrjeremy@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoRelNotes 2.18: clarify where directory rename detection applies
Elijah Newren [Tue, 12 Jun 2018 23:57:55 +0000 (16:57 -0700)]
RelNotes 2.18: clarify where directory rename detection applies

Mention that this feature works with some commands (merge and cherry-pick,
implying that it also works with commands that build on these like rebase
-m and rebase -i).  Explicitly mentioning two commands hopefully implies
that it may not always work with other commands (am, and rebase without
flags that imply either -m or -i).

Also, since the directory rename detection from this cycle was
specifically added in merge-recursive and not diffcore-rename, remove the
'in "diff" family" phrase from the note.  (Folks have requested in the
past that `git diff` detect directory renames and somehow simplify its
output, so it may be helpful to avoid implying that diff has any new
capability here.)

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoUse hyphenated "remote-tracking branch" (docs and comments)
Robert P. J. Day [Thu, 7 Jun 2018 11:53:36 +0000 (07:53 -0400)]
Use hyphenated "remote-tracking branch" (docs and comments)

Use the obvious consensus of hyphenated "remote-tracking branch", and
fix an obvious typo, all in documentation and comments.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-credential-netrc: remove use of "autodie"
Ævar Arnfjörð Bjarmason [Wed, 13 Jun 2018 07:48:10 +0000 (07:48 +0000)]
git-credential-netrc: remove use of "autodie"

The "autodie" module was added in Perl 5.10.1, but our INSTALL
document says "version 5.8 or later is needed".

As discussed in <87efhfvxzu.fsf@evledraar.gmail.com> this script is in
contrib/, so we might not want to apply that policy, however in this
case "autodie" was recently added as a "gratuitous safeguard" in
786ef50a23 ("git-credential-netrc: accept gpg option",
2018-05-12) (see
<CAHqJXRE8OKSKcck1APHAHccLZhox+tZi8nNu2RA74RErX8s3Pg@mail.gmail.com>).

Looking at it more carefully the addition of "autodie" inadvertently
introduced a logic error, since having it is equivalent to this patch:

    @@ -245,10 +244,10 @@ sub load_netrc {
      if ($gpgmode) {
      my @cmd = ($options{'gpg'}, qw(--decrypt), $file);
      log_verbose("Using GPG to open $file: [@cmd]");
    - open $io, "-|", @cmd;
    + open $io, "-|", @cmd or die "@cmd: $!";
      } else {
      log_verbose("Opening $file...");
    - open $io, '<', $file;
    + open $io, '<', $file or die "$file: $!$!;
      }

      # nothing to do if the open failed (we log the error later)

As shown in the context the intent of that code is not do die but to
log the error later.

Per my reading of the file this was the only thing autodie was doing
in this file (there was no other code it altered). So let's remove it,
both to fix the logic error and to get rid of the dependency.

1. <87efhfvxzu.fsf@evledraar.gmail.com>
   (https://public-inbox.org/git/87efhfvxzu.fsf@evledraar.gmail.com/)
2. <CAHqJXRE8OKSKcck1APHAHccLZhox+tZi8nNu2RA74RErX8s3Pg@mail.gmail.com>
   (https://public-inbox.org/git/CAHqJXRE8OKSKcck1APHAHccLZhox+tZi8nNu2RA74RErX8s3Pg@mail.gmail.com/)

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-p4: auto-size the block
Luke Diamand [Fri, 8 Jun 2018 20:32:48 +0000 (21:32 +0100)]
git-p4: auto-size the block

git-p4 originally would fetch changes in one query. On large repos this
could fail because of the limits that Perforce imposes on the number of
items returned and the number of queries in the database.

To fix this, git-p4 learned to query changes in blocks of 512 changes,
However, this can be very slow - if you have a few million changes,
with each chunk taking about a second, it can be an hour or so.

Although it's possible to tune this value manually with the
"--changes-block-size" option, it's far from obvious to ordinary users
that this is what needs doing.

This change alters the block size dynamically by looking for the
specific error messages returned from the Perforce server, and reducing
the block size if the error is seen, either to the limit reported by the
server, or to half the current block size.

That means we can start out with a very large block size, and then let
it automatically drop down to a value that works without error, while
still failing correctly if some other error occurs.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-p4: narrow the scope of exceptions caught when parsing an int
Luke Diamand [Fri, 8 Jun 2018 20:32:47 +0000 (21:32 +0100)]
git-p4: narrow the scope of exceptions caught when parsing an int

The current code traps all exceptions around some code which parses an
integer, and then talks to Perforce.

That can result in errors from Perforce being ignored. Change the code
to only catch the integer conversion exceptions.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-p4: raise exceptions from p4CmdList based on error from p4 server
Luke Diamand [Fri, 8 Jun 2018 20:32:46 +0000 (21:32 +0100)]
git-p4: raise exceptions from p4CmdList based on error from p4 server

This change lays some groundwork for better handling of rowcount errors
from the server, where it fails to send us results because we requested
too many.

It adds an option to p4CmdList() to return errors as a Python exception.

The exceptions are derived from P4Exception (something went wrong),
P4ServerException (the server sent us an error code) and
P4RequestSizeException (we requested too many rows/results from the
server database).

This makes the code that handles the errors a bit easier.

The default behavior is unchanged; the new code is enabled with a flag.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-p4: better error reporting when p4 fails
Luke Diamand [Fri, 8 Jun 2018 20:32:45 +0000 (21:32 +0100)]
git-p4: better error reporting when p4 fails

Currently when p4 fails to run, git-p4 just crashes with an obscure
error message.

For example, if the P4 ticket has expired, you get:

  Error: Cannot locate perforce checkout of <path> in client view

This change checks whether git-p4 can talk to the Perforce server when
the first P4 operation is attempted, and tries to print a meaningful
error message if it fails.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-p4: add option to disable syncing of p4/master with p4
Luke Diamand [Fri, 8 Jun 2018 20:32:44 +0000 (21:32 +0100)]
git-p4: add option to disable syncing of p4/master with p4

Add an option to the git-p4 submit command to disable syncing
with Perforce.

This is useful for the case where a git-p4 mirror has been setup
on a server somewhere, running from (e.g.) cron, and developers
then clone from this. Having the local cloned copy also sync
from Perforce just isn't useful.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-p4: disable-rebase: allow setting this via configuration
Luke Diamand [Fri, 8 Jun 2018 20:32:43 +0000 (21:32 +0100)]
git-p4: disable-rebase: allow setting this via configuration

This just lets you set the --disable-rebase option with the
git configuration options git-p4.disableRebase. If you're
using this option, you probably want to set it all the time
for a given repo.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-p4: add options --commit and --disable-rebase
Romain Merland [Fri, 1 Jun 2018 07:46:14 +0000 (09:46 +0200)]
git-p4: add options --commit and --disable-rebase

On a daily work with multiple local git branches, the usual way to
submit only a specified commit was to cherry-pick the commit on
master then run git-p4 submit.  It can be very annoying to switch
between local branches and master, only to submit one commit.  The
proposed new way is to select directly the commit you want to
submit.

Add option --commit to command 'git-p4 submit' in order to submit
only specified commit(s) in p4.

On a daily work developping software with big compilation time, one
may not want to rebase on his local git tree, in order to avoid long
recompilation.

Add option --disable-rebase to command 'git-p4 submit' in order to
disable rebase after submission.

Thanks-to: Cedric Borgese <cedric.borgese@gmail.com>
Reviewed-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Romain Merland <merlorom@yahoo.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogitworkflows: fix grammar in 'Merge upwards' rule
Kyle Meyer [Sat, 9 Jun 2018 15:19:43 +0000 (11:19 -0400)]
gitworkflows: fix grammar in 'Merge upwards' rule

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompletion: correct zsh detection when run from git-completion.zsh
SZEDER Gábor [Mon, 11 Jun 2018 18:20:53 +0000 (11:20 -0700)]
completion: correct zsh detection when run from git-completion.zsh

v2.18.0-rc0~90^2 (completion: reduce overhead of clearing cached
--options, 2018-04-18) worked around a bug in bash's "set" builtin on
MacOS by using compgen instead.  It was careful to avoid breaking zsh
by guarding this workaround with

if [[ -n ${ZSH_VERSION-}} ]]

Alas, this interacts poorly with git-completion.zsh's bash emulation:

ZSH_VERSION='' . "$script"

Correct it by instead using a new GIT_SOURCING_ZSH_COMPLETION shell
variable to detect whether git-completion.bash is being sourced from
git-completion.zsh.  This way, the zsh variant is used both when run
from zsh directly and when run via git-completion.zsh.

Reproduction recipe:

 1. cd git/contrib/completion && cp git-completion.zsh _git
 2. Put the following in a new ~/.zshrc file:

  autoload -U compinit; compinit
autoload -U bashcompinit; bashcompinit
fpath=(~/src/git/contrib/completion $fpath)

 3. Open zsh and "git <TAB>".

With this patch:
Triggers nice git-completion.bash based tab completion

Without:
 contrib/completion/git-completion.bash:354: read-only variable: QISUFFIX
 zsh:12: command not found: ___main
 zsh:15: _default: function definition file not found
 _dispatch:70: bad math expression: operand expected at `/usr/bin/g...'
 Segmentation fault

Reported-by: Rick van Hattem <wolph@wol.ph>
Reported-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: bg.po: Updated Bulgarian translation (3608t)
Alexander Shopov [Tue, 12 Jun 2018 07:35:27 +0000 (09:35 +0200)]
l10n: bg.po: Updated Bulgarian translation (3608t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2 years agoindex-pack: correct install_packed_git() args
Junio C Hamano [Mon, 11 Jun 2018 22:09:18 +0000 (15:09 -0700)]
index-pack: correct install_packed_git() args

The function does not start taking the repository object as a
parameter before v2.18 track.  Make the topic mergeable to v2.17
maintenance track by dropping it.

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