]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
4 years agosequencer: run post-commit hook
Phillip Wood [Tue, 15 Oct 2019 10:25:32 +0000 (10:25 +0000)] 
sequencer: run post-commit hook

Prior to commit 356ee4659b ("sequencer: try to commit without forking
'git commit'", 2017-11-24) the sequencer would always run the
post-commit hook after each pick or revert as it forked `git commit` to
create the commit. The conversion to committing without forking `git
commit` omitted to call the post-commit hook after creating the commit.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomove run_commit_hook() to libgit and use it there
Phillip Wood [Tue, 15 Oct 2019 10:25:31 +0000 (10:25 +0000)] 
move run_commit_hook() to libgit and use it there

This function was declared in commit.h but was implemented in
builtin/commit.c so was not part of libgit. Move it to libgit so we can
use it in the sequencer. This simplifies the implementation of
run_prepare_commit_msg_hook() and will be used in the next commit.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosequencer.h fix placement of #endif
Phillip Wood [Tue, 15 Oct 2019 10:25:30 +0000 (10:25 +0000)] 
sequencer.h fix placement of #endif

Commit 65850686cf ("rebase -i: rewrite write_basic_state() in C",
2018-08-28) accidentially added new function declarations after
the #endif at the end of the include guard.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot3404: remove uneeded calls to set_fake_editor
Phillip Wood [Tue, 15 Oct 2019 10:25:29 +0000 (10:25 +0000)] 
t3404: remove uneeded calls to set_fake_editor

Some tests were calling set_fake_editor to ensure they had a sane no-op
editor set. Now that all the editor setting is done in subshells these
tests can rely on EDITOR=: and so do not need to call set_fake_editor.

Also add a test at the end to detect any future additions messing with
the exported value of $EDITOR.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot3404: set $EDITOR in subshell
Phillip Wood [Tue, 15 Oct 2019 10:25:28 +0000 (10:25 +0000)] 
t3404: set $EDITOR in subshell

As $EDITOR is exported setting it in one test affects all subsequent
tests. Avoid this by always setting it in a subshell. This commit leaves
20 calls to set_fake_editor that are not in subshells as they can
safely be removed in the next commit once all the other editor setting
is done inside subshells.

I have moved the call to set_fake_editor in some tests so it comes
immediately before the call to 'git rebase' to avoid moving unrelated
commands into the subshell. In one case ('rebase -ix with
--autosquash') the call to set_fake_editor is moved past an invocation
of 'git rebase'. This is safe as that invocation of 'git rebase'
requires EDITOR=: or EDITOR=fake-editor.sh without FAKE_LINES being
set which will be the case as the preceding tests either set their
editor in a subshell or call set_fake_editor without setting FAKE_LINES.

In a one test ('auto-amend only edited commits after "edit"') a call
to test_tick are now in a subshell. I think this is OK as it is there
to set the date for the next commit which is executed in the same
subshell rather than updating GIT_COMMITTER_DATE for later tests (the
next test calls test_tick before doing anything else).

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot3404: remove unnecessary subshell
Phillip Wood [Tue, 15 Oct 2019 10:25:27 +0000 (10:25 +0000)] 
t3404: remove unnecessary subshell

Neither of the commands executed in the subshell change any shell
variables or the current directory so there is no need for them to be
executed in a subshell.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosequencer: simplify root commit creation
Phillip Wood [Mon, 19 Aug 2019 09:18:23 +0000 (02:18 -0700)] 
sequencer: simplify root commit creation

Adapt try_to_commit() to create a new root commit rather than special
casing this in run_git_commit(). This significantly reduces the amount of
special case code for creating the root commit and reduces the number of
commit code paths we have to worry about.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agorebase -i: check for updated todo after squash and reword
Phillip Wood [Mon, 19 Aug 2019 09:18:22 +0000 (02:18 -0700)] 
rebase -i: check for updated todo after squash and reword

While a rebase is stopped for the user to edit a commit message it can
be convenient for them to also edit the todo list. The scripted version
of rebase supported this but the C version does not. We already check to
see if the todo list has been updated by an exec command so extend this
to rewords and squashes. It only costs a single stat call to do this so
it should not affect the speed of the rebase (especially as it has just
stopped for the user to edit a message)

Note that for squashes the editor may be opened on a different pick to
the squash itself as we edit the message at the end of a chain fixups
and squashes.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agorebase -i: always update HEAD before rewording
Phillip Wood [Mon, 19 Aug 2019 09:18:21 +0000 (02:18 -0700)] 
rebase -i: always update HEAD before rewording

If the user runs git log while rewording a commit it is confusing if
sometimes we're amending the commit that's being reworded and at other
times we're creating a new commit depending on whether we could
fast-forward or not[1]. Fix this inconsistency by always committing the
picked commit and then running 'git commit --amend' to do the reword.

The first commit is performed by the sequencer without forking git
commit and does not impact on the speed of rebase. In a test rewording
100 commits with

    GIT_EDITOR=true GIT_SEQUENCE_EDITOR='sed -i s/pick/reword/' \
../bin-wrappers/git rebase -i --root

and taking the best of three runs the current master took
957ms and with this patch it took 961ms.

This change fixes rewording the new root commit when rearranging commits
with --root.

Note that the new code no longer updates CHERRY_PICK_HEAD after creating
a root commit - I'm not sure why the old code was that creating that ref
after a successful commit, everywhere else it is removed after a
successful commit.

[1] https://public-inbox.org/git/xmqqlfvu4be3.fsf@gitster-ct.c.googlers.com/T/#m133009cb91cf0917bcf667300f061178be56680a

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoRelNotes/2.21.1: typofix
Martin Ågren [Thu, 1 Aug 2019 14:12:20 +0000 (16:12 +0200)] 
RelNotes/2.21.1: typofix

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge fixes made on the 'master' front
Junio C Hamano [Mon, 29 Jul 2019 18:14:47 +0000 (11:14 -0700)] 
Merge fixes made on the 'master' front

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'jc/post-c89-rules-doc' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:23 +0000 (12:38 -0700)] 
Merge branch 'jc/post-c89-rules-doc' into maint

We have been trying out a few language features outside c89; the
coding guidelines document did not talk about them and instead had
a blanket ban against them.

* jc/post-c89-rules-doc:
  CodingGuidelines: spell out post-C89 rules

4 years agoMerge branch 'fc/fetch-with-import-fix' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:23 +0000 (12:38 -0700)] 
Merge branch 'fc/fetch-with-import-fix' into maint

