<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/git.git/shell.c, branch v1.8.0.2</title>
<subtitle>Git
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.8.0.2</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.8.0.2'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/'/>
<updated>2011-12-06T04:46:55Z</updated>
<entry>
<title>i18n: add infrastructure for translating Git with gettext</title>
<updated>2011-12-06T04:46:55Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2011-11-17T23:14:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=5e9637c629702e3d41ad01d95956d1835d7338e0'/>
<id>urn:sha1:5e9637c629702e3d41ad01d95956d1835d7338e0</id>
<content type='text'>
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 &lt;AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com&gt; 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 &lt;jepler@unpythonic.net&gt; 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 &lt;avarab@gmail.com&gt;
Signed-off-by: Ramsay Jones &lt;ramsay@ramsay1.demon.co.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>shell: add missing initialization of argv0_path</title>
<updated>2011-05-05T16:32:28Z</updated>
<author>
<name>Dima Sharov</name>
<email>git.avalakvista@gmail.com</email>
</author>
<published>2011-05-05T06:40:17Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=2d9932cf67a886c8f356603b9ffd81832cc1850f'/>
<id>urn:sha1:2d9932cf67a886c8f356603b9ffd81832cc1850f</id>
<content type='text'>
According to c6dfb39 (remote-curl: add missing initialization of
argv0_path, 2009-10-13), stand-alone programs (non-builtins)
must call git_extract_argv0_path(argv[0]) in order to help builds
that derive the installation prefix at runtime. Without this call,
the program segfaults (or raises an assertion failure).

Signed-off-by: Dima Sharov &lt;git.avalakvista@gmail.com&gt;
Acked-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>shell: Display errors from improperly-formatted command lines</title>
<updated>2010-08-27T17:43:59Z</updated>
<author>
<name>Greg Brockman</name>
<email>gdb@MIT.EDU</email>
</author>
<published>2010-08-27T05:36:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=9f29fe9a779e55e7387577cd7f712de0b13b5cd6'/>
<id>urn:sha1:9f29fe9a779e55e7387577cd7f712de0b13b5cd6</id>
<content type='text'>
The interface for split_cmdline has changed such that the caller holds
responsibility for printing any error messages.  This patch changes
the git shell to print these error messages as appropriate.

Signed-off-by: Greg Brockman &lt;gdb@mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>shell: Rewrite documentation and improve error message</title>
<updated>2010-08-24T17:47:21Z</updated>
<author>
<name>Ramkumar Ramachandra</name>
<email>artagnon@gmail.com</email>
</author>
<published>2010-08-24T05:36:51Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=70256a3a6780a9fd181edf0bf0e762eb56637c9c'/>
<id>urn:sha1:70256a3a6780a9fd181edf0bf0e762eb56637c9c</id>
<content type='text'>
Update the documentation of 'git shell' to mention the interactive
mode and COMMAND_DIR. Also provide a hint when interactive mode is not
available in the shell.

Signed-off-by: Ramkumar Ramachandra &lt;artagnon@gmail.com&gt;
Reviewed-by: Greg Brockman &lt;gdb@MIT.EDU&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Add interactive mode to git-shell for user-friendliness</title>
<updated>2010-08-12T22:16:31Z</updated>
<author>
<name>Greg Brockman</name>
<email>gdb@MIT.EDU</email>
</author>
<published>2010-07-28T07:43:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=e69164ddb9d6092a94915bb984749d48f598cea8'/>
<id>urn:sha1:e69164ddb9d6092a94915bb984749d48f598cea8</id>
<content type='text'>
Signed-off-by: Greg Brockman &lt;gdb@mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Allow creation of arbitrary git-shell commands</title>
<updated>2010-08-12T22:16:15Z</updated>
<author>
<name>Greg Brockman</name>
<email>gdb@MIT.EDU</email>
</author>
<published>2010-07-29T00:31:01Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=2dbc887eaa6fbd787edfc9472b86b0faeb54e2ae'/>
<id>urn:sha1:2dbc887eaa6fbd787edfc9472b86b0faeb54e2ae</id>
<content type='text'>
This provides a mechanism for the server to expose custom
functionality to clients.  My particular use case is that I would like
a way of discovering all repositories available for cloning.  A
client that clones via

  git clone user@example.com

can invoke a command by

  ssh user@example.com $command

Signed-off-by: Greg Brockman &lt;gdb@mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Convert existing die(..., strerror(errno)) to die_errno()</title>
<updated>2009-06-27T18:14:53Z</updated>
<author>
<name>Thomas Rast</name>
<email>trast@student.ethz.ch</email>
</author>
<published>2009-06-27T15:58:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=d824cbba02a4061400a0e382f9bd241fbbff34f0'/>
<id>urn:sha1:d824cbba02a4061400a0e382f9bd241fbbff34f0</id>
<content type='text'>
Change calls to die(..., strerror(errno)) to use the new die_errno().

In the process, also make slight style adjustments: at least state
_something_ about the function that failed (instead of just printing
the pathname), and put paths in single quotes.

Signed-off-by: Thomas Rast &lt;trast@student.ethz.ch&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-shell: Add 'git-upload-archive' to allowed commands.</title>
<updated>2009-04-11T18:01:15Z</updated>
<author>
<name>Erik Broes</name>
<email>erikbroes@ripe.net</email>
</author>
<published>2009-04-09T19:58:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=79f72b97633d1699f131e798bb9833339ba22f6a'/>
<id>urn:sha1:79f72b97633d1699f131e798bb9833339ba22f6a</id>
<content type='text'>
This allows for example gitosis to allow use of 'git archive --remote' in a
controlled environment.

Signed-off-by: Erik Broes &lt;erikbroes@ripe.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'maint'</title>
<updated>2008-08-29T07:16:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2008-08-29T07:16:39Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=445cac18c015809a7fcb4a570d3c6571b1ddaf7d'/>
<id>urn:sha1:445cac18c015809a7fcb4a570d3c6571b1ddaf7d</id>
<content type='text'>
* maint:
  tutorial: gentler illustration of Alice/Bob workflow using gitk
  pretty=format: respect date format options
  make git-shell paranoid about closed stdin/stdout/stderr
  Document gitk --argscmd flag.
  Fix '--dirstat' with cross-directory renaming
  for-each-ref: Allow a trailing slash in the patterns
</content>
</entry>
<entry>
<title>make git-shell paranoid about closed stdin/stdout/stderr</title>
<updated>2008-08-29T07:14:29Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>bonzini@gnu.org</email>
</author>
<published>2008-08-27T15:20:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=0cfeed2e1d320cc76c434e0bfc26d90065754e46'/>
<id>urn:sha1:0cfeed2e1d320cc76c434e0bfc26d90065754e46</id>
<content type='text'>
It is in general unsafe to start a program with one or more of file
descriptors 0/1/2 closed.  Karl Chen for example noticed that stat_command
does this in order to rename a pipe file descriptor to 0:

    dup2(from, 0);
    close(from);

... but if stdin was closed (for example) from == 0, so that

    dup2(0, 0);
    close(0);

just ends up closing the pipe.  Another extremely rare but nasty problem
would occur if an "important" file ends up in file descriptor 2, and is
corrupted by a call to die().

Fixing this in git was considered to be overkill, so this patch works
around it only for git-shell.  The fix is simply to open all the "low"
descriptors to /dev/null in main.

Signed-off-by: Paolo Bonzini &lt;bonzini@gnu.org&gt;
Acked-by: Stephen R. van den Berg &lt;srb@cuci.nl&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
