gitweb.git
gitweb: Allow UTF-8 encoded CGI query parameters and... Jakub Narebski Fri, 3 Feb 2012 12:44:54 +0000 (13:44 +0100)

gitweb: Allow UTF-8 encoded CGI query parameters and path_info

Gitweb forgot to turn query parameters into UTF-8. This results in a bug
that one cannot search for a string with characters outside US-ASCII. For
example searching for "Michał Kiedrowicz" (containing letter 'ł' - LATIN
SMALL LETTER L WITH STROKE, with Unicode codepoint U+0142, represented
with 0xc5 0x82 bytes in UTF-8 and percent-encoded as %C5%82) result in the
following incorrect data in search field

MichaÅ\202 Kiedrowicz

This is caused by CGI by default treating '0xc5 0x82' bytes as two
characters in Perl legacy encoding latin-1 (iso-8859-1), because 's'
query parameter is not processed explicitly as UTF-8 encoded string.

The solution used here follows "Using Unicode in a Perl CGI script"
article on http://www.lemoda.net/cgi/perl-unicode/index.html:

use CGI;
use Encode 'decode_utf8;
my $value = params('input');
$value = decode_utf8($value);

Decoding UTF-8 is done when filling %input_params hash and $path_info
variable; the former requires to move from explicit $cgi->param(<label>)
to $input_params{<name>} in a few places, which is a good idea anyway.

Also add -override=>1 parameter to $cgi->textfield() invocation in search
form. Otherwise CGI would use values from query string if it is present,
filling value from $cgi->param... without decode_utf8(). As we are using
value of appropriate parameter anyway, -override=>1 doesn't change the
situation but makes gitweb fill search field correctly.

We could simply use the '-utf8' pragma (via "use CGI '-utf8';") to solve
this, but according to CGI.pm documentation, it may cause problems with
POST requests containing binary files, and it requires CGI 3.31 (I think),
released with perl v5.8.9.

Reported-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Jakub Narębski <jnareb@gmail.com>
Tested-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

standardize and improve lookup rules for external local... Jeff King Thu, 2 Feb 2012 21:59:13 +0000 (16:59 -0500)

standardize and improve lookup rules for external local repos

When you specify a local repository on the command line of
clone, ls-remote, upload-pack, receive-pack, or upload-archive,
or in a request to git-daemon, we perform a little bit of
lookup magic, doing things like looking in working trees for
.git directories and appending ".git" for bare repos.

For clone, this magic happens in get_repo_path. For
everything else, it happens in enter_repo. In both cases,
there are some ambiguous or confusing cases that aren't
handled well, and there is one case that is not handled the
same by both methods.

This patch tries to provide (and test!) standard, sensible
lookup rules for both code paths. The intended changes are:

