gitweb.git
Merge branch 'ms/ls-remote-exit-with-status'Junio C Hamano Mon, 23 May 2011 17:27:08 +0000 (10:27 -0700)

Merge branch 'ms/ls-remote-exit-with-status'

* ms/ls-remote-exit-with-status:
ls-remote: the --exit-code option reports "no matching refs"

Merge branch 'mg/config-symbolic-constants'Junio C Hamano Mon, 23 May 2011 16:59:05 +0000 (09:59 -0700)

Merge branch 'mg/config-symbolic-constants'

* mg/config-symbolic-constants:
config: Give error message when not changing a multivar
config: define and document exit codes

Merge branch 'ab/i18n-scripts-basic'Junio C Hamano Mon, 23 May 2011 16:58:45 +0000 (09:58 -0700)

Merge branch 'ab/i18n-scripts-basic'

* ab/i18n-scripts-basic:
Makefile: add xgettext target for *.sh files
git-sh-i18n.sh: add GIT_GETTEXT_POISON support
git-sh-i18n.sh: add no-op gettext() and eval_gettext() wrappers
git-sh-i18n--envsubst: our own envsubst(1) for eval_gettext()

Merge branch 'jc/magic-pathspec'Junio C Hamano Mon, 23 May 2011 16:58:35 +0000 (09:58 -0700)

Merge branch 'jc/magic-pathspec'

* jc/magic-pathspec:
setup.c: Fix some "symbol not declared" sparse warnings
t3703: Skip tests using directory name ":" on Windows
revision.c: leave a note for "a lone :" enhancement
t3703, t4208: add test cases for magic pathspec
rev/path disambiguation: further restrict "misspelled index entry" diag
fix overslow :/no-such-string-ever-existed diagnostics
fix overstrict :<path> diagnosis
grep: use get_pathspec() correctly
pathspec: drop "lone : means no pathspec" from get_pathspec()
Revert "magic pathspec: add ":(icase)path" to match case insensitively"
magic pathspec: add ":(icase)path" to match case insensitively
magic pathspec: futureproof shorthand form
magic pathspec: add tentative ":/path/from/top/level" pathspec support

Merge branch 'jk/blame-line-porcelain'Junio C Hamano Mon, 23 May 2011 16:58:31 +0000 (09:58 -0700)

Merge branch 'jk/blame-line-porcelain'

* jk/blame-line-porcelain:
blame: add --line-porcelain output format
blame: refactor porcelain output
add tests for various blame formats

tests: make test_expect_code quieter on successJonathan Nieder Sat, 21 May 2011 19:40:32 +0000 (14:40 -0500)

tests: make test_expect_code quieter on success

A command exiting with the expected status is not particularly
notable.

While the indication of progress might be useful when tracking down
where in a test a failure has happened, the same applies to most other
test helpers, which are quiet about success, so this single helper's
output stands out in an unpleasant way. An alternative method for
showing progress information might to invent a --progress option that
runs tests with "set -x", or until that is available, to run tests
using commands like

prove -v -j2 --shuffle --exec='sh -x' t2202-add-addremove.sh

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

userdiff/perl: catch sub with brace on second lineJonathan Nieder Sat, 21 May 2011 19:38:26 +0000 (14:38 -0500)

userdiff/perl: catch sub with brace on second line

Accept

sub foo
{
}

as an alternative to a more common style that introduces perl
functions with a brace on the first line (and likewise for BEGIN/END
blocks). The new regex is a little hairy to avoid matching

# forward declaration
sub foo;

while continuing to match "sub foo($;@) {" and

sub foo { # This routine is interesting;
# in fact, the lines below explain how...

While at it, pay attention to Perl 5.14's "package foo {" syntax as an
alternative to the traditional "package foo;".

Requested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

userdiff/perl: match full line of POD headersJonathan Nieder Sat, 21 May 2011 19:35:51 +0000 (14:35 -0500)

userdiff/perl: match full line of POD headers

The builtin perl userdiff driver is not greedy enough about catching
POD header lines. Capture the whole line, so instead of just
declaring that we are in some "@@ =head1" section, diff/grep output
can explain that the enclosing section is about "@@ =head1 OPTIONS".

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

userdiff/perl: anchor "sub" and "package" patterns... Jonathan Nieder Sat, 21 May 2011 19:29:01 +0000 (14:29 -0500)

userdiff/perl: anchor "sub" and "package" patterns on the left

The userdiff funcname mechanism has no concept of nested scopes ---
instead, "git diff" and "git grep --show-function" simply label the
diff header with the most recent matching line. Unfortunately that
means text following a subroutine in a POD section:

=head1 DESCRIPTION

You might use this facility like so:

sub example {
foo;
}

Now, having said that, let's say more about the facility.
Blah blah blah ... etc etc.

gets the subroutine name instead of the POD header in its diff/grep
funcname header, making it harder to get oriented when reading a
diff without enough context.

The fix is simple: anchor the funcname syntax to the left margin so
nested subroutines and packages like this won't get picked up. (The
builtin C++ funcname pattern already does the same thing.) This means
the userdiff driver will misparse the idiom

{
my $static;
sub foo {
... use $static ...
}
}

but I think that's worth it; we can revisit this later if the userdiff
mechanism learns to keep track of the beginning and end of nested
scopes.

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4018 (funcname patterns): minor cleanupsJonathan Nieder Sat, 21 May 2011 19:25:14 +0000 (14:25 -0500)

t4018 (funcname patterns): minor cleanups

Introduce a test_expect_funcname function to make a diff and apply a
regexp anchored on the left to the function name it writes, avoiding
some repetition.

Omit the space after >, <<, and < operators for consistency with
other scripts. Quote the <<here document delimiter and $ signs in
quotes so readers don't have to worry about the effect of shell
metacharacters.

Remove some unnecessary blank lines.

Run "git diff" as a separate command instead of as upstream of a pipe
that checks its output, so the exit status can be tested. In
particular, this way if "git diff" starts segfaulting the test harness
will notice.

