]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
10 years agocommit: record buffer length in cache
Jeff King [Tue, 10 Jun 2014 21:44:13 +0000 (17:44 -0400)] 
commit: record buffer length in cache

Most callsites which use the commit buffer try to use the
cached version attached to the commit, rather than
re-reading from disk. Unfortunately, that interface provides
only a pointer to the NUL-terminated buffer, with no
indication of the original length.

For the most part, this doesn't matter. People do not put
NULs in their commit messages, and the log code is happy to
treat it all as a NUL-terminated string. However, some code
paths do care. For example, when checking signatures, we
want to be very careful that we verify all the bytes to
avoid malicious trickery.

This patch just adds an optional "size" out-pointer to
get_commit_buffer and friends. The existing callers all pass
NULL (there did not seem to be any obvious sites where we
could avoid an immediate strlen() call, though perhaps with
some further refactoring we could).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocommit: convert commit->buffer to a slab
Jeff King [Tue, 10 Jun 2014 21:43:02 +0000 (17:43 -0400)] 
commit: convert commit->buffer to a slab

This will make it easier to manage the buffer cache
independently of the "struct commit" objects. It also
shrinks "struct commit" by one pointer, which may be
helpful.

Unfortunately it does not reduce the max memory size of
something like "rev-list", because rev-list uses
get_cached_commit_buffer() to decide not to show each
commit's output (and due to the design of slab_at, accessing
the slab requires us to extend it, allocating exactly the
same number of buffer pointers we dropped from the commit
structs).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocommit-slab: provide a static initializer
Jeff King [Tue, 10 Jun 2014 21:42:51 +0000 (17:42 -0400)] 
commit-slab: provide a static initializer

Callers currently must use init_foo_slab() at runtime before
accessing a slab. For global slabs, it's much nicer if we
can initialize them in BSS, so that each user does not have
to add code to check-and-initialize.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agouse get_commit_buffer everywhere
Jeff King [Tue, 10 Jun 2014 21:41:51 +0000 (17:41 -0400)] 
use get_commit_buffer everywhere

Each of these sites assumes that commit->buffer is valid.
Since they would segfault if this was not the case, they are
likely to be correct in practice. However, we can
future-proof them by using get_commit_buffer.

And as a side effect, we abstract away the final bare uses
of commit->buffer.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoconvert logmsg_reencode to get_commit_buffer
Jeff King [Tue, 10 Jun 2014 21:41:39 +0000 (17:41 -0400)] 
convert logmsg_reencode to get_commit_buffer

Like the callsites in the previous commit, logmsg_reencode
already falls back to read_sha1_file when necessary.
However, I split its conversion out into its own commit
because it's a bit more complex.

We return either:

  1. The original commit->buffer

  2. A newly allocated buffer from read_sha1_file

  3. A reencoded buffer (based on either 1 or 2 above).

while trying to do as few extra reads/allocations as
possible. Callers currently free the result with
logmsg_free, but we can simplify this by pointing them
straight to unuse_commit_buffer. This is a slight layering
violation, in that we may be passing a buffer from (3).
However, since the end result is to free() anything except
(1), which is unlikely to change, and because this makes the
interface much simpler, it's a reasonable bending of the
rules.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agouse get_commit_buffer to avoid duplicate code
Jeff King [Tue, 10 Jun 2014 21:41:02 +0000 (17:41 -0400)] 
use get_commit_buffer to avoid duplicate code

For both of these sites, we already do the "fallback to
read_sha1_file" trick. But we can shorten the code by just
using get_commit_buffer.

Note that the error cases are slightly different when
read_sha1_file fails. get_commit_buffer will die() if the
object cannot be loaded, or is a non-commit.