1. When looking up "foo", we have always preferred
a working tree "foo" (containing "foo/.git" over the
bare "foo.git". But we did not prefer a bare "foo" over
"foo.git". With this patch, we do so.

2. We would select directories that existed but didn't
actually look like git repositories. With this patch,
we make sure a selected directory looks like a git
repo. Not only is this more sensible in general, but it
will help anybody who is negatively affected by change
(1) negatively (e.g., if they had "foo.git" next to its
separate work tree "foo", and expect to keep finding
"foo.git" when they reference "foo").

3. The enter_repo code path would, given "foo", look for
"foo.git/.git" (i.e., do the ".git" append magic even
for a repo with working tree). The clone code path did
not; with this patch, they now behave the same.

In the unlikely case of a working tree overlaying a bare
repo (i.e., a ".git" directory _inside_ a bare repo), we
continue to treat it as a working tree (prefering the
"inner" .git over the bare repo). This is mainly because the
combination seems nonsensical, and I'd rather stick with
existing behavior on the off chance that somebody is relying
on it.

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

vcs-svn: suppress a -Wtype-limits warningJonathan Nieder Thu, 2 Feb 2012 11:06:01 +0000 (05:06 -0600)

vcs-svn: suppress a -Wtype-limits warning

On 32-bit architectures with 64-bit file offsets, gcc 4.3 and earlier
produce the following warning:

CC vcs-svn/sliding_window.o
vcs-svn/sliding_window.c: In function `check_overflow':
vcs-svn/sliding_window.c:36: warning: comparison is always false \
due to limited range of data type

The warning appears even when gcc is run without any warning flags
(this is gcc bug 12963). In later versions the same warning can be
reproduced with -Wtype-limits, which is implied by -Wextra.

On 64-bit architectures it really is possible for a size_t not to be
representable as an off_t so the check this is warning about is not
actually redundant. But even false positives are distracting. Avoid
the warning by making the "len" argument to check_overflow a
uintmax_t; no functional change intended.

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

vcs-svn: allow import of > 4GiB filesJonathan Nieder Thu, 2 Feb 2012 11:03:16 +0000 (05:03 -0600)

vcs-svn: allow import of > 4GiB files

There is no reason in principle that an svn-format dump would not be
able to represent a file whose length does not fit in a 32-bit
integer. Use off_t consistently to represent file lengths (in place
of using uint32_t in some contexts) so we can handle that.

Most svn-fe code is already ready to do that without this patch and
passes values of type off_t around. The type mismatch from stragglers
was noticed with gcc -Wtype-limits.

While at it, tighten the parsing of the Text-content-length field to
make sure it is a number and does not overflow, and tighten other
overflow checks as that value is passed around and manipulated.

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

vcs-svn: rename check_overflow arguments for clarityRamsay Jones Thu, 2 Feb 2012 10:59:23 +0000 (04:59 -0600)

vcs-svn: rename check_overflow arguments for clarity

Code using the argument names a and b just doesn't look right (not
sure why!). Use more explicit names "offset" and "len" to make their
type and meaning clearer.

Also rename check_overflow() to check_offset_overflow() to clarify
that we are making sure that "len" bytes beyond "offset" still fits
the type to represent an offset.

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

grep: pre-load userdiff drivers when threadedJeff King Thu, 2 Feb 2012 08:24:28 +0000 (03:24 -0500)

grep: pre-load userdiff drivers when threaded

The low-level grep_source code will automatically load the
userdiff driver to see whether a file is binary. However,
when we are threaded, it will load the drivers in a
non-deterministic order, handling each one as its assigned
thread happens to be scheduled.

Meanwhile, the attribute lookup code (which underlies the
userdiff driver lookup) is optimized to handle paths in
sequential order (because they tend to share the same
gitattributes files). Multi-threading the lookups destroys
the locality and makes this optimization less effective.

We can fix this by pre-loading the userdiff driver in the
main thread, before we hand off the file to a worker thread.
My best-of-five for "git grep foo" on the linux-2.6
repository went from:

real 0m0.391s
user 0m1.708s
sys 0m0.584s

to:

real 0m0.360s
user 0m1.576s
sys 0m0.572s

Not a huge speedup, but it's quite easy to do. The only
trick is that we shouldn't perform this optimization if "-a"
was used, in which case we won't bother checking whether
the files are binary at all.

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

grep: load file data after checking binary-nessJeff King Thu, 2 Feb 2012 08:21:11 +0000 (03:21 -0500)

grep: load file data after checking binary-ness

Usually we load each file to grep into memory, check whether
it's binary, and then either grep it (the default) or not
(if "-I" was given).

In the "-I" case, we can skip loading the file entirely if
it is marked as binary via gitattributes. On my giant
3-gigabyte media repository, doing "git grep -I foo" went
from:

real 0m0.712s
user 0m0.044s
sys 0m4.780s

to:

real 0m0.026s
user 0m0.016s
sys 0m0.020s

Obviously this is an extreme example. The repo is almost
entirely binary files, and you can see that we spent all of
our time asking the kernel to read() the data. However, with
a cold disk cache, even avoiding a few binary files can have
an impact.

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

grep: respect diff attributes for binary-nessJeff King Thu, 2 Feb 2012 08:21:02 +0000 (03:21 -0500)

grep: respect diff attributes for binary-ness

There is currently no way for users to tell git-grep that a
particular path is or is not a binary file; instead, grep
always relies on its auto-detection (or the user specifying
"-a" to treat all binary-looking files like text).

This patch teaches git-grep to use the same attribute lookup
that is used by git-diff. We could add a new "grep" flag,
but that is unnecessarily complex and unlikely to be useful.
Despite the name, the "-diff" attribute (or "diff=foo" and
the associated diff.foo.binary config option) are really
about describing the contents of the path. It's simply
historical that diff was the only thing that cared about
these attributes in the past.

And if this simple approach turns out to be insufficient, we
still have a backwards-compatible path forward: we can add a
separate "grep" attribute, and fall back to respecting
"diff" if it is unset.

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

grep: cache userdiff_driver in grep_sourceJeff King Thu, 2 Feb 2012 08:20:43 +0000 (03:20 -0500)

grep: cache userdiff_driver in grep_source

Right now, grep only uses the userdiff_driver for one thing:
looking up funcname patterns for "-p" and "-W". As new uses
for userdiff drivers are added to the grep code, we want to
minimize attribute lookups, which can be expensive.

It might seem at first that this would also optimize multiple
lookups when the funcname pattern for a file is needed
multiple times. However, the compiled funcname pattern is
already cached in struct grep_opt's "priv" member, so
multiple lookups are already suppressed.

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

grep: drop grep_buffer's "name" parameterJeff King Thu, 2 Feb 2012 08:20:10 +0000 (03:20 -0500)

grep: drop grep_buffer's "name" parameter

Before the grep_source interface existed, grep_buffer was
used by two types of callers:

1. Ones which pulled a file into a buffer, and then wanted
to supply the file's name for the output (i.e.,
git grep).

2. Ones which really just wanted to grep a buffer (i.e.,
git log --grep).

Callers in set (1) should now be using grep_source. Callers
in set (2) always pass NULL for the "name" parameter of
grep_buffer. We can therefore get rid of this now-useless
parameter.

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

convert git-grep to use grep_source interfaceJeff King Thu, 2 Feb 2012 08:19:37 +0000 (03:19 -0500)

convert git-grep to use grep_source interface

The grep_source interface (as opposed to grep_buffer) will
eventually gives us a richer interface for telling the
low-level grep code about our buffers. Eventually this will
lead to things like better binary-file handling. For now, it
lets us drop a lot of now-redundant code.

The conversion is mostly straight-forward. One thing to note
is that the memory ownership rules for "struct grep_source"
are different than the "struct work_item" found here (the
former will copy things like the filename, rather than
taking ownership). Therefore you will also see some slight
tweaking of when filename buffers are released.

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

grep: refactor the concept of "grep source" into an... Jeff King Thu, 2 Feb 2012 08:19:28 +0000 (03:19 -0500)

grep: refactor the concept of "grep source" into an object

The main interface to the low-level grep code is
grep_buffer, which takes a pointer to a buffer and a size.
This is convenient and flexible (we use it to grep commit
bodies, files on disk, and blobs by sha1), but it makes it
hard to pass extra information about what we are grepping
(either for correctness, like overriding binary
auto-detection, or for optimizations, like lazily loading
blob contents).

Instead, let's encapsulate the idea of a "grep source",
including the buffer, its size, and where the data is coming
from. This is similar to the diff_filespec structure used by
the diff code (unsurprising, since future patches will
implement some of the same optimizations found there).

The diffstat is slightly scarier than the actual patch
content. Most of the modified lines are simply replacing
access to raw variables with their counterparts that are now
in a "struct grep_source". Most of the added lines were
taken from builtin/grep.c, which partially abstracted the
idea of grep sources (for file vs sha1 sources).

Instead of dropping the now-redundant code, this patch
leaves builtin/grep.c using the traditional grep_buffer
interface (which now wraps the grep_source interface). That
makes it easy to test that there is no change of behavior
(yet).

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

grep: move sha1-reading mutex into low-level codeJeff King Thu, 2 Feb 2012 08:18:41 +0000 (03:18 -0500)

grep: move sha1-reading mutex into low-level code

The multi-threaded git-grep code needs to serialize access
to the thread-unsafe read_sha1_file call. It does this with
a mutex that is local to builtin/grep.c.

Let's instead push this down into grep.c, where it can be
used by both builtin/grep.c and grep.c. This will let us
safely teach the low-level grep.c code tricks that involve
reading from the object db.

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

grep: make locking flag globalJeff King Thu, 2 Feb 2012 08:18:29 +0000 (03:18 -0500)

grep: make locking flag global

The low-level grep code traditionally didn't care about
threading, as it doesn't do any threading itself and didn't
call out to other non-thread-safe code. That changed with
0579f91 (grep: enable threading with -p and -W using lazy
attribute lookup, 2011-12-12), which pushed the lookup of
funcname attributes (which is not thread-safe) into the
low-level grep code.

As a result, the low-level code learned about a new global
"grep_attr_mutex" to serialize access to the attribute code.
A multi-threaded caller (e.g., builtin/grep.c) is expected
to initialize the mutex and set "use_threads" in the
grep_opt structure. The low-level code only uses the lock if
use_threads is set.

However, putting the use_threads flag into the grep_opt
struct is not the most logical place. Whether threading is
in use is not something that matters for each call to
grep_buffer, but is instead global to the whole program
(i.e., if any thread is doing multi-threaded grep, every
other thread, even if it thinks it is doing its own
single-threaded grep, would need to use the locking). In
practice, this distinction isn't a problem for us, because
the only user of multi-threaded grep is "git-grep", which
does nothing except call grep.

This patch turns the opt->use_threads flag into a global
flag. More important than the nit-picking semantic argument
above is that this means that the locking functions don't
need to actually have access to a grep_opt to know whether
to lock. Which in turn can make adding new locks simpler, as
we don't need to pass around a grep_opt.

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

i18n: format_tracking_info "Your branch is behind"... Jiang Xin Thu, 2 Feb 2012 02:02:23 +0000 (10:02 +0800)

i18n: format_tracking_info "Your branch is behind" message

Function format_tracking_info in remote.c is called by
wt_status_print_tracking in wt-status.c, which will print
branch tracking message in git-status. git-checkout also
show these messages through it's report_tracking function.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

i18n: git-commit whence_s "merge/cherry-pick" messageJiang Xin Wed, 1 Feb 2012 17:20:30 +0000 (01:20 +0800)

i18n: git-commit whence_s "merge/cherry-pick" message

Mark the "merge/cherry-pick" messages in whence_s for translation.
These messages returned from whence_s function are used as argument
to build other messages.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 1.7.10Junio C Hamano Wed, 1 Feb 2012 06:31:35 +0000 (22:31 -0800)

Update draft release notes to 1.7.10

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

find_pack_entry(): do not keep packed_git pointer locallyNguyễn Thái Ngọc Duy Wed, 1 Feb 2012 13:48:55 +0000 (20:48 +0700)

find_pack_entry(): do not keep packed_git pointer locally

Commit f7c22cc (always start looking up objects in the last used pack
first - 2007-05-30) introduce a static packed_git* pointer as an
optimization. The kept pointer however may become invalid if
free_pack_by_name() happens to free that particular pack.

Current code base does not access packs after calling
free_pack_by_name() so it should not be a problem. Anyway, move the
pointer out so that free_pack_by_name() can reset it to avoid running
into troubles in future.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file.c: move the core logic of find_pack_entry... Nguyễn Thái Ngọc Duy Wed, 1 Feb 2012 13:48:54 +0000 (20:48 +0700)

sha1_file.c: move the core logic of find_pack_entry() into fill_pack_entry()

The new helper function implements the logic to find the offset for the
object in one pack and fill a pack_entry structure. The next patch will
restructure the loop and will call the helper from two places.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack-objects: convert to use parse_options()Nguyễn Thái Ngọc Duy Wed, 1 Feb 2012 15:17:20 +0000 (22:17 +0700)

pack-objects: convert to use parse_options()

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack-objects: remove bogus commentNguyễn Thái Ngọc Duy Wed, 1 Feb 2012 15:17:19 +0000 (22:17 +0700)

pack-objects: remove bogus comment

The comment was introduced in b5d97e6 (pack-objects: run rev-list
equivalent internally. - 2006-09-04), stating that

git pack-objects [options] base-name <refs...>

is acceptable and refs should be passed into rev-list. But that's not
true. All arguments after base-name are ignored.

Remove the comment and reject this syntax (i.e. no more arguments after
base name)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack-objects: do not accept "--index-version=version,"Nguyễn Thái Ngọc Duy Wed, 1 Feb 2012 15:17:18 +0000 (22:17 +0700)

pack-objects: do not accept "--index-version=version,"

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: Make project search respect project_filterJakub Narebski Tue, 31 Jan 2012 00:20:55 +0000 (01:20 +0100)

gitweb: Make project search respect project_filter

Make gitweb search within filtered projects (i.e. projects shown), and
change "List all projects" to "List all projects in '$project_filter/'"
if project_filter is used.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: improve usability of projects search formJakub Narebski Tue, 31 Jan 2012 00:20:54 +0000 (01:20 +0100)

gitweb: improve usability of projects search form

Refactor generating project search form into git_project_search_form().

Make text field wider and add on mouse over explanation (via "title"
attribute), add an option to use regular expressions, and replace
'Search:' label with [Search] button.

Also add "List all projects" link to make it easier to go back from search
result to list of all projects (note that an empty search term is
disallowed).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: place links to parent directories in page headerBernhard R. Link Mon, 30 Jan 2012 20:10:23 +0000 (21:10 +0100)

gitweb: place links to parent directories in page header

Change html page headers to not only link the project root and the
currently selected project but also the directories in between using
project_filter. (Allowing to jump to a list of all projects within
that intermediate directory directly and making the project_filter
feature visible to users).

Signed-off-by: Bernhard R. Link <brlink@debian.org>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: show active project_filter in project_list... Bernhard R. Link Mon, 30 Jan 2012 20:09:43 +0000 (21:09 +0100)

gitweb: show active project_filter in project_list page header

In the page header of a project_list view with a project_filter
given show breadcrumbs in the page headers showing which directory
it is currently limited to and also containing links to the parent
directories.

Signed-off-by: Bernhard R. Link <brlink@debian.org>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: limit links to alternate forms of project_list... Bernhard R. Link Mon, 30 Jan 2012 20:09:00 +0000 (21:09 +0100)

gitweb: limit links to alternate forms of project_list to active project_filter

If project_list action is given a project_filter argument, pass that to
TXT and OPML formats.

This way [OPML] and [TXT] links provide the same list of projects as
the projects_list page they are linked from.

Signed-off-by: Bernhard R. Link <brlink@debian.org>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: add project_filter to limit project list to... Bernhard R. Link Mon, 30 Jan 2012 20:07:37 +0000 (21:07 +0100)

gitweb: add project_filter to limit project list to a subdirectory

This commit changes the project listing views (project_list,
project_index and opml) to limit the output to only projects in a
subdirectory if the new optional parameter ?pf=directory name is
used.

The implementation of the filter reuses the implementation used for
the 'forks' action (i.e. listing all projects within that directory
from the projects list file (GITWEB_LIST) or only projects in the
given subdirectory of the project root directory without a projects
list file).

Reusing $project instead of adding a new parameter would have been
nicer from a UI point-of-view (including PATH_INFO support) but
would complicate the $project validating code that is currently
being used to ensure nothing is exported that should not be viewable.

Signed-off-by: Bernhard R. Link <brlink@debian.org>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: prepare git_get_projects_list for use outside... Bernhard R. Link Mon, 30 Jan 2012 20:06:38 +0000 (21:06 +0100)

gitweb: prepare git_get_projects_list for use outside 'forks'.

Use of the filter option of git_get_projects_list is currently limited
to forks. It currently assumes the project belonging to the filter
directory was already validated to be visible in the project list.

To make it more generic add an optional argument to denote visibility
verification is still needed.

If there is a projects list file (GITWEB_LIST) only projects from
this list are returned anyway, so no more checks needed.

If there is no projects list file and the caller requests strict
checking (GITWEB_STRICT_EXPORT), do not jump directly to the
given directory but instead do a normal search and filter the
results instead.

The only effect of GITWEB_STRICT_EXPORT without GITWEB_LIST is to make
sure no project can be viewed without also be found starting from
project root. git_get_projects_list without this patch does not enforce
this but all callers only call it with a filter already checked this
way. With this parameter a caller can request this check if the filter
cannot be checked this way.

Signed-off-by: Bernhard R. Link <brlink@debian.org>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: move hard coded .git suffix out of git_get_proj... Bernhard R. Link Mon, 30 Jan 2012 20:05:47 +0000 (21:05 +0100)

gitweb: move hard coded .git suffix out of git_get_projects_list

Use of the filter option of git_get_projects_list is currently
limited to forks. It hard codes removal of ".git" suffixes from
the filter.

To make it more generic move the .git suffix removal to the callers.

Signed-off-by: Bernhard R. Link <brlink@debian.org>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'tr/merge-edit-guidance'Junio C Hamano Wed, 1 Feb 2012 06:31:03 +0000 (22:31 -0800)

Merge branch 'tr/merge-edit-guidance'

* tr/merge-edit-guidance:
merge: add instructions to the commit message when editing

Merge branch 'jc/pull-signed-tag'Junio C Hamano Wed, 1 Feb 2012 06:30:42 +0000 (22:30 -0800)

Merge branch 'jc/pull-signed-tag'

* jc/pull-signed-tag:
merge: use editor by default in interactive sessions

Conflicts:
Documentation/merge-options.txt

Merge branch 'ar/i18n-no-gettext'Junio C Hamano Wed, 1 Feb 2012 06:24:23 +0000 (22:24 -0800)

Merge branch 'ar/i18n-no-gettext'

* ar/i18n-no-gettext:
i18n: Do not force USE_GETTEXT_SCHEME=fallthrough on NO_GETTEXT
i18n: Make NO_GETTEXT imply fallthrough scheme in shell l10n
add a Makefile switch to avoid gettext translation in shell scripts
git-sh-i18n: restructure the logic to compute gettext.sh scheme

Merge branch 'nd/clone-detached'Junio C Hamano Wed, 1 Feb 2012 06:24:23 +0000 (22:24 -0800)

Merge branch 'nd/clone-detached'

* nd/clone-detached:
clone: fix up delay cloning conditions
push: do not let configured foreign-vcs permanently clobbered
clone: print advice on checking out detached HEAD
clone: allow --branch to take a tag
clone: refuse to clone if --branch points to bogus ref
clone: --branch=<branch> always means refs/heads/<branch>
clone: delay cloning until after remote HEAD checking
clone: factor out remote ref writing
clone: factor out HEAD update code
clone: factor out checkout code
clone: write detached HEAD in bare repositories
t5601: add missing && cascade

Merge branch 'da/maint-mergetool-twoway'Junio C Hamano Wed, 1 Feb 2012 06:01:17 +0000 (22:01 -0800)

Merge branch 'da/maint-mergetool-twoway'

* da/maint-mergetool-twoway:
mergetool: Provide an empty file when needed

Merge branch 'va/git-p4-branch'Junio C Hamano Wed, 1 Feb 2012 06:01:16 +0000 (22:01 -0800)

Merge branch 'va/git-p4-branch'

* va/git-p4-branch:
t9801: do not overuse test_must_fail
git-p4: Change p4 command invocation
git-p4: Add test case for complex branch import
git-p4: Search for parent commit on branch creation

Merge branch 'jl/submodule-re-add'Junio C Hamano Wed, 1 Feb 2012 06:01:16 +0000 (22:01 -0800)

Merge branch 'jl/submodule-re-add'

* jl/submodule-re-add:
submodule add: fix breakage when re-adding a deep submodule

Merge branch 'tr/grep-l-with-decoration'Junio C Hamano Wed, 1 Feb 2012 06:01:15 +0000 (22:01 -0800)

Merge branch 'tr/grep-l-with-decoration'

* tr/grep-l-with-decoration:
grep: fix -l/-L interaction with decoration lines

Merge branch 'ks/sort-wildcard-in-makefile'Junio C Hamano Wed, 1 Feb 2012 06:01:15 +0000 (22:01 -0800)

Merge branch 'ks/sort-wildcard-in-makefile'

* ks/sort-wildcard-in-makefile:
t/Makefile: Use $(sort ...) explicitly where needed

Merge branch 'rr/sequencer'Junio C Hamano Wed, 1 Feb 2012 06:01:14 +0000 (22:01 -0800)

Merge branch 'rr/sequencer'

* rr/sequencer:
sequencer: factor code out of revert builtin
revert: prepare to move replay_action to header

Conflicts:
builtin/revert.c

Merge branch 'ld/git-p4-branches-and-labels'Junio C Hamano Wed, 1 Feb 2012 06:01:14 +0000 (22:01 -0800)

Merge branch 'ld/git-p4-branches-and-labels'

* ld/git-p4-branches-and-labels:
git-p4: label import fails with multiple labels at the same changelist
git-p4: add test for p4 labels
git-p4: importing labels should cope with missing owner
git-p4: cope with labels with empty descriptions
git-p4: handle p4 branches and labels containing shell chars

Merge branch 'jc/advise-i18n'Junio C Hamano Wed, 1 Feb 2012 06:01:14 +0000 (22:01 -0800)

Merge branch 'jc/advise-i18n'

* jc/advise-i18n:
i18n of multi-line advice messages

request-pull: explicitly ask tags/$name to be pulledJunio C Hamano Wed, 1 Feb 2012 05:06:06 +0000 (21:06 -0800)

request-pull: explicitly ask tags/$name to be pulled

When asking for a tag to be pulled, disambiguate by leaving tags/ prefix
in front of the name of the tag. E.g.

... in the git repository at:

git://example.com/git/git.git/ tags/v1.2.3

for you to fetch changes up to 123456...

This way, older versions of "git pull" can be used to respond to such a
request more easily, as "git pull $URL v1.2.3" did not DWIM to fetch
v1.2.3 tag in older versions. Also this makes it clearer for humans that
the pull request is made for a tag and he should anticipate a signed one.

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

merge: add instructions to the commit message when... Thomas Rast Mon, 30 Jan 2012 20:25:30 +0000 (21:25 +0100)

merge: add instructions to the commit message when editing

Before f824628 (merge: use editor by default in interactive sessions,
2012-01-10), git-merge only started an editor if the user explicitly
asked for it with --edit. Thus it seemed unlikely that the user would
need extra guidance.

After f824628 the _normal_ thing is to start an editor. Give at least
an indication of why we are doing it.

The sentence about justification is one of the few things about
standard git that are not agnostic to the workflow that the user
chose. However, f824628 was proposed by Linus specifically to
discourage users from merging unrelated upstream progress into topic
branches. So we may as well take another step in the same direction.

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

completion: --edit and --no-edit for git-mergeAdrian Weimann Mon, 30 Jan 2012 19:29:33 +0000 (20:29 +0100)

completion: --edit and --no-edit for git-merge

Signed-off-by: Adrian Weimann <adrian.weimann@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kick off the post 1.7.9 cycleJunio C Hamano Sun, 29 Jan 2012 21:46:18 +0000 (13:46 -0800)

Kick off the post 1.7.9 cycle

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

completion: --edit-description option for git-branchRalf Thielow Sun, 29 Jan 2012 12:55:33 +0000 (13:55 +0100)

completion: --edit-description option for git-branch

Signed-off-by: Ralf Thielow <ralf.thielow@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'nd/index-pack-no-recurse'Junio C Hamano Sun, 29 Jan 2012 21:18:56 +0000 (13:18 -0800)

Merge branch 'nd/index-pack-no-recurse'

* nd/index-pack-no-recurse:
index-pack: eliminate unlimited recursion in get_base_data()
index-pack: eliminate recursion in find_unresolved_deltas
Eliminate recursion in setting/clearing marks in commit list

Merge branch 'rs/diff-postimage-in-context'Junio C Hamano Sun, 29 Jan 2012 21:18:55 +0000 (13:18 -0800)

Merge branch 'rs/diff-postimage-in-context'

* rs/diff-postimage-in-context:
xdiff: print post-image for common records instead of pre-image

Merge branch 'jk/parse-object-cached'Junio C Hamano Sun, 29 Jan 2012 21:18:55 +0000 (13:18 -0800)

Merge branch 'jk/parse-object-cached'

* jk/parse-object-cached:
upload-pack: avoid parsing tag destinations
upload-pack: avoid parsing objects during ref advertisement
parse_object: try internal cache before reading object db

Merge branch 'sp/smart-http-failure-to-push'Junio C Hamano Sun, 29 Jan 2012 21:18:54 +0000 (13:18 -0800)

Merge branch 'sp/smart-http-failure-to-push'

* sp/smart-http-failure-to-push:
remote-curl: Fix push status report when all branches fail

Merge branch 'jc/maint-log-first-parent-pathspec'Junio C Hamano Sun, 29 Jan 2012 21:18:54 +0000 (13:18 -0800)

Merge branch 'jc/maint-log-first-parent-pathspec'

* jc/maint-log-first-parent-pathspec:
Making pathspec limited log play nicer with --first-parent

Merge branch 'mh/ref-clone-without-extra-refs'Junio C Hamano Sun, 29 Jan 2012 21:18:53 +0000 (13:18 -0800)

Merge branch 'mh/ref-clone-without-extra-refs'

* mh/ref-clone-without-extra-refs:
write_remote_refs(): create packed (rather than extra) refs
add_packed_ref(): new function in the refs API.
ref_array: keep track of whether references are sorted
pack_refs(): remove redundant check

Merge branch 'jl/test-pause'Junio C Hamano Sun, 29 Jan 2012 21:18:53 +0000 (13:18 -0800)

Merge branch 'jl/test-pause'

* jl/test-pause:
test-lib: add the test_pause convenience function

Merge branch 'tr/maint-mailinfo'Junio C Hamano Sun, 29 Jan 2012 21:18:53 +0000 (13:18 -0800)

Merge branch 'tr/maint-mailinfo'

* tr/maint-mailinfo:
mailinfo: with -b, keep space after [foo]
am: learn passing -b to mailinfo

Conflicts:
git-am.sh

Merge branch 'pw/p4-view-updates'Junio C Hamano Sun, 29 Jan 2012 21:18:52 +0000 (13:18 -0800)

Merge branch 'pw/p4-view-updates'

* pw/p4-view-updates:
git-p4: add tests demonstrating spec overlay ambiguities
git-p4: adjust test to adhere to stricter useClientSpec
git-p4: clarify comment
git-p4: fix verbose comment typo
git-p4: only a single ... wildcard is supported

Merge branch 'nd/maint-refname-in-hierarchy-check'Junio C Hamano Sun, 29 Jan 2012 21:18:51 +0000 (13:18 -0800)

Merge branch 'nd/maint-refname-in-hierarchy-check'

* nd/maint-refname-in-hierarchy-check:
Fix incorrect ref namespace check

Merge branch 'jn/gitweb-unspecified-action'Junio C Hamano Sun, 29 Jan 2012 21:18:50 +0000 (13:18 -0800)

Merge branch 'jn/gitweb-unspecified-action'

* jn/gitweb-unspecified-action:
gitweb: Fix actionless dispatch for non-existent objects

Merge branch 'cb/push-quiet'Junio C Hamano Sun, 29 Jan 2012 21:18:50 +0000 (13:18 -0800)

Merge branch 'cb/push-quiet'

* cb/push-quiet:
t5541: avoid TAP test miscounting
fix push --quiet: add 'quiet' capability to receive-pack
server_supports(): parse feature list more carefully

Merge branch 'nd/clone-single-branch'Junio C Hamano Sun, 29 Jan 2012 21:18:50 +0000 (13:18 -0800)

Merge branch 'nd/clone-single-branch'

* nd/clone-single-branch:
clone: add --single-branch to fetch only one branch

Merge branch 'cb/git-daemon-tests'Junio C Hamano Sun, 29 Jan 2012 21:18:50 +0000 (13:18 -0800)

Merge branch 'cb/git-daemon-tests'

* cb/git-daemon-tests:
git-daemon tests: wait until daemon is ready
git-daemon: produce output when ready
git-daemon: add tests

Merge branch 'cb/maint-kill-subprocess-upon-signal'Junio C Hamano Sun, 29 Jan 2012 21:18:50 +0000 (13:18 -0800)

Merge branch 'cb/maint-kill-subprocess-upon-signal'

* cb/maint-kill-subprocess-upon-signal:
dashed externals: kill children on exit
run-command: optionally kill children on exit

vcs-svn/svndiff.c: squelch false "unused" warning from gccJunio C Hamano Fri, 27 Jan 2012 19:58:56 +0000 (11:58 -0800)

vcs-svn/svndiff.c: squelch false "unused" warning from gcc

Curiously, pre_len given to read_length() does not trigger the same warning
even though the code structure is the same. Most likely this is because
read_offset() is used only once and inlining it will make gcc realize that
it has a chance to do more flow analysis. Alas, the analysis is flawed, so
it does not help X-<.

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

Git 1.7.9 v1.7.9Junio C Hamano Fri, 27 Jan 2012 19:31:02 +0000 (11:31 -0800)

Git 1.7.9

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

Merge branch 'svn-fe' of git://repo.or.cz/git/jrn into... Junio C Hamano Fri, 27 Jan 2012 19:04:28 +0000 (11:04 -0800)

Merge branch 'svn-fe' of git://repo.or.cz/git/jrn into jn/svn-fe

This simplifies svn-fe a great deal and fulfills a longstanding wish:
support for dumps with deltas in them, and incremental imports.

The cost is that commandline usage of the svn-fe tool becomes a little
more complicated since it no longer keeps state itself but instead reads
blobs back from fast-import in order to copy them between revisions and
apply deltas to them.

Also removes a couple of custom data structures and replaces them with
strbufs like other parts of Git.

* 'svn-fe' of git://repo.or.cz/git/jrn: (32 commits)
vcs-svn: reset first_commit_done in fast_export_init
vcs-svn: do not initialize report_buffer twice
vcs-svn: avoid hangs from corrupt deltas
vcs-svn: guard against overflow when computing preimage length
vcs-svn: cap number of bytes read from sliding view
test-svn-fe: split off "test-svn-fe -d" into a separate function
vcs-svn: implement text-delta handling
vcs-svn: let deltas use data from preimage
vcs-svn: let deltas use data from postimage
vcs-svn: verify that deltas consume all inline data
vcs-svn: implement copyfrom_data delta instruction
vcs-svn: read instructions from deltas
vcs-svn: read inline data from deltas
vcs-svn: read the preimage when applying deltas
vcs-svn: parse svndiff0 window header
vcs-svn: skeleton of an svn delta parser
vcs-svn: make buffer_read_binary API more convenient
vcs-svn: learn to maintain a sliding view of a file
Makefile: list one vcs-svn/xdiff object or header per line
vcs-svn: avoid using ls command twice
...

Conflicts:
Makefile
contrib/svn-fe/svn-fe.txt

i18n: Do not force USE_GETTEXT_SCHEME=fallthrough on... Junio C Hamano Tue, 24 Jan 2012 00:31:09 +0000 (18:31 -0600)

i18n: Do not force USE_GETTEXT_SCHEME=fallthrough on NO_GETTEXT

It should merely be the default used when the builder does not say
anything about USE_GETTEXT_SCHEME.

Even with NO_GETTEXT, USE_GETTEXT_SCHEME=gnu may be a way to avoid
possibly slower emulation in our shell scripts.

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

INSTALL: warn about recent Fedora breakageJunio C Hamano Fri, 27 Jan 2012 05:48:33 +0000 (21:48 -0800)

INSTALL: warn about recent Fedora breakage

Recent releases of Redhat/Fedora are reported to ship Perl binary package
with some core modules stripped away (see http://lwn.net/Articles/477234/)
against the upstream Perl5 people's wishes. The Time::HiRes module used by
gitweb one of them.

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

git-completion: workaround zsh COMPREPLY bugFelipe Contreras Wed, 25 Jan 2012 01:37:02 +0000 (03:37 +0200)

git-completion: workaround zsh COMPREPLY bug

zsh adds a backslash (foo\ ) for each item in the COMPREPLY array if IFS
doesn't contain spaces. This issue has been reported[1], but there is no
solution yet.

This wasn't a problem due to another bug[2], which was fixed in zsh
version 4.3.12. After this change, 'git checkout ma<tab>' would resolve
to 'git checkout master\ '.

Aditionally, the introduction of __gitcomp_nl in commit a31e626
(completion: optimize refs completion) in git also made the problem
apparent, as Matthieu Moy reported.

The simplest and most generic solution is to hide all the changes we do
to IFS, so that "foo \nbar " is recognized by zsh as "foo bar". This
works on versions of git before and after the introduction of
__gitcomp_nl (a31e626), and versions of zsh before and after 4.3.12.

Once zsh is fixed, we should conditionally disable this workaround to
have the same benefits as bash users.

[1] http://www.zsh.org/mla/workers/2012/msg00053.html
[2] http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=commitdiff;h=2e25dfb8fd38dbef0a306282ffab1d343ce3ad8d

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t9801: do not overuse test_must_failJunio C Hamano Thu, 26 Jan 2012 19:40:09 +0000 (11:40 -0800)

t9801: do not overuse test_must_fail

test_must_fail is to make sure a program we can potentially break during
the course of updating git itself exits with a non-zero status in a clean
and controlled way.

When we expect a non-zero exit status from the commands we use from the
underlying platform in tests, e.g. making sure a string "error: " does not
appear in the output by running "grep 'error: '", just use "! grep" for
readability. It is not like we will try to update Git and suddenly 'grep'
we use from the system starts segfaulting.

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

git-p4: Change p4 command invocationPete Wyckoff Wed, 25 Jan 2012 23:48:24 +0000 (23:48 +0000)

git-p4: Change p4 command invocation

Change p4 command invocation to avoid going through the shell. This
allows names with spaces and wildcards to work.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: Add test case for complex branch importVitor Antunes Wed, 25 Jan 2012 23:48:23 +0000 (23:48 +0000)

git-p4: Add test case for complex branch import

Check if branches created from old changelists are correctly imported.
Also included some updates to simple branch test so that both are
coherent in respect to each other.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: Search for parent commit on branch creationVitor Antunes Wed, 25 Jan 2012 23:48:22 +0000 (23:48 +0000)

git-p4: Search for parent commit on branch creation

To find out which is its parent the commit of the new branch is compared
sequentially to each blob of the parent branch from the newest to the
oldest. The first blob which results in a zero diff is considered the
parent commit. If none is found, then the commit is applied to the top
of the parent branch.

A fast-import "checkpoint" call is required because diff-tree is only
able to work with blobs on disk. But most of these commits will not be
part of the final imported tree, making fast-import fail. To avoid this,
the temporary branches are tracked and then removed at the end of the
import process.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

docs: minor grammar fixes for v1.7.9 release notesJeff King Wed, 25 Jan 2012 22:20:03 +0000 (17:20 -0500)

docs: minor grammar fixes for v1.7.9 release notes

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

submodule add: fix breakage when re-adding a deep submoduleJens Lehmann Tue, 24 Jan 2012 21:49:56 +0000 (22:49 +0100)

submodule add: fix breakage when re-adding a deep submodule

Since recently a submodule with name <name> has its git directory in the
.git/modules/<name> directory of the superproject while the work tree
contains a gitfile pointing there.

When the same submodule is added on a branch where it wasn't present so
far (it is not found in the .gitmodules file), the name is not initialized
from the path as it should. This leads to a wrong path entered in the
gitfile when the .git/modules/<name> directory is found, as this happily
uses the - now empty - name. It then always points only a single directory
up, even if we have a path deeper in the directory hierarchy.

Fix that by initializing the name of the submodule early in module_clone()
if module_name() returned an empty name and add a test to catch that bug.

Reported-by: Jehan Bing <jehan@orb.com>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone: fix up delay cloning conditionsNguyễn Thái Ngọc Duy Tue, 24 Jan 2012 11:10:38 +0000 (18:10 +0700)

clone: fix up delay cloning conditions

6f48d39 (clone: delay cloning until after remote HEAD checking -
2012-01-16) allows us to perform some checks on remote refs before the
actual cloning happens. But not all transport types support
this. Remote helper with "import" capability will not return complete
ref information until fetch is performed and therefore the clone cannot
be delayed.

foreign_vcs field in struct remote was used to detect this kind of transport
and save the result. This is a mistake because foreign_vcs is designed
to override url-based transport detection. As a result, if the same
"struct transport *" object is used on many different urls and one of
them attached remote transport, the following urls will be mistakenly
attached to the same transport. This fault is worked around by dad0b3d
(push: do not let configured foreign-vcs permanently clobbered -
2012-01-23)

To fix this, detect incomplete refs from transport_get_remote_refs()
by SHA-1. Incomplete ones must have null SHA-1 (*). Then revert
changes related to foreign_cvs field in 6f48d39 and dad0b3d.

A good thing from this change is that cloning smart http transport can
also be delayed. Earlier it falls into the same category "remote
transport, no delay".

(*) Theoretically if one of the remote refs happens to have null SHA-1,
it will trigger false alarm and the clone will not be delayed. But
that chance may be too small for us to pay attention to.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

push: do not let configured foreign-vcs permanently... Junio C Hamano Tue, 24 Jan 2012 00:34:22 +0000 (16:34 -0800)

push: do not let configured foreign-vcs permanently clobbered

Recently, 6f48d39 (clone: delay cloning until after remote HEAD checking,
2012-01-16) tried to record if a remote helper needs to be called after
parsing the remote when transport_get() is called, by overwriting the
field meant to store the configured remote helper name in the remote
structure.

This is OK when a remote represents a single remote repository, but fails
miserably when pushing to locations with multiple URLs, like this:

$ cat .git/config
[remote "origin"]
url = https://code.google.com/p/git-htmldocs/
url = github.com:gitster/git-htmldocs.git
push = refs/heads/master:refs/heads/master
$ git push

The second url that is supposed to use the git-over-ssh transport
mistakenly use https:// and fails with:

error: Couldn't resolve host 'github.com:gitster' while accessing
github.com:gitster/git-htmldocs.git/info/refs
fatal: HTTP request failed

The right solution would probably be to dedicate a separate field to store
the detected external helper to be used, which is valid only during a
single use of transport until it is disconnected, instead of overwriting
foreign_vcs field, but in the meantime, this band-aid should suffice.

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

merge: use editor by default in interactive sessionsJunio C Hamano Wed, 11 Jan 2012 06:44:45 +0000 (22:44 -0800)

merge: use editor by default in interactive sessions

Traditionally, a cleanly resolved merge was committed by "git merge" using
the auto-generated merge commit log message without invoking the editor.

After 5 years of use in the field, it turns out that people perform too
many unjustified merges of the upstream history into their topic branches.
These merges are not just useless, but they are often not explained well,
and making the end result unreadable when it gets time for merging their
history back to their upstream.

Earlier we added the "--edit" option to the command, so that people can
edit the log message to explain and justify their merge commits. Let's
take it one step further and spawn the editor by default when we are in an
interactive session (i.e. the standard input and the standard output are
pointing at the same tty device).

There may be existing scripts that leave the standard input and the
standard output of the "git merge" connected to whatever environment the
scripts were started, and such invocation might trigger the above
"interactive session" heuristics. GIT_MERGE_AUTOEDIT environment variable
can be set to "no" at the beginning of such scripts to use the historical
behaviour while the script runs.

Note that this backward compatibility is meant only for scripts, and we
deliberately do *not* support "merge.edit = yes/no/auto" configuration
option to allow people to keep the historical behaviour.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

i18n: Make NO_GETTEXT imply fallthrough scheme in shell... Junio C Hamano Mon, 23 Jan 2012 22:25:19 +0000 (14:25 -0800)

i18n: Make NO_GETTEXT imply fallthrough scheme in shell l10n

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

add a Makefile switch to avoid gettext translation... Alex Riesen Mon, 23 Jan 2012 22:04:29 +0000 (14:04 -0800)

add a Makefile switch to avoid gettext translation in shell scripts

Some systems have gettext.sh (GNU gettext) installed, but it is either
broken or misconfigured in such a way so its output is not usable. In
case the users of these systems are unable or not interested in fixing
them, setting the new Makefile switch should help:

make USE_GETTEXT_SCHEME=fallthrough

This will replace the translation routines with fallthrough versions,
that does not use gettext from the platform.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-sh-i18n: restructure the logic to compute gettext... Junio C Hamano Mon, 23 Jan 2012 22:02:55 +0000 (14:02 -0800)

git-sh-i18n: restructure the logic to compute gettext.sh scheme

Instead of having a single long and complex chain of commands to decide
what to do and carry out the decision, split the code so that we first
decide which scheme to use, and in the second section define what exactly
is done by the chosen scheme. It makes the code much easier to follow and
update.

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

mergetool: Provide an empty file when neededDavid Aguilar Fri, 20 Jan 2012 07:47:35 +0000 (23:47 -0800)

mergetool: Provide an empty file when needed

Some merge tools cannot cope when $LOCAL, $BASE, or $REMOTE are missing.
$BASE can be missing when two branches independently add the same
filename.

Provide an empty file to make these tools happy.

When a delete/modify conflict occurs, $LOCAL and $REMOTE can also be
missing. We have special case code to handle such case so this change
may not affect that codepath, but try to be consistent and create an
empty file for them anyway.

Reported-by: Jason Wenger <jcwenger@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: fix -l/-L interaction with decoration linesAlbert Yale Mon, 23 Jan 2012 17:52:44 +0000 (18:52 +0100)

grep: fix -l/-L interaction with decoration lines

In threaded mode, git-grep emits file breaks (enabled with context, -W
and --break) into the accumulation buffers even if they are not
required. The output collection thread then uses skip_first_line to
skip the first such line in the output, which would otherwise be at
the very top.

This is wrong when the user also specified -l/-L/-c, in which case
every line is relevant. While arguably giving these options together
doesn't make any sense, git-grep has always quietly accepted it. So
do not skip anything in these cases.

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

Fix typo in 1.7.9 release notesMichael Haggerty Mon, 23 Jan 2012 12:09:58 +0000 (13:09 +0100)

Fix typo in 1.7.9 release notes

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/Makefile: Use $(sort ...) explicitly where neededKirill Smelkov Sat, 3 Sep 2011 20:41:21 +0000 (00:41 +0400)

t/Makefile: Use $(sort ...) explicitly where needed

Starting from GNU Make 3.82 $(wildcard ...) no longer sorts the result
(from NEWS):

* WARNING: Backward-incompatibility!
Wildcards were not documented as returning sorted values, but the results
have been sorted up until this release.. If your makefiles require sorted
results from wildcard expansions, use the $(sort ...) function to request
it explicitly.

http://repo.or.cz/w/make.git/commitdiff/2a59dc32aaf0681dec569f32a9d7ab88a379d34f

I usually watch test progress visually, and if tests are sorted, even
with make -j4 they go more or less incrementally by their t number. On
the other side, without sorting, tests are executed in seemingly random
order even for -j1. Let's please maintain sane tests order for perceived
prettyness.

Another note is that in GNU Make sort also works as uniq, so after sort
being removed, we might expect e.g. $(wildcard *.sh a.*) to produce
duplicates for e.g. "a.sh". From this point of view, adding sort could
be seen as hardening t/Makefile from accidentally introduced dups.

It turned out that prevous releases of GNU Make did not perform full
sort in $(wildcard), only sorting results for each pattern, that's why
explicit sort-as-uniq is relevant even for older makes.

Signed-off-by: Kirill Smelkov <kirr@navytux.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: label import fails with multiple labels at... Luke Diamand Thu, 19 Jan 2012 09:52:29 +0000 (09:52 +0000)

git-p4: label import fails with multiple labels at the same changelist

git-p4 has an array of changelists with one label per changelist.
But you can have multiple labels on a single changelist and so this
code fails.

Add a test case demonstrating the problem.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: add test for p4 labelsLuke Diamand Thu, 19 Jan 2012 09:52:28 +0000 (09:52 +0000)

git-p4: add test for p4 labels

Add basic test of p4 label import. Checks label import and
import with shell metachars; labels with different length
descriptions.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: importing labels should cope with missing ownerLuke Diamand Thu, 19 Jan 2012 09:52:27 +0000 (09:52 +0000)

git-p4: importing labels should cope with missing owner

In p4, the Owner field is optional. If it is missing,
construct something sensible rather than crashing.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: cope with labels with empty descriptionsLuke Diamand Thu, 19 Jan 2012 09:52:26 +0000 (09:52 +0000)

git-p4: cope with labels with empty descriptions

Use an explicit length for the data in a label, rather
than EOT, so that labels with empty descriptions are
passed through correctly.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: handle p4 branches and labels containing shell... Luke Diamand Thu, 19 Jan 2012 09:52:25 +0000 (09:52 +0000)

git-p4: handle p4 branches and labels containing shell chars

Don't use shell expansion when detecting branches, as it will
fail if the branch name contains a shell metachar. Similarly
for labels.

Add additional test for branches with shell metachars.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote-curl: Fix push status report when all branches... Shawn O. Pearce Fri, 20 Jan 2012 03:12:09 +0000 (19:12 -0800)

remote-curl: Fix push status report when all branches fail

The protocol between transport-helper.c and remote-curl requires
remote-curl to always print a blank line after the push command
has run. If the blank line is ommitted, transport-helper kills its
container process (the git push the user started) with exit(128)
and no message indicating a problem, assuming the helper already
printed reasonable error text to the console.

However if the remote rejects all branches with "ng" commands in the
report-status reply, send-pack terminates with non-zero status, and
in turn remote-curl exited with non-zero status before outputting
the blank line after the helper status printed by send-pack. No
error messages reach the user.

This caused users to see the following from git push over HTTP
when the remote side's update hook rejected the branch:

$ git push http://... master
Counting objects: 4, done.
Delta compression using up to 6 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 301 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
$

Always print a blank line after the send-pack process terminates,
ensuring the helper status report (if it was output) will be
correctly parsed by the calling transport-helper.c. This ensures
the helper doesn't abort before the status report can be shown to
the user.

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

Making pathspec limited log play nicer with --first... Junio C Hamano Thu, 19 Jan 2012 19:58:45 +0000 (11:58 -0800)

Making pathspec limited log play nicer with --first-parent

In a topic branch workflow, you often want to find the latest commit that
merged a side branch that touched a particular area of the system, so that
a new topic branch to work on that area can be forked from that commit.
For example, I wanted to find an appropriate fork-point to queue Luke's
changes related to git-p4 in contrib/fast-import/.

"git log --first-parent" traverses the first-parent chain, and "-m --stat"
shows the list of paths touched by commits including merge commits. We
could ask the question this way:

# What is the latest commit that touched that path?
$ git log --first-parent --oneline -m --stat master |
sed -e '/^ contrib\/fast-import\/git-p4 /q' | tail

The above finds that 8cbfc11 (Merge branch 'pw/p4-view-updates',
2012-01-06) was such a commit.

But a more natural way to spell this question is this:

$ git log --first-parent --oneline -m --stat -1 master -- \
contrib/fast-import/git-p4

Unfortunately, this does not work. It finds ecb7cf9 (git-p4: rewrite view
handling, 2012-01-02). This commit is a part of the merged topic branch
and is _not_ on the first-parent path from the 'master':

$ git show-branch 8cbfc11 ecb7cf9
! [8cbfc11] Merge branch 'pw/p4-view-updates'
! [ecb7cf9] git-p4: rewrite view handling
--
- [8cbfc11] Merge branch 'pw/p4-view-updates'
+ [8cbfc11^2] git-p4: view spec documentation
++ [ecb7cf9] git-p4: rewrite view handling

The problem is caused by the merge simplification logic when it inspects
the merge commit 8cbfc11. In this case, the history leading to the tip of
'master' did not touch git-p4 since 'pw/p4-view-updates' topic forked, and
the result of the merge is simply a copy from the tip of the topic branch
in the view limited by the given pathspec. The merge simplification logic
discards the history on the mainline side of the merge, and pretends as if
the sole parent of the merge is its second parent, i.e. the tip of the
topic. While this simplification is correct in the general case, it is at
least surprising if not outright wrong when the user explicitly asked to
show the first-parent history.

Here is an attempt to fix this issue, by not allowing us to compare the
merge result with anything but the first parent when --first-parent is in
effect, to avoid the history traversal veering off to the side branch.

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

Git 1.7.9-rc2 v1.7.9-rc2Junio C Hamano Wed, 18 Jan 2012 23:53:35 +0000 (15:53 -0800)

Git 1.7.9-rc2

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

Merge branch 'maint'Junio C Hamano Wed, 18 Jan 2012 23:52:08 +0000 (15:52 -0800)

Merge branch 'maint'

* maint:
Git 1.7.8.4
Git 1.7.7.6
diff-index: enable recursive pathspec matching in unpack_trees

Conflicts:
GIT-VERSION-GEN

Git 1.7.8.4 v1.7.8.4Junio C Hamano Wed, 18 Jan 2012 23:51:00 +0000 (15:51 -0800)

Git 1.7.8.4

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

Merge branch 'maint-1.7.7' into maintJunio C Hamano Wed, 18 Jan 2012 23:48:46 +0000 (15:48 -0800)

Merge branch 'maint-1.7.7' into maint

* maint-1.7.7:
Git 1.7.7.6
diff-index: enable recursive pathspec matching in unpack_trees

Conflicts:
GIT-VERSION-GEN

Git 1.7.7.6 v1.7.7.6Junio C Hamano Wed, 18 Jan 2012 23:46:31 +0000 (15:46 -0800)

Git 1.7.7.6

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

diff-index: enable recursive pathspec matching in unpac... Nguyen Thai Ngoc Duy Sun, 15 Jan 2012 10:03:27 +0000 (17:03 +0700)

diff-index: enable recursive pathspec matching in unpack_trees

The pathspec structure has a few bits of data to drive various operation
modes after we unified the pathspec matching logic in various codepaths.
For example, max_depth field is there so that "git grep" can limit the
output for files found in limited depth of tree traversal. Also in order
to show just the surface level differences in "git diff-tree", recursive
field stops us from descending into deeper level of the tree structure
when it is set to false, and this also affects pathspec matching when
we have wildcards in the pathspec.

The diff-index has always wanted the recursive behaviour, and wanted to
match pathspecs without any depth limit. But we forgot to do so when we
updated tree_entry_interesting() logic to unify the pathspec matching
logic.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jc/pull-signed-tag-doc'Junio C Hamano Wed, 18 Jan 2012 23:18:02 +0000 (15:18 -0800)

Merge branch 'jc/pull-signed-tag-doc'

* jc/pull-signed-tag-doc:
pulling signed tag: add howto document

pulling signed tag: add howto documentJunio C Hamano Tue, 17 Jan 2012 22:52:24 +0000 (14:52 -0800)

pulling signed tag: add howto document

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

Merge branch 'jk/credentials'Junio C Hamano Wed, 18 Jan 2012 23:16:53 +0000 (15:16 -0800)

Merge branch 'jk/credentials'

* jk/credentials:
credential-cache: ignore "connection refused" errors
unix-socket: do not let close() or chdir() clobber errno during cleanup
credential-cache: report more daemon connection errors
unix-socket: handle long socket pathnames