i18n: branch: mark strings for translation

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
usage: allow pluggable die-recursion checks

When any git code calls die or die_errno, we use a counter
to detect recursion into the die functions from any of the
helper functions. However, such a simple counter is not good
enough for threaded programs, which may call die from a
sub-thread, killing only the sub-thread (but incrementing
the counter for everyone).

Rather than try to deal with threads ourselves here, let's
just allow callers to plug in their own recursion-detection
function. This is similar to how we handle the die routine
(the caller plugs in a die routine which may kill only the
sub-thread).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
run-command: use thread-aware die_is_recursing routine

If we die from an async thread, we do not actually exit the
program, but just kill the thread. This confuses the static
counter in usage.c's default die_is_recursing function; it
updates the counter once for the thread death, and then when
the main program calls die() itself, it erroneously thinks
we are recursing. The end result is that we print "recursion
detected in die handler" instead of the real error in such a
case (the easiest way to trigger this is having a remote
connection hang up while running a sideband demultiplexer).

This patch solves it by using a per-thread counter when the
async_die function is installed; we detect recursion in each
thread (including the main one), but they do not step on
each other's toes.

Other threaded code does not need to worry about this, as
they do not install specialized die handlers; they just let
a die() from a sub-thread take down the whole program.

Since we are overriding the default recursion-check
function, there is an interesting corner case that is not a
problem, but bears some explanation. Imagine the main thread
calls die(), and then in the die_routine starts an async
call. We will switch to using thread-local storage, which
starts at 0, for the main thread's counter, even though
the original counter was actually at 1. That's OK, though,
for two reasons:

  1. It would miss only the first level of recursion, and
     would still find recursive failures inside the async
     helper.

  2. We do not currently and are not likely to start doing
     anything as heavyweight as starting an async routine
     from within a die routine or helper function.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
attr.c: extract read_index_data() as read_blob_data_from_index()

Extract the read_index_data() function from attr.c and move it to
read-cache.c; rename it to read_blob_data_from_index() and update
the function signature of it to align better with index/cache API
functions.

This allows for reusing the function in convert.c later.

Signed-off-by: Lukas Fleischer <git@cryptocrack.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
read_blob_data_from_index(): optionally return the size of blob data

This allows for optionally getting the size of the returned data and
will be used in a follow-up patch.

Signed-off-by: Lukas Fleischer <git@cryptocrack.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
convert.c: remove duplicate code

The has_cr_in_index() function is an almost 1:1 copy of
read_blob_data_from_index() with some additions.  Use the
latter instead of using copy-pasted code.

Signed-off-by: Lukas Fleischer <git@cryptocrack.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'lf/read-blob-data-from-index' into next

* lf/read-blob-data-from-index:
  convert.c: remove duplicate code
  read_blob_data_from_index(): optionally return the size of blob data
  attr.c: extract read_index_data() as read_blob_data_from_index()
remote-hg: fix commit messages

git fast-import expects an extra newline after the commit message data,
but we are adding it only on hg-git compat mode, which is why the
bidirectionality tests pass.

We should add it unconditionally.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t6200: avoid path mangling issue on Windows

MSYS bash interprets the slash in the argument core.commentchar="/"
as root directory and mangles it into a Windows style path. Use a
different core.commentchar to dodge the issue.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'jk/http-error-messages'

A regression fix for the recently graduated topic.

* jk/http-error-messages:
  http: set curl FAILONERROR each time we select a handle
Merge branch 'tr/packed-object-info-wo-recursion'

Attempts to reduce the stack footprint of sha1_object_info()
and unpack_entry() codepaths.

* tr/packed-object-info-wo-recursion:
  sha1_file: remove recursion in unpack_entry
  Refactor parts of in_delta_base_cache/cache_or_unpack_entry
  sha1_file: remove recursion in packed_object_info
Merge branch 'jc/detached-head-doc'

* jc/detached-head-doc:
  glossary: extend "detached HEAD" description
Merge branch 'kb/co-orphan-suggestion-short-sha1'

Update the informational message when "git checkout" leaves the
detached head state.

* kb/co-orphan-suggestion-short-sha1:
  checkout: abbreviate hash in suggest_reattach
Merge branch 'fc/completion'

In addition to a user visible change to offer more options to cherry-pick,
generally cleans up and simplifies the code.

* fc/completion:
  completion: small optimization
  completion: inline __gitcomp_1 to its sole callsite
  completion: get rid of compgen
  completion: add __gitcomp_nl tests
  completion: add new __gitcompadd helper
  completion: get rid of empty COMPREPLY assignments
  completion: trivial test improvement
  completion: add more cherry-pick options
Merge branch 'jk/daemon-user-doc'

Document where the configuration is read by the git-daemon when its --user
option is used.

* jk/daemon-user-doc:
  doc: clarify that "git daemon --user=<user>" option does not export HOME=~user
Merge branch 'jc/push-2.0-default-to-simple' (early part)

Adjust our tests for upcoming migration of the default value for the
"push.default" configuration variable to "simple" from "mixed".

* 'jc/push-2.0-default-to-simple' (early part):
  t5570: do not assume the "matching" push is the default
  t5551: do not assume the "matching" push is the default
  t5550: do not assume the "matching" push is the default
  t9401: do not assume the "matching" push is the default
  t9400: do not assume the "matching" push is the default
  t7406: do not assume the "matching" push is the default
  t5531: do not assume the "matching" push is the default
  t5519: do not assume the "matching" push is the default
  t5517: do not assume the "matching" push is the default
  t5516: do not assume the "matching" push is the default
  t5505: do not assume the "matching" push is the default
  t5404: do not assume the "matching" push is the default
Merge branch 'fc/send-email-annotate'

Allows format-patch --cover-letter to be configurable; the most
notable is the "auto" mode to create cover-letter only for multi
patch series.

* fc/send-email-annotate:
  rebase-am: explicitly disable cover-letter
  format-patch: trivial cleanups
  format-patch: add format.coverLetter configuration variable
  log: update to OPT_BOOL
  format-patch: refactor branch name calculation
  format-patch: improve head calculation for cover-letter
  send-email: make annotate configurable
Merge branch 'rs/empty-archive'

Implementations of "tar" of BSD descend have found to have trouble
with reading an otherwise empty tar archive with pax headers and
causes an unnecessary test failure.

* rs/empty-archive:
  t5004: fix issue with empty archive test and bsdtar
Merge branch 'jk/http-dumb-namespaces'

Allow smart-capable HTTP servers to be restricted via the
GIT_NAMESPACE mechanism when talking with commit-walker clients
(they already do so when talking with smart HTTP clients).

* jk/http-dumb-namespaces:
  http-backend: respect GIT_NAMESPACE with dumb clients
Merge branch 'jk/merge-tree-added-identically'

The resolution of some corner cases by "git merge-tree" were
inconsistent between top-of-the-tree and in a subdirectory.

* jk/merge-tree-added-identically:
  merge-tree: don't print entries that match "local"