git
13 years agohelp.c: Fix detection of custom merge strategy on cygwin
Ramsay Jones [Thu, 16 Jun 2011 20:22:16 +0000 (21:22 +0100)] 
help.c: Fix detection of custom merge strategy on cygwin

Test t7606-merge-custom.sh fails on cygwin when git-merge fails
with an "Could not find merge strategy 'theirs'" error, despite
the test correctly preparing an (executable) git-merge-theirs
script.

The cause of the failure is the mis-detection of the executable
status of the script, by the is_executable() function, while the
load_command_list() function is searching the path for additional
merge strategy programs.

Note that the l/stat() "functions" on cygwin are somewhat
schizophrenic (see commits adbc0b67faee6b and 7974843), and
their behaviour depends on the timing of various git setup and
config function calls. In particular, until the "git_dir" has
been set (have_git_dir() returns true), the real cygwin (POSIX
emulating) l/stat() functions are called. Once "git_dir" has
been set, the "native Win32 API" implementations of l/stat()
may, or may not, be called depending on the setting of the
core.filemode and core.ignorecygwinfstricks config variables.

We also note that, since commit c869753, core.filemode is forced
to false, even on NTFS, by git-init and git-clone. A user (or a
test) can, of course, reset core.filemode to true explicitly if
the filesystem supports it (and he doesn't use any problematic
windows software). The test-suite currently runs all tests on
cygwin with core.filemode set to false.

Given the above, we see that the built-in merge strategies are
correctly detected as executable, since they are checked for
before "git_dir" is set, whereas all custom merge strategies are
not, since they are checked for after "git_dir" is set.

In order to fix the mis-detection problem, we change the code in
is_executable() to re-use the conditional WIN32 code section,
which actually looks at the content of the file to determine if
the file is executable. On cygwin we also make the additional
code conditional on the executable bit of the file mode returned
by the initial stat() call. (only the real cygwin function would
set the executable bit in the file mode.)

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix typo: existant->existent
Dmitry Ivankov [Thu, 16 Jun 2011 13:42:48 +0000 (19:42 +0600)] 
Fix typo: existant->existent

refs.c had a error message "Trying to write ref with nonexistant object".
And no tests relied on the wrong spelling.
Also typo was present in some test scripts internals, these tests still pass.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.6-rc2 v1.7.6-rc2
Junio C Hamano [Thu, 16 Jun 2011 16:21:36 +0000 (09:21 -0700)] 
Git 1.7.6-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot/gitweb-lib.sh: skip gitweb tests when perl dependencies are not met
Junio C Hamano [Wed, 15 Jun 2011 16:54:15 +0000 (09:54 -0700)] 
t/gitweb-lib.sh: skip gitweb tests when perl dependencies are not met