Allow "error:" as a synonym for "fatal:" when checking error messages,
since whether a command uses die() or "return error()" is a small
implementation detail.

Anchor some more regexes on the right.

None of the above is very important on its own; the point is just to
make the script a little easier to read and the code less scary to
modify.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4018 (funcname patterns): make configuration easier... Jonathan Nieder Sat, 21 May 2011 19:22:28 +0000 (14:22 -0500)

t4018 (funcname patterns): make configuration easier to track

Introduce a "test_config" function to set a configuration variable
for use by a single test (automatically unsetting it when the
assertion finishes). If this function is used consistently, the
configuration used in a test_expect_success block can be read at the
beginning of that block instead of requiring reading all the tests
that come before. So it becomes a little easier to add new tests or
rearrange existing ones without fear of breaking configuration.

In particular, the test of alternation in xfuncname patterns also
checks that xfuncname takes precedence over funcname variable as a
sort of side-effect, since the latter leaks in from previous tests.
In the new syntax, the test has to say explicitly what variables it is
using, making the test clearer and a future regression in coverage
from carelessly editing the script less likely.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4018 (funcname patterns): make .gitattributes state... Jonathan Nieder Sat, 21 May 2011 19:11:33 +0000 (14:11 -0500)

t4018 (funcname patterns): make .gitattributes state easier to track

Most, but not all, tests in this script rely on attributes declaring
that files with a .java extension should use the "java" driver:

*.java diff=java

Split out a "set up" test to put such a .gitattributes in place after
the tests that do not want it have run, to make it more likely that
individual tests other than this setup test can be safely modified,
rearranged, or skipped. Presumably this setup code will learn to
request other drivers for other extensions in the same place when the
test suite learns to exercise other diff drivers.

Similarly, make sure that early test assertions that do not use these
default attributes set up .gitattributes appropriately for themselves,
so tests that run before can be modified with less risk of breaking
something.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Sat, 21 May 2011 01:50:29 +0000 (18:50 -0700)

Merge branch 'maint'

* maint:
git-svn: Fix git svn log --show-commit

do not read beyond end of malloc'd bufferJim Meyering Fri, 20 May 2011 17:20:12 +0000 (19:20 +0200)

do not read beyond end of malloc'd buffer

With diff.suppress-blank-empty=true, "git diff --word-diff" would
output data that had been read from uninitialized heap memory.
The problem was that fn_out_consume did not account for the
possibility of a line with length 1, i.e., the empty context line
that diff.suppress-blank-empty=true converts from " \n" to "\n".
Since it assumed there would always be a prefix character (the space),
it decremented "len" unconditionally, thus passing len=0 to emit_line,
which would then blindly call emit_line_0 with len=-1 which would
pass that value on to fwrite as SIZE_MAX. Boom.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-svn: Fix git svn log --show-commitMichael J Gruber Fri, 20 May 2011 11:16:34 +0000 (13:16 +0200)

git-svn: Fix git svn log --show-commit

git svn log --show-commit had no tests and, consequently, no attention
by the author of

b1b4755 (git-log: put space after commit mark, 2011-03-10)

who kept git svn log working only without --show-commit.

Introduce a test and fix it.

Reported-by: Bernt Hansen <bernt@norang.ca>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 1.7.6Junio C Hamano Fri, 20 May 2011 03:50:07 +0000 (20:50 -0700)

Update draft release notes to 1.7.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jc/maint-1.7.4-pathspec-stdin-and-cmdline'Junio C Hamano Fri, 20 May 2011 04:02:14 +0000 (21:02 -0700)

Merge branch 'jc/maint-1.7.4-pathspec-stdin-and-cmdline'

* jc/maint-1.7.4-pathspec-stdin-and-cmdline:

Merge branch 'rg/copy-gecos-username'Junio C Hamano Fri, 20 May 2011 03:37:21 +0000 (20:37 -0700)

Merge branch 'rg/copy-gecos-username'

* rg/copy-gecos-username:
copy_gecos: fix not adding nlen to len when processing "&"

Merge branch 'jl/submodule-conflicted-gitmodules'Junio C Hamano Fri, 20 May 2011 03:37:21 +0000 (20:37 -0700)

Merge branch 'jl/submodule-conflicted-gitmodules'

* jl/submodule-conflicted-gitmodules:
Submodules: Don't parse .gitmodules when it contains, merge conflicts
test that git status works with merge conflict in, .gitmodules

Merge branch 'jc/replacing'Junio C Hamano Fri, 20 May 2011 03:37:21 +0000 (20:37 -0700)

Merge branch 'jc/replacing'

* jc/replacing:
read_sha1_file(): allow selective bypassing of replacement mechanism
inline lookup_replace_object() calls
read_sha1_file(): get rid of read_sha1_file_repl() madness
t6050: make sure we test not just commit replacement
Declare lookup_replace_object() in cache.h, not in commit.h

Conflicts:
environment.c

Merge branch 'nd/sparse-co-fix'Junio C Hamano Fri, 20 May 2011 03:37:21 +0000 (20:37 -0700)

Merge branch 'nd/sparse-co-fix'

* nd/sparse-co-fix:
sparse checkout: do not eagerly decide the fate for whole directory
t1011: fix sparse-checkout initialization and add new file

Merge branch 'ld/p4-preserve-user-names'Junio C Hamano Fri, 20 May 2011 03:37:20 +0000 (20:37 -0700)

Merge branch 'ld/p4-preserve-user-names'

* ld/p4-preserve-user-names:
git-p4: warn if git authorship won't be retained
git-p4: small improvements to user-preservation
git-p4: add option to preserve user names

Merge branch 'ms/tagname-does-not-begin-with-dash'Junio C Hamano Fri, 20 May 2011 03:37:20 +0000 (20:37 -0700)

Merge branch 'ms/tagname-does-not-begin-with-dash'

* ms/tagname-does-not-begin-with-dash:
tag: disallow '-' as tag name

Merge branch 'jk/git-connection-deadlock-fix'Junio C Hamano Fri, 20 May 2011 03:37:20 +0000 (20:37 -0700)