For get_sha1_oneline, this will almost certainly never
happen, as we will have just called parse_object (and if it
does, it's probably worth complaining about).

For record_author_date, the new behavior is probably better;
we notify the user of the error instead of silently ignoring
it. And because it's used only for sorting by author-date,
somebody examining a corrupt repo can fallback to the
regular traversal order.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agouse get_cached_commit_buffer where appropriate
Jeff King [Tue, 10 Jun 2014 21:40:46 +0000 (17:40 -0400)] 
use get_cached_commit_buffer where appropriate

Some call sites check commit->buffer to see whether we have
a cached buffer, and if so, do some work with it. In the
long run we may want to switch these code paths to make
their decision on a different boolean flag (because checking
the cache may get a little more expensive in the future).
But for now, we can easily support them by converting the
calls to use get_cached_commit_buffer.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoprovide helpers to access the commit buffer
Jeff King [Tue, 10 Jun 2014 21:40:39 +0000 (17:40 -0400)] 
provide helpers to access the commit buffer

Many sites look at commit->buffer to get more detailed
information than what is in the parsed commit struct.
However, we sometimes drop commit->buffer to save memory,
in which case the caller would need to read the object
afresh. Some callers do this (leading to duplicated code),
and others do not (which opens the possibility of a segfault
if somebody else frees the buffer).

Let's provide a pair of helpers, "get" and "unuse", that let
callers easily get the buffer. They will use the cached
buffer when possible, and otherwise load from disk using
read_sha1_file.

Note that we also need to add a "get_cached" variant which
returns NULL when we do not have a cached buffer. At first
glance this seems to defeat the purpose of "get", which is
to always provide a return value. However, some log code
paths actually use the NULL-ness of commit->buffer as a
boolean flag to decide whether to try printing the
commit. At least for now, we want to continue supporting
that use.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoprovide a helper to set the commit buffer
Jeff King [Tue, 10 Jun 2014 21:40:14 +0000 (17:40 -0400)] 
provide a helper to set the commit buffer

Right now this is just a one-liner, but abstracting it will
make it easier to change later.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoprovide a helper to free commit buffer
Jeff King [Thu, 12 Jun 2014 22:05:37 +0000 (18:05 -0400)] 
provide a helper to free commit buffer

This converts two lines into one at each caller. But more
importantly, it abstracts the concept of freeing the buffer,
which will make it easier to change later.

Note that we also need to provide a "detach" mechanism for a
tricky case in index-pack. We are passed a buffer for the
object generated by processing the incoming pack. If we are
not using --strict, we just calculate the sha1 on that
buffer and return, leaving the caller to free it.  But if we
are using --strict, we actually attach that buffer to an
object, pass the object to the fsck functions, and then
detach the buffer from the object again (so that the caller
can free it as usual).  In this case, we don't want to free
the buffer ourselves, but just make sure it is no longer
associated with the commit.

Note that we are making the assumption here that the
attach/detach process does not impact the buffer at all
(e.g., it is never reallocated or modified). That holds true
now, and we have no plans to change that. However, as we
abstract the commit_buffer code, this dependency becomes
less obvious. So when we detach, let's also make sure that
we get back the same buffer that we gave to the
commit_buffer code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'jc/rev-parse-argh-dashed-multi-words' into maint
Junio C Hamano [Thu, 12 Jun 2014 19:17:57 +0000 (12:17 -0700)] 
Merge branch 'jc/rev-parse-argh-dashed-multi-words' into maint

* jc/rev-parse-argh-dashed-multi-words:
  update-index: fix segfault with missing --cacheinfo argument

10 years agopull: do not abuse 'break' inside a shell 'case'
Jacek Konieczny [Wed, 11 Jun 2014 08:47:45 +0000 (10:47 +0200)] 
pull: do not abuse 'break' inside a shell 'case'

It is not C. The code would break under mksh when 'pull.ff' is set:

  $ git pull
  /usr/lib/git-core/git-pull[67]: break: can't break
  Already up-to-date.

Signed-off-by: Jacek Konieczny <jajcus@jajcus.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosequencer: use logmsg_reencode in get_message
Jeff King [Tue, 10 Jun 2014 21:39:35 +0000 (17:39 -0400)] 
sequencer: use logmsg_reencode in get_message

This simplifies the code, as logmsg_reencode handles the
reencoding for us in a single call. It also means we learn
logmsg_reencode's trick of pulling the buffer from disk when
commit->buffer is NULL (we currently just silently return!).
It is doubtful this matters in practice, though, as
sequencer operations would not generally turn off
save_commit_buffer.

Note that we may be fixing a bug here. The existing code
does:

  if (same_encoding(to, from))
  reencode_string(buf, to, from);

That probably should have been "!same_encoding".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agologmsg_reencode: return const buffer
Jeff King [Tue, 10 Jun 2014 21:39:30 +0000 (17:39 -0400)] 
logmsg_reencode: return const buffer

The return value from logmsg_reencode may be either a newly
allocated buffer or a pointer to the existing commit->buffer.
We would not want the caller to accidentally free() or
modify the latter, so let's mark it as const.  We can cast
away the constness in logmsg_free, but only once we have
determined that it is a free-able buffer.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodo not create "struct commit" with xcalloc
Jeff King [Tue, 10 Jun 2014 21:39:11 +0000 (17:39 -0400)] 
do not create "struct commit" with xcalloc

In both blame and merge-recursive, we sometimes create a
"fake" commit struct for convenience (e.g., to represent the
HEAD state as if we would commit it). By allocating
ourselves rather than using alloc_commit_node, we do not
properly set the "index" field of the commit. This can
produce subtle bugs if we then use commit-slab on the
resulting commit, as we will share the "0" index with
another commit.

We can fix this by using alloc_commit_node() to allocate.
Note that we cannot free the result, as it is part of our
commit allocator. However, both cases were already leaking
the allocated commit anyway, so there's nothing to fix up.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocommit: push commit_index update into alloc_commit_node
Jeff King [Tue, 10 Jun 2014 21:39:04 +0000 (17:39 -0400)] 
commit: push commit_index update into alloc_commit_node

Whenever we create a commit object via lookup_commit, we
give it a unique index to be used with the commit-slab API.
The theory is that any "struct commit" we create would
follow this code path, so any such struct would get an
index. However, callers could use alloc_commit_node()
directly (and get multiple commits with index 0).

Let's push the indexing into alloc_commit_node so that it's
hard for callers to get it wrong.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoalloc: include any-object allocations in alloc_report
Jeff King [Tue, 10 Jun 2014 21:38:47 +0000 (17:38 -0400)] 
alloc: include any-object allocations in alloc_report

When 2c1cbec (Use proper object allocators for unknown
object nodes too, 2007-04-16), added a special "any_object"
allocator, it never taught alloc_report to report on it. To
do so we need to add an extra type argument to the REPORT
macro, as that commit did for DEFINE_ALLOCATOR.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoreplace dangerous uses of strbuf_attach
Jeff King [Tue, 10 Jun 2014 21:38:38 +0000 (17:38 -0400)] 
replace dangerous uses of strbuf_attach

It is not a good idea to strbuf_attach an arbitrary pointer
just because a function you are calling wants a strbuf.
Attaching implies a transfer of memory ownership; if anyone
were to modify or release the resulting strbuf, we would
free() the pointer, leading to possible problems:

  1. Other users of the original pointer might access freed
     memory.

  2. The pointer might not be the start of a malloc'd
     area, so calling free() on it in the first place would
     be wrong.

In the two cases modified here, we are fortunate that nobody
touches the strbuf once it is attached, but it is an
accident waiting to happen.  Since the previous commit,
commit_tree and friends take a pointer/buf pair, so we can
just do away with the strbufs entirely.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocommit_tree: take a pointer/len pair rather than a const strbuf
Jeff King [Tue, 10 Jun 2014 21:36:52 +0000 (17:36 -0400)] 
commit_tree: take a pointer/len pair rather than a const strbuf

While strbufs are pretty common throughout our code, it is
more flexible for functions to take a pointer/len pair than
a strbuf. It's easy to turn a strbuf into such a pair (by
dereferencing its members), but less easy to go the other
way (you can strbuf_attach, but that has implications about
memory ownership).

This patch teaches commit_tree (and its associated callers
and sub-functions) to take such a pair for the commit
message rather than a strbuf.  This makes passing the buffer
around slightly more verbose, but means we can get rid of
some dangerous strbuf_attach calls in the next patch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorepack: s/write_bitmap/&s/ in code
Jeff King [Tue, 10 Jun 2014 20:10:07 +0000 (16:10 -0400)] 
repack: s/write_bitmap/&s/ in code

The config name is "writeBitmaps", so the internal variable
missing the plural is unnecessarily confusing to write.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorepack: respect pack.writebitmaps
Jeff King [Tue, 10 Jun 2014 20:09:23 +0000 (16:09 -0400)] 
repack: respect pack.writebitmaps

The config option to turn on bitmaps is read all the way
down in the plumbing of pack-objects. This makes it hard for
other options in the porcelain of repack to make decisions
based on the bitmap setting. For example,
repack.packKeptObjects tries to kick in by default only when
bitmaps are turned on. But it can't do so reliably because
it doesn't yet know whether we are using bitmaps.

This patch teaches repack to respect pack.writebitmaps. It
means we pass a redundant command-line flag to pack-objects,
but that's OK; it shouldn't affect the outcome.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorepack: do not accidentally pack kept objects by default
Jeff King [Tue, 10 Jun 2014 20:08:38 +0000 (16:08 -0400)] 
repack: do not accidentally pack kept objects by default

Commit ee34a2b (repack: add `repack.packKeptObjects` config
var, 2014-03-03) added a flag which could duplicate kept
objects, but did not mean to turn it on by default. Instead,
the option is tied by default to the decision to write
bitmaps, like:

  if (pack_kept_objects < 0)
  pack_kept_objects = write_bitmap;