Linus noticed that we go ahead testing gitweb and fail miserably on a
box with Perl but not perl-CGI library. We already have a code to detect
lack of Perl and refrain from testing gitweb in t/gitweb-lib.sh (by the
way, shouldn't it be called t/lib-gitweb.sh?), so let's extend it
to cover this case as well.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUpdate the Interix default build configuration.
Markus Duft [Wed, 15 Jun 2011 11:34:18 +0000 (13:34 +0200)] 
Update the Interix default build configuration.

Currently, on Interix, libsuacomp is required for building (see [1]).

Since suacomp provides poll() and inttypes.h for all interix versions,
remove NO_*=YesPlease that are no longer necessary.

Interix versions 3 and 5 miss struct sockaddr_storage, so make git
avoid using it.

Same for FNMATCH_CASEFOLD, which does not exist for Interix 3 and 5.

[1] http://news.gmane.org/find-root.php?message_id=%3c4DDF4440.4040405%40gentoo.org%3e

Signed-off-by: Markus Duft <mduft@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: allow space as delimiter in mime.types
Ludwig Nussel [Wed, 15 Jun 2011 06:10:08 +0000 (08:10 +0200)] 
gitweb: allow space as delimiter in mime.types

in openSUSE /etc/mime.types has only spaces. I don't know if there's
a canonical reference that says that only tabs are allowed. Mutt at
least also accepts spaces. So make gitweb more liberal too.

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-submodule.sh: clarify the "should we die now" logic
Junio C Hamano [Mon, 13 Jun 2011 19:17:52 +0000 (12:17 -0700)] 
git-submodule.sh: clarify the "should we die now" logic

Earlier the decision to stop or continue was made on the $action variable
that was set by inspecting $update_module variable. The former is a
redundant variable and will be removed in another topic.

Decide upon inspecting $update_module if a failure should cascade up to
cause us immediately stop, and use a variable that means just that, to
clarify the logic.

Incidentally this also makes the merge with the other topic slightly
easier and cleaner to understand.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosubmodule update: continue when a checkout fails
Fredrik Gustafsson [Mon, 13 Jun 2011 17:15:26 +0000 (19:15 +0200)] 
submodule update: continue when a checkout fails

"git submodule update" stops at the first error and gives control
back to the user. Only after the user fixes the problematic
submodule and runs "git submodule update" again, the second error
is found. And the user needs to repeat until all the problems are
found and fixed one by one. This is tedious.

Instead, the command can remember which submodules it had trouble with,
continue updating the ones it can, and report which ones had errors at
the end. The user can run "git submodule update", find all the ones that
need minor fixing (e.g. working tree was dirty) to fix them in a single
pass. Then another "git submodule update" can be run to update all.

Note that the problematic submodules are skipped only when they are to
be integrated with a safer value of submodule.<name>.update option,
namely "checkout". Fixing a failure in a submodule that uses "rebase" or
"merge" may need an involved conflict resolution by the user, and
leaving too many submodules in states that need resolution would not
reduce the mental burden on the user.

Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
Mentored-by: Jens Lehmann <Jens.Lehmann@web.de>
Mentored-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-sh-setup: add die_with_status
Fredrik Gustafsson [Thu, 9 Jun 2011 07:47:02 +0000 (09:47 +0200)] 
git-sh-setup: add die_with_status

This behaves similar to "die" but can exit with status different from the
usual 1.

Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
Mentored-by: Jens Lehmann <Jens.Lehmann@web.de>
Mentored-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodefault core.clockskew variable to one day
Jeff King [Sat, 11 Jun 2011 19:04:10 +0000 (19:04 +0000)] 
default core.clockskew variable to one day

This is the slop value used by name-rev, so presumably is a
reasonable default.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agolimit "contains" traversals based on commit timestamp
Jeff King [Sat, 11 Jun 2011 19:04:09 +0000 (19:04 +0000)] 
limit "contains" traversals based on commit timestamp

When looking for commits that contain other commits (e.g.,
via "git tag --contains"), we can end up traversing useless
portions of the graph. For example, if I am looking for a
tag that contains a commit made last week, there is not much
point in traversing portions of the history graph made five
years ago.

This optimization can provide massive speedups. For example,
doing "git tag --contains HEAD~200" in the linux-2.6
repository goes from:

  real    0m5.302s
  user    0m5.116s
  sys     0m0.184s

to:

  real    0m0.030s
  user    0m0.020s
  sys     0m0.008s

The downside is that we will no longer find some answers in
the face of extreme clock skew, as we will stop the
traversal early when seeing commits skewed too far into the
past.

Name-rev already implements a similar optimization, using a
"slop" of one day to allow for a certain amount of clock
skew in commit timestamps. This patch introduces a
"core.clockskew" variable, which allows specifying the
allowable amount of clock skew in seconds.  For safety, it
defaults to "none", causing a full traversal (i.e., no
change in behavior from previous versions).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotag: speed up --contains calculation
Jeff King [Sat, 11 Jun 2011 19:04:08 +0000 (19:04 +0000)] 
tag: speed up --contains calculation

When we want to know if commit A contains commit B (or any
one of a set of commits, B through Z), we generally
calculate the merge bases and see if B is a merge base of A
(or for a set, if any of the commits B through Z have that
property).

When we are going to check a series of commits A1 through An
to see whether each contains B (e.g., because we are
deciding which tags to show with "git tag --contains"), we
do a series of merge base calculations. This can be very
expensive, as we repeat a lot of traversal work.

Instead, let's leverage the fact that we are going to use
the same --contains list for each tag, and mark areas of the
commit graph is definitely containing those commits, or
definitely not containing those commits. Later tags can then
stop traversing as soon as they see a previously calculated
answer.

This sped up "git tag --contains HEAD~200" in the linux-2.6
repository from:

  real    0m15.417s
  user    0m15.197s
  sys     0m0.220s

to:

  real    0m5.329s
  user    0m5.144s
  sys     0m0.184s

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agozlib: allow feeding more than 4GB in one go
Junio C Hamano [Fri, 10 Jun 2011 19:15:17 +0000 (12:15 -0700)] 
zlib: allow feeding more than 4GB in one go

Update zlib_post_call() that adjusts the wrapper's notion of avail_in and
avail_out to what came back from zlib, so that the callers can feed
buffers larger than than 4GB to the API.

When underlying inflate/deflate stopped processing because we fed a buffer
larger than 4GB limit, detect that case, update the state variables, and
let the zlib function work another round.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agozlib: zlib can only process 4GB at a time
Junio C Hamano [Fri, 10 Jun 2011 18:52:15 +0000 (11:52 -0700)] 
zlib: zlib can only process 4GB at a time

The size of objects we read from the repository and data we try to put
into the repository are represented in "unsigned long", so that on larger
architectures we can handle objects that weigh more than 4GB.

But the interface defined in zlib.h to communicate with inflate/deflate
limits avail_in (how many bytes of input are we calling zlib with) and
avail_out (how many bytes of output from zlib are we ready to accept)
fields effectively to 4GB by defining their type to be uInt.

In many places in our code, we allocate a large buffer (e.g. mmap'ing a
large loose object file) and tell zlib its size by assigning the size to
avail_in field of the stream, but that will truncate the high octets of
the real size. The worst part of this story is that we often pass around
z_stream (the state object used by zlib) to keep track of the number of
used bytes in input/output buffer by inspecting these two fields, which
practically limits our callchain to the same 4GB limit.

Wrap z_stream in another structure git_zstream that can express avail_in
and avail_out in unsigned long. For now, just die() when the caller gives
a size that cannot be given to a single zlib call. In later patches in the
series, we would make git_inflate() and git_deflate() internally loop to
give callers an illusion that our "improved" version of zlib interface can
operate on a buffer larger than 4GB in one go.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agozlib: wrap deflateBound() too
Junio C Hamano [Fri, 10 Jun 2011 18:18:17 +0000 (11:18 -0700)] 
zlib: wrap deflateBound() too

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agozlib: wrap deflate side of the API
Junio C Hamano [Fri, 10 Jun 2011 17:55:10 +0000 (10:55 -0700)] 
zlib: wrap deflate side of the API

Wrap deflateInit, deflate, and deflateEnd for everybody, and the sole use
of deflateInit2 in remote-curl.c to tell the library to use gzip header
and trailer in git_deflate_init_gzip().

There is only one caller that cares about the status from deflateEnd().
Introduce git_deflate_end_gently() to let that sole caller retrieve the
status and act on it (i.e. die) for now, but we would probably want to
make inflate_end/deflate_end die when they ran out of memory and get
rid of the _gently() kind.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agozlib: wrap inflateInit2 used to accept only for gzip format
Junio C Hamano [Fri, 10 Jun 2011 17:45:29 +0000 (10:45 -0700)] 
zlib: wrap inflateInit2 used to accept only for gzip format

http-backend.c uses inflateInit2() to tell the library that it wants to
accept only gzip format. Wrap it in a helper function so that readers do
not have to wonder what the magic numbers 15 and 16 are for.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agozlib: wrap remaining calls to direct inflate/inflateEnd
Junio C Hamano [Fri, 10 Jun 2011 17:39:27 +0000 (10:39 -0700)] 
zlib: wrap remaining calls to direct inflate/inflateEnd

Two callsites in http-backend.c to inflate() and inflateEnd()
were not using git_ prefixed versions.  After this, running

    $ find all objects -print | xargs nm -ugo | grep inflate

shows only zlib.c makes direct calls to zlib for inflate operation,
except for a singlecall to inflateInit2 in http-backend.c

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agozlib wrapper: refactor error message formatter
Junio C Hamano [Fri, 10 Jun 2011 17:31:34 +0000 (10:31 -0700)] 
zlib wrapper: refactor error message formatter

Before refactoring the main part of the wrappers, first move the
logic to convert error status that come back from zlib to string
to a helper function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: do not misparse nonnumeric content tag files that contain a digit
Jonathan Nieder [Thu, 9 Jun 2011 07:08:57 +0000 (02:08 -0500)] 
gitweb: do not misparse nonnumeric content tag files that contain a digit

v1.7.6-rc0~27^2~4 (gitweb: Change the way "content tags" ('ctags') are
handled, 2011-04-29) tried to make gitweb's tag cloud feature more
intuitive for webmasters by checking whether the ctags/<label> under
a project's .git dir contains a number (representing the strength of
association to <label>) before treating it as one.