Code restructuring during 2.20 period broke fetching tags via
"import" based transports.

* fc/fetch-with-import-fix:
  fetch: fix regression with transport helpers
  fetch: make the code more understandable
  fetch: trivial cleanup
  t5801 (remote-helpers): add test to fetch tags
  t5801 (remote-helpers): cleanup refspec stuff

4 years agoMerge branch 'ds/close-object-store' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:22 +0000 (12:38 -0700)] 
Merge branch 'ds/close-object-store' into maint

The commit-graph file is now part of the "files that the runtime
may keep open file descriptors on, all of which would need to be
closed when done with the object store", and the file descriptor to
an existing commit-graph file now is closed before "gc" finalizes a
new instance to replace it.

* ds/close-object-store:
  packfile: rename close_all_packs to close_object_store
  packfile: close commit-graph in close_all_packs
  commit-graph: use raw_object_store when closing
  commit-graph: extract write_commit_graph_file()
  commit-graph: extract copy_oids_to_commits()
  commit-graph: extract count_distinct_commits()
  commit-graph: extract fill_oids_from_all_packs()
  commit-graph: extract fill_oids_from_commit_hex()
  commit-graph: extract fill_oids_from_packs()
  commit-graph: create write_commit_graph_context
  commit-graph: remove Future Work section
  commit-graph: collapse parameters into flags
  commit-graph: return with errors during write
  commit-graph: fix the_repository reference

4 years agoMerge branch 'pw/add-p-recount' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:22 +0000 (12:38 -0700)] 
Merge branch 'pw/add-p-recount' into maint

"git checkout -p" needs to selectively apply a patch in reverse,
which did not work well.

* pw/add-p-recount:
  add -p: fix checkout -p with pathological context

4 years agoMerge branch 'rs/avoid-overflow-in-midpoint-computation' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:21 +0000 (12:38 -0700)] 
Merge branch 'rs/avoid-overflow-in-midpoint-computation' into maint

Code clean-up to avoid signed integer overlaps during binary search.

* rs/avoid-overflow-in-midpoint-computation:
  cleanup: fix possible overflow errors in binary search, part 2

4 years agoMerge branch 'jk/trailers-use-config' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:21 +0000 (12:38 -0700)] 
Merge branch 'jk/trailers-use-config' into maint

"git interpret-trailers" always treated '#' as the comment
character, regardless of core.commentChar setting, which has been
corrected.

* jk/trailers-use-config:
  interpret-trailers: load default config

4 years agoMerge branch 'tg/stash-ref-by-index-fix' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:20 +0000 (12:38 -0700)] 
Merge branch 'tg/stash-ref-by-index-fix' into maint

"git stash show 23" used to work, but no more after getting
rewritten in C; this regression has been corrected.

* tg/stash-ref-by-index-fix:
  stash: fix show referencing stash index

4 years agoMerge branch 'pw/rebase-abort-clean-rewritten' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:20 +0000 (12:38 -0700)] 
Merge branch 'pw/rebase-abort-clean-rewritten' into maint

"git rebase --abort" used to leave refs/rewritten/ when concluding
"git rebase -r", which has been corrected.

* pw/rebase-abort-clean-rewritten:
  rebase --abort/--quit: cleanup refs/rewritten
  sequencer: return errors from sequencer_remove_state()
  rebase: warn if state directory cannot be removed
  rebase: fix a memory leak

4 years agoMerge branch 'nd/completion-no-cache-failure' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:20 +0000 (12:38 -0700)] 
Merge branch 'nd/completion-no-cache-failure' into maint

An incorrect list of options was cached after command line
completion failed (e.g. trying to complete a command that requires
a repository outside one), which has been corrected.

* nd/completion-no-cache-failure:
  completion: do not cache if --git-completion-helper fails

4 years agoMerge branch 'rs/config-unit-parsing' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:19 +0000 (12:38 -0700)] 
Merge branch 'rs/config-unit-parsing' into maint

The code to parse scaled numbers out of configuration files has
been made more robust and also easier to follow.

* rs/config-unit-parsing:
  config: simplify parsing of unit factors
  config: don't multiply in parse_unit_factor()
  config: use unsigned_mult_overflows to check for overflows

4 years agoMerge branch 'jk/delta-islands-progress-fix' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:19 +0000 (12:38 -0700)] 
Merge branch 'jk/delta-islands-progress-fix' into maint

The codepath to compute delta islands used to spew progress output
without giving the callers any way to squelch it, which has been
fixed.

* jk/delta-islands-progress-fix:
  delta-islands: respect progress flag

4 years agoMerge branch 'sg/rebase-progress' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:19 +0000 (12:38 -0700)] 
Merge branch 'sg/rebase-progress' into maint

Use "Erase in Line" CSI sequence that is already used in the editor
support to clear cruft in the progress output.

* sg/rebase-progress:
  progress: use term_clear_line()
  rebase: fix garbled progress display with '-x'
  pager: add a helper function to clear the last line in the terminal
  t3404: make the 'rebase.missingCommitsCheck=ignore' test more focused
  t3404: modernize here doc style

4 years agoMerge branch 'ms/submodule-foreach-fix' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:18 +0000 (12:38 -0700)] 
Merge branch 'ms/submodule-foreach-fix' into maint

"git submodule foreach" did not protect command line options passed
to the command to be run in each submodule correctly, when the
"--recursive" option was in use.

* ms/submodule-foreach-fix:
  submodule foreach: fix recursion of options

4 years agoMerge branch 'js/rebase-reschedule-applies-only-to-interactive' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:18 +0000 (12:38 -0700)] 
Merge branch 'js/rebase-reschedule-applies-only-to-interactive' into maint

The configuration variable rebase.rescheduleFailedExec should be
effective only while running an interactive rebase and should not
affect anything when running an non-interactive one, which was not
the case.  This has been corrected.

* js/rebase-reschedule-applies-only-to-interactive:
  rebase --am: ignore rebase.rescheduleFailedExec

4 years agoMerge branch 'qn/clone-doc-use-long-form' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:18 +0000 (12:38 -0700)] 
Merge branch 'qn/clone-doc-use-long-form' into maint

The "git clone" documentation refers to command line options in its
description in the short form; they have been replaced with long
forms to make them more recognisable.