after which we expect pack_kept_objects to be a boolean 0 or
1.  However, that assignment neglects that write_bitmap is
_also_ a tri-state with "-1" as the default, and with
neither option given, we accidentally turn the option on.

This patch is the minimal fix to restore the desired
behavior for the default state. Further patches will fix the
more complicated cases.

Note the update to t7700. It failed to turn on bitmaps,
meaning we were actually confirming the wrong behavior!

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoapi-strbuf.txt minor typos
Jeremiah Mahler [Mon, 9 Jun 2014 03:32:03 +0000 (20:32 -0700)] 
api-strbuf.txt minor typos

Fixed some minor typos in api-strbuf.txt: 'A' instead of 'An', 'have'
instead of 'has', a overlong line, and 'another' instead of 'an other'.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorevision: parse "git log -<count>" more carefully
Junio C Hamano [Fri, 6 Jun 2014 22:33:25 +0000 (15:33 -0700)] 
revision: parse "git log -<count>" more carefully

This mistyped command line simply ignores "master" and ends up
showing two commits from the current HEAD:

    $ git log -2master

because we feed "2master" to atoi() without making sure that the
whole string is parsed as an integer.

Use the strtol_i() helper function instead.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot/t7810-grep.sh: remove duplicate test_config()
Jeremiah Mahler [Thu, 5 Jun 2014 05:18:18 +0000 (22:18 -0700)] 
t/t7810-grep.sh: remove duplicate test_config()

t/t7810-grep.sh had its own test_config() function which served the
same purpose as the one in t/test-lib-functions.sh.  Removed, all tests
pass.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoshortlog: allow --exclude=<glob> to be passed
Junio C Hamano [Fri, 30 May 2014 19:57:25 +0000 (12:57 -0700)] 
shortlog: allow --exclude=<glob> to be passed

These two commands are supposed to be equivalent:

  $ git log --exclude=refs/notes/\* --all --no-merges --since=2.days |
    git shortlog
  $ git shortlog --exclude=refs/notes/\* --all --no-merges --since=2.days

However, the latter does not understand the ref-exclusion command
line option, even though other options understood by "log", such as
"--all" and "--no-merges", are understood.

This was because e7b432c5 (revision: introduce --exclude=<glob> to
tame wildcards, 2013-08-30) did not wire the new option fully to the
machinery.  A new option understood by handle_revision_pseudo_opt()
must be told to handle_revision_opt() as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot5000, t5003: do not use test_cmp to compare binary files
Stepan Kasal [Wed, 4 Jun 2014 15:57:52 +0000 (17:57 +0200)] 
t5000, t5003: do not use test_cmp to compare binary files

test_cmp() is primarily meant to compare text files (and display the
difference for debug purposes).

Raw "cmp" is better suited to compare binary files (tar, zip, etc.).

On MinGW, test_cmp is a shell function mingw_test_cmp that tries to
read both files into environment, stripping CR characters (introduced
in commit 4d715ac0).

This function usually speeds things up, as fork is extremly slow on
Windows.  But no wonder that this function is extremely slow and
sometimes even crashes when comparing large tar or zip files.

Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoupdate-index: fix segfault with missing --cacheinfo argument
Jeff King [Wed, 4 Jun 2014 07:11:11 +0000 (03:11 -0400)] 
update-index: fix segfault with missing --cacheinfo argument

Running "git update-index --cacheinfo" without any further
arguments results in a segfault rather than an error
message. Commit ec160ae (update-index: teach --cacheinfo a
new syntax "mode,sha1,path", 2014-03-23) added code to
examine the format of the argument, but forgot to handle the
NULL case.

Returning an error from the parser is enough, since we then
treat it as an old-style "--cacheinfo <mode> <sha1> <path>",
and complain that we have less than 3 arguments to read.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodir.c:trim_trailing_spaces(): fix for " \ " sequence
Pasha Bolokhov [Mon, 2 Jun 2014 22:36:56 +0000 (15:36 -0700)] 
dir.c:trim_trailing_spaces(): fix for " \ " sequence

Discard the unnecessary 'nr_spaces' variable, remove 'strlen()' and
improve the 'if' structure.  Switch to pointers instead of integers
to control the loop.

Slightly more rare occurrences of 'text  \    ' with a backslash
in between spaces are handled correctly.  Namely, the code in
7e2e4b37 (dir: ignore trailing spaces in exclude patterns, 2014-02-09)
does not reset 'last_space' when a backslash is encountered and the above
line stays intact as a result.

Add a test at the end of t/t0008-ignores.sh to exhibit this behavior.

Signed-off-by: Pasha Bolokhov <pasha.bolokhov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agopack-objects: use free()+xcalloc() instead of xrealloc()+memset()
René Scharfe [Sun, 1 Jun 2014 11:07:21 +0000 (13:07 +0200)] 
pack-objects: use free()+xcalloc() instead of xrealloc()+memset()

Whenever the hash table becomes too small then its size is increased,
the original part (and the added space) is zerod out using memset(),
and the table is rebuilt from scratch.

Simplify this proceess by returning the old memory using free() and
allocating the new buffer using xcalloc(), which already clears the
buffer for us.  That way we avoid copying the old hash table contents
needlessly inside xrealloc().

While at it, use the first array member with sizeof instead of a
specific type.  The old code used uint32_t and int, while index is
actually an array of int32_t.  Their sizes are the same basically
everywhere, so it's not actually a problem, but the new code is
cleaner and doesn't have to be touched should the type be changed.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agomailinfo: use strcmp() for string comparison
René Scharfe [Sun, 1 Jun 2014 09:00:40 +0000 (11:00 +0200)] 
mailinfo: use strcmp() for string comparison

The array header is defined as:

static const char *header[MAX_HDR_PARSED] = {
     "From","Subject","Date",
};

When looking for the index of a specfic string in that array, simply
use strcmp() instead of memcmp().  This avoids running over the end of
the string (e.g. with memcmp("Subject", "From", 7)) and gets rid of
magic string length constants.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agofix brown paper bag breakage in t5150-request-pull.sh
Johannes Sixt [Mon, 2 Jun 2014 07:06:56 +0000 (09:06 +0200)] 
fix brown paper bag breakage in t5150-request-pull.sh

The recent addition to the test case 'pull request format' interrupted
the single-quoted text, effectively adding a third argument to the
test_expect_success command. Since we do not have a prerequisite named
"pull request format", the test is skipped, no matter what. Additionally,
the file name argument to the grep command is missing. Fix both issues.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosideband.c: do not use ANSI control sequence on non-terminal
Michael Naumov [Wed, 28 May 2014 03:12:15 +0000 (03:12 +0000)] 
sideband.c: do not use ANSI control sequence on non-terminal

Diagnostic messages received on the sideband #2 from the server side
are sent to the standard error with ANSI terminal control sequence
"\033[K" that erases to the end of line appended at the end of each
line.