With that change, after putting '$feature{'ctags'}{'default'} = [1];'
in your $GITWEB_CONFIG, you could do

echo Linux >.git/ctags/linux

and gitweb would treat that as a request to tag the current repository
with the Linux tag, instead of the previous behavior of writing an
error page embedded in the projects list that triggers error messages
from Chromium and Firefox about malformed XML.

Unfortunately the pattern (\d+) used to match numbers is too loose,
and the "XML declaration allowed only at the start of the document"
error can still be experienced if you write "Linux-2.6" in place of
"Linux" in the example above.  Fix it by tightening the pattern to
^\d+$.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.6-rc1 v1.7.6-rc1
Junio C Hamano [Thu, 9 Jun 2011 01:29:48 +0000 (18:29 -0700)] 
Git 1.7.6-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Thu, 9 Jun 2011 01:13:39 +0000 (18:13 -0700)] 
Merge branch 'maint'

* maint:
  fetch: do not leak a refspec

13 years agoDocument the underlying protocol used by shallow repositories and --depth commands.
Alex Neronskiy [Wed, 8 Jun 2011 22:11:51 +0000 (15:11 -0700)] 
Document the underlying protocol used by shallow repositories and --depth commands.

Explain the exchange that occurs between a client and server when
the client is requesting shallow history and/or is already using
a shallow repository.

Signed-off-by: Alex Neronskiy <zakmagnus@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix documentation of fetch-pack that implies that the client can disconnect after...
Alex Neronskiy [Wed, 8 Jun 2011 22:11:50 +0000 (15:11 -0700)] 
Fix documentation of fetch-pack that implies that the client can disconnect after sending wants.

Specify conditions under which the client can terminate the connection
early. Previously, an unintended behavior was possible which could
confuse servers.

Based-on-patch-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Alex Neronskiy <zakmagnus@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agofetch: do not leak a refspec
Jim Meyering [Wed, 8 Jun 2011 20:06:33 +0000 (22:06 +0200)] 
fetch: do not leak a refspec

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosha1_file.c: "legacy" is really the current format
Junio C Hamano [Wed, 8 Jun 2011 18:29:01 +0000 (11:29 -0700)] 
sha1_file.c: "legacy" is really the current format

Every time I look at the read-loose-object codepath, legacy_loose_object()
function makes my brain go through mental contortion. When we were playing
with the experimental loose object format, it may have made sense to call
the traditional format "legacy", in the hope that the experimental one
will some day replace it to become official, but it never happened.

This renames the function (and negates its return value) to detect if we
are looking at the experimental format, and move the code around in its
caller which used to do "if we are looing at legacy, do this special case,
otherwise the normal case is this". The codepath to read from the loose
objects in experimental format is the "unlikely" case.

Someday after Git 2.0, we should drop the support of this format.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoverify_dotfile(): do not assume '/' is the path seperator
Theo Niessink [Wed, 8 Jun 2011 12:04:41 +0000 (14:04 +0200)] 
verify_dotfile(): do not assume '/' is the path seperator

verify_dotfile() currently assumes that the path seperator is '/', but on
Windows it can also be '\\', so use is_dir_sep() instead.

Signed-off-by: Theo Niessink <theo@taletn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoverify_path(): simplify check at the directory boundary
Junio C Hamano [Tue, 7 Jun 2011 03:49:06 +0000 (20:49 -0700)] 
verify_path(): simplify check at the directory boundary

We simply want to say "At a directory boundary, be careful with a name
that begins with a dot, forbid a name that ends with the boundary
character or has duplicated bounadry characters".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/magic-pathspec'
Junio C Hamano [Tue, 7 Jun 2011 15:32:42 +0000 (08:32 -0700)] 
Merge branch 'jc/magic-pathspec'

* jc/magic-pathspec:
  t3703: skip more tests using colons in file names on Windows

13 years agot3703: skip more tests using colons in file names on Windows
Alex Riesen [Tue, 7 Jun 2011 09:49:44 +0000 (11:49 +0200)] 
t3703: skip more tests using colons in file names on Windows

Use the same test and prerequisite as introduced in similar
fix in 650af7ae8bdf92bd92df2.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jn/mime-type-with-params'
Junio C Hamano [Mon, 6 Jun 2011 18:40:22 +0000 (11:40 -0700)] 
Merge branch 'jn/mime-type-with-params'

* jn/mime-type-with-params:
  gitweb: Fix usability of $prevent_xss

13 years agoMerge branch 'jn/gitweb-docs'
Junio C Hamano [Mon, 6 Jun 2011 18:40:18 +0000 (11:40 -0700)] 
Merge branch 'jn/gitweb-docs'

* jn/gitweb-docs:
  gitweb: Move "Requirements" up in gitweb/INSTALL
  gitweb: Describe CSSMIN and JSMIN in gitweb/INSTALL
  gitweb: Move information about installation from README to INSTALL

13 years agoMerge branch 'jk/diff-not-so-quick'
Junio C Hamano [Mon, 6 Jun 2011 18:40:14 +0000 (11:40 -0700)] 
Merge branch 'jk/diff-not-so-quick'

* jk/diff-not-so-quick:
  diff: futureproof "stop feeding the backend early" logic
  diff_tree: disable QUICK optimization with diff filter

Conflicts:
diff.c

13 years agoMerge branch 'bc/maint-status-z-to-use-porcelain'
Junio C Hamano [Mon, 6 Jun 2011 18:40:08 +0000 (11:40 -0700)] 
Merge branch 'bc/maint-status-z-to-use-porcelain'

* bc/maint-status-z-to-use-porcelain:
  builtin/commit.c: set status_format _after_ option parsing
  t7508: demonstrate status's failure to use --porcelain format with -z

Conflicts:
builtin/commit.c

13 years agoWindows: teach getenv to do a case-sensitive search
Johannes Sixt [Mon, 6 Jun 2011 07:08:13 +0000 (09:08 +0200)] 
Windows: teach getenv to do a case-sensitive search