* qn/clone-doc-use-long-form:
  docs: git-clone: list short form of options first
  docs: git-clone: refer to long form of options

4 years agoMerge branch 'jc/denoise-rm-to-resolve' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:17 +0000 (12:38 -0700)] 
Merge branch 'jc/denoise-rm-to-resolve' into maint

"git rm" to resolve a conflicted path leaked an internal message
"needs merge" before actually removing the path, which was
confusing.  This has been corrected.

* jc/denoise-rm-to-resolve:
  rm: resolving by removal is not a warning-worthy event

4 years agoMerge branch 'js/mingw-spawn-with-spaces-in-path' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:17 +0000 (12:38 -0700)] 
Merge branch 'js/mingw-spawn-with-spaces-in-path' into maint

Window 7 update ;-)

* js/mingw-spawn-with-spaces-in-path:
  mingw: support spawning programs containing spaces in their names

4 years agoMerge branch 'sr/gpg-interface-stop-at-the-end' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:17 +0000 (12:38 -0700)] 
Merge branch 'sr/gpg-interface-stop-at-the-end' into maint

A codepath that reads from GPG for signed object verification read
past the end of allocated buffer, which has been fixed.

* sr/gpg-interface-stop-at-the-end:
  gpg-interface: do not scan past the end of buffer

4 years agoMerge branch 'js/clean-report-too-long-a-path' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:16 +0000 (12:38 -0700)] 
Merge branch 'js/clean-report-too-long-a-path' into maint

"git clean" silently skipped a path when it cannot lstat() it; now
it gives a warning.

* js/clean-report-too-long-a-path:
  clean: show an error message when the path is too long

4 years agoMerge branch 'es/local-atomic-push-failure-with-http' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:16 +0000 (12:38 -0700)] 
Merge branch 'es/local-atomic-push-failure-with-http' into maint

"git push --atomic" that goes over the transport-helper (namely,
the smart http transport) failed to prevent refs to be pushed when
it can locally tell that one of the ref update will fail without
having to consult the other end, which has been corrected.

* es/local-atomic-push-failure-with-http:
  transport-helper: avoid var decl in for () loop control
  transport-helper: enforce atomic in push_refs_with_push

4 years agoMerge branch 'po/doc-branch' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:16 +0000 (12:38 -0700)] 
Merge branch 'po/doc-branch' into maint

Doc update.

* po/doc-branch:
  doc branch: provide examples for listing remote tracking branches

4 years agoMerge branch 'dl/config-alias-doc' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:15 +0000 (12:38 -0700)] 
Merge branch 'dl/config-alias-doc' into maint

Doc update.

* dl/config-alias-doc:
  config/alias.txt: document alias accepting non-command first word
  config/alias.txt: change " and ' to `

4 years agoMerge branch 'cb/fsmonitor-intfix' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:15 +0000 (12:38 -0700)] 
Merge branch 'cb/fsmonitor-intfix' into maint

Variable type fix.

* cb/fsmonitor-intfix:
  fsmonitor: avoid signed integer overflow / infinite loop

4 years agoMerge branch 'rs/copy-array' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:15 +0000 (12:38 -0700)] 
Merge branch 'rs/copy-array' into maint

Code clean-up.

* rs/copy-array:
  use COPY_ARRAY for copying arrays
  coccinelle: use COPY_ARRAY for copying arrays

4 years agoMerge branch 'js/t3404-typofix' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:14 +0000 (12:38 -0700)] 
Merge branch 'js/t3404-typofix' into maint

Typofix.

* js/t3404-typofix:
  t3404: fix a typo

4 years agoMerge branch 'cb/mkstemps-uint-type-fix' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:14 +0000 (12:38 -0700)] 
Merge branch 'cb/mkstemps-uint-type-fix' into maint

Variable type fix.

* cb/mkstemps-uint-type-fix:
  wrapper: avoid undefined behaviour in macOS

4 years agoMerge branch 'js/t0001-case-insensitive' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:14 +0000 (12:38 -0700)] 
Merge branch 'js/t0001-case-insensitive' into maint

Test update.

* js/t0001-case-insensitive:
  t0001: fix on case-insensitive filesystems

4 years agoMerge branch 'jw/gitweb-sample-update' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:13 +0000 (12:38 -0700)] 
Merge branch 'jw/gitweb-sample-update' into maint

Doc update.

* jw/gitweb-sample-update:
  doc: don't use git.kernel.org as example gitweb URL

4 years agoMerge branch 'sg/t5551-fetch-smart-error-is-translated' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:13 +0000 (12:38 -0700)] 
Merge branch 'sg/t5551-fetch-smart-error-is-translated' into maint

Test update.

* sg/t5551-fetch-smart-error-is-translated:
  t5551: use 'test_i18ngrep' to check translated output

4 years agoMerge branch 'jt/t5551-test-chunked' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:13 +0000 (12:38 -0700)] 
Merge branch 'jt/t5551-test-chunked' into maint

Update smart-http test.

* jt/t5551-test-chunked:
  t5551: test usage of chunked encoding explicitly

4 years agoMerge branch 'sg/git-C-empty-doc' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:13 +0000 (12:38 -0700)] 
Merge branch 'sg/git-C-empty-doc' into maint

Doc update.

* sg/git-C-empty-doc:
  Document that 'git -C ""' works and doesn't change directory

4 years agoMerge branch 'sg/ci-brew-gcc-workaround' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:12 +0000 (12:38 -0700)] 
Merge branch 'sg/ci-brew-gcc-workaround' into maint

Dev support update.

* sg/ci-brew-gcc-workaround:
  ci/lib.sh: update a comment about installed P4 and Git-LFS versions
  ci: disable Homebrew's auto cleanup
  ci: don't update Homebrew

4 years agoMerge branch 'js/trace2-signo-typofix' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:12 +0000 (12:38 -0700)] 
Merge branch 'js/trace2-signo-typofix' into maint

Documentation fix.

* js/trace2-signo-typofix:
  trace2: correct trace2 field name documentation

4 years agoMerge branch 'di/readme-markup-fix' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:12 +0000 (12:38 -0700)] 
Merge branch 'di/readme-markup-fix' into maint

Docfix.

* di/readme-markup-fix:
  README: fix rendering of text in angle brackets

4 years agoMerge branch 'vn/xmmap-gently' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:12 +0000 (12:38 -0700)] 
Merge branch 'vn/xmmap-gently' into maint