However, some programs (e.g. GitExtensions for Windows) read and
interpret and/or show the message without understanding the terminal
control sequences, resulting them to be shown to their end users.
To help these programs, squelch the control sequence when the
standard error stream is not being sent to a tty.

NOTE: I considered to cover the case that a pager has already been
started. But decided that is probably not worth worrying about here,
though, as we shouldn't be using a pager for commands that do network
communications (and if we do, omitting the magic line-clearing signal
is probably a sane thing to do).

Thanks-to: Erik Faye-Lund <kusmabite@gmail.com>
Thanks-to: Jeff King <peff@peff.net>
Signed-off-by: Michael Naumov <mnaoumov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocompat/bswap.h: fix endianness detection
Ben Walton [Fri, 30 May 2014 15:22:40 +0000 (16:22 +0100)] 
compat/bswap.h: fix endianness detection

The changes to make detection of endianness more portable had a bug
that breaks on (at least) Solaris x86.

The bug appears to be a simple copy/paste typo. It checks for
_BIG_ENDIAN and not _LITTLE_ENDIAN for both the case where we would
decide the system is big endian and little endian. Instead, the
second test should be for _LITTLE_ENDIAN and not _BIG_ENDIAN.

Two fixes were possible:

 1. Change the negation order of the conditions in the second test.
 2. Reverse the order of the conditions in the second test.

Use the second option so that the condition we expect is always a
positive check.

Signed-off-by: Ben Walton <bdwalton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot5538: move http push tests out to t5542
Nick Alcock [Fri, 30 May 2014 17:36:21 +0000 (13:36 -0400)] 
t5538: move http push tests out to t5542

As 0232852b, but for the push tests instead: this avoids a start_httpd
in the middle of the file, which fails under GIT_TEST_HTTPD=false.

Note that we have to munge the test in a few ways while
moving it:

  1. We drop the `test -z "$GIT_TEST_HTTPD"` check; this is
     too simplistic since 83d842d, and we should let
     lib-httpd.sh handle it.

  2. We have to port over some of the old setup from t5538.

  3. In the final test, we no longer expect the extra commit
     "1" built on top of "4". This was a side effect from an
     earlier test in t5538 which was not ported over.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoSync with 1.9.4
Junio C Hamano [Fri, 30 May 2014 17:57:52 +0000 (10:57 -0700)] 
Sync with 1.9.4

10 years agoGit 1.9.4 v1.9.4
Junio C Hamano [Wed, 28 May 2014 22:50:22 +0000 (15:50 -0700)] 
Git 1.9.4

This is expected to be the final maintenance release for 1.9 series,
merging the remaining fixes that are relevant and are already in 2.0.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot5537: re-drop http tests
Jeff King [Fri, 30 May 2014 01:34:19 +0000 (21:34 -0400)] 
t5537: re-drop http tests

These were originally removed by 0232852 (t5537: move
http tests out to t5539, 2014-02-13). However, they were
accidentally re-added in 1ddb4d7 (Merge branch
'nd/upload-pack-shallow', 2014-03-21).

This looks like an error in manual conflict resolution.
Here's what happened:

  1. v1.9.0 shipped with the http tests in t5537.

  2. We realized that this caused problems, and built
     0232852 on top to move the tests to their own file.
     This fix made it into v1.9.1.

  3. We later had another fix in nd/upload-pack-shallow that
     also touched t5537. It was built directly on v1.9.0.

When we merged nd/upload-pack-shallow to master, we got a
conflict; it was built on a version with the http tests, but
we had since removed them. The correct resolution was to
drop the http tests and keep the new ones, but instead we
kept everything.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'rh/prompt-pcmode-avoid-eval-on-refname' into maint
Junio C Hamano [Wed, 28 May 2014 22:46:36 +0000 (15:46 -0700)] 
Merge branch 'rh/prompt-pcmode-avoid-eval-on-refname' into maint

* rh/prompt-pcmode-avoid-eval-on-refname:
  git-prompt.sh: don't assume the shell expands the value of PS1

10 years agoMerge branch 'mw/symlinks' into maint
Junio C Hamano [Wed, 28 May 2014 22:45:57 +0000 (15:45 -0700)] 
Merge branch 'mw/symlinks' into maint

* mw/symlinks:
  setup: fix windows path buffer over-stepping
  setup: don't dereference in-tree symlinks for absolute paths
  setup: add abspath_part_inside_repo() function
  t0060: add tests for prefix_path when path begins with work tree
  t0060: add test for prefix_path when path == work tree
  t0060: add test for prefix_path on symlinks via absolute paths
  t3004: add test for ls-files on symlinks via absolute paths

10 years agoGit 2.0 v2.0.0
Junio C Hamano [Wed, 28 May 2014 18:04:19 +0000 (11:04 -0700)] 
Git 2.0

10 years agoDocumentation: wording fixes in the user manual and glossary
Jeremiah Mahler [Wed, 28 May 2014 02:23:32 +0000 (19:23 -0700)] 
Documentation: wording fixes in the user manual and glossary

Re-word the section on "Updating a repository with git fetch" in the
user manual.

Various other minor fixes in the manual and glossary.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agotransport-helper.c: rearrange xcalloc arguments
Brian Gesiak [Mon, 26 May 2014 15:33:56 +0000 (00:33 +0900)] 
transport-helper.c: rearrange xcalloc arguments

xcalloc() takes two arguments: the number of elements and their size.
transport_helper_init passes the arguments in reverse order, passing the
size of a helper_data*, followed by the number to allocate.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoremote.c: rearrange xcalloc arguments
Brian Gesiak [Mon, 26 May 2014 15:33:55 +0000 (00:33 +0900)] 
remote.c: rearrange xcalloc arguments

xcalloc() takes two arguments: the number of elements and their size.
parse_refspec_internal passes the arguments in reverse order, passing the
size of a refspec, followed by the number to allocate.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoreflog-walk.c: rearrange xcalloc arguments
Brian Gesiak [Mon, 26 May 2014 15:33:54 +0000 (00:33 +0900)] 
reflog-walk.c: rearrange xcalloc arguments

xcalloc() takes two arguments: the number of elements and their size.
reflog-walk.c includes several calls to xcalloc() that pass the arguments
in reverse order.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agopack-revindex.c: rearrange xcalloc arguments
Brian Gesiak [Mon, 26 May 2014 15:33:53 +0000 (00:33 +0900)] 
pack-revindex.c: rearrange xcalloc arguments

xcalloc() takes two arguments: the number of elements and their size.
init_pack_revindex() passes the arguments in reverse order, passing the
size of a pack_revindex, followed by the number to allocate.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agonotes.c: rearrange xcalloc arguments
Brian Gesiak [Mon, 26 May 2014 15:33:52 +0000 (00:33 +0900)] 
notes.c: rearrange xcalloc arguments