Merge branch 'jk/git-connection-deadlock-fix'

* jk/git-connection-deadlock-fix:
test core.gitproxy configuration
send-pack: avoid deadlock on git:// push with failed pack-objects
connect: let callers know if connection is a socket
connect: treat generic proxy processes like ssh processes

Conflicts:
connect.c

Merge branch 'js/maint-send-pack-stateless-rpc-deadlock... Junio C Hamano Fri, 20 May 2011 03:37:19 +0000 (20:37 -0700)

Merge branch 'js/maint-send-pack-stateless-rpc-deadlock-fix'

* js/maint-send-pack-stateless-rpc-deadlock-fix:
sideband_demux(): fix decl-after-stmt

Merge branch 'jk/cherry-pick-root-with-resolve'Junio C Hamano Fri, 20 May 2011 03:37:19 +0000 (20:37 -0700)

Merge branch 'jk/cherry-pick-root-with-resolve'

* jk/cherry-pick-root-with-resolve:
t3503: test cherry picking and reverting root commits
revert: allow reverting a root commit
cherry-pick: handle root commits with external strategies

Merge branch 'jc/maint-pathspec-stdin-and-cmdline'Junio C Hamano Fri, 20 May 2011 03:37:18 +0000 (20:37 -0700)

Merge branch 'jc/maint-pathspec-stdin-and-cmdline'

* jc/maint-pathspec-stdin-and-cmdline:
setup_revisions(): take pathspec from command line and --stdin correctly

Conflicts:
revision.c

Merge 1.7.5.2 inJunio C Hamano Fri, 20 May 2011 03:37:08 +0000 (20:37 -0700)

Merge 1.7.5.2 in

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Revert "Merge branch 'en/merge-recursive'"Junio C Hamano Fri, 20 May 2011 03:17:44 +0000 (20:17 -0700)

Revert "Merge branch 'en/merge-recursive'"

As the band-aid to merge-recursive seems to regress complex merges in an
unpleasant way. The merge-recursive implementation needs to be rewritten
in such a way that it resolves renames and D/F conflicts entirely in-core
and not to touch working tree at all while doing so. But in the meantime,
this reverts commit ac9666f84 that merged the topic in its entirety.

Git 1.7.5.2 v1.7.5.2Junio C Hamano Fri, 20 May 2011 03:30:44 +0000 (20:30 -0700)

Git 1.7.5.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>

receive-pack: eliminate duplicate .have refsJeff King Thu, 19 May 2011 21:34:46 +0000 (17:34 -0400)

receive-pack: eliminate duplicate .have refs

When receiving a push, we advertise ref tips from any
alternate repositories, in case that helps the client send a
smaller pack. Since these refs don't actually exist in the
destination repository, we don't transmit the real ref
names, but instead use the pseudo-ref ".have".

If your alternate has a large number of duplicate refs (for
example, because it is aggregating objects from many related
repositories, some of which will have the same tags and
branch tips), then we will send each ".have $sha1" line
multiple times. This is a pointless waste of bandwidth, as
we are simply repeating the same fact to the client over and
over.

This patch eliminates duplicate .have refs early on. It does
so efficiently by sorting the complete list and skipping
duplicates. This has the side effect of re-ordering the
.have lines by ascending sha1; this isn't a problem, though,
as the original order was meaningless.

There is a similar .have system in fetch-pack, but it
does not suffer from the same problem. For each alternate
ref we consider in fetch-pack, we actually open the object
and mark it with the SEEN flag, so duplicates are
automatically culled.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bisect: refactor sha1_array into a generic sha1 listJeff King Thu, 19 May 2011 21:34:33 +0000 (17:34 -0400)

bisect: refactor sha1_array into a generic sha1 list

This is a generally useful abstraction, so let's let others
make use of it. The refactoring is more or less a straight
copy; however, functions and struct members have had their
names changed to match string_list, which is the most
similar data structure.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refactor refs_from_alternate_cb to allow passing extra... Jeff King Thu, 19 May 2011 21:33:17 +0000 (17:33 -0400)

refactor refs_from_alternate_cb to allow passing extra data

The foreach_alt_odb function triggers a callback for each
alternate object db we have, with room for a single void
pointer as data. Currently, we always call refs_from_alternate_cb
as the callback function, and then pass another callback (to
receive each ref individually) as the void pointer.

This has two problems:

1. C technically forbids stuffing a function pointer into
a "void *". In practice, this probably doesn't matter
on any architectures git runs on, but it never hurts to
follow the letter of the law.

2. There is no room for an extra data pointer. Indeed, the
alternate_ref_fn that refs_from_alternate_cb calls
takes a void* for data, but we always pass it NULL.

Instead, let's properly stuff our function pointer into a
data struct, which also leaves room for an extra
caller-supplied data pointer. And to keep things simple for
existing callers, let's make a for_each_alternate_ref
function that takes care of creating the extra struct.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: sort TEST_PROGRAMS listJeff King Thu, 19 May 2011 21:24:24 +0000 (17:24 -0400)

Makefile: sort TEST_PROGRAMS list

We usually keep these lists in sorted order, but the last
few entries were just tacked on the end.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fetch: avoid repeated commits in mark_completeJeff King Thu, 19 May 2011 20:48:51 +0000 (16:48 -0400)

fetch: avoid repeated commits in mark_complete

We add every local ref to a list so that we can mark them
and all of their ancestors back to a certain cutoff point.
However, if some refs point to the same commit, we will end
up adding them to the list many times.

Furthermore, since commit_lists are stored as linked lists,
we must do an O(n) traversal of the list in order to find
the right place to insert each commit. This makes building
the list O(n^2) in the number of refs.

For normal repositories, this isn't a big deal. We have a
few hundreds refs at most, and most of them are unique. But
consider an "alternates" repo that serves as an object
database for many other similar repos. For reachability, it
needs to keep a copy of the refs in each child repo. This
means it may have a large number of refs, many of which
point to the same commits.