Clean-up an error codepath.

* vn/xmmap-gently:
  read-cache.c: do not die if mmap fails

4 years agoMerge branch 'rm/gpg-program-doc-fix' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:12 +0000 (12:38 -0700)] 
Merge branch 'rm/gpg-program-doc-fix' into maint

Docfix.

* rm/gpg-program-doc-fix:
  gpg(docs): use correct --verify syntax

4 years agoMerge branch 'js/unmap-before-ext-diff' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:11 +0000 (12:38 -0700)] 
Merge branch 'js/unmap-before-ext-diff' into maint

Windows update.

* js/unmap-before-ext-diff:
  diff: munmap() file contents before running external diff

4 years agoMerge branch 'js/gcc-8-and-9' into maint
Junio C Hamano [Mon, 29 Jul 2019 19:38:11 +0000 (12:38 -0700)] 
Merge branch 'js/gcc-8-and-9' into maint

Code clean-up for new compilers.
The 'kwset' one may get a wholesale replacement, either with new
version of kwset from upstream or removal of its users, but in the
meantime, it is probably OK to merge it down.

* js/gcc-8-and-9:
  config: avoid calling `labs()` on too-large data type
  winansi: simplify loading the GetCurrentConsoleFontEx() function
  kwset: allow building with GCC 8
  poll (mingw): allow compiling with GCC 8 and DEVELOPER=1

4 years agoFlush fixes up to the third batch post 2.22.0
Junio C Hamano [Thu, 25 Jul 2019 21:32:36 +0000 (14:32 -0700)] 
Flush fixes up to the third batch post 2.22.0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'ab/hash-object-doc' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:16 +0000 (14:27 -0700)] 
Merge branch 'ab/hash-object-doc' into maint

Doc update.

* ab/hash-object-doc:
  hash-object doc: stop mentioning git-cvsimport

4 years agoMerge branch 'cm/send-email-document-req-modules' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:15 +0000 (14:27 -0700)] 
Merge branch 'cm/send-email-document-req-modules' into maint

A doc update.

* cm/send-email-document-req-modules:
  send-email: update documentation of required Perl modules

4 years agoMerge branch 'sw/git-p4-unshelve-branched-files' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:15 +0000 (14:27 -0700)] 
Merge branch 'sw/git-p4-unshelve-branched-files' into maint

"git p4" update.

* sw/git-p4-unshelve-branched-files:
  git-p4: allow unshelving of branched files

4 years agoMerge branch 'js/bisect-helper-check-get-oid-return-value' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:14 +0000 (14:27 -0700)] 
Merge branch 'js/bisect-helper-check-get-oid-return-value' into maint

Code cleanup.

* js/bisect-helper-check-get-oid-return-value:
  bisect--helper: verify HEAD could be parsed before continuing

4 years agoMerge branch 'es/git-debugger-doc' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:14 +0000 (14:27 -0700)] 
Merge branch 'es/git-debugger-doc' into maint

Doc update.

* es/git-debugger-doc:
  doc: hint about GIT_DEBUGGER in CodingGuidelines

4 years agoMerge branch 'mo/clang-format-for-each-update' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:14 +0000 (14:27 -0700)] 
Merge branch 'mo/clang-format-for-each-update' into maint

The list of for-each like macros used by clang-format has been
updated.

* mo/clang-format-for-each-update:
  clang-format: use git grep to generate the ForEachMacros list

4 years agoMerge branch 'md/url-parse-harden' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:13 +0000 (14:27 -0700)] 
Merge branch 'md/url-parse-harden' into maint

The URL decoding code has been updated to avoid going past the end
of the string while parsing %-<hex>-<hex> sequence.

* md/url-parse-harden:
  url: do not allow %00 to represent NUL in URLs
  url: do not read past end of buffer

4 years agoMerge branch 'an/ignore-doc-update' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:13 +0000 (14:27 -0700)] 
Merge branch 'an/ignore-doc-update' into maint

The description about slashes in gitignore patterns (used to
indicate things like "anchored to this level only" and "only
matches directories") has been revamped.

* an/ignore-doc-update:
  gitignore.txt: make slash-rules more readable

4 years agoMerge branch 'md/list-objects-filter-memfix' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:12 +0000 (14:27 -0700)] 
Merge branch 'md/list-objects-filter-memfix' into maint

The filter_data used in the list-objects-filter (which manages a
lazily sparse clone repository) did not use the dynamic array API
correctly---'nr' is supposed to point at one past the last element
of the array in use.  This has been corrected.

* md/list-objects-filter-memfix:
  list-objects-filter: correct usage of ALLOC_GROW

4 years agoMerge branch 'jt/partial-clone-missing-ref-delta-base' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:12 +0000 (14:27 -0700)] 
Merge branch 'jt/partial-clone-missing-ref-delta-base' into maint

"git fetch" into a lazy clone forgot to fetch base objects that are
necessary to complete delta in a thin packfile, which has been
corrected.

* jt/partial-clone-missing-ref-delta-base:
  t5616: cover case of client having delta base
  t5616: use correct flag to check object is missing
  index-pack: prefetch missing REF_DELTA bases
  t5616: refactor packfile replacement

4 years agoMerge branch 'xl/record-partial-clone-origin' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:12 +0000 (14:27 -0700)] 
Merge branch 'xl/record-partial-clone-origin' into maint

When creating a partial clone, the object filtering criteria is
recorded for the origin of the clone, but this incorrectly used a
hardcoded name "origin" to name that remote; it has been corrected
to honor the "--origin <name>" option.

* xl/record-partial-clone-origin:
  clone: respect user supplied origin name when setting up partial clone

4 years agoMerge branch 'pb/request-pull-verify-remote-ref' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:11 +0000 (14:27 -0700)] 
Merge branch 'pb/request-pull-verify-remote-ref' into maint

"git request-pull" learned to warn when the ref we ask them to pull
from in the local repository and in the published repository are
different.

* pb/request-pull-verify-remote-ref:
  request-pull: warn if the remote object is not the same as the local one
  request-pull: quote regex metacharacters in local ref

4 years agoMerge branch 'mm/p4-unshelve-windows-fix' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:11 +0000 (14:27 -0700)] 
Merge branch 'mm/p4-unshelve-windows-fix' into maint

The command line to invoke a "git cat-file" command from inside
"git p4" was not properly quoted to protect a caret and running a
broken command on Windows, which has been corrected.