xcalloc() takes two arguments: the number of elements and their size.
notes.c includes several calls to xcalloc() that pass the arguments in
reverse order.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoimap-send.c: rearrange xcalloc arguments
Brian Gesiak [Mon, 26 May 2014 15:33:51 +0000 (00:33 +0900)] 
imap-send.c: rearrange xcalloc arguments

xcalloc() takes two arguments: the number of elements and their size.
imap_open_store() passes the arguments in reverse order, passing the
size of an imap_store*, followed by the number to allocate.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agohttp-push.c: rearrange xcalloc arguments
Brian Gesiak [Mon, 26 May 2014 15:33:50 +0000 (00:33 +0900)] 
http-push.c: rearrange xcalloc arguments

xcalloc() takes two arguments: the number of elements and their size.
http-push passes the arguments in reverse order, passing the size
of a repo, followed by the number to allocate.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodiff.c: rearrange xcalloc arguments
Brian Gesiak [Mon, 26 May 2014 15:33:47 +0000 (00:33 +0900)] 
diff.c: rearrange xcalloc arguments

xcalloc() takes two arguments: the number of elements and their size.
diffstat_add() passes the arguments in reverse order, passing the
size of a diffstat_file*, followed by the number of diffstat_file* to
be allocated.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoconfig.c: rearrange xcalloc arguments
Brian Gesiak [Mon, 26 May 2014 15:33:46 +0000 (00:33 +0900)] 
config.c: rearrange xcalloc arguments

xcalloc() takes two arguments: the number of elements and their size.
config.c includes several calls to xcalloc() that pass the arguments
in reverse order: the size of a struct lock_file*, followed by the
number to allocate.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocommit.c: rearrange xcalloc arguments
Brian Gesiak [Mon, 26 May 2014 15:33:45 +0000 (00:33 +0900)] 
commit.c: rearrange xcalloc arguments

xcalloc() takes two arguments: the number of elements and their size.
reduce_heads() passes the arguments in reverse order, passing the
size of a commit*, followed by the number of commit* to be allocated.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agobuiltin/remote.c: rearrange xcalloc arguments
Brian Gesiak [Mon, 26 May 2014 15:33:44 +0000 (00:33 +0900)] 
builtin/remote.c: rearrange xcalloc arguments

xcalloc() takes two arguments: the number of elements and their size.
builtin/remote.c includes several calls to xcalloc() that pass the
arguments in reverse order.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agobuiltin/ls-remote.c: rearrange xcalloc arguments
Brian Gesiak [Mon, 26 May 2014 15:33:43 +0000 (00:33 +0900)] 
builtin/ls-remote.c: rearrange xcalloc arguments

xcalloc() takes two arguments: the number of elements and their size.
cmd_ls_remote() passes the arguments in reverse order, passing the
size of a char*, followed by the number of char* to be allocated.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoconfig: respect '~' and '~user' in mailmap.file
Øystein Walle [Tue, 27 May 2014 08:45:58 +0000 (10:45 +0200)] 
config: respect '~' and '~user' in mailmap.file

git_config_string() does not handle '~' and '~user' as part of the
value. Using git_config_pathname() fixes this.

Signed-off-by: Øystein Walle <oystwa@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit-instaweb: add support for Apache 2.4
Jonathan McCrohan [Tue, 27 May 2014 01:18:10 +0000 (02:18 +0100)] 
git-instaweb: add support for Apache 2.4

Detect available Apache MPMs and use first available according to
following order of precedence:
mpm_event
mpm_prefork
mpm_worker

Add authz_core module if available to avoid HTTP Error 500 errors.

Signed-off-by: Jonathan McCrohan <jmccrohan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogc --auto: do not lock refs in the background
Nguyễn Thái Ngọc Duy [Sun, 25 May 2014 00:38:29 +0000 (07:38 +0700)] 
gc --auto: do not lock refs in the background

9f673f9 (gc: config option for running --auto in background -
2014-02-08) puts "gc --auto" in background to reduce user's wait
time. Part of the garbage collecting is pack-refs and pruning
reflogs. These require locking some refs and may abort other processes
trying to lock the same ref. If gc --auto is fired in the middle of a
script, gc's holding locks in the background could fail the script,
which could never happen before 9f673f9.

Keep running pack-refs and "reflog --prune" in foreground to stop
parallel ref updates. The remaining background operations (repack,
prune and rerere) should not impact running git processes.

Reported-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoremote prune: optimize "dangling symref" check/warning
Jens Lindström [Fri, 23 May 2014 10:30:25 +0000 (12:30 +0200)] 
remote prune: optimize "dangling symref" check/warning

When 'git remote prune' was used to delete many refs in a repository
with many refs, a lot of time was spent checking for (now) dangling
symbolic refs pointing to the deleted ref, since warn_dangling_symref()
was once per deleted ref to check all other refs in the repository.

Avoid this using the new warn_dangling_symrefs() function which
makes one pass over all refs and checks for all the deleted refs in
one go, after they have all been deleted.

Signed-off-by: Jens Lindström <jl@opera.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoremote: repack packed-refs once when deleting multiple refs
Jens Lindström [Fri, 23 May 2014 10:29:45 +0000 (12:29 +0200)] 
remote: repack packed-refs once when deleting multiple refs

When 'git remote rm' or 'git remote prune' were used in a repository
with many refs, and needed to delete many remote-tracking refs, a lot
of time was spent deleting those refs since for each deleted ref,
repack_without_refs() was called to rewrite packed-refs without just
that deleted ref.

To avoid this, call repack_without_refs() first to repack without all
the refs that will be deleted, before calling delete_ref() to delete
each one completely.  The call to repack_without_ref() in delete_ref()
then becomes a no-op, since packed-refs already won't contain any of
the deleted refs.

Signed-off-by: Jens Lindström <jl@opera.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocompletion: add missing options for git-merge
John Keeping [Thu, 22 May 2014 13:58:38 +0000 (14:58 +0100)] 
completion: add missing options for git-merge

The options added to __git_merge_options are those that git-pull passes
to git-merge, since that variable is used by both commands.

Those added directly in _git_merge() are specific to git-merge and
are not passed thru from git-pull.

Reported-by: Haralan Dobrev <hkdobrev@gmail.com>
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocompletion: add a note that merge options are shared
John Keeping [Thu, 22 May 2014 13:58:37 +0000 (14:58 +0100)] 
completion: add a note that merge options are shared

This should avoid future confusion after a subsequent patch has added
some options to __git_merge_options and some directly in _git_merge().

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoscripts: more "export VAR=VALUE" fixes
Junio C Hamano [Fri, 23 May 2014 18:19:34 +0000 (11:19 -0700)] 
scripts: more "export VAR=VALUE" fixes

