branch: remove lego in i18n tracking info strings

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t1411: add more selector index/date tests

We already check that @{now} and "--date" cause the
displayed selector to use the date for both the multiline
and oneline formats. However, we miss several cases:

  1. The --format=%gd selector is not tested at all.

  2. We do not check how the log.date config interacts with the
     "--date" magic (according to f4ea32f, it should not
     impact the output).

Doing so reveals that the combination of both (log.date
combined with the %gd format) does not behave as expected.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
log: respect date_mode_explicit with --format:%gd

When we show a reflog selector (e.g., via "git log -g"), we
perform some DWIM magic: while we normally show the entry's
index (e.g., HEAD@{1}), if the user has given us a date
with "--date", then we show a date-based select (e.g.,
HEAD@{yesterday}).

However, we don't want to trigger this magic if the
alternate date format we got was from the "log.date"
configuration; that is not sufficiently strong context for
us to invoke this particular magic. To fix this, commit
f4ea32f (improve reflog date/number heuristic, 2009-09-24)
introduced a "date_mode_explicit" flag in rev_info. This
flag is set only when we see a "--date" option on the
command line, and we a vanilla date to the reflog code if
the date was not explicit.

Later, commit 8f8f547 (Introduce new pretty formats %g[sdD]
for reflog information, 2009-10-19) added another way to
show selectors, and it did not respect the date_mode_explicit
flag from f4ea32f.

This patch propagates the date_mode_explicit flag to the
pretty-print code, which can then use it to pass the
appropriate date field to the reflog code. This brings the
behavior of "%gd" in line with the other formats, and means
that its output is independent of any user configuration.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reflog-walk: clean up "flag" field of commit_reflog struct

When we prepare to walk a reflog, we parse the specification
and pull some information from it, such as which reflog to
look in (e.g., HEAD), and where to start (e.g., HEAD@{10} or
HEAD@{yesterday}). The resulting struct has a "recno" field
to show where in the reflog we are starting. It also has a
"flag" field; if true, it means the recno field came from
parsing a date like HEAD@{yesterday}.

There are two problems with this:

  1. "flag" is an absolutely terrible name, as it conveys
     nothing about the meaning

  2. you can tell "HEAD" from "HEAD@{yesterday}", but you
     can't differentiate "HEAD" from "HEAD{0}"

This patch converts the flag into a tri-state (and gives it
a better name!).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reflog-walk: always make HEAD@{0} show indexed selectors

When we are showing reflog selectors during a walk, we infer
from context whether the user wanted to see the index in
each selector, or the reflog date. The current rules are:

  1. if the user asked for an explicit date format in the
     output, show the date

  2. if the user asked for ref@{now}, show the date

  3. if neither is true, show the index

However,  if we see "ref@{0}", that should be a strong clue
that the user wants to see the counted version. In fact, it
should be much stronger than the date format in (1). The
user may have been setting the date format to use in another
part of the output (e.g., in --format="%gd (%ad)", they may
have wanted to influence the author date).

This patch flips the rules to:

  1. if the user asked for ref@{0}, always show the index

  2. if the user asked for ref@{now}, always show the date

  3. otherwise, we have just "ref"; show them counted by
     default, but respect the presence of "--date" as a clue
     that the user wanted them date-based

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reflog-walk: tell explicit --date=default from not having --date at all

Introduction of opt->date_mode_explicit was a step in the right direction,
but lost that crucial bit at the very end of the callchain, and the callee
could not tell an explicitly specified "I want *date* but in default format"
from the built-in default value passed when there was no --date specified.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
checkout: do not corrupt HEAD on empty repo

In abe1998 ("git checkout -b: allow switching out of an unborn
branch"), a code-path overly-optimisticly assumed that a
branch-name was specified. This is not always the case, and as
a result a NULL-pointer was attempted printed to .git/HEAD.

This could lead to at least two different failure modes:
 1) vsnprintf formated the NULL-string as something useful (e.g
    "(null)")
 2) vsnprintf crashed

Neither were very convenient for formatting a new HEAD-reference.

To fix this, reintroduce some strictness so we only take this
new codepath if a banch-name was specified.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
document submdule.$name.update=none option for gitmodules

This option was not yet described in the gitmodules documentation. We
only described it in the 'git submodule' command documentation but
gitmodules is the more natural place to look.

A short reference in the 'git submodule' documentation should be
sufficient since the details can now be found in the documentation to
gitmodules.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'rl/show-empty-prefix' into maint

Unlike "git rev-parse --show-cdup", "--show-prefix" did not give an
empty line when run at the top of the working tree.

By Ross Lagerwall
* rl/show-empty-prefix:
  rev-parse --show-prefix: add in trailing newline
Merge branch 'sl/test-wc-l-line-count' into maint

By Stefano Lattarini
* sl/test-wc-l-line-count:
  tests: modernise style: more uses of test_line_count
Merge branch 'rs/unpack-trees-leakfix' into maint

By René Scharfe
* rs/unpack-trees-leakfix:
  unpack-trees: plug minor memory leak
  unpack-trees: don't perform any index operation if we're not merging
Merge branch 'fa/maint-config-doc' into maint

By Florian Achleitner
* fa/maint-config-doc:
  Documentation/git-config: describe and clarify "--local <file>" option
Merge branch 'ah/maint-grep-double-init' into maint

By Angus Hammond
* ah/maint-grep-double-init:
  grep.c: remove redundant line of code
Merge branch 'jk/repack-no-explode-objects-from-old-pack' into maint

"git repack" used to write out unreachable objects as loose objects
when repacking, even if such loose objects will immediately pruned
due to its age.

By Jeff King
* jk/repack-no-explode-objects-from-old-pack:
  gc: use argv-array for sub-commands
  argv-array: add a new "pushl" method
  argv-array: refactor empty_argv initialization
  gc: do not explode objects which will be immediately pruned
Merge branch 'js/fast-import-test-9300' into maint

By Johannes Sixt
* js/fast-import-test-9300:
  t9300-fast-import: avoid 'exit' in test_expect_success snippets
Merge branch 'ct/advise-push-default' into maint

The cases "git push" fails due to non-ff can be broken into three
categories; each case is given a separate advise message.

By Christopher Tiwald (2) and Jeff King (1)
* ct/advise-push-default:
  Fix httpd tests that broke when non-ff push advice changed
  clean up struct ref's nonfastforward field
  push: Provide situational hints for non-fast-forward errors
Merge branch 'jc/diff-algo-cleanup' into maint

* jc/diff-algo-cleanup:
  xdiff: PATIENCE/HISTOGRAM are not independent option bits
  xdiff: remove XDL_PATCH_* macros
Git 1.7.10.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Sync with 1.7.10.2
Merge branch 'nd/i18n-branch-lego'

Fix yet another message construction by concatenating pieces of sentenes,
which is unfriendly to i18n.

By Nguyễn Thái Ngọc Duy
* nd/i18n-branch-lego:
  branch: remove lego in i18n tracking info strings