* mm/p4-unshelve-windows-fix:
  p4 unshelve: fix "Not a valid object name HEAD0" on Windows

4 years agoMerge branch 'bb/unicode-12.1-reiwa' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:10 +0000 (14:27 -0700)] 
Merge branch 'bb/unicode-12.1-reiwa' into maint

Update to Unicode 12.1 width table.

* bb/unicode-12.1-reiwa:
  unicode: update the width tables to Unicode 12.1

4 years agoMerge branch 'js/fsmonitor-unflake' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:10 +0000 (14:27 -0700)] 
Merge branch 'js/fsmonitor-unflake' into maint

The data collected by fsmonitor was not properly written back to
the on-disk index file, breaking t7519 tests occasionally, which
has been corrected.

* js/fsmonitor-unflake:
  mark_fsmonitor_valid(): mark the index as changed if needed
  fill_stat_cache_info(): prepare for an fsmonitor fix

4 years agoMerge branch 'vv/merge-squash-with-explicit-commit' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:10 +0000 (14:27 -0700)] 
Merge branch 'vv/merge-squash-with-explicit-commit' into maint

"git merge --squash" is designed to update the working tree and the
index without creating the commit, and this cannot be countermanded
by adding the "--commit" option; the command now refuses to work
when both options are given.

* vv/merge-squash-with-explicit-commit:
  merge: refuse --commit with --squash

4 years agoMerge branch 'js/bundle-verify-require-object-store' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:09 +0000 (14:27 -0700)] 
Merge branch 'js/bundle-verify-require-object-store' into maint

"git bundle verify" needs to see if prerequisite objects exist in
the receiving repository, but the command did not check if we are
in a repository upfront, which has been corrected.

* js/bundle-verify-require-object-store:
  bundle verify: error out if called without an object database

4 years agoMerge branch 'jk/am-i-resolved-fix' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:09 +0000 (14:27 -0700)] 
Merge branch 'jk/am-i-resolved-fix' into maint

"git am -i --resolved" segfaulted after trying to see a commit as
if it were a tree, which has been corrected.

* jk/am-i-resolved-fix:
  am: fix --interactive HEAD tree resolution
  am: drop tty requirement for --interactive
  am: read interactive input from stdin
  am: simplify prompt response handling

4 years agoMerge branch 'jk/HEAD-symref-in-xfer-namespaces' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:09 +0000 (14:27 -0700)] 
Merge branch 'jk/HEAD-symref-in-xfer-namespaces' into maint

The server side support for "git fetch" used to show incorrect
value for the HEAD symbolic ref when the namespace feature is in
use, which has been corrected.

* jk/HEAD-symref-in-xfer-namespaces:
  upload-pack: strip namespace from symref data

4 years agoMerge branch 'ew/server-info-remove-crufts' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:08 +0000 (14:27 -0700)] 
Merge branch 'ew/server-info-remove-crufts' into maint

"git update-server-info" used to leave stale packfiles in its
output, which has been corrected.

* ew/server-info-remove-crufts:
  server-info: do not list unlinked packs

4 years agoMerge branch 'es/grep-require-name-when-needed' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:08 +0000 (14:27 -0700)] 
Merge branch 'es/grep-require-name-when-needed' into maint

More parameter validation.

* es/grep-require-name-when-needed:
  grep: fail if call could output and name is null

4 years agoMerge branch 'ds/object-info-for-prefetch-fix' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:08 +0000 (14:27 -0700)] 
Merge branch 'ds/object-info-for-prefetch-fix' into maint

Code cleanup and futureproof.

* ds/object-info-for-prefetch-fix:
  sha1-file: split OBJECT_INFO_FOR_PREFETCH

4 years agoMerge branch 'mh/import-transport-fd-fix' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:07 +0000 (14:27 -0700)] 
Merge branch 'mh/import-transport-fd-fix' into maint

The ownership rule for the file descriptor to fast-import remote
backend was mixed up, leading to unrelated file descriptor getting
closed, which has been fixed.

* mh/import-transport-fd-fix:
  Use xmmap_gently instead of xmmap in use_pack
  dup() the input fd for fast-import used for remote helpers

4 years agoMerge branch 'nd/corrupt-worktrees' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:07 +0000 (14:27 -0700)] 
Merge branch 'nd/corrupt-worktrees' into maint

"git worktree add" used to fail when another worktree connected to
the same repository was corrupt, which has been corrected.

* nd/corrupt-worktrees:
  worktree add: be tolerant of corrupt worktrees

4 years agoMerge branch 'nd/init-relative-template-fix' into maint
Junio C Hamano [Thu, 25 Jul 2019 21:27:06 +0000 (14:27 -0700)] 
Merge branch 'nd/init-relative-template-fix' into maint

A relative pathname given to "git init --template=<path> <repo>"
ought to be relative to the directory "git init" gets invoked in,
but it instead was made relative to the repository, which has been
corrected.

* nd/init-relative-template-fix:
  init: make --template path relative to $CWD

4 years agoclean: show an error message when the path is too long
Johannes Schindelin [Thu, 18 Jul 2019 09:30:33 +0000 (02:30 -0700)] 
clean: show an error message when the path is too long

When `lstat()` failed, `git clean` would abort without an error
message, leaving the user quite puzzled.

In particular on Windows, where the default maximum path length is
quite small (yet there are ways to circumvent that limit in many
cases), it is very important that users be given an indication why
their command failed because of too long paths when it did.

This test case makes sure that a warning is issued that would have
helped the user who reported this issue:

https://github.com/git-for-windows/git/issues/521

Note that we temporarily set `core.longpaths = false` in the regression
test; this ensures forward-compatibility with the `core.longpaths`
feature that has not yet been upstreamed from Git for Windows.

Helped-by: René Scharfe <l.s.r@web.de>
Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoCodingGuidelines: spell out post-C89 rules
Junio C Hamano [Tue, 16 Jul 2019 17:21:20 +0000 (10:21 -0700)] 
CodingGuidelines: spell out post-C89 rules

Even though we have been sticking to C89, there are a few handy
features we borrow from more recent C language in our codebase after
trying them in weather balloons and saw that nobody screamed.

Spell them out.

While at it, extend the existing variable declaration rule a bit to
read better with the newly spelled out rule for the for loop.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoREADME: fix rendering of text in angle brackets
Doug Ilijev [Thu, 18 Jul 2019 19:08:45 +0000 (12:08 -0700)] 
README: fix rendering of text in angle brackets

