1. 09 3月, 2011 7 次提交
    • J
      i18n: do not poison translations unless GIT_GETTEXT_POISON envvar is set · 30955229
      Jonathan Nieder 提交于
      Tweak the GETTEXT_POISON facility so it is activated at run time
      instead of compile time.  If the GIT_GETTEXT_POISON environment
      variable is set, _(msg) will result in gibberish as before; but if the
      GIT_GETTEXT_POISON variable is not set, it will return the message for
      human-readable output.  So the behavior of mistranslated and
      untranslated git can be compared without rebuilding git in between.
      
      For simplicity we always set the GIT_GETTEXT_POISON variable in tests.
      
      This does not affect builds without the GETTEXT_POISON compile-time
      option set, so non-i18n git will not be slowed down.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      30955229
    • Æ
      i18n: add GETTEXT_POISON to simulate unfriendly translator · bb946bba
      Ævar Arnfjörð Bjarmason 提交于
      Add a new GETTEXT_POISON compile-time parameter to make _(msg) always
      return gibberish. So now you can run
      
      	make GETTEXT_POISON=YesPlease
      
      to get a copy of git that functions correctly (one hopes) but produces
      output that is in nobody's native language at all.
      
      This is a debugging aid for people who are working on the i18n part of
      the system, to make sure that they are not marking plumbing messages
      that should never be translated with _().
      
      As new strings get marked for translation, naturally a number of tests
      will be broken in this mode. Tests that depend on output from
      Porcelain will need to be marked with the new C_LOCALE_OUTPUT test
      prerequisite. Newly failing tests that do not depend on output from
      Porcelain would be bugs due to messages that should not have been
      marked for translation.
      
      Note that the string we're using ("# GETTEXT POISON #") intentionally
      starts the pound sign. Some of Git's tests such as
      t3404-rebase-interactive.sh rely on interactive editing with a fake
      editor, and will needlessly break if the message doesn't start with
      something the interactive editor considers a comment.
      
      A future patch will fix fix the underlying cause of that issue by
      adding "#" characters to the commit advice automatically.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      bb946bba
    • Æ
      i18n: add no-op _() and N_() wrappers · 65784830
      Ævar Arnfjörð Bjarmason 提交于
      The _ function is for translating strings into the user's chosen
      language.  The N_ macro just marks translatable strings for the
      xgettext(1) tool without translating them; it is intended for use in
      contexts where a function call cannot be used.  So, for example:
      
      	fprintf(stderr, _("Expansion of alias '%s' failed; "
      		"'%s' is not a git command\n"),
      		cmd, argv[0]);
      
      and
      
      	const char *unpack_plumbing_errors[NB_UNPACK_TREES_ERROR_TYPES] = {
      		/* ERROR_WOULD_OVERWRITE */
      		N_("Entry '%s' would be overwritten by merge. Cannot merge."),
      	[...]
      
      Define such _ and N_ in a new gettext.h and include it in cache.h, so
      they can be used everywhere.  Each just returns its argument for now.
      _ is a function rather than a macro like N_ to avoid the temptation to
      use _("foo") as a string literal (which would be a compile-time error
      once _(s) expands to an expression for the translation of s).
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      65784830
    • J
      commit, status: use status_printf{,_ln,_more} helpers · 098d0e0e
      Jonathan Nieder 提交于
      wt-status code is used to provide a reminder of changes included and
      not included for the commit message template opened in the operator's
      text editor by "git commit".  Therefore each line of its output begins
      with the comment character "#":
      
      	# Please enter the commit message for your changes. Lines starting
      
      Use the new status_printf{,_ln,_more} functions to take care of adding
      "#" to the beginning of such status lines automatically.  Using these
      will have two advantages over the current code:
      
       - The obvious one is to force separation of the "#" from the
         translatable part of the message when git learns to translate its
         output.
      
       - Another advantage is that this makes it easier for us to drop "#"
         prefix in "git status" output in later versions of git if we want
         to.
      Explained-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      098d0e0e
    • J
      commit: refer to commit template as s->fp · 3c624a30
      Jonathan Nieder 提交于
      Instead of maintaining a local variable for it, use s->fp to keep
      track of where the commit message template should be written.
      
      This prepares us to take advantage of the status_printf functions,
      which use a struct wt_status instead of a FILE pointer to determine
      where to send their output.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3c624a30
    • J
      wt-status: add helpers for printing wt-status lines · e0335fcd
      Jonathan Nieder 提交于
      Introduce status_printf{,_ln,_more} wrapper functions around
      color_vfprintf() which take care of adding "#" to the beginning of
      status lines automatically.  The semantics:
      
       - status_printf() is just like color_fprintf() but it adds a "# "
         at the beginning of each line of output;
      
       - status_printf_ln() is a convenience function that additionally
         adds "\n" at the end;
      
       - status_printf_more() is a variant of status_printf() used to
         continue lines that have already started.  It suppresses the "#" at
         the beginning of the first line.
      Helped-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e0335fcd
    • J
      compat: fall back on __va_copy if available · 26db0f2e
      Jonathan Nieder 提交于
      Since an obvious implementation of va_list is to make it a pointer
      into the stack frame, implementing va_copy as "dst = src" will work on
      many systems.  Platforms that use something different (e.g., a size-1
      array of structs, to be assigned with *(dst) = *(src)) will need some
      other compatibility macro, though.
      
      Luckily, as the glibc manual hints, such systems tend to provide the
      __va_copy macro (introduced in GCC in March, 1997).  By using that if
      it is available, we can cover our bases pretty well.
      
      Discovered by building with CC="gcc -std=c89" on an amd64 machine:
      
       $ make CC=c89 strbuf.o
       [...]
       strbuf.c: In function 'strbuf_vaddf':
       strbuf.c:211:2: error: incompatible types when assigning to type 'va_list'
        from type 'struct __va_list_tag *'
       make: *** [strbuf.o] Error 1
      Explained-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      26db0f2e
  2. 26 2月, 2011 2 次提交
  3. 23 2月, 2011 2 次提交
  4. 22 2月, 2011 7 次提交
  5. 17 2月, 2011 6 次提交
  6. 16 2月, 2011 10 次提交
  7. 15 2月, 2011 4 次提交
    • R
      configure: use AC_LANG_PROGRAM consistently · 1e58dba1
      Ralf Wildenhues 提交于
      Avoid warnings from Autoconf 2.68 about missing use of AC_LANG_PROGRAM
      and friends.
      
      Quoting autoconf-2.68/NEWS:
      
        ** The macros AC_PREPROC_IFELSE, AC_COMPILE_IFELSE, AC_LINK_IFELSE, and
           AC_RUN_IFELSE now warn if the first argument failed to use
           AC_LANG_SOURCE or AC_LANG_PROGRAM to generate the conftest file
           contents.  A new macro AC_LANG_DEFINES_PROVIDED exists if you have
           a compelling reason why you cannot use AC_LANG_SOURCE but must
           avoid the warning.
      
      The underlying reason for that change is that AC_LANG_{SOURCE,PROGRAM}
      take care to supply the previously computed set of #defines (and
      include standard headers if so desired) for preprocessed languages
      like C and C++.
      
      In some cases, AC_LANG_PROGRAM is already used but not sufficiently
      m4-quoted, so we just need to add another set of [quotes] to prevent
      the autoconf warning from being triggered bogusly.  Quoting all
      arguments (except when calling special macros that need to be expanded
      before recursion) is better style, anyway.  These and more rules are
      described in detail in 'info Autoconf "Programming in M4"'.
      
      No change in the resulting config.mak.autogen after running
      ./configure intended.
      Signed-off-by: NRalf Wildenhues <Ralf.Wildenhues@gmx.de>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1e58dba1
    • J
      string_list_append: always set util pointer to NULL · 62b8102c
      Jeff King 提交于
      It is not immediately obvious that the util field may
      contain random bytes after appending an item. Especially
      since the string_list_insert* functions _do_ explicitly zero
      the util pointer.
      
      This does not appear to be a bug in any current git code, as
      all callers either fill in the util field immediately or
      never use it. However, it is worth it to be less surprising
      to new users of the string-list API who may expect it to be
      intialized to NULL.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      62b8102c
    • J
      correct type of EMPTY_TREE_SHA1_BIN · dab0d410
      Jonathan Nieder 提交于
      Functions such as hashcmp that expect a binary SHA-1 value take
      parameters of type "unsigned char *" to avoid accepting a textual
      SHA-1 passed by mistake.  Unfortunately, this means passing the string
      literal EMPTY_TREE_SHA1_BIN requires an ugly cast.  Tweak the
      definition of EMPTY_TREE_SHA1_BIN to produce a value of more
      convenient type.
      
      In the future the definition might change to
      
      	extern const unsigned char empty_tree_sha1_bin[20];
      	#define EMPTY_TREE_SHA1_BIN empty_tree_sha1_bin
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dab0d410
    • I
      Obey p4 views when using client spec · 3952710b
      Ian Wienand 提交于
      When using the p4 client spec, this attempts to obey the client's
      output preferences.
      
      For example, a view like
      
      //depot/foo/branch/... //client/branch/foo/...
      //depot/bar/branch/... //client/branch/bar/...
      
      will result in a directory layout in the git tree of
      
      branch/
      branch/foo
      branch/bar
      
      p4 can do various other reordering that this change doesn't support,
      but we should detect it and at least fail nicely.
      Signed-off-by: NIan Wienand <ianw@vmware.com>
      Acked-by: NPete Wyckoff <pw@padd.com>
      Acked-by: NTor Arvid Lund <torarvid@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3952710b
  8. 14 2月, 2011 2 次提交