getenv() on Windows looks up environment variables in a case-insensitive
manner. Even though all documentations claim that the environment is
case-insensitive, it is possible for applications to pass an environment
to child processes that has variables that differ only in case. Bash on
Windows does this, for example, and sh-i18n--envsubst depends on this
behavior.

With this patch environment variables are first looked up in a
case-sensitive manner; only if this finds nothing, the system's getenv() is
used as a fallback.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomingw.c: move definition of mingw_getenv down
Johannes Sixt [Mon, 6 Jun 2011 07:06:02 +0000 (09:06 +0200)] 
mingw.c: move definition of mingw_getenv down

We want to use static lookup_env() in a subsequent change.

At first sight, this change looks innocent. But it is not due to the
#undef getenv. There is one caller of getenv between the old location and
the new location whose behavior could change. But as can be seen from the
defintion of mingw_getenv, the behavior for this caller does not change
substantially.

To ensure consistent behavior in the future, change all getenv callers
in mingw.c to use mingw_getenv.

With this patch, this is not a big deal, yet, but with the subsequent
change, where we teach getenv to do a case-sensitive lookup, the behavior
of all call sites is changed.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosh-i18n--envsubst: do not crash when no arguments are given
Johannes Sixt [Mon, 6 Jun 2011 06:59:10 +0000 (08:59 +0200)] 
sh-i18n--envsubst: do not crash when no arguments are given

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoverify-pack: use index-pack --verify
Junio C Hamano [Fri, 3 Jun 2011 22:32:17 +0000 (15:32 -0700)] 
verify-pack: use index-pack --verify

This finally gets rid of the inefficient verify-pack implementation that
walks objects in the packfile in their object name order and replaces it
with a call to index-pack --verify. As a side effect, it also removes
packed_object_info_detail() API which is rather expensive.

As this changes the way errors are reported (verify-pack used to rely on
the usual runtime error detection routine unpack_entry() to diagnose the
CRC errors in an entry in the *.idx file; index-pack --verify checks the
whole *.idx file in one go), update a test that expected the string "CRC"
to appear in the error message.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoindex-pack: show histogram when emulating "verify-pack -v"
Junio C Hamano [Fri, 3 Jun 2011 22:32:16 +0000 (15:32 -0700)] 
index-pack: show histogram when emulating "verify-pack -v"

The histogram produced by "verify-pack -v" always had an artificial
limit of 50, but index-pack knows what the maximum delta depth is, so
we do not have to limit it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoindex-pack: start learning to emulate "verify-pack -v"
Junio C Hamano [Fri, 3 Jun 2011 22:32:15 +0000 (15:32 -0700)] 
index-pack: start learning to emulate "verify-pack -v"

The "index-pack" machinery already has almost enough knowledge to produce
the same output as "verify-pack -v". Fill small gaps in its bookkeeping,
and teach it to show what it knows.

Add a few more command line options that do not have to be advertised to
the end users. They will be used internally when verify-pack calls this.
The eventual goal is to remove verify-pack implementation and redo it as a
thin wrapper around the index-pack, so that we can remove the rather
expensive packed_object_info_detail() API.

This still does not do the delta-chain-depth histogram yet but that part
is easy.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoindex-pack: a miniscule refactor
Junio C Hamano [Fri, 3 Jun 2011 22:32:14 +0000 (15:32 -0700)] 
index-pack: a miniscule refactor

Introduce a helper function that takes the type of an object and
tell if it is a delta, as we seem to use this check in many places.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocheckout -b <name>: correctly detect existing branch
Junio C Hamano [Mon, 6 Jun 2011 05:17:04 +0000 (22:17 -0700)] 
checkout -b <name>: correctly detect existing branch

When create a new branch, we fed "refs/heads/<proposed name>" as a string
to get_sha1() and expected it to fail when a branch already exists.

The right way to check if a ref exists is to check with resolve_ref().