Markdown incorrectly interpreted `<commandname>` as an HTML tag;
use backticks to escape `Documentation/git-<commandname>.txt` to ensure
that it renders the text as intended.

Signed-off-by: Doug Ilijev <doug.ilijev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agorm: resolving by removal is not a warning-worthy event
Junio C Hamano [Wed, 17 Jul 2019 20:28:24 +0000 (13:28 -0700)] 
rm: resolving by removal is not a warning-worthy event

When resolving a conflict on a path in favor of removing it, using
"git rm" on it is the standard way to do so.  The user however is
greeted with a "needs merge" message during that operation:

$ git merge side-branch
$ edit conflicted-path-1
$ git add conflicted-path-1
$ git rm conflicted-path-2
conflicted-path-2: needs merge
rm 'conflicted-path-2'

The removal by "git rm" does get performed, but an uninitiated user
may find it confusing, "needs merge? so I need to resolve conflict
before being able to remove it???"

The message is coming from "update-index --refresh" that is called
internally to make sure "git rm" knows which paths are clean and
which paths are dirty, in order to prevent removal of paths modified
relative to the index without the "-f" option.  We somehow ended up
not squelching this message which seeped through to the UI surface.

Use the same mechanism used by "git commit", "git describe", etc. to
squelch the message.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotransport-helper: avoid var decl in for () loop control
Junio C Hamano [Tue, 16 Jul 2019 20:28:21 +0000 (13:28 -0700)] 
transport-helper: avoid var decl in for () loop control

We do allow a few selected C99 constructs in our codebase these
days, but this is not among them (yet).

Reported-by: Carlo Arenas <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomingw: support spawning programs containing spaces in their names
Johannes Schindelin [Tue, 16 Jul 2019 14:03:12 +0000 (07:03 -0700)] 
mingw: support spawning programs containing spaces in their names

On some older Windows versions (e.g. Windows 7), the CreateProcessW()
function does not really support spaces in its first argument,
lpApplicationName. But it supports passing NULL as lpApplicationName,
which makes it figure out the application from the (possibly quoted)
first argument of lpCommandLine.

Let's use that trick (if we are certain that the first argument matches
the executable's path) to support launching programs whose path contains
spaces.

We will abuse the test-fake-ssh.exe helper to verify that this works and
does not regress.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agogpg-interface: do not scan past the end of buffer
Steven Roberts [Tue, 16 Jul 2019 18:47:37 +0000 (11:47 -0700)] 
gpg-interface: do not scan past the end of buffer

If the GPG output ends with trailing blank lines, after skipping
them over inside the loop to find the terminating NUL at the end,
the loop ends up looking for the next line, starting past the end.

Signed-off-by: Steven Roberts <sroberts@fenderq.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoread-cache.c: do not die if mmap fails
Varun Naik [Sun, 14 Jul 2019 03:01:53 +0000 (20:01 -0700)] 
read-cache.c: do not die if mmap fails

do_read_index() mmaps the index, or tries to die with an error message
on failure. It should call xmmap_gently(), which returns MAP_FAILED,
rather than xmmap(), which dies with its own error message.

An easy way to cause this mmap to fail is by setting $GIT_INDEX_FILE to
a path to a directory and then invoking any command that reads from the
index.

Signed-off-by: Varun Naik <vcnaik94@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agogpg(docs): use correct --verify syntax
Robert Morgan [Fri, 12 Jul 2019 15:33:57 +0000 (08:33 -0700)] 
gpg(docs): use correct --verify syntax

The gpg --verify usage example within the 'gpg.program' variable
reference provides an incorrect example of the gpg --verify command
arguments.

The command argument order, when providing both a detached signature
and data, should be signature first and data second:
https://gnupg.org/documentation/manuals/gnupg/Operational-GPG-Commands.html

Signed-off-by: Robert Morgan <robert.thomas.morgan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotransport-helper: enforce atomic in push_refs_with_push
Emily Shaffer [Thu, 11 Jul 2019 21:19:19 +0000 (14:19 -0700)] 
transport-helper: enforce atomic in push_refs_with_push

Teach transport-helper how to notice if skipping a ref during push would
violate atomicity on the client side. We notice that a ref would be
rejected, and choose not to send it, but don't notice that if the client
has asked for --atomic we are violating atomicity if all the other
pushes we are sending would succeed. Asking the server end to uphold
atomicity wouldn't work here as the server doesn't have any idea that we
tried to update a ref that's broken.

The added test-case is a succinct way to reproduce this issue that fails
today. The same steps work fine when we aren't using a transport-helper
to get to the upstream, i.e. when we've added a local repository as a
remote:

  git remote add ~/upstream upstream

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agodiff: munmap() file contents before running external diff
Johannes Schindelin [Thu, 11 Jul 2019 08:23:41 +0000 (01:23 -0700)] 
diff: munmap() file contents before running external diff

When running an external diff from, say, a diff tool, it is safe to
assume that we want to write the files in question. On Windows, that
means that there cannot be any other process holding an open handle to
said files, or even just a mapped region.

So let's make sure that `git diff` itself is not holding any open handle
to the files in question.

In fact, we will just release the file pair right away, as the external
diff uses the files we just wrote, so we do not need to hold the file
contents in memory anymore.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotrace2: correct trace2 field name documentation
Josh Steadmon [Tue, 9 Jul 2019 23:09:01 +0000 (16:09 -0700)] 
trace2: correct trace2 field name documentation

Correct the api-trace2 documentation, which lists "signal" as an
expected field for the signal event type, but which actually outputs
"signo" as the field name.

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoci/lib.sh: update a comment about installed P4 and Git-LFS versions
SZEDER Gábor [Sat, 6 Jul 2019 16:21:14 +0000 (18:21 +0200)] 
ci/lib.sh: update a comment about installed P4 and Git-LFS versions

A comment in 'ci/lib.sh' claims that the "OS X build installs the
latest available versions" of P4 and Git-LFS, but since f2f47150
("ci: don't update Homebrew", 2019-07-03) that's no longer the case,
as it will install the versions which were recorded in the image's
Homebrew database when the image was created.

Update this comment accordingly.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoci: disable Homebrew's auto cleanup
SZEDER Gábor [Wed, 3 Jul 2019 10:47:48 +0000 (12:47 +0200)] 
ci: disable Homebrew's auto cleanup

