builtin/merge.c: drop a parameter that is never used

Since the very beginning when we added the "renormalizing" parameter
to this function with 7610fa57 (merge-recursive --renormalize,
2010-08-05), nobody seems to have ever referenced it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge & sequencer: unify codepaths that write "Conflicts:" hint

Two identical loops in suggest_conflicts() in merge, and
do_recursive_merge() in sequencer, can use a single helper function
extracted from the latter that prepares the "Conflicts:" hint that
is meant to remind the user the paths for which merge conflicts had
to be resolved to write a better commit log message.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
strbuf_add_commented_lines(): avoid SP-HT sequence in commented lines

The strbuf_add_commented_lines() function passes a pair of prefixes,
one to be used for a non-empty line, and the other for an empty
line, to underlying add_lines().  The former is set to a comment
char followed by a SP, while the latter is set to just the comment
char.  This is designed to give a SP after the comment character,
e.g. "# <user text>\n", on a line with some text, and to avoid
emitting an unsightly "# \n" for an empty line.

Teach this machinery to also use the latter space-less prefix when
the payload line begins with a tab, to show e.g. "#\t<user text>\n";
otherwise we will end up showing "# \t<user text>\n" which is
similarly unsightly.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit.c: extract ignore_non_trailer() helper function

Extract a helper function from prepare_to_commit() to determine
where to place a new Signed-off-by: line, which is essentially the
true "end" of the log message, ignoring the trailing "Conflicts:"
line and everything below it.

The detection _should_ make sure the "Conflicts:" line it finds is
truly the conflict hint block by checking everything that follows is
a HT indented pathname to avoid false positive, but this logic will
be revamped in a later patch to ignore comments and blanks anyway,
so it is left as-is in this step.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge & sequencer: turn "Conflicts:" hint into a comment

Just like other hints such as "Changes to be committed" we show in
the editor to remind the committer what paths were involved in the
resulting commit to help improving their log message, this section
is merely a reminder.

Traditionally, it was not made into comments primarily because it
has to be generated outside the wt-status infrastructure, and also
because it was meant as a bit stronger reminder than the others
(i.e. explaining how you resolved conflicts is much more important
than mentioning what you did to every paths involved in the commit).

But that still does not make this hint a part of the log message
proper, and not showing it as a comment is inviting mistakes.

Note that we still notice "Conflicts:" followed by list of indented
pathnames as an old-style cruft and insert a new Signed-off-by:
before it.  This is so that "commit --amend -s" adds the new S-o-b
at the right place when used on an older commit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
receive-pack: avoid minor leak in case start_async() fails

If the asynchronous start of copy_to_sideband() fails, then any
env_array entries added to struct child_process proc by
prepare_push_cert_sha1() are leaked.  Call the latter function only
after start_async() succeeded so that the allocated entries are
cleaned up automatically by start_command() or finish_command().

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
api-run-command: add missing list item marker

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'bc/asciidoctor'

Add machinery to alternatively use AsciiDoctor to format our
documentation.

* bc/asciidoctor:
  Documentation: remove Asciidoctor linkgit macro
  Documentation: refactor common operations into variables
  Documentation: implement linkgit macro for Asciidoctor
  Documentation: move some AsciiDoc parameters into variables
Merge branch 'jk/prune-mtime'

Tighten the logic to decide that an unreachable cruft is
sufficiently old by covering corner cases such as an ancient object
becoming reachable and then going unreachable again, in which case
its retention period should be prolonged.

* jk/prune-mtime: (28 commits)
  drop add_object_array_with_mode
  revision: remove definition of unused 'add_object' function
  pack-objects: double-check options before discarding objects
  repack: pack objects mentioned by the index
  pack-objects: use argv_array
  reachable: use revision machinery's --indexed-objects code
  rev-list: add --indexed-objects option
  rev-list: document --reflog option
  t5516: test pushing a tag of an otherwise unreferenced blob
  traverse_commit_list: support pending blobs/trees with paths
  make add_object_array_with_context interface more sane
  write_sha1_file: freshen existing objects
  pack-objects: match prune logic for discarding objects
  pack-objects: refactor unpack-unreachable expiration check
  prune: keep objects reachable from recent objects
  sha1_file: add for_each iterators for loose and packed objects
  count-objects: use for_each_loose_file_in_objdir
  count-objects: do not use xsize_t when counting object size
  prune-packed: use for_each_loose_file_in_objdir
  reachable: mark index blobs as SEEN
  ...
Merge branch 'oc/mergetools-beyondcompare'

* oc/mergetools-beyondcompare:
  mergetool: rename bc3 to bc
Merge branch 'dm/port2zos'

z/OS port

* dm/port2zos:
  compat/bswap.h: detect endianness from XL C compiler macros
  Makefile: reorder linker flags in the git executable rule
  git-compat-util.h: support variadic macros with the XL C compiler
Merge branch 'mg/lib-gpg-ro-safety'

In a tarball extract whose files are all read-only, running GPG
tests would have failed due to unwritable files.

* mg/lib-gpg-ro-safety:
  t/lib-gpg: make gpghome files writable
Merge branch 'rb/pack-window-memory-config-doc'

* rb/pack-window-memory-config-doc:
  config.txt: pack.windowmemory limit applies per-thread
Merge branch 'da/difftool'

Allow diff tool backend to stop early by exiting with a non-zero
status.

* da/difftool:
  difftool: add support for --trust-exit-code
  difftool--helper: exit when reading a prompt answer fails
Update draft release notes to 2.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'jc/strbuf-add-lines-avoid-sp-ht-sequence' into next

The commented output used to blindly add a SP before the payload
line, resulting in "# \t<indented text>\n" when the payload began
with a HT.  Instead, produce "#\t<indented text>\n".

* jc/strbuf-add-lines-avoid-sp-ht-sequence:
  strbuf_add_commented_lines(): avoid SP-HT sequence in commented lines
Merge branch 'jc/conflict-hint' into next

Unlike all the other hints given in the commit log editor, the list
of conflicted paths were appended at the end without commented out.

* jc/conflict-hint:
  merge & sequencer: turn "Conflicts:" hint into a comment
  builtin/commit.c: extract ignore_non_trailer() helper function
  merge & sequencer: unify codepaths that write "Conflicts:" hint
  builtin/merge.c: drop a parameter that is never used
Merge branch 'jc/push-cert' into next

* jc/push-cert:
  receive-pack: avoid minor leak in case start_async() fails
Merge branch 'rs/daemon-fixes' into maint

* rs/daemon-fixes:
  daemon: remove write-only variable maxfd
  daemon: fix error message after bind()
  daemon: handle gethostbyname() error
Merge branch 'bc/asciidoc-pretty-formats-fix' into maint

* bc/asciidoc-pretty-formats-fix:
  Documentation: fix misrender of pretty-formats in Asciidoctor