A naïve solution that might appear attractive but does not work is to
forbid slashes in get_describe_name() but that will not work. A describe
name is is in the form of "ANYTHING-g<short sha1>", and that ANYTHING part
comes from a original tag name used in the repository the user ran the
describe command. A sick user could have a confusing hierarchical tag
whose name is "refs/heads/foobar" (stored as refs/tags/refs/heads/foobar")
to generate a describe name "refs/heads/foobar-6-g02ac983", and we should
be able to use that name to refer to the object whose name is 02ac983.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogrep: add --heading
René Scharfe [Sun, 5 Jun 2011 15:24:36 +0000 (17:24 +0200)] 
grep: add --heading

With --heading, the filename is printed once before matches from that
file instead of at the start of each line, giving more screen space to
the actual search results.

This option is taken from ack (http://betterthangrep.com/).  And now
git grep can dress up like it:

$ git config alias.ack "grep --break --heading --line-number"

$ git ack -e --heading
Documentation/git-grep.txt
154:--heading::

t/t7810-grep.sh
785:test_expect_success 'grep --heading' '
786:    git grep --heading -e char -e lo_w hello.c hello_world >actual &&
808:    git grep --break --heading -n --color \

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogrep: add --break
René Scharfe [Sun, 5 Jun 2011 15:24:25 +0000 (17:24 +0200)] 
grep: add --break

With --break, an empty line is printed between matches from different
files, increasing readability.  This option is taken from ack
(http://betterthangrep.com/).

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogrep: fix coloring of hunk marks between files
René Scharfe [Sun, 5 Jun 2011 15:24:15 +0000 (17:24 +0200)] 
grep: fix coloring of hunk marks between files

Commit 431d6e7b (grep: enable threading for context line printing)
split the printing of the "--\n" mark between results from different
files out into two places: show_line() in grep.c for the non-threaded
case and work_done() in builtin/grep.c for the threaded case.  Commit
55f638bd (grep: Colorize filename, line number, and separator) updated
the former, but not the latter, so the separators between files are
not colored if threads are used.

This patch merges the two.  In the threaded case, hunk marks are now
printed by show_line() for every file, including the first one, and the
very first mark is simply skipped in work_done().  This ensures that the
output is properly colored and works just as well.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Fix usability of $prevent_xss
Jakub Narebski [Sat, 4 Jun 2011 08:43:35 +0000 (10:43 +0200)] 
gitweb: Fix usability of $prevent_xss

With XSS prevention on (enabled using $prevent_xss), blobs
('blob_plain') of all types except a few known safe ones are served
with "Content-Disposition: attachment".  However the check was too
strict; it didn't take into account optional parameter attributes,

  media-type     = type "/" subtype *( ";" parameter )

as described in RFC 2616

  http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17
  http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7

This fixes that, and it for example treats following as safe MIME
media type:

  text/plain; charset=utf-8

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Move "Requirements" up in gitweb/INSTALL
Jakub Narebski [Fri, 3 Jun 2011 16:31:48 +0000 (18:31 +0200)] 
gitweb: Move "Requirements" up in gitweb/INSTALL

This way you can examine prerequisites at first glance, before
detailed instructions on installing gitweb.  Straightforward
text movement.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agohttp: pass http.cookiefile using CURLOPT_COOKIEFILE
Duncan Brown [Thu, 2 Jun 2011 20:31:25 +0000 (16:31 -0400)] 
http: pass http.cookiefile using CURLOPT_COOKIEFILE

If the config option http.cookiefile is set, pass this file to libCURL using
the CURLOPT_COOKIEFILE option. This is similar to calling curl with the -b
option.  This allows git http authorization with authentication mechanisms
that use cookies, such as SAML Enhanced Client or Proxy (ECP) used by
Shibboleth.

To use SAML/ECP, the user needs to request a session cookie with their own ECP
code. See for example:

<https://wiki.shibboleth.net/confluence/display/SHIB2/ECP>

Once the cookie file has been created, it can be passed to git with, e.g.

git config --global http.cookiefile "/home/dbrown/.curlcookies"

libCURL will then pass the appropriate session cookies to the git http server.

Signed-off-by: Duncan Brown <duncan.brown@ligo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit status --ignored: tests and docs
Junio C Hamano [Thu, 2 Jun 2011 16:07:11 +0000 (09:07 -0700)] 
git status --ignored: tests and docs

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Describe CSSMIN and JSMIN in gitweb/INSTALL
Jakub Narebski [Thu, 2 Jun 2011 14:55:53 +0000 (16:55 +0200)] 
gitweb: Describe CSSMIN and JSMIN in gitweb/INSTALL

The build-time configuration variables JSMIN and CSSMIN were mentioned
only in Makefile; add their description to gitweb/INSTALL.

This required moving description of GITWEB_JS up, near GITWEB_CSS and
just introduced CSMIN and JSMIN.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Move information about installation from README to INSTALL
Jakub Narebski [Thu, 2 Jun 2011 14:55:52 +0000 (16:55 +0200)] 
gitweb: Move information about installation from README to INSTALL

Almost straightformard moving of "How to configure gitweb for your
local system" section from gitweb/README to gitweb/INSTALL, as it is
about build time configuration.  Updated references to it.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot/t7503-pre-commit-hook.sh: Add GIT_PREFIX tests
David Aguilar [Thu, 2 Jun 2011 09:26:25 +0000 (02:26 -0700)] 
t/t7503-pre-commit-hook.sh: Add GIT_PREFIX tests

Ensure that the pre-commit hook has access to GIT_PREFIX.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agostatus: fix bug with missing --ignore files
Jeff King [Thu, 2 Jun 2011 05:54:49 +0000 (01:54 -0400)] 
status: fix bug with missing --ignore files

Commit 1b908b6 (wt-status: rename and restructure
status-print-untracked, 2010-04-10) converted the
wt_status_print_untracked function into
wt_status_print_other, taking a string_list of either
untracked or ignored items to print. However, the "nothing
to show" early return still checked the wt_status->untracked
list instead of the passed-in list.

That meant that if we had ignored items to show, but no
untracked items, we would erroneously exit early and fail to
show the ignored items.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoSync with 1.7.5.4 v1.7.6-rc0
Junio C Hamano [Wed, 1 Jun 2011 21:11:17 +0000 (14:11 -0700)] 
Sync with 1.7.5.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.5.4 v1.7.5.4
Junio C Hamano [Wed, 1 Jun 2011 21:08:26 +0000 (14:08 -0700)] 
Git 1.7.5.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jk/maint-config-alias-fix' into maint
Junio C Hamano [Wed, 1 Jun 2011 21:05:22 +0000 (14:05 -0700)] 
Merge branch 'jk/maint-config-alias-fix' into maint

* jk/maint-config-alias-fix:
  handle_options(): do not miscount how many arguments were used
  config: always parse GIT_CONFIG_PARAMETERS during git_config
  git_config: don't peek at global config_parameters
  config: make environment parsing routines static

13 years agoMerge branch 'jc/fmt-req-fix' into maint
Junio C Hamano [Wed, 1 Jun 2011 21:03:07 +0000 (14:03 -0700)] 
Merge branch 'jc/fmt-req-fix' into maint

* jc/fmt-req-fix:
  userformat_find_requirements(): find requirement for the correct format

13 years agoMerge branch 'jk/maint-docs' into maint
Junio C Hamano [Wed, 1 Jun 2011 21:02:52 +0000 (14:02 -0700)] 
Merge branch 'jk/maint-docs' into maint

* jk/maint-docs:
  docs: fix some antique example output
  docs: make sure literal "->" isn't converted to arrow
  docs: update status --porcelain format
  docs: minor grammar fixes to git-status

13 years agoMerge branch 'jn/doc-remote-helpers' into maint
Junio C Hamano [Wed, 1 Jun 2011 21:02:45 +0000 (14:02 -0700)] 
Merge branch 'jn/doc-remote-helpers' into maint

* jn/doc-remote-helpers:
  Documentation: do not misinterpret refspecs as bold text

13 years agoMerge branch 'kk/maint-prefix-in-config-mak' into maint
Junio C Hamano [Wed, 1 Jun 2011 21:02:39 +0000 (14:02 -0700)] 
Merge branch 'kk/maint-prefix-in-config-mak' into maint

* kk/maint-prefix-in-config-mak:
  config.mak.in: allow "configure --sysconfdir=/else/where"

13 years agodiffcore-rename.c: avoid set-but-not-used warning
Jim Meyering [Fri, 29 Apr 2011 09:42:41 +0000 (11:42 +0200)] 
diffcore-rename.c: avoid set-but-not-used warning

Since 9d8a5a5 (diffcore-rename: refactor "too many candidates" logic,
2011-01-06), diffcore_rename() initializes num_src but does not use it
anymore.  "-Wunused-but-set-variable" in gcc-4.6 complains about this.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUpdate draft release notes to 1.7.6
Junio C Hamano [Tue, 31 May 2011 19:22:50 +0000 (12:22 -0700)] 
Update draft release notes to 1.7.6

I think we are almost there for the feature freeze.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jk/format-patch-am'
Junio C Hamano [Tue, 31 May 2011 19:19:11 +0000 (12:19 -0700)] 
Merge branch 'jk/format-patch-am'

* jk/format-patch-am:
  format-patch: preserve subject newlines with -k
  clean up calling conventions for pretty.c functions
  pretty: add pp_commit_easy function for simple callers
  mailinfo: always clean up rfc822 header folding
  t: test subject handling in format-patch / am pipeline

Conflicts:
builtin/branch.c
builtin/log.c
commit.h

13 years agoMerge branch 'jn/doc-remote-helpers'
Junio C Hamano [Tue, 31 May 2011 19:09:35 +0000 (12:09 -0700)] 
Merge branch 'jn/doc-remote-helpers'

* jn/doc-remote-helpers:
  Documentation: do not misinterpret refspecs as bold text

13 years agoMerge branch 'jk/format-patch-empty-prefix'
Junio C Hamano [Tue, 31 May 2011 19:09:27 +0000 (12:09 -0700)] 
Merge branch 'jk/format-patch-empty-prefix'

* jk/format-patch-empty-prefix:
  format-patch: make zero-length subject prefixes prettier

13 years agoMerge branch 'ab/i18n-envsubst-doc-fix'
Junio C Hamano [Tue, 31 May 2011 19:09:21 +0000 (12:09 -0700)] 
Merge branch 'ab/i18n-envsubst-doc-fix'

* ab/i18n-envsubst-doc-fix:
  git-sh-i18n--envsubst: add SYNOPSIS section to the documentation

13 years agoMerge branch 'jc/log-quiet-fix'
Junio C Hamano [Tue, 31 May 2011 19:09:18 +0000 (12:09 -0700)] 
Merge branch 'jc/log-quiet-fix'

* jc/log-quiet-fix:
  log: --quiet should serve as synonym to -s

13 years agoMerge branch 'kk/maint-prefix-in-config-mak'
Junio C Hamano [Tue, 31 May 2011 19:09:12 +0000 (12:09 -0700)] 
Merge branch 'kk/maint-prefix-in-config-mak'

* kk/maint-prefix-in-config-mak:
  config.mak.in: allow "configure --sysconfdir=/else/where"

13 years agoMerge branch 'jk/rebase-head-reflog'
Junio C Hamano [Tue, 31 May 2011 19:09:08 +0000 (12:09 -0700)] 
Merge branch 'jk/rebase-head-reflog'

* jk/rebase-head-reflog:
  rebase: write a reflog entry when finishing
  rebase: create HEAD reflog entry when aborting

13 years agoMerge branch 'jk/maint-docs'
Junio C Hamano [Tue, 31 May 2011 19:09:00 +0000 (12:09 -0700)] 
Merge branch 'jk/maint-docs'

* jk/maint-docs:
  docs: fix some antique example output
  docs: make sure literal "->" isn't converted to arrow
  docs: update status --porcelain format
  docs: minor grammar fixes to git-status

13 years agoMerge branch 'jk/read-in-full-stops-on-error'
Junio C Hamano [Tue, 31 May 2011 19:08:55 +0000 (12:08 -0700)] 
Merge branch 'jk/read-in-full-stops-on-error'

* jk/read-in-full-stops-on-error:
  read_in_full: always report errors

13 years agoMerge branch 'jk/maint-remote-mirror-safer'
Junio C Hamano [Tue, 31 May 2011 19:08:52 +0000 (12:08 -0700)] 
Merge branch 'jk/maint-remote-mirror-safer'

* jk/maint-remote-mirror-safer:
  remote: allow "-t" with fetch mirrors

13 years agoMerge branch 'jl/read-tree-m-dry-run'
Junio C Hamano [Tue, 31 May 2011 19:08:48 +0000 (12:08 -0700)] 
Merge branch 'jl/read-tree-m-dry-run'

* jl/read-tree-m-dry-run:
  Teach read-tree the -n|--dry-run option
  unpack-trees: add the dry_run flag to unpack_trees_options

13 years agoSync with maint
Junio C Hamano [Tue, 31 May 2011 19:07:14 +0000 (12:07 -0700)] 
Sync with maint

13 years agoStart 1.7.5.4 draft release notes
Junio C Hamano [Tue, 31 May 2011 19:06:40 +0000 (12:06 -0700)] 
Start 1.7.5.4 draft release notes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'tr/add-i-no-escape' into maint
Junio C Hamano [Tue, 31 May 2011 19:02:04 +0000 (12:02 -0700)] 
Merge branch 'tr/add-i-no-escape' into maint

* tr/add-i-no-escape:
  add -i: ignore terminal escape sequences

13 years agoMerge branch 'vh/config-interactive-singlekey-doc' into maint
Junio C Hamano [Tue, 31 May 2011 19:01:06 +0000 (12:01 -0700)] 
Merge branch 'vh/config-interactive-singlekey-doc' into maint

* vh/config-interactive-singlekey-doc:
  git-reset.txt: better docs for '--patch'
  git-checkout.txt: better docs for '--patch'
  git-stash.txt: better docs for '--patch'
  git-add.txt: document 'interactive.singlekey'
  config.txt: 'interactive.singlekey; is used by...

13 years agoMerge branch 'ml/test-readme' into maint
Junio C Hamano [Tue, 31 May 2011 19:00:43 +0000 (12:00 -0700)] 
Merge branch 'ml/test-readme' into maint

* ml/test-readme:
  t/README: unify documentation of test function args

13 years agoMerge branch 'ab/i18n-fixup' into maint
Junio C Hamano [Tue, 31 May 2011 19:00:27 +0000 (12:00 -0700)] 
Merge branch 'ab/i18n-fixup' into maint

* ab/i18n-fixup: (24 commits)
  i18n: use test_i18n{cmp,grep} in t7600, t7607, t7611 and t7811
  i18n: use test_i18n{grep,cmp} in t7508
  i18n: use test_i18ngrep in t7506
  i18n: use test_i18ngrep and test_i18ncmp in t7502
  i18n: use test_i18ngrep in t7501
  i18n: use test_i18ncmp in t7500
  i18n: use test_i18ngrep in t7201
  i18n: use test_i18ncmp and test_i18ngrep in t7102 and t7110
  i18n: use test_i18ncmp and test_i18ngrep in t5541, t6040, t6120, t7004, t7012 and t7060
  i18n: use test_i18ncmp and test_i18ngrep in t3700, t4001 and t4014
  i18n: use test_i18ncmp and test_i18ngrep in t3203, t3501 and t3507
  i18n: use test_i18ngrep in t2020, t2204, t3030, and t3200
  i18n: use test_i18ngrep in lib-httpd and t2019
  i18n: do not overuse C_LOCALE_OUTPUT (grep)
  i18n: use test_i18ncmp in t1200 and t2200
  i18n: .git file is not a human readable message (t5601)
  i18n: do not overuse C_LOCALE_OUTPUT
  i18n: mark init-db messages for translation
  i18n: mark checkout plural warning for translation
  i18n: mark checkout --detach messages for translation
  ...

13 years agoMerge branch 'jc/rename-degrade-cc-to-c' into maint
Junio C Hamano [Tue, 31 May 2011 19:00:02 +0000 (12:00 -0700)] 
Merge branch 'jc/rename-degrade-cc-to-c' into maint

* jc/rename-degrade-cc-to-c:
  diffcore-rename: fall back to -C when -C -C busts the rename limit
  diffcore-rename: record filepair for rename src
  diffcore-rename: refactor "too many candidates" logic
  builtin/diff.c: remove duplicated call to diff_result_code()

13 years agoMerge branch 'rr/doc-content-type' into maint
Junio C Hamano [Tue, 31 May 2011 18:59:39 +0000 (11:59 -0700)] 
Merge branch 'rr/doc-content-type' into maint

* rr/doc-content-type:
  Documentation: Allow custom diff tools to be specified in 'diff.tool'
  Documentation: Add diff.<driver>.* to config
  Documentation: Move diff.<driver>.* from config.txt to diff-config.txt
  Documentation: Add filter.<driver>.* to config

13 years agodiff-index --quiet: learn the "stop feeding the backend early" logic
Junio C Hamano [Tue, 31 May 2011 17:06:44 +0000 (10:06 -0700)] 
diff-index --quiet: learn the "stop feeding the backend early" logic

A negative return from the unpack callback function usually means unpack
failed for the entry and signals the unpack_trees() machinery to fail the
entire merge operation, immediately and there is no other way for the
callback to tell the machinery to exit early without reporting an error.

This is what we usually want to make a merge all-or-nothing operation, but
the machinery is also used for diff-index codepath by using a custom
unpack callback function. And we do sometimes want to exit early without
failing, namely when we are under --quiet and can short-cut the diff upon
finding the first difference.

Add "exiting_early" field to unpack_trees_options structure, to signal the
unpack_trees() machinery that the negative return value is not signaling
an error but an early return from the unpack_trees() machinery. As this by
definition hasn't unpacked everything, discard the resulting index just
like the failure codepath.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge remote-tracking branch 'ko/maint' into jc/diff-index-quick-exit-early
Junio C Hamano [Tue, 31 May 2011 17:57:32 +0000 (10:57 -0700)] 
Merge remote-tracking branch 'ko/maint' into jc/diff-index-quick-exit-early

* ko/maint: (4352 commits)
  git-submodule.sh: separate parens by a space to avoid confusing some shells
  Documentation/technical/api-diff.txt: correct name of diff_unmerge()
  read_gitfile_gently: use ssize_t to hold read result
  remove tests of always-false condition
  rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'
  Git 1.7.5.3
  init/clone: remove short option -L and document --separate-git-dir
  do not read beyond end of malloc'd buffer
  git-svn: Fix git svn log --show-commit
  Git 1.7.5.2
  provide a copy of the LGPLv2.1
  test core.gitproxy configuration
  copy_gecos: fix not adding nlen to len when processing "&"
  Update draft release notes to 1.7.5.2
  Documentation/git-fsck.txt: fix typo: unreadable -> unreachable
  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
  sideband_demux(): fix decl-after-stmt
  t3503: test cherry picking and reverting root commits
  ...

Conflicts:
diff.c

13 years agoconfig.c: Remove unused git_config_global() function
Ramsay Jones [Tue, 31 May 2011 17:23:42 +0000 (18:23 +0100)] 
config.c: Remove unused git_config_global() function

Commit 8f323c00 (drop support for GIT_CONFIG_NOGLOBAL, 15-03-2011)
removed the git_config_global() function, among other things, since
it is no longer required. Unfortunately, this function has since
been unintentionally restored by a faulty conflict resolution.

Remove it.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff: futureproof "stop feeding the backend early" logic
Junio C Hamano [Tue, 31 May 2011 16:14:17 +0000 (09:14 -0700)] 
diff: futureproof "stop feeding the backend early" logic

Refactor the "do not stop feeding the backend early" logic into a small
helper function and use it in both run_diff_files() and diff_tree() that
has the stop-early optimization. We may later add other types of diffcore
transformation that require to look at the whole result like diff-filter
does, and having the logic in a single place is essential for longer term
maintainability.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff_tree: disable QUICK optimization with diff filter
Jeff King [Tue, 31 May 2011 15:33:56 +0000 (11:33 -0400)] 
diff_tree: disable QUICK optimization with diff filter

We stop looking for changes early with QUICK, so our diff
queue contains only a subset of the changes. However, we
don't apply diff filters until later; it will appear at that
point as though there are no changes matching our filter,
when in reality we simply didn't keep looking for changes
long enough.

Commit 2cfe8a6 (diff --quiet: disable optimization when
--diff-filter=X is used, 2011-03-16) fixes this in some
cases by disabling the optimization when a filter is
present. However, it only tweaked run_diff_files, missing
the similar case in diff_tree. Thus the fix worked only for
diffing the working tree and index, but not between trees.

Noticed by Yasushi SHOJI.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/fmt-req-fix'
Junio C Hamano [Tue, 31 May 2011 03:19:21 +0000 (20:19 -0700)] 
Merge branch 'jc/fmt-req-fix'

* jc/fmt-req-fix:
  userformat_find_requirements(): find requirement for the correct format

13 years agoMerge branch 'jk/maint-config-alias-fix'
Junio C Hamano [Tue, 31 May 2011 03:19:14 +0000 (20:19 -0700)] 
Merge branch 'jk/maint-config-alias-fix'

* jk/maint-config-alias-fix:
  handle_options(): do not miscount how many arguments were used
  config: always parse GIT_CONFIG_PARAMETERS during git_config
  git_config: don't peek at global config_parameters
  config: make environment parsing routines static

Conflicts:
config.c

13 years agoDocumentation: do not misinterpret refspecs as bold text
Jonathan Nieder [Mon, 30 May 2011 15:52:56 +0000 (10:52 -0500)] 
Documentation: do not misinterpret refspecs as bold text

In v1.7.3.3~2 (Documentation: do not misinterpret pull refspec as bold
text, 2010-12-03) many uses of asterisks in expressions like
"refs/heads/*:refs/svn/origin/branches/*" were escaped as {asterisk}
to avoid being treated as delimiters for bold text, but these two were
missed.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoformat-patch: make zero-length subject prefixes prettier
Jeff King [Mon, 30 May 2011 14:19:05 +0000 (10:19 -0400)] 
format-patch: make zero-length subject prefixes prettier

If you give a zero-length subject prefix to format-patch
(e.g., "format-patch --subject-prefix="), we will print the
ugly:

  Subject: [ 1/2] your subject here

because we always insert a space between the prefix and
numbering. Requiring the user to provide the space in their
prefix would be more flexible, but would break existing
usage. This patch provides a DWIM and suppresses the space
for zero-length prefixes, under the assumption that nobody
actually wants "[ 1/2]".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-sh-i18n--envsubst: add SYNOPSIS section to the documentation
Ævar Arnfjörð Bjarmason [Sun, 29 May 2011 11:00:35 +0000 (11:00 +0000)] 
git-sh-i18n--envsubst: add SYNOPSIS section to the documentation

Change the documentation for the git-sh-i18n--envsubst program to
include a SYNOPSIS section. Include the invocation of the program from
git-sh-i18n.sh.

Not having a SYNOPSIS section caused the "doc" target to fail on
Centos 5.5 with asciidoc 8.2.5, while building with 8.6.4 on Debian
works just fine.

The relevant error was:

    ERROR: git-sh-i18n--envsubst.txt: line 9: second section must be named SYNOPSIS

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Mon, 30 May 2011 07:09:55 +0000 (00:09 -0700)] 
Merge branch 'maint'

* maint:
  git-submodule.sh: separate parens by a space to avoid confusing some shells
  Documentation/technical/api-diff.txt: correct name of diff_unmerge()
  read_gitfile_gently: use ssize_t to hold read result
  remove tests of always-false condition
  rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'

13 years agoMerge branch 'jm/maint-misc-fix' into maint
Junio C Hamano [Mon, 30 May 2011 07:09:41 +0000 (00:09 -0700)] 
Merge branch 'jm/maint-misc-fix' into maint

* jm/maint-misc-fix:
  read_gitfile_gently: use ssize_t to hold read result
  remove tests of always-false condition
  rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'

13 years agoMerge branch 'bc/maint-submodule-fix-parked' into maint
Junio C Hamano [Mon, 30 May 2011 07:09:36 +0000 (00:09 -0700)] 
Merge branch 'bc/maint-submodule-fix-parked' into maint

* bc/maint-submodule-fix-parked:
  git-submodule.sh: separate parens by a space to avoid confusing some shells

13 years agoMerge branch 'bc/maint-api-doc-parked' into maint
Junio C Hamano [Mon, 30 May 2011 07:03:52 +0000 (00:03 -0700)] 
Merge branch 'bc/maint-api-doc-parked' into maint

* bc/maint-api-doc-parked:
  Documentation/technical/api-diff.txt: correct name of diff_unmerge()

13 years agoMerge branch 'mk/grep-pcre'
Junio C Hamano [Mon, 30 May 2011 07:00:07 +0000 (00:00 -0700)] 
Merge branch 'mk/grep-pcre'

* mk/grep-pcre:
  git-grep: Fix problems with recently added tests
  git-grep: Update tests (mainly for -P)
  Makefile: Pass USE_LIBPCRE down in GIT-BUILD-OPTIONS
  git-grep: update tests now regexp type is "last one wins"
  git-grep: do not die upon -F/-P when grep.extendedRegexp is set.
  git-grep: Bail out when -P is used with -F or -E
  grep: Add basic tests
  configure: Check for libpcre
  git-grep: Learn PCRE
  grep: Extract compile_regexp_failed() from compile_regexp()
  grep: Fix a typo in a comment
  grep: Put calls to fixmatch() and regmatch() into patmatch()
  contrib/completion: --line-number to git grep
  Documentation: Add --line-number to git-grep synopsis

13 years agogit-grep: Fix problems with recently added tests
Michał Kiedrowicz [Thu, 26 May 2011 22:43:59 +0000 (00:43 +0200)] 
git-grep: Fix problems with recently added tests

Brian Gernhardt reported that test 'git grep -E -F -G a\\+b' fails on
OS X 10.6.7. This is because I assumed \+ is part of BRE, which isn't
true on all platforms.

The easiest way to make this test pass is to just update expected
output, but that would make the test pointless. Its real purpose is to
check whether 'git grep -E -F -G' is different from 'git grep -E -G -F'.
To check that, let's change pattern to "a+b*c". This should return
different match for -G, -F and -E.

I also made two small tweaks to the tests. First, I added path "ab" to
all calls to future-proof tests. Second, I updated last two tests to
better show that 'git grep -P -E' is different from 'git grep -E -P'.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/notes-batch-removal'
Junio C Hamano [Mon, 30 May 2011 06:51:26 +0000 (23:51 -0700)] 
Merge branch 'jc/notes-batch-removal'

* jc/notes-batch-removal:
  show: --ignore-missing
  notes remove: --stdin reads from the standard input
  notes remove: --ignore-missing
  notes remove: allow removing more than one

13 years agoMerge branch 'jk/haves-from-alternate-odb'
Junio C Hamano [Mon, 30 May 2011 06:51:22 +0000 (23:51 -0700)] 
Merge branch 'jk/haves-from-alternate-odb'

* jk/haves-from-alternate-odb:
  receive-pack: eliminate duplicate .have refs
  bisect: refactor sha1_array into a generic sha1 list
  refactor refs_from_alternate_cb to allow passing extra data

13 years agoMerge branch 'jn/run-command-error-failure' into maint
Junio C Hamano [Mon, 30 May 2011 02:08:51 +0000 (19:08 -0700)] 
Merge branch 'jn/run-command-error-failure' into maint

* jn/run-command-error-failure:
  run-command: handle short writes and EINTR in die_child
  tests: check error message from run_command