Lately Homebrew learned to automagically clean up information about
outdated packages during other 'brew' commands, which might be useful
for the avarage user, but is a waste of time in CI build jobs, because
the next build jobs will start from the exact same image containing
the same outdated packages anyway.

Export HOMEBREW_NO_INSTALL_CLEANUP=1 to disable this auto cleanup feature,
shaving off about 20-30s from the time needed to install dependencies
in our macOS build jobs on Travis CI.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoci: don't update Homebrew
SZEDER Gábor [Wed, 3 Jul 2019 10:47:47 +0000 (12:47 +0200)] 
ci: don't update Homebrew

Lately our GCC macOS build job on Travis CI has been erroring out
while installing dependencies with:

  +brew link gcc@8
  Error: No such keg: /usr/local/Cellar/gcc@8
  The command "ci/install-dependencies.sh" failed and exited with 1 during .

Now, while gcc@8 is still pre-installed (but not linked) and would be
perfectly usable in the Travis CI macOS image we use [1], it's at
version 8.2.  However, when installing dependencies we first
explicitly run 'brew update', which spends over two minutes to update
itself and information about the available packages, and it learns
about GCC 8.3.  After that point gcc@8 exclusively refers to v8.3,
and, unfortunately, 'brew' is just too dumb to be able to do anything
with the still installed 8.2 package, and the subsequent 'brew link
gcc@8' fails.  (Even 'brew uninstall gcc@8' fails with the same
error!)

Don't run 'brew update' to keep the already installed GCC 8.2 'brew
link'-able.  Note that in addition we have to 'export
HOMEBREW_NO_AUTO_UPDATE=1' first, because 'brew' is so very helpful
that it would implicitly run update for us on the next 'brew install
<pkg>' otherwise.

Disabling 'brew update' has additional benefits:

  - It shaves off 2-3mins from the ~4mins currently spent on
    installing dependencies, and the macOS build jobs have always been
    prone to exceeding the time limit on Travis CI.

  - Our builds won't suddenly break because of the occasional Homebrew
    breakages [2].

The drawback is that we'll be stuck with slightly older versions of
the packages that we install via Homebrew (Git-LFS 2.5.2 and Perforce
2018.1; they are currently at 2.7.2 and 2019.1, respectively).  We
might want to reconsider this decision as time goes on and/or switch
to a more recent macOS image as they become available.

[1] 2000ac9fbf (travis-ci: switch to Xcode 10.1 macOS image,
    2019-01-17)

[2] See e.g. a1ccaedd62 (travis-ci: make the OSX build jobs' 'brew
    update' more quiet, 2019-02-02) or

    https://public-inbox.org/git/20180907032002.23366-1-szeder.dev@gmail.com/T/#+u

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agodocs: git-clone: list short form of options first
Quentin Nerden [Tue, 2 Jul 2019 14:37:41 +0000 (07:37 -0700)] 
docs: git-clone: list short form of options first

List the short form of options (e.g.: '-l') before the long form (e.g.
'--local').
This is to match the doc of git-add, git-commit, git-clean, git-branch...

Signed-off-by: Quentin Nerden <quentin.nerden@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agodocs: git-clone: refer to long form of options
Quentin Nerden [Tue, 2 Jul 2019 14:37:40 +0000 (07:37 -0700)] 
docs: git-clone: refer to long form of options

To make the doc of git-clone easier to read,
refer to the long form of the options
(it is easier to guess what '--verbose' is doing than '-v').

Signed-off-by: Quentin Nerden <quentin.nerden@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoDocument that 'git -C ""' works and doesn't change directory
SZEDER Gábor [Sat, 29 Jun 2019 08:24:57 +0000 (10:24 +0200)] 
Document that 'git -C ""' works and doesn't change directory

It's been behaving so since 6a536e2076 (git: treat "git -C '<path>'"
as a no-op when <path> is empty, 2015-03-06).

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agorebase --am: ignore rebase.rescheduleFailedExec
Johannes Schindelin [Mon, 1 Jul 2019 11:58:15 +0000 (04:58 -0700)] 
rebase --am: ignore rebase.rescheduleFailedExec

The `exec` command is specific to the interactive backend, therefore it
does not make sense for non-interactive rebases to heed that config
setting.

We still want to error out if a non-interactive rebase is started with
`--reschedule-failed-exec`, of course.

Reported by Vas Sudanagunta via:
https://github.com/git/git/commit/969de3ff0e0#commitcomment-33257187

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoprogress: use term_clear_line()
SZEDER Gábor [Mon, 24 Jun 2019 18:13:18 +0000 (20:13 +0200)] 
progress: use term_clear_line()

To make sure that the previously displayed progress line is completely
covered up when the new line is shorter, commit 545dc345eb (progress:
break too long progress bar lines, 2019-04-12) added a bunch of
calculations to figure out how many characters it needs to overwrite
with spaces.

Use the just introduced term_clear_line() helper function to, well,
clear the last line, making all these calculations unnecessary, and
thus simplifying the code considerably.

Three tests in 't5541-http-push-smart.sh' 'grep' for specific text
shown in the progress lines at the beginning of the line, but now
those lines begin either with the ANSI escape sequence or with the
terminal width worth of space characters clearing the line.  Relax the
'grep' patterns to match anywhere on the line.  Note that only two of
these three tests fail without relaxing their 'grep' pattern, but the
third looks for the absence of the pattern, so it still succeeds, but
without the adjustment would potentially hide future regressions.

Note also that with this change we no longer need the length of the
previously displayed progress line, so the strbuf added to 'struct
progress' in d53ba841d4 (progress: assemble percentage and counters in
a strbuf before printing, 2019-04-05) is not strictly necessary
anymore.  We still keep it, though, as it avoids allocating and
releasing a strbuf each time the progress is updated.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agorebase: fix garbled progress display with '-x'
SZEDER Gábor [Thu, 27 Jun 2019 13:42:48 +0000 (15:42 +0200)] 
rebase: fix garbled progress display with '-x'

When running a command with the 'exec' instruction during an
interactive rebase session, or for a range of commits using 'git
rebase -x', the output can be a bit garbled when the name of the
command is short enough:

  $ git rebase -x true HEAD~5
  Executing: true
  Executing: true
  Executing: true
  Executing: true
  Executing: true)
  Successfully rebased and updated refs/heads/master.

