#define FORMAT_PRESERVING(n) __attribute__((format_arg(n)))
-int use_gettext_poison(void);
-
#ifndef NO_GETTEXT
+ extern int git_gettext_enabled;
void git_setup_gettext(void);
int gettext_width(const char *s);
#else
+ #define git_gettext_enabled (0)
static inline void git_setup_gettext(void)
{
- use_gettext_poison(); /* getenv() reentrancy paranoia */
}
static inline int gettext_width(const char *s)
{
{
if (!*msgid)
return "";
- return use_gettext_poison() ? "# GETTEXT POISON #" :
- !git_gettext_enabled ? msgid : gettext(msgid);
++ if (!git_gettext_enabled)
++ return msgid;
+ return gettext(msgid);
}
static inline FORMAT_PRESERVING(1) FORMAT_PRESERVING(2)
const char *Q_(const char *msgid, const char *plu, unsigned long n)
{
- if (use_gettext_poison())
- return "# GETTEXT POISON #";
+ if (!git_gettext_enabled)
+ return n == 1 ? msgid : plu;
return ngettext(msgid, plu, n);
}
expect_rejected_dir () {
test_must_fail git status 2>err &&
- grep "safe.directory" err
- test_i18ngrep "safe.directory" err
++ grep "dubious ownership" err
}
test_expect_success 'safe.directory is not set' '
test_must_fail git config --rename-section branch.zwei "bogus name"
'
- test_i18ngrep "refusing to work with overly long line in .y. on line 2" err
+ test_expect_success 'renaming a section with a long line' '
+ {
+ printf "[b]\\n" &&
+ printf " c = d %1024s [a] e = f\\n" " " &&
+ printf "[a] g = h\\n"
+ } >y &&
+ git config -f y --rename-section a xyz &&
+ test_must_fail git config -f y b.e
+ '
+
+ test_expect_success 'renaming an embedded section with a long line' '
+ {
+ printf "[b]\\n" &&
+ printf " c = d %1024s [a] [foo] e = f\\n" " " &&
+ printf "[a] g = h\\n"
+ } >y &&
+ git config -f y --rename-section a xyz &&
+ test_must_fail git config -f y foo.e
+ '
+
+ test_expect_success 'renaming a section with an overly-long line' '
+ {
+ printf "[b]\\n" &&
+ printf " c = d %525000s e" " " &&
+ printf "[a] g = h\\n"
+ } >y &&
+ test_must_fail git config -f y --rename-section a xyz 2>err &&
++ grep "refusing to work with overly long line in .y. on line 2" err
+ '
+
cat >> .git/config << EOF
[branch "zwei"] a = 1 [branch "vier"]
EOF