Found by

    git grep '[^-]export [^&]*=' -- \*.sh

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoscripts: "export VAR=VALUE" construct is not portable
Elia Pinto [Fri, 23 May 2014 10:15:31 +0000 (03:15 -0700)] 
scripts: "export VAR=VALUE" construct is not portable

Found by check-non-portable-shell.pl

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoremote rm: delete remote configuration as the last
Jens Lindström [Fri, 23 May 2014 10:28:43 +0000 (12:28 +0200)] 
remote rm: delete remote configuration as the last

When removing a remote, delete the remote-tracking branches before
deleting the remote configuration.  This way, if the operation fails or
is aborted while deleting the remote-tracking branches, the command can
be rerun to complete the operation.

Signed-off-by: Jens Lindström <jl@opera.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoUpdate draft release notes to 2.0
Junio C Hamano [Wed, 21 May 2014 18:50:35 +0000 (11:50 -0700)] 
Update draft release notes to 2.0

Hopefully for the last time ;-)

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agopretty.c: format string with truncate respects logOutputEncoding
Alexey Shumkin [Wed, 21 May 2014 13:20:07 +0000 (17:20 +0400)] 
pretty.c: format string with truncate respects logOutputEncoding

Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given
length with an appropriate padding. This works for non-ASCII texts when
i18n.logOutputEncoding is UTF-8 only (independently of a printed commit
message encoding) but does not work when i18n.logOutputEncoding is NOT
UTF-8.

In 7e77df3 (pretty: two phase conversion for non utf-8 commits, 2013-04-19)
'format_commit_item' function assumes commit message to be in UTF-8.
And that was so until ecaee80 (pretty: --format output should honor
logOutputEncoding, 2013-06-26) where conversion to logOutputEncoding was
added before calling 'format_commit_message'.

Correct this by converting a commit message to UTF-8 first (as it
assumed in 7e77df3 (pretty: two phase conversion for non utf-8 commits,
2013-04-19)). Only after that convert a commit message to an actual
logOutputEncoding.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4205, t6006: add tests that fail with i18n.logOutputEncoding set
Alexey Shumkin [Wed, 21 May 2014 13:20:06 +0000 (17:20 +0400)] 
t4205, t6006: add tests that fail with i18n.logOutputEncoding set

Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given
length with an appropriate padding. This works for non-ASCII texts when
i18n.logOutputEncoding is UTF-8 only (independently of a printed commit
message encoding) but does not work when i18n.logOutputEncoding is NOT
UTF-8.

There were no breakages as far as were no tests for the case
when both a commit message and logOutputEncoding are not UTF-8.

Add failing tests for that which will be fixed in the next patch.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Helped-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Helped-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4205 (log-pretty-format): use `tformat` rather than `format`
Alexey Shumkin [Wed, 21 May 2014 13:20:05 +0000 (17:20 +0400)] 
t4205 (log-pretty-format): use `tformat` rather than `format`

Use `tformat` to avoid using of `echo` to complete end of line.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4041, t4205, t6006, t7102: don't hardcode tested encoding value
Alexey Shumkin [Wed, 21 May 2014 13:20:04 +0000 (17:20 +0400)] 
t4041, t4205, t6006, t7102: don't hardcode tested encoding value

The tested encoding is always available in a variable. Use it instead of
hardcoding. Also, to be in line with other tests use ISO8859-1
(uppercase) rather then iso8859-1.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoGit 2.0-rc4 v2.0.0-rc4
Junio C Hamano [Tue, 20 May 2014 19:07:35 +0000 (12:07 -0700)] 
Git 2.0-rc4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoRelNotes/2.0.0.txt: Fix several grammar issues, notably a lack of hyphens, double...
Jason St. John [Sat, 17 May 2014 03:30:34 +0000 (23:30 -0400)] 
RelNotes/2.0.0.txt: Fix several grammar issues, notably a lack of hyphens, double quotes, or articles

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoRevert "Merge branch 'jc/graduate-remote-hg-bzr' (early part)"
Junio C Hamano [Tue, 20 May 2014 21:18:11 +0000 (14:18 -0700)] 
Revert "Merge branch 'jc/graduate-remote-hg-bzr' (early part)"

Instead of showing a warning and working as before, fail and show
the message and force immediate upgrade from their upstream
repositories when these tools are run, per request from their
primary author.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorebase -i: test "Nothing to do" case with autostash
Matthieu Moy [Tue, 20 May 2014 07:49:31 +0000 (09:49 +0200)] 
rebase -i: test "Nothing to do" case with autostash

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agomove "--follow needs one pathspec" rule to diff_setup_done
Jeff King [Tue, 20 May 2014 06:49:20 +0000 (02:49 -0400)] 
move "--follow needs one pathspec" rule to diff_setup_done

Because of the way "--follow" is implemented, we must have
exactly one pathspec. "git log" enforces this restriction,
but other users of the revision traversal code do not. For
example, "git format-patch --follow" will segfault during
try_to_follow_renames, as we have no pathspecs at all.

We can push this check down into diff_setup_done, which is
probably a better place anyway. It is the diff code that
introduces this restriction, so other parts of the code
should not need to care themselves.

Reported-by: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'jc/graduate-remote-hg-bzr' (early part)
Junio C Hamano [Tue, 20 May 2014 00:12:36 +0000 (17:12 -0700)] 
Merge branch 'jc/graduate-remote-hg-bzr' (early part)

* 'jc/graduate-remote-hg-bzr' (early part):
  remote-helpers: point at their upstream repositories
  contrib: remote-helpers: add move warnings (v2.0)
  Revert "Merge branch 'fc/transport-helper-sync-error-fix'"

10 years agoremote-helpers: point at their upstream repositories
Junio C Hamano [Thu, 15 May 2014 21:58:16 +0000 (14:58 -0700)] 
remote-helpers: point at their upstream repositories

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib: remote-helpers: add move warnings (v2.0)
Felipe Contreras [Tue, 13 May 2014 21:29:56 +0000 (16:29 -0500)] 
contrib: remote-helpers: add move warnings (v2.0)

The tools are now maintained out-of-tree, and they have a regression
in v2.0. It's better to start warning the users as soon as possible.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoRevert "Merge branch 'fc/transport-helper-sync-error-fix'"
Junio C Hamano [Wed, 14 May 2014 19:06:35 +0000 (12:06 -0700)] 
Revert "Merge branch 'fc/transport-helper-sync-error-fix'"

This reverts commit d508e4a8e2391ae2596403b6478d01cf3d5f928f,
reversing changes made to e42552135a2a396f37053a89f44952ea907870b2.

The author of the original topic says he broke the upcoming 2.0
release with something that relates to "synchronization crash
regression" while refusing to give further specifics, so this would
unfortunately be the safest option for the upcoming release.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'rh/prompt-pcmode-avoid-eval-on-refname'
Junio C Hamano [Mon, 19 May 2014 23:10:10 +0000 (16:10 -0700)] 
Merge branch 'rh/prompt-pcmode-avoid-eval-on-refname'