By noting commits we have already added to the list, we can
shrink the size of "n" in such a repo to the number of
unique commits, which is on the order of what a normal repo
would contain (it's actually more than a normal repo, since child repos
may have branches at different states, but in practice it tends
to be much smaller than the list with duplicates).

Here are the results on one particular giant repo
(containing objects for all Rails forks on GitHub):

$ git for-each-ref | wc -l
112514

[before]
$ git fetch --no-tags ../remote.git
63.52user 0.12system 1:03.68elapsed 99%CPU (0avgtext+0avgdata 137648maxresident)k
1856inputs+48outputs (11major+19603minor)pagefaults 0swaps

$ git fetch --no-tags ../remote.git
6.15user 0.08system 0:06.25elapsed 99%CPU (0avgtext+0avgdata 123856maxresident)k
0inputs+40outputs (0major+18872minor)pagefaults 0swaps

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ident: add NO_GECOS_IN_PWENT for systems without pw_gec... Rafael Gieschke Thu, 19 May 2011 11:37:55 +0000 (13:37 +0200)

ident: add NO_GECOS_IN_PWENT for systems without pw_gecos in struct passwd

Allow NO_GECOS_IN_PWENT to be defined in the Makefile for platforms that
lack the pw_gecos field in their "struct passwd", in which case the
uppercased user name is used instead via the standard '&' replacement
mechanism.

Signed-off-by: Rafael Gieschke <rafael@gieschke.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

provide a copy of the LGPLv2.1Jonathan Nieder Thu, 19 May 2011 15:14:25 +0000 (10:14 -0500)

provide a copy of the LGPLv2.1

The LGPL seems to require providing a copy of the license when
distributing xdiff, compat/fnmatch, and so on, or altering the license
notices to refer to the GPL intead. Since we don't want to do the
latter, let's do the former. It's nice to let people know their
rights anyway.

Inspired-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

show: --ignore-missingJunio C Hamano Thu, 19 May 2011 01:08:09 +0000 (18:08 -0700)

show: --ignore-missing

Instead of barfing, simply ignore bad object names seen in the
input. This is useful when reading from "git notes list" output
that may refer to objects that have already been garbage collected.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

notes remove: --stdin reads from the standard inputJunio C Hamano Wed, 18 May 2011 23:44:30 +0000 (16:44 -0700)

notes remove: --stdin reads from the standard input

Teach the command to read object names to remove from the standard
input, in addition to the object names given from the command line.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

notes remove: --ignore-missingJunio C Hamano Wed, 18 May 2011 23:02:58 +0000 (16:02 -0700)

notes remove: --ignore-missing

Depending on the application, it is not necessarily an error for an object
to lack a note, especially if the only thing the caller wants to make sure
is that notes are cleared for an object. By passing this option from the
command line, the "git notes remove" command considers it a success if the
object did not have any note to begin with.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

notes remove: allow removing more than oneJunio C Hamano Wed, 18 May 2011 22:44:37 +0000 (15:44 -0700)

notes remove: allow removing more than one

While "xargs -n1 git notes rm" is certainly a possible way to remove notes
from many objects, this would create one notes "commit" per removal, which
is not quite suitable for seasonal housekeeping.

Allow taking more than one on the command line, and record their removal
as a single atomic event if everthing goes well.

Even though the old code insisted that "git notes rm" must be given only
one object (or zero, in which case it would default to HEAD), this
condition was not tested. Add tests to handle the new case where we feed
multiple objects, and also make sure if there is a bad input, no change
is recorded.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

ls-remote: the --exit-code option reports "no matching... Michael Schubert Wed, 18 May 2011 20:06:00 +0000 (22:06 +0200)

ls-remote: the --exit-code option reports "no matching refs"

The "git ls-remote" uses its exit status to indicate if it successfully
talked with the remote repository. A new option "--exit-code" makes the
command exit with status "2" when there is no refs to be listed, even when
the command successfully talked with the remote repository.

This way, the caller can tell if we failed to contact the remote, or the
remote did not have what we wanted to see. Of course, you can inspect the
output from the command, which has been and will continue to be a valid
way to check the same thing.

Signed-off-by: Michael Schubert <mschub@elegosoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Windows: add a wrapper for the shutdown() system callJohannes Sixt Wed, 18 May 2011 20:24:37 +0000 (22:24 +0200)

Windows: add a wrapper for the shutdown() system call

Even though Windows's socket functions look like their POSIX counter parts,
they do not operate on file descriptors, but on "socket objects". To bring
the functions in line with POSIX, we have proxy functions that wrap and
unwrap the socket objects in file descriptors using open_osfhandle and
get_osfhandle. But shutdown() was not proxied, yet. Fix this.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test core.gitproxy configurationJeff King Wed, 18 May 2011 08:57:44 +0000 (04:57 -0400)

test core.gitproxy configuration

This is just a basic sanity test to see whether
core.gitproxy works at all. Until now, we were not testing
anywhere.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add log.abbrevCommit config variableJay Soffian Wed, 18 May 2011 17:56:04 +0000 (13:56 -0400)

Add log.abbrevCommit config variable

Add log.abbrevCommit config variable as a convenience for users who
often use --abbrev-commit with git log and friends. Allow the option
to be overridden with --no-abbrev-commit. Per 635530a2fc and 4f62c2bc57,
the config variable is ignored when log is given "--pretty=raw".