Note the ')' at the end of the last line.  It gets more garbled as the
range of commits increases:

  $ git rebase -x true HEAD~50
  Executing: true)
  [ repeated 3 more times ]
  Executing: true0)
  [ repeated 44 more times ]
  Executing: true00)
  Successfully rebased and updated refs/heads/master.

Those extra numbers and ')' are remnants of the previously displayed
"Rebasing (N/M)" progress lines that are usually completely
overwritten by the "Executing: <cmd>" lines, unless 'cmd' is short and
the "N/M" part is long.

Make sure that the previously displayed "Rebasing (N/M)" line is
cleared by using the term_clear_line() helper function added in the
previous patch.  Do so only when not being '--verbose', because in
that case these "Rebasing (N/M)" lines are not printed as progress
(i.e. as lines with '\r' at the end), but as "regular" output (with
'\n' at the end).

A couple of other rebase commands print similar messages, e.g.
"Stopped at <abbrev-oid>... <subject>" for the 'edit' or 'break'
commands, or the "Successfully rebased and updated <full-ref>." at the
very end.  These are so long that they practically always overwrite
that "Rebasing (N/M)" progress line, but let's be prudent, and clear
the last line before printing these, too.

In 't3420-rebase-autostash.sh' two helper functions prepare the
expected output of four tests that check the full output of 'git
rebase' and thus are affected by this change, so adjust their
expectations to account for the new line clearing.

Note that this patch doesn't completely eliminate the possibility of
similar garbled outputs, e.g. some error messages from rebase or the
"Auto-merging <file>" message from within the depths of the merge
machinery might not be long enough to completely cover the last
"Rebasing (N/M)" line.  This patch doesn't do anything about them,
because dealing with them individually would result in way too much
churn, while having a catch-all term_clear_line() call in the common
code path of pick_commits() would hide the "Rebasing (N/M)" line way
too soon, and it would either flicker or be invisible.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot5551: test usage of chunked encoding explicitly
Jonathan Tan [Wed, 5 Jun 2019 19:26:24 +0000 (12:26 -0700)] 
t5551: test usage of chunked encoding explicitly

When run using GIT_TEST_PROTOCOL_VERSION=2, a test in t5551 fails
because 4 POSTs (probe, ls-refs, probe, fetch) are sent instead of 2
(probe, fetch).

One way to resolve this would be to relax the condition (from "= 2" to
greater than 1, say), but upon further inspection, the test probably
shouldn't be counting the number of POSTs. This test states that large
requests are split across POSTs, but this is not correct; the main
change is that chunked transfer encoding is used, but the request is
still contained within one POST. (The test coincidentally works because
Git indeed sends 2 POSTs in the case of a large request, but that is
because, as stated above, the first POST is a probing RPC - see
post_rpc() in remote-curl.c for more information.)

Therefore, instead of counting POSTs, check that chunked transfer
encoding is used. This also has the desirable side effect of passing
with GIT_TEST_PROTOCOL_VERSION=2.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Acked-by: Derrick Stolee <dstolee@microsoft.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot5551: use 'test_i18ngrep' to check translated output
SZEDER Gábor [Mon, 24 Jun 2019 12:44:46 +0000 (14:44 +0200)] 
t5551: use 'test_i18ngrep' to check translated output

The two tests 'invalid Content-Type rejected' and 'server-side error
detected' in 't5551-http-fetch-smart.sh' use "plain" 'grep' to check
that 'git clone' failed with the expected error message, but the
messages they are checking are translated, and, consequently, these
tests fail when the test script is run with GIT_TEST_GETTEXT_POISON
enabled.

Use 'test_i18ngrep' instead.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosubmodule foreach: fix recursion of options
Morian Sonnet [Mon, 24 Jun 2019 20:26:55 +0000 (22:26 +0200)] 
submodule foreach: fix recursion of options

Calling

    git submodule foreach --recursive <subcommand> --<option>

leads to an error stating that the option --<option> is unknown to
submodule--helper. That is of course only, when <option> is not a valid
option for git submodule foreach.

The reason for this is, that above call is internally translated into a
call to submodule--helper:

    git submodule--helper foreach --recursive \
        -- <subcommand> --<option>

This call starts by executing the subcommand with its option inside the
first level submodule and continues by calling the next iteration of
the submodule foreach call

    git --super-prefix <submodulepath> submodule--helper \
      foreach --recursive <subcommand> --<option>

inside the first level submodule. Note that the double dash in front of
the subcommand is missing.

This problem starts to arise only recently, as the
PARSE_OPT_KEEP_UNKNOWN flag for the argument parsing of git submodule
foreach was removed in commit a282f5a906. Hence, the unknown option is
complained about now, as the argument parsing is not properly ended by
the double dash.

This commit fixes the problem by adding the double dash in front of the
subcommand during the recursion.

Signed-off-by: Morian Sonnet <moriansonnet@googlemail.com>
Acked-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agopager: add a helper function to clear the last line in the terminal
SZEDER Gábor [Mon, 24 Jun 2019 18:13:16 +0000 (20:13 +0200)] 
pager: add a helper function to clear the last line in the terminal

There are a couple of places where we want to clear the last line on
the terminal, e.g. when a progress bar line is overwritten by a
shorter line, then the end of that progress line would remain visible,
unless we cover it up.

In 'progress.c' we did this by always appending a fixed number of
space characters to the next line (even if it was not shorter than the
previous), but as it turned out that fixed number was not quite large
enough, see the fix in 9f1fd84e15 (progress: clear previous progress
update dynamically, 2019-04-12).  From then on we've been keeping
track of the length of the last displayed progress line and appending
the appropriate number of space characters to the next line, if
necessary, but, alas, this approach turned out to be error prone, see
the fix in 1aed1a5f25 (progress: avoid empty line when breaking the
progress line, 2019-05-19).  The next patch in this series is about to
fix a case where we don't clear the last line, and on occasion do end
up with such garbage at the end of the line.  It would be great if we
could do that without the need to deal with that without meticulously
computing the necessary number of space characters.

So add a helper function to clear the last line on the terminal using
an ANSI escape sequence, which has the advantage to clear the whole
line no matter how wide it is, even after the terminal width changed.
Such an escape sequence is not available on dumb terminals, though, so
in that case fall back to simply print a whole terminal width (as
reported by term_columns()) worth of space characters.

In 'editor.c' launch_specified_editor() already used this ANSI escape
sequence, so replace it with a call to this function.

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