Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Dec 6, 2011
  1. @avar @gitster

    i18n: add infrastructure for translating Git with gettext

    avar authored gitster committed
    Change the skeleton implementation of i18n in Git to one that can show
    localized strings to users for our C, Shell and Perl programs using
    either GNU libintl or the Solaris gettext implementation.
    
    This new internationalization support is enabled by default. If
    gettext isn't available, or if Git is compiled with
    NO_GETTEXT=YesPlease, Git falls back on its current behavior of
    showing interface messages in English. When using the autoconf script
    we'll auto-detect if the gettext libraries are installed and act
    appropriately.
    
    This change is somewhat large because as well as adding a C, Shell and
    Perl i18n interface we're adding a lot of tests for them, and for
    those tests to work we need a skeleton PO file to actually test
    translations. A minimal Icelandic translation is included for this
    purpose. Icelandic includes multi-byte characters which makes it easy
    to test various edge cases, and it's a language I happen to
    understand.
    
    The rest of the commit message goes into detail about various
    sub-parts of this commit.
    
    = Installation
    
    Gettext .mo files will be installed and looked for in the standard
    $(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
    override that, but that's only intended to be used to test Git itself.
    
    = Perl
    
    Perl code that's to be localized should use the new Git::I18n
    module. It imports a __ function into the caller's package by default.
    
    Instead of using the high level Locale::TextDomain interface I've
    opted to use the low-level (equivalent to the C interface)
    Locale::Messages module, which Locale::TextDomain itself uses.
    
    Locale::TextDomain does a lot of redundant work we don't need, and
    some of it would potentially introduce bugs. It tries to set the
    $TEXTDOMAIN based on package of the caller, and has its own
    hardcoded paths where it'll search for messages.
    
    I found it easier just to completely avoid it rather than try to
    circumvent its behavior. In any case, this is an issue wholly
    internal Git::I18N. Its guts can be changed later if that's deemed
    necessary.
    
    See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
    a further elaboration on this topic.
    
    = Shell
    
    Shell code that's to be localized should use the git-sh-i18n
    library. It's basically just a wrapper for the system's gettext.sh.
    
    If gettext.sh isn't available we'll fall back on gettext(1) if it's
    available. The latter is available without the former on Solaris,
    which has its own non-GNU gettext implementation. We also need to
    emulate eval_gettext() there.
    
    If neither are present we'll use a dumb printf(1) fall-through
    wrapper.
    
    = About libcharset.h and langinfo.h
    
    We use libcharset to query the character set of the current locale if
    it's available. I.e. we'll use it instead of nl_langinfo if
    HAVE_LIBCHARSET_H is set.
    
    The GNU gettext manual recommends using langinfo.h's
    nl_langinfo(CODESET) to acquire the current character set, but on
    systems that have libcharset.h's locale_charset() using the latter is
    either saner, or the only option on those systems.
    
    GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
    but MinGW and some others need to use libcharset.h's locale_charset()
    instead.
    
    =Credits
    
    This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
    did the initial Makefile / C work, and a lot of comments from the Git
    mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
    Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
    others.
    
    [jc: squashed a small Makefile fix from Ramsay]
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 6, 2011
  1. @drafnel @gitster

    cleanup: use internal memory allocation wrapper functions everywhere

    drafnel authored gitster committed
    The "x"-prefixed versions of strdup, malloc, etc. will check whether the
    allocation was successful and terminate the process otherwise.
    
    A few uses of malloc were left alone since they already implemented a
    graceful path of failure or were in a quasi external library like xdiff.
    
    Additionally, the call to malloc in compat/win32/syslog.c was not modified
    since the syslog() implemented there is a die handler and a call to the
    x-wrappers within a die handler could result in recursion should memory
    allocation fail.  This will have to be addressed separately.
    
    Signed-off-by: Brandon Casey <drafnel@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 22, 2010
  1. @torvalds @gitster

    slim down "git show-index"

    torvalds authored gitster committed
    As the documentation says, this is primarily for debugging, and
    in the longer term we should rename it to test-show-index or something.
    
    In the meantime, just avoid xmalloc (which slurps in the rest of git), and
    separating out the trivial hex functions into "hex.o".
    
    This results in
    
      [torvalds@nehalem git]$ size git-show-index
           text    data     bss     dec     hex filename
         222818    2276  112688  337782   52776 git-show-index (before)
           5696     624    1264    7584    1da0 git-show-index (after)
    
    which is a whole lot better.
    
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 10, 2009
  1. @jrn @gitster

    Show usage string for 'git show-index -h'

    jrn authored gitster committed
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 6, 2008
  1. @gitster

    Fix some warnings (on cygwin) to allow -Werror

    Ramsay Jones authored gitster committed
    When printing valuds of type uint32_t, we should use PRIu32, and should
    not assume that it is unsigned int.  On 32-bit platforms, it could be
    defined as unsigned long. The same caution applies to ntohl().
    
    Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 21, 2007
  1. @spearce

    Use PRIuMAX instead of 'unsigned long long' in show-index

    spearce authored
    Elsewhere in Git we already use PRIuMAX and cast to uintmax_t when
    we need to display a value that is 'very big' and we're not exactly
    sure what the largest display size is for this platform.
    
    This particular fix is needed so we can do the incredibly crazy
    temporary hack of:
    
        diff --git a/cache.h b/cache.h
        index e0abcd6..6637fd8 100644
        --- a/cache.h
        +++ b/cache.h
        @@ -6,6 +6,7 @@
    
         #include SHA1_HEADER
         #include <zlib.h>
        +#define long long long
    
         #if ZLIB_VERNUM < 0x1200
         #define deflateBound(c,s)  ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)
    
    allowing us to more easily look for locations where we are passing
    a pointer to an 8 byte value to a function that expects a 4 byte
    value.  This can occur on some platforms where sizeof(long) == 8
    and sizeof(size_t) == 4.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Apr 10, 2007
  1. show-index.c: learn about index v2

    Nicolas Pitre authored Junio C Hamano committed
    When index v2 is encountered, the CRC32 of each object is also displayed
    in parenthesis at the end of the line.
    
    Signed-off-by: Nicolas Pitre <nico@cam.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Oct 20, 2006
  1. @hjemli

    Fix typo in show-index.c

    hjemli authored Junio C Hamano committed
    Signed-off-by: Lars Hjemli <hjemli@gmail.com>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jul 6, 2005
  1. Add a "git-show-index" helper that shows the contents of a pack index

    Linus Torvalds authored
    This was invaluable for debugging the zero-sized compression issue, and
    might be useful for scripting too, if people want to see the contents of
    a pack.
Something went wrong with that request. Please try again.