(Also, a drive-by spelling correction in git log's short help.)

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

"git log -h": typofix misspelled 'suppress'Jay Soffian Wed, 18 May 2011 17:56:04 +0000 (13:56 -0400)

"git log -h": typofix misspelled 'suppress'

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

copy_gecos: fix not adding nlen to len when processing "&"Rafael Gieschke Mon, 16 May 2011 20:08:21 +0000 (22:08 +0200)

copy_gecos: fix not adding nlen to len when processing "&"

nlen has to be added to len when inserting (capitalized) pw_name as
substitution for "&" in pw_gecos. Otherwise, pw_gecos will be truncated
and data might be written beyond name+sz.

Signed-off-by: Rafael Gieschke <rafael@gieschke.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

setup.c: Fix some "symbol not declared" sparse warningsRamsay Jones Tue, 17 May 2011 17:43:10 +0000 (18:43 +0100)

setup.c: Fix some "symbol not declared" sparse warnings

In particular, sparse issues the "symbol 'a_symbol' was not declared.
Should it be static?" warnings for the following symbols:

setup.c:159:3: 'pathspec_magic'
setup.c:176:12: 'prefix_pathspec'

These symbols only require file scope, so we add the static modifier
to their declarations.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: Give error message when not changing a multivarMichael J Gruber Tue, 17 May 2011 15:38:53 +0000 (17:38 +0200)

config: Give error message when not changing a multivar

When trying to set a multivar with "git config var value", "git config"
issues

warning: remote.repoor.push has multiple values

leaving the user under the impression that the operation succeeded,
unless one checks the return value.

Instead, make it

warning: remote.repoor.push has multiple values
error: cannot overwrite multiple values with a single value
Use a regexp, --add or --set-all to change remote.repoor.push.

to be clear and helpful.

Note: The "warning" is raised through other code paths also so that it
needs to remain a warning for these (which do not raise the error). Only
the caller can determine how to go on from that.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: define and document exit codesMichael J Gruber Tue, 17 May 2011 15:38:52 +0000 (17:38 +0200)

config: define and document exit codes

The return codes of git_config_set() and friends are magic numbers right
in the source. #define them in cache.h where the functions are declared,
and use the constants in the source.

Also, mention the resulting exit codes of "git config" in its man page
(and complete the list).

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add -i: ignore terminal escape sequencesThomas Rast Tue, 17 May 2011 15:19:08 +0000 (17:19 +0200)

add -i: ignore terminal escape sequences

On the author's terminal, the up-arrow input sequence is ^[[A, and
thus fat-fingering an up-arrow into 'git checkout -p' is quite
dangerous: git-add--interactive.perl will ignore the ^[ and [
characters and happily treat A as "discard everything".

As a band-aid fix, use Term::Cap to get all terminal capabilities.
Then use the heuristic that any capability value that starts with ^[
(i.e., \e in perl) must be a key input sequence. Finally, given an
input that starts with ^[, read more characters until we have read a
full escape sequence, then return that to the caller. We use a
timeout of 0.5 seconds on the subsequent reads to avoid getting stuck
if the user actually input a lone ^[.

Since none of the currently recognized keys start with ^[, the net
result is that the sequence as a whole will be ignored and the help
displayed.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update release notes to 1.7.6Junio C Hamano Mon, 16 May 2011 23:58:35 +0000 (16:58 -0700)

Update release notes to 1.7.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'js/maint-1.6.6-send-pack-stateless-rpc... Junio C Hamano Tue, 17 May 2011 00:01:03 +0000 (17:01 -0700)

Merge branch 'js/maint-1.6.6-send-pack-stateless-rpc-deadlock-fix' into js/maint-send-pack-stateless-rpc-deadlock-fix

* js/maint-1.6.6-send-pack-stateless-rpc-deadlock-fix:
sideband_demux(): fix decl-after-stmt

Merge branch 'jc/convert'Junio C Hamano Mon, 16 May 2011 23:47:16 +0000 (16:47 -0700)

Merge branch 'jc/convert'

* jc/convert:
convert: make it harder to screw up adding a conversion attribute
convert: make it safer to add conversion attributes
convert: give saner names to crlf/eol variables, types and functions
convert: rename the "eol" global variable to "core_eol"

Merge branch 'ci/commit--interactive-atomic'Junio C Hamano Mon, 16 May 2011 23:47:10 +0000 (16:47 -0700)

Merge branch 'ci/commit--interactive-atomic'

* ci/commit--interactive-atomic:
Test atomic git-commit --interactive
Add commit to list of config.singlekey commands
Add support for -p/--patch to git-commit
Allow git commit --interactive with paths
t7501.8: feed a meaningful command
Use a temporary index for git commit --interactive

Merge branch 'sg/completion-updates'Junio C Hamano Mon, 16 May 2011 23:47:00 +0000 (16:47 -0700)

Merge branch 'sg/completion-updates'

* sg/completion-updates:
Revert "completion: don't declare 'local words' to make zsh happy"
git-completion: fix regression in zsh support
completion: move private shopt shim for zsh to __git_ namespace
completion: don't declare 'local words' to make zsh happy

Merge branch 'kk/maint-prefix-in-config-mak'Junio C Hamano Mon, 16 May 2011 23:46:53 +0000 (16:46 -0700)

Merge branch 'kk/maint-prefix-in-config-mak'

* kk/maint-prefix-in-config-mak:
Honor $(prefix) set in config.mak* when defining ETC_GIT*
Revert "Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir"
Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir

Merge branch 'mg/merge-ff-config'Junio C Hamano Mon, 16 May 2011 23:46:23 +0000 (16:46 -0700)

Merge branch 'mg/merge-ff-config'

* mg/merge-ff-config:
tests: check git does not barf on merge.ff values for future versions of git
merge: introduce merge.ff configuration variable

Conflicts:
t/t7600-merge.sh

Merge branch 'maint'Junio C Hamano Mon, 16 May 2011 23:44:57 +0000 (16:44 -0700)

Merge branch 'maint'

* maint:
Update draft release notes to 1.7.5.2
Documentation/git-fsck.txt: fix typo: unreadable -> unreachable

Update draft release notes to 1.7.5.2Junio C Hamano Mon, 16 May 2011 23:44:50 +0000 (16:44 -0700)

Update draft release notes to 1.7.5.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jn/maint-format-patch-doc' into maintJunio C Hamano Mon, 16 May 2011 23:39:09 +0000 (16:39 -0700)

Merge branch 'jn/maint-format-patch-doc' into maint

* jn/maint-format-patch-doc:
Documentation: describe the format of messages with inline patches

Merge branch 'ss/cherry-pick-x-doc' into maintJunio C Hamano Mon, 16 May 2011 23:38:56 +0000 (16:38 -0700)

Merge branch 'ss/cherry-pick-x-doc' into maint

* ss/cherry-pick-x-doc:
doc: Clarify that "cherry-pick -x" does not use "git notes"

Merge branch 'vr/merge-base-doc' into maintJunio C Hamano Mon, 16 May 2011 23:38:46 +0000 (16:38 -0700)

Merge branch 'vr/merge-base-doc' into maint

* vr/merge-base-doc:
Restructure documentation for git-merge-base.
Documentation: update to git-merge-base --octopus

Merge branch 'sr/maint-fast-import-tighten-option-parsi... Junio C Hamano Mon, 16 May 2011 23:38:16 +0000 (16:38 -0700)

Merge branch 'sr/maint-fast-import-tighten-option-parsing' into maint

* sr/maint-fast-import-tighten-option-parsing:
fast-import: fix option parser for no-arg options

Merge branch 'jc/t1506-shell-param-expansion-gotcha... Junio C Hamano Mon, 16 May 2011 23:37:54 +0000 (16:37 -0700)

Merge branch 'jc/t1506-shell-param-expansion-gotcha' into maint

* jc/t1506-shell-param-expansion-gotcha:
t1507: avoid "${parameter<op>'word'}" inside double-quotes

Merge branch 'jc/fix-add-u-unmerged' into maintJunio C Hamano Mon, 16 May 2011 23:37:33 +0000 (16:37 -0700)

Merge branch 'jc/fix-add-u-unmerged' into maint

* jc/fix-add-u-unmerged:
Fix "add -u" that sometimes fails to resolve unmerged paths

Conflicts:
builtin/add.c

Merge branch 'jn/gitweb-dependency' into maintJunio C Hamano Mon, 16 May 2011 23:37:12 +0000 (16:37 -0700)

Merge branch 'jn/gitweb-dependency' into maint

* jn/gitweb-dependency:
Remove gitweb/gitweb.cgi and other legacy targets from main Makefile
git-instaweb: Simplify build dependency on gitweb

Merge branch 'jc/maint-branch-mergeoptions' into maintJunio C Hamano Mon, 16 May 2011 23:37:07 +0000 (16:37 -0700)

Merge branch 'jc/maint-branch-mergeoptions' into maint

* jc/maint-branch-mergeoptions:
merge: make branch.<name>.mergeoptions correctly override merge.<option>

Conflicts:
builtin/merge.c

Merge branch 'jc/maint-add-p-overlapping-hunks' into... Junio C Hamano Mon, 16 May 2011 23:36:46 +0000 (16:36 -0700)

Merge branch 'jc/maint-add-p-overlapping-hunks' into maint

* jc/maint-add-p-overlapping-hunks:
t3701: add-p-fix makes the last test to pass
"add -p": work-around an old laziness that does not coalesce hunks
add--interactive.perl: factor out repeated --recount option
t3701: Editing a split hunk in an "add -p" session
add -p: 'q' should really quit

Documentation/git-fsck.txt: fix typo: unreadable -... Jim Meyering Mon, 16 May 2011 18:23:35 +0000 (20:23 +0200)

Documentation/git-fsck.txt: fix typo: unreadable -> unreachable

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

send-pack: avoid deadlock on git:// push with failed... Jeff King Mon, 16 May 2011 06:52:57 +0000 (02:52 -0400)

send-pack: avoid deadlock on git:// push with failed pack-objects

Commit 09c9957c fixes a deadlock in which pack-objects
fails, the remote end is still waiting for pack data, and we
are still waiting for the remote end to say something (see
that commit for a much more in-depth explanation).

We solved the problem there by making sure the output pipe
is closed on error; thus the remote sees EOF, and proceeds
to complain and close its end of the connection.

However, in the special case of push over git://, we don't
have a pipe, but rather a full-duplex socket, with another
dup()-ed descriptor in place of the second half of the pipe.
In this case, closing the second descriptor signals nothing
to the remote end, and we still deadlock.

This patch calls shutdown() explicitly to signal EOF to the
other side.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

connect: let callers know if connection is a socketJeff King Mon, 16 May 2011 06:52:11 +0000 (02:52 -0400)

connect: let callers know if connection is a socket

They might care because they want to do a half-duplex close.
With pipes, that means simply closing the output descriptor;
with a socket, you must actually call shutdown.

Instead of exposing the magic no_fork child_process struct,
let's encapsulate the test in a function.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

connect: treat generic proxy processes like ssh processesJeff King Mon, 16 May 2011 06:46:07 +0000 (02:46 -0400)

connect: treat generic proxy processes like ssh processes

The git_connect function returns two ends of a pipe for
talking with a remote, plus a struct child_process
representing the other end of the pipe. If we have a direct
socket connection, then this points to a special "no_fork"
child process.

The code path for doing git-over-pipes or git-over-ssh sets
up this child process to point to the child git command or
the ssh process. When we call finish_connect eventually, we
check wait() on the command and report its return value.

The code path for git://, on the other hand, always sets it
to no_fork. In the case of a direct TCP connection, this
makes sense; we have no child process. But in the case of a
proxy command (configured by core.gitproxy), we do have a
child process, but we throw away its pid, and therefore
ignore its return code.

Instead, let's keep that information in the proxy case, and
respect its return code, which can help catch some errors
(though depending on your proxy command, it will be errors
reported by the proxy command itself, and not propagated
from git commands. Still, it is probably better to propagate
such errors than to ignore them).

It also means that the child_process field can reliably be
used to determine whether the returned descriptors are
actually a full-duplex socket, which means we should be
using shutdown() instead of a simple close.

Signed-off-by: Jeff King <peff@peff.net>
Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sideband_demux(): fix decl-after-stmtJunio C Hamano Mon, 16 May 2011 23:19:49 +0000 (16:19 -0700)

sideband_demux(): fix decl-after-stmt

Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3503: test cherry picking and reverting root commitsJeff King Thu, 12 May 2011 11:10:07 +0000 (07:10 -0400)

t3503: test cherry picking and reverting root commits

We already tested cherry-picking a root commit, but only
with the internal merge-recursive strategy. Let's also test
the recently-allowed reverting of a root commit, as well as
testing with external strategies (which until recently
triggered a segfault).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

revert: allow reverting a root commitJeff King Thu, 12 May 2011 11:09:55 +0000 (07:09 -0400)

revert: allow reverting a root commit

Although it is probably an uncommon operation, there is no
reason to disallow it, as it works just fine. It is the
reverse of a cherry-pick of a root commit, which is already
allowed.

We do have to tweak one check on whether we have a merge
commit, which assumed we had at least one parent.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

cherry-pick: handle root commits with external strategiesJeff King Thu, 12 May 2011 11:09:46 +0000 (07:09 -0400)

cherry-pick: handle root commits with external strategies

The merge-recursive strategy already handles root commits;
it cherry-picks the difference between the empty tree and
the root commit's tree.

However, for external strategies, we dereference NULL and
segfault while building the argument list. Instead, let's
handle this by passing the empty tree sha1 to the merge
script.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: Pass USE_LIBPCRE down in GIT-BUILD-OPTIONSJunio C Hamano Mon, 16 May 2011 07:11:53 +0000 (00:11 -0700)

Makefile: Pass USE_LIBPCRE down in GIT-BUILD-OPTIONS

Otherwise we would fail to rebuild correctly when this option was
changed between $(MAKE) invocations, and more importantly, $(MAKE) test
would not pass it down and t/test-lib.sh would not set the LIBPCRE
prerequisite.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-grep: update tests now regexp type is "last one... Junio C Hamano Mon, 16 May 2011 07:10:14 +0000 (00:10 -0700)

git-grep: update tests now regexp type is "last one wins"

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync release notes for 1.7.6 to exclude what are in... Junio C Hamano Sun, 15 May 2011 23:19:16 +0000 (16:19 -0700)

Sync release notes for 1.7.6 to exclude what are in maintenance track

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Sun, 15 May 2011 23:16:56 +0000 (16:16 -0700)

Merge branch 'maint'

* maint:
Update draft release notes to 1.7.5.2
git_open_noatime(): drop unused parameter
sha1_file: typofix

Update draft release notes to 1.7.5.2Junio C Hamano Sun, 15 May 2011 23:11:55 +0000 (16:11 -0700)

Update draft release notes to 1.7.5.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'cn/format-patch-quiet' into maintJunio C Hamano Sun, 15 May 2011 23:10:49 +0000 (16:10 -0700)

Merge branch 'cn/format-patch-quiet' into maint

* cn/format-patch-quiet:
format-patch: document --quiet option
format-patch: don't pass on the --quiet flag

Merge branch 'jm/mergetool-submodules' into maintJunio C Hamano Sun, 15 May 2011 22:57:16 +0000 (15:57 -0700)

Merge branch 'jm/mergetool-submodules' into maint

* jm/mergetool-submodules:
mergetool: Teach about submodules

Merge branch 'jk/format-patch-quote-special-in-from... Junio C Hamano Sun, 15 May 2011 22:56:44 +0000 (15:56 -0700)

Merge branch 'jk/format-patch-quote-special-in-from' into maint

* jk/format-patch-quote-special-in-from:
pretty: quote rfc822 specials in email addresses

Merge branch 'vh/git-svn-doc' into maintJunio C Hamano Sun, 15 May 2011 22:52:40 +0000 (15:52 -0700)

Merge branch 'vh/git-svn-doc' into maint

* vh/git-svn-doc:
git-svn.txt: small typeface improvements
git-svn.txt: move option descriptions
git-svn.txt: fix usage of --add-author-from

git_open_noatime(): drop unused parameterJunio C Hamano Sun, 15 May 2011 19:16:29 +0000 (12:16 -0700)

git_open_noatime(): drop unused parameter

Since commit c793430 (Limit file descriptors used by packs, 2011-02-28),
the extra parameter added in f2e872aa (Work around EMFILE when there are
too many pack files, 2010-11-01) is not used anymore.

Remove it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>

sha1_file: typofixJunio C Hamano Sun, 15 May 2011 19:16:03 +0000 (12:16 -0700)

sha1_file: typofix

The number zero is spelled "zero", not "zer0".

Signed-off-by: Junio C Hamano <gitster@pobox.com>

read_sha1_file(): allow selective bypassing of replacem... Junio C Hamano Sun, 15 May 2011 19:54:54 +0000 (12:54 -0700)

read_sha1_file(): allow selective bypassing of replacement mechanism

The way "object replacement" mechanism was tucked to the read_sha1_file()
interface was suboptimal in a couple of ways:

- Callers that want it to die with useful diagnosis upon seeing a corrupt
object does not have a way to say that they do not want any object
replacement.

- Callers who do not want it to die but want to handle the errors
themselves are told to arrange to call read_object(), but the function
does not use the replacement mechanism, and also it is a file scope
static function that not many callers can call to begin with.

This adds a read_sha1_file_extended() that takes a set of flags; the
callers of read_sha1_file() passes a flag READ_SHA1_FILE_REPLACE to ask
for object replacement mechanism to kick in.

Later, we could add another flag bit to tell the function to return an
error instead of dying and then remove the misguided "call read_object()
yourself".

Signed-off-by: Junio C Hamano <gitster@pobox.com>

inline lookup_replace_object() callsJunio C Hamano Sun, 15 May 2011 19:54:53 +0000 (12:54 -0700)

inline lookup_replace_object() calls

In a repository without object replacement, lookup_replace_object() should
be a no-op. Check the flag "read_replace_refs" on the side of the caller,
and bypess a function call when we know we are not dealing with replacement.

Also, even when we are set up to replace objects, if we do not find any
replacement defined, flip that flag off to avoid function call overhead
for all the later object accesses.

As this change the semantics of the flag from "do we need read the
replacement definition?" to "do we need to check with the lookup table?"
the flag needs to be renamed later to something saner, e.g. "use_replace",
when the codebase is calmer, but not now.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

read_sha1_file(): get rid of read_sha1_file_repl()... Junio C Hamano Sun, 15 May 2011 19:54:52 +0000 (12:54 -0700)

read_sha1_file(): get rid of read_sha1_file_repl() madness

Most callers want to silently get a replacement object, and they do not
care what the real name of the replacement object is. Worse yet, no sane
interface to return the underlying object without replacement is provided.

Remove the function and make only the few callers that want the name of
the replacement object find it themselves.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

t6050: make sure we test not just commit replacementJunio C Hamano Sun, 15 May 2011 19:54:51 +0000 (12:54 -0700)

t6050: make sure we test not just commit replacement

The replacement mechanism should affect all types of objects not
just commits, so make sure it deals with at least a blob.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Declare lookup_replace_object() in cache.h, not in... Junio C Hamano Sun, 15 May 2011 19:54:50 +0000 (12:54 -0700)

Declare lookup_replace_object() in cache.h, not in commit.h

The declaration is misplaced as the replace API is supposed to affect
not just commits, but all types of objects.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Sun, 15 May 2011 03:44:09 +0000 (20:44 -0700)

Merge branch 'maint'

* maint:
add, merge, diff: do not use strcasecmp to compare config variable names

Makefile: add xgettext target for *.sh filesÆvar Arnfjörð Bjarmason Sat, 14 May 2011 13:47:45 +0000 (13:47 +0000)

Makefile: add xgettext target for *.sh files

Change the "pot" target to also extract strings from our $(SCRIPT_SH)
files with xgettext(1).

Note that due to Jonathan Nieder's trick of doing "mv $@+ $@" at the
end of the target the "pot" target will now warn:

$ make pot
XGETTEXT po/git.pot
po/git.pot+: warning: Charset "CHARSET" is not a portable encoding name.
Message conversion to user's charset might not work.

This warnings is emitted because xgettext is writing into a non-*.pot
file, it's harmless however. The content that's written out is
equivalent to what it would be if we were writing directly into an
existing POT file with --join-existing.

As part of this change I've eliminated the && chain between xgettext
calls, this is incompatible with $(QUIET_XGETTEXT), if the && is left
in it'll emit:

/bin/sh: @echo: not found

Since it's redundant (the Makefile will stop if there's an error) I've
removed it altogether.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-sh-i18n.sh: add GIT_GETTEXT_POISON supportÆvar Arnfjörð Bjarmason Sat, 14 May 2011 13:47:44 +0000 (13:47 +0000)

git-sh-i18n.sh: add GIT_GETTEXT_POISON support

Change git-sh-i18n.sh to support the GIT_GETTEXT_POISON environment
variable like gettext.c does, this ensures that tests that use
git-sh-i18n.sh will fail under GETTEXT_POISON=YesPlease if they rely
on Git's C locale messages without declaring that they do.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-sh-i18n.sh: add no-op gettext() and eval_gettext... Ævar Arnfjörð Bjarmason Sat, 14 May 2011 13:47:43 +0000 (13:47 +0000)

git-sh-i18n.sh: add no-op gettext() and eval_gettext() wrappers

Add a no-op wrapper library for Git's shell scripts. To split up the
gettext series I'm first submitting patches to gettextize the source
tree before I add any of the Makefile and Shell library changes needed
to actually use them.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-sh-i18n--envsubst: our own envsubst(1) for eval_get... Ævar Arnfjörð Bjarmason Sat, 14 May 2011 13:47:42 +0000 (13:47 +0000)

git-sh-i18n--envsubst: our own envsubst(1) for eval_gettext()

Add a git-sh-i18n--envsubst program which is a stripped-down version
of the GNU envsubst(1) program that comes with GNU gettext for use in
the eval_gettext() fallback.

We need a C helper program because implementing eval_gettext() purely
in shell turned out to be unworkable. Digging through the Git mailing
list archives will reveal two shell implementations of eval_gettext
that are almost good enough, but fail on an edge case which is tested
for in the tests which are part of this patch.

These are the modifications I made to envsubst.c as I turned it into
sh-i18n--envsubst.c:

* Added our git-compat-util.h header for xrealloc() and friends.

* Removed inclusion of gettext-specific headers.

* Removed most of main() and replaced it with my own. The modified
version only does option parsing for --variables. That's all it
needs.

* Modified error() invocations to use our error() instead of
error(3).

* Replaced the gettext XNMALLOC(n, size) macro with just
xmalloc(n). Since XNMALLOC() only allocated char's.

* Removed the string_list_destroy function. It's redundant (also in
the upstream code).

* Replaced the use of stdbool.h (a C99 header) by doing the following
replacements on the code:

* s/bool/unsigned short int/g
* s/true/1/g
* s/false/0/g

Reported-by: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add, merge, diff: do not use strcasecmp to compare... Jonathan Nieder Sat, 14 May 2011 20:19:21 +0000 (15:19 -0500)

add, merge, diff: do not use strcasecmp to compare config variable names

The config machinery already makes section and variable names
lowercase when parsing them, so using strcasecmp for comparison just
feels wasteful. No noticeable change intended.

Noticed-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Submodules: Don't parse .gitmodules when it contains... Jens Lehmann Sat, 14 May 2011 16:26:58 +0000 (18:26 +0200)

Submodules: Don't parse .gitmodules when it contains, merge conflicts

Commands like "git status", "git diff" and "git fetch" would fail when the
.gitmodules file contained merge conflicts because the config parser would
call die() when hitting the conflict markers:

"fatal: bad config file line <n> in <path>/.gitmodules"

While this behavior was on the safe side, it is really unhelpful to the
user to have commands like status and diff fail, as these are needed to
find out what's going on. And the error message is only mildly helpful,
as it points to the right file but doesn't mention that it is unmerged.
Users of git gui were not shown any conflicts at all when this happened.

Improve the situation by checking if the index records .gitmodules as
unmerged. When that is the case we can't make any assumptions about the
configuration to be found there after the merge conflict is resolved by
the user, so assume that all recursion is disabled unless .git/config or
the global config say otherwise.

As soon as the merge conflict is resolved and the .gitmodules file has
been staged subsequent commands again honor any configuration done there.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>