gettext: do not translate empty string

The gettext .po files have a header, but it looks like the
translation specification for an empty string.  This results in
_("") actually returning that header.

Check the input to _() and do not call gettext() on an empty string;
in some places, we run _(opts->help) where opts->help may be empty.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t6300: test sort with multiple keys

Documentation of git-for-each-ref says that --sort=<key> option can be
used multiple times, in which case the last key becomes the primary key.
However this functionality was never checked in test suite and is
currently broken. This commit adds appropriate test in preparation for fix.

Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
for-each-ref: Fix sort with multiple keys

The linked list describing sort options was not correctly set up in
opt_parse_sort. In the result, contrary to the documentation, only the
last of multiple --sort options to git-for-each-ref was taken into
account. This commit fixes it.

Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config: warn on inaccessible files

Before reading a config file, we check "!access(path, R_OK)"
to make sure that the file exists and is readable. If it's
not, then we silently ignore it.

For the case of ENOENT, this is fine, as the presence of the
file is optional. For other cases, though, it may indicate a
configuration error (e.g., not having permissions to read
the file). Let's print a warning in these cases to let the
user know.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitignore: report access errors of exclude files

When we try to access gitignore files, we check for their
existence with a call to "access". We silently ignore
missing files. However, if a file is not readable, this may
be a configuration error; let's warn the user.

For $GIT_DIR/info/excludes or core.excludesfile, we can just
use access_or_warn. However, for per-directory files we
actually try to open them, so we must add a custom warning.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
attr: warn on inaccessible attribute files

Just like config and gitignore files, we silently ignore
missing or inaccessible attribute files. An existent but
inaccessible file is probably a configuration error, so
let's warn the user.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
warn_on_inaccessible(): a helper to warn on inaccessible paths

The previous series introduced warnings to multiple places, but it
could become tiring to see the warning on the same path over and
over again during a single run of Git.  Making just one function
responsible for issuing this warning, we could later choose to keep
track of which paths we issued a warning (it would involve a hash
table of paths after running them through real_path() or something)
in order to reduce noise.

Right now we do not know if the noise reduction is necessary, but it
still would be a good code reduction/sharing anyway.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Fix tests under GETTEXT_POISON on relative dates

Use a i18n-specific test_i18ncmp in t/t0006-data.sh for relative dates
tests. This issue was was introduced in v1.7.10-230-g7d29a:

    7d29a i18n: mark relative dates for translation

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Fix tests under GETTEXT_POISON on git-stash

Use i18n-specific test functions in test scripts for git-stash.
This issue was was introduced in v1.7.4.1-119-g355ec:

    355ec i18n: git-status basic messages

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Fix tests under GETTEXT_POISON on diffstat

Use i18n-specific test functions in test scripts for diffstat.
This issue was was introduced in v1.7.9-1-g7f814:

    7f814 Use correct grammar in diffstat summary line

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Fix tests under GETTEXT_POISON on git-apply

Use i18n-specific test functions in test scripts for git-apply.
This issue was was introduced in the following commits:

    de373 i18n: apply: mark parseopt strings for translation
    3638e i18n: apply: mark strings for translation

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Fix tests under GETTEXT_POISON on pack-object

Use i18n-specific test functions in test scripts for pack-object.
This issue was was introduced in v1.7.10.2-556-g46140:

    46140 index-pack: use streaming interface for collision test on large blobs
    cf2ba pack-objects: use streaming interface for reading large loose blobs

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Fix tests under GETTEXT_POISON on parseopt

Use i18n-specific test functions in test scripts for parseopt tests.
This issue was was introduced in v1.7.10.1-488-g54e6d:

    54e6d i18n: parseopt: lookup help and argument translations when showing usage

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'ms/git-svn-1.7' into jch

A series by Michael Schwern via Eric to update git-svn to revamp the
way URLs are internally passed around, to make it work with SVN 1.7.

Will merge to 'next' after pinging Eric to double check and then to 'master'.

* ms/git-svn-1.7:
  git-svn: remove ad-hoc canonicalizations
  git-svn: canonicalize newly-minted URLs
  git-svn: introduce add_path_to_url function
  git-svn: canonicalize earlier
  git-svn: replace URL escapes with canonicalization
  git-svn: attempt to mimic SVN 1.7 URL canonicalization
  t9107: fix typo
  t9118: workaround inconsistency between SVN versions
  Git::SVN{,::Ra}: canonicalize earlier
  git-svn: path canonicalization uses SVN API
  Git::SVN::Utils: remove irrelevant comment
  git-svn: add join_paths() to safely concatenate paths
  git-svn: factor out _collapse_dotdot function
  git-svn: use SVN 1.7 to canonicalize when possible
  git-svn: move canonicalization to Git::SVN::Utils
  use Git::SVN{,::RA}->url accessor globally
  use Git::SVN->path accessor globally
  Git::SVN::Ra: use accessor for URLs
  Git::SVN: use accessor for URLs internally
  Git::SVN: use accessors internally for path
Merge branch 'jc/test-prereq' into jch

(Originally merged to 'next' on 2012-08-04)

Teaches the test framework to probe rarely used prerequistes lazily,
and make use of it for detecting SYMLINKS, CASE_INSENSITIVE_FS and
NKD/NKC MacOS x gotcha.

Will merge to 'master' as part of the first batch.

* jc/test-prereq:
  fixup! t3910: use the UTF8_NFD_TO_NFC test prereq
  t3910: use the UTF8_NFD_TO_NFC test prereq
  test-lib: provide UTF8 behaviour as a prerequisite
  t0050: use the SYMLINKS test prereq
  t0050: use the CASE_INSENSITIVE_FS test prereq
  test-lib: provide case insensitivity as a prerequisite
  test: allow prerequisite to be evaluated lazily
  test: rename $satisfied to $satisfied_prereq
Merge branch 'pg/maint-apply-remove-unused-variable' into jch

(Originally merged to 'next' on 2012-08-05)

Remove an unused field.
Will merge to 'master' as part of the first batch.

* pg/maint-apply-remove-unused-variable:
  apply: delete unused deflate_origlen from patch struct
Merge branch 'mk/test-seq' into jch

(Originally merged to 'next' on 2012-08-06)

Add a compatibility/utility function to the test framework.

Will merge to 'master' as part of the first batch.

* mk/test-seq:
  tests: Introduce test_seq
Merge branch 'nd/index-errno' into jch

(Originally merged to 'next' on 2012-08-06)

Assignments to errno before calling system functions that used to
matter in the old code were left behind after the code structure
changed sufficiently to make them useless.

Will merge to 'master' as part of the first batch.

* nd/index-errno:
  read_index_from: remove bogus errno assignments
Merge branch 'tr/maint-send-email-2047' into jch

(Originally merged to 'next' on 2012-08-09)

"git send-email" did not unquote encoded words that appear on the
header correctly, and lost "_" from strings.

Will merge to 'master' as part of the first batch.

* tr/maint-send-email-2047:
  send-email: improve RFC2047 quote parsing
Merge branch 'mm/die-with-dashdash-help' into jch

(Originally merged to 'next' on 2012-08-09)

Reword error messages.

Will merge to 'master' as part of the first batch.

* mm/die-with-dashdash-help:
  setup: clarify error messages for file/revisions ambiguity