* rh/prompt-pcmode-avoid-eval-on-refname:
  git-prompt.sh: don't assume the shell expands the value of PS1

10 years agogit-prompt.sh: don't assume the shell expands the value of PS1
Richard Hansen [Mon, 19 May 2014 22:55:37 +0000 (18:55 -0400)] 
git-prompt.sh: don't assume the shell expands the value of PS1

Not all shells subject the prompt string to parameter expansion.  Test
whether the shell will expand the value of PS1, and use the result to
control whether raw ref names are included directly in PS1.

This fixes a regression introduced in commit 8976500 ("git-prompt.sh:
don't put unsanitized branch names in $PS1"):  zsh does not expand PS1
by default, but that commit assumed it did.  The bug resulted in
prompts containing the literal string '${__git_ps1_branch_name}'
instead of the actual branch name.

Reported-by: Caleb Thompson <caleb@calebthompson.io>
Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorebase -i: handle "Nothing to do" case with autostash
Ramkumar Ramachandra [Mon, 19 May 2014 22:05:20 +0000 (18:05 -0400)] 
rebase -i: handle "Nothing to do" case with autostash

When a user invokes

  $ git rebase -i @~3

with dirty files and rebase.autostash turned on, and exits the $EDITOR
with an empty buffer, the autostash fails to apply. Although the primary
focus of rr/rebase-autostash was to get the git-rebase--backend.sh
scripts to return control to git-rebase.sh, it missed this case in
git-rebase--interactive.sh. Since this case is unlike the other cases
which return control for housekeeping, assign it a special return status
and handle that return value explicitly in git-rebase.sh.

Reported-by: Karen Etheridge <ether@cpan.org>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs
Alexey Shumkin [Mon, 19 May 2014 15:28:16 +0000 (19:28 +0400)] 
t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs

The expected SHA-1 digests are always available in variables. Use
them instead of hardcoding.

That was introduced in a742f2a (t4205 (log-pretty-formats): don't
hardcode SHA-1 in expected outputs, 2013-06-26) but unfortunately was
not followed in 5e1361c (log: properly handle decorations with chained
tags, 2013-12-17)

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'lt/request-pull'
Junio C Hamano [Mon, 19 May 2014 17:35:36 +0000 (10:35 -0700)] 
Merge branch 'lt/request-pull'

* lt/request-pull:
  request-pull: resurrect for-linus -> tags/for-linus DWIM

10 years agoMerge branch 'jl/use-vsatisfy-correctly-for-2.0'
Junio C Hamano [Mon, 19 May 2014 17:35:24 +0000 (10:35 -0700)] 
Merge branch 'jl/use-vsatisfy-correctly-for-2.0'

* jl/use-vsatisfy-correctly-for-2.0:
  git-gui: tolerate major version changes when comparing the git version

10 years agoMerge git://github.com/git-l10n/git-po
Junio C Hamano [Mon, 19 May 2014 17:32:56 +0000 (10:32 -0700)] 
Merge git://github.com/git-l10n/git-po

* git://github.com/git-l10n/git-po:
  fr: a lot of good fixups

10 years agoMerge branch 'kb/fast-hashmap'
Junio C Hamano [Mon, 19 May 2014 17:32:25 +0000 (10:32 -0700)] 
Merge branch 'kb/fast-hashmap'

* kb/fast-hashmap:
  Documentation/technical/api-hashmap: remove source highlighting

10 years agoDocumentation/technical/api-hashmap: remove source highlighting
Anders Kaseorg [Sat, 17 May 2014 11:08:55 +0000 (07:08 -0400)] 
Documentation/technical/api-hashmap: remove source highlighting

The highlighting was pretty, but unfortunately, the failure mode
when source-highlight is not installed was that the entire code
block disappears.

See https://bugs.debian.org/745591,
    https://bugs.launchpad.net/bugs/1316810.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit-gui: tolerate major version changes when comparing the git version
Jens Lehmann [Sat, 17 May 2014 19:49:05 +0000 (21:49 +0200)] 
git-gui: tolerate major version changes when comparing the git version

Since git 2.0.0 starting git gui in a submodule using a gitfile fails with
the following error:

   No working directory ../../../<path>

   couldn't change working directory
   to "../../../<path>": no such file or
   directory

This is because "git rev-parse --show-toplevel" is only run when git gui
sees a git version of at least 1.7.0 (which is the version in which the
--show-toplevel option was introduced). But "package vsatisfies" returns
false when the major version changes, which is not what we want here.

Fix that for both places where the git version is checked using vsatisfies
by appending a '-' to the version number. This tells vsatisfies that a
change of the major version is not considered to be a problem, as long as
the new major version is larger. This is done for both the place that
caused the reported bug and another spot where the git version is tested
for another feature.

Reported-by: Chris Packham <judge.packham@gmail.com>
Reported-by: Yann Dirson <ydirson@free.fr>
Helped-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Tested-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agofr: a lot of good fixups
Grégoire Paris [Tue, 6 May 2014 21:29:57 +0000 (23:29 +0200)] 
fr: a lot of good fixups

Signed-off-by: Grégoire Paris <postmaster@greg0ire.fr>
Acked-by: Jean-Noel Avila <jn.avila@free.fr>
10 years agorequest-pull: resurrect for-linus -> tags/for-linus DWIM
Junio C Hamano [Fri, 16 May 2014 17:18:25 +0000 (10:18 -0700)] 
request-pull: resurrect for-linus -> tags/for-linus DWIM

Older versions of Git before v1.7.10 did not DWIM

    $ git pull $URL for-linus

to the tag "tags/for-linus" and the users were required to say

    $ git pull $URL tags/for-linus

instead.  Because newer versions of Git works either way,
request-pull used to show tags/for-linus when asked

    $ git request-pull origin/master $URL for-linus

The recent updates broke this and in the output we see "for-linus"
without the "tags/" prefix.

As v1.7.10 is more than 2 years old, this should matter very little
in practice, but resurrecting it is very simple.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit grep -O -i: if the pager is 'less', pass the '-I' option
Johannes Schindelin [Tue, 8 Feb 2011 06:17:24 +0000 (00:17 -0600)] 
git grep -O -i: if the pager is 'less', pass the '-I' option

When <command> happens to be the magic string "less", today

git grep -O<command> -e<pattern>

helpfully passes +/<pattern> to less so you can navigate through
the results within a file using the n and shift+n keystrokes.

Alas, that doesn't do the right thing for a case-insensitive match,
i.e.

git grep -i -O<command> -e<pattern>

For that case we should pass --IGNORE-CASE to "less" so that n and
shift+n can move between results ignoring case in the pattern.

The original patch came from msysgit and used "-i", but that was not
due to lack of support for "-I" but it merely overlooked that it
ought to work even when the pattern contains capital letters.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoopen_sha1_file: report "most interesting" errno
Jeff King [Thu, 15 May 2014 08:54:06 +0000 (04:54 -0400)] 
open_sha1_file: report "most interesting" errno

When we try to open a loose object file, we first attempt to
open in the local object database, and then try any
alternates. This means that the errno value when we return
will be from the last place we looked (and due to the way
the code is structured, simply ENOENT if we do not have have
any alternates).

This can cause confusing error messages, as read_sha1_file
checks for ENOENT when reporting a missing object. If errno
is something else, we report that. If it is ENOENT, but
has_loose_object reports that we have it, then we claim the
object is corrupted. For example:

    $ chmod 0 .git/objects/??/*
    $ git rev-list --all
    fatal: loose object b2d6fab18b92d49eac46dc3c5a0bcafabda20131 (stored in .git/objects/b2/d6fab18b92d49eac46dc3c5a0bcafabda20131) is corrupt

This patch instead keeps track of the "most interesting"
errno we receive during our search. We consider ENOENT to be
the least interesting of all, and otherwise report the first
error found (so problems in the object database take
precedence over ones in alternates). Here it is with this
patch:

    $ git rev-list --all
    fatal: failed to read object b2d6fab18b92d49eac46dc3c5a0bcafabda20131: Permission denied

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorun_diff_files: do not look at uninitialized stat data
Jeff King [Wed, 14 May 2014 22:13:06 +0000 (18:13 -0400)] 
run_diff_files: do not look at uninitialized stat data

If we try to diff an index entry marked CE_VALID (because it
was marked with --assume-unchanged), we do not bother even
running stat() on the file to see if it was removed. This
started long ago with 540e694 (Prevent diff machinery from
examining assume-unchanged entries on worktree, 2009-08-11).

However, the subsequent code may look at our "struct stat"
and expect to find actual data; currently it will find
whatever cruft was left on the stack. This can cause
problems in two situations:

  1. We call match_stat_with_submodule with the stat data,
     so a submodule may be erroneously marked as changed.

  2. If --find-copies-harder is in effect, we pass all
     entries, even unchanged ones, to diff_change, so it can
     list them as rename/copy sources. Since we found no
     change, we assume that function will realize it and not
     actually display any diff output. However, we end up
     feeding it a bogus mode, leading it to sometimes claim
     there was a mode change.

We can fix both by splitting the CE_VALID and regular code
paths, and making sure only to look at the stat information
in the latter. Furthermore, we push the declaration of our
"struct stat" down into the code paths that actually set it,
so we cannot accidentally access it uninitialized in future
code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit-show: fix 'git show -s' to not add extra terminator after merge commit
Max Kirillov [Wed, 14 May 2014 22:12:45 +0000 (01:12 +0300)] 
git-show: fix 'git show -s' to not add extra terminator after merge commit

When git show -s is called for merge commit it prints extra newline
after any merge commit. This differs from output for commits with one
parent. Fix it by more thorough checking that diff output is disabled.

The code in question exists since commit 3969cf7db1. The additional
newline is really needed for cases when patch is requested, test
t4013-diff-various.sh contains cases which can demonstrate behavior when
the condition is restricted further.

Tests:

Added merge commit to 'set up a bit of history' case in t7007-show.sh to
cover the fix.

Existing tests are updated to demonstrate the new behaviour.  Earlier,
the tests that used "git show -s --pretty=format:%s", even though
"--pretty=format:%s" calls for item separator semantics and does not ask
for the terminating newline after the last item, expected the output to
end with such a newline.  They were relying on the buggy behaviour.  Use
of "--format=%s", which is equivalent to "--pretty=tformat:%s" that asks
for a terminating newline after each item, is a more realistic way to
use the command.

In the test 'merge log messages' the expected data is changed, because
it was explicitly listing the extra newline. Also the msg.nologff and
msg.nolognoff expected files are replaced by one msg.nolog, because they
were diffing because of the bug, and now there should be no difference.

Signed-off-by: Max Kirillov <max@max630.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'fc/prompt-zsh-read-from-file'
Junio C Hamano [Tue, 13 May 2014 18:53:14 +0000 (11:53 -0700)] 
Merge branch 'fc/prompt-zsh-read-from-file'

* fc/prompt-zsh-read-from-file:
  contrib: completion: fix 'eread()' namespace

10 years agocontrib: completion: fix 'eread()' namespace
Felipe Contreras [Tue, 13 May 2014 13:21:19 +0000 (08:21 -0500)] 
contrib: completion: fix 'eread()' namespace

Otherwise it might collide with a function of the same name in the
user's environment.

Suggested-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoindex-pack: distinguish missing objects from type errors
Jeff King [Mon, 12 May 2014 04:38:39 +0000 (00:38 -0400)] 
index-pack: distinguish missing objects from type errors

When we fetch a pack that does not contain an object we
expected to receive, we get an error like:

  $ git init --bare tmp.git && cd tmp.git
  $ git fetch ../parent.git
  [...]
  error: Could not read 964953ec7bcc0245cb1d0db4095455edd21a2f2e
  fatal: Failed to traverse parents of commit b8247b40caf6704fe52736cdece6d6aae87471aa
  error: ../parent.git did not send all necessary objects

This comes from the check_everything_connected rev-list. If
we try cloning the same repo (rather than a fetch), we end
up using index-pack's --check-self-contained-and-connected
option instead, which produces output like:

  $ git clone --no-local --bare parent.git tmp.git
  [...]
  fatal: object of unexpected type
  fatal: index-pack failed

Not only is the sha1 missing, but it's a misleading message.
There's no type problem, but rather a missing object
problem; we don't notice the difference because we simply
compare OBJ_BAD != OBJ_BLOB.  Let's provide a different
message for this case:

  $ git clone --no-local --bare parent.git tmp.git
  fatal: did not receive expected object 6b00a8c61ed379d5f925a72c1987c9c52129d364
  fatal: index-pack failed

While we're at it, let's also improve a true type mismatch
error to look like

  fatal: object 6b00a8c61ed379d5f925a72c1987c9c52129d364: expected type blob, got tree

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge git://github.com/git-l10n/git-po
Junio C Hamano [Mon, 12 May 2014 17:12:05 +0000 (10:12 -0700)] 
Merge git://github.com/git-l10n/git-po

* git://github.com/git-l10n/git-po:
  l10n: Updated Bulgarian translation of git (1307t0f921u)

10 years agol10n: Updated Bulgarian translation of git (1307t0f921u)
Alexander Shopov [Wed, 29 Jan 2014 13:08:40 +0000 (15:08 +0200)] 
l10n: Updated Bulgarian translation of git (1307t0f921u)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
10 years agoGit 2.0-rc3 v2.0.0-rc3
Junio C Hamano [Fri, 9 May 2014 18:23:25 +0000 (11:23 -0700)] 
Git 2.0-rc3