gitweb.git
describe: fix --contains when a tag is given as inputJunio C Hamano Thu, 18 Jul 2013 21:46:51 +0000 (14:46 -0700)

describe: fix --contains when a tag is given as input

"git describe" takes a commit and gives it a name based on tags in
its neighbourhood. The command does take a commit-ish but when
given a tag that points at a commit, it should dereference the tag
before computing the name for the commit.

As the whole processing is internally delegated to name-rev, if we
unwrap tags down to the underlying commit when invoking name-rev, it
will make the name-rev issue an error message based on the unwrapped
object name (i.e. either 40-hex object name, or "$tag^0") that is
different from what the end-user gave to the command when the commit
cannot be described. Introduce an internal option --peel-tag to the
name-rev to tell it to unwrap a tag in its input from the command
line.

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

name-rev: differentiate between tags and commits they... Junio C Hamano Thu, 18 Jul 2013 21:11:35 +0000 (14:11 -0700)

name-rev: differentiate between tags and commits they point at

"git name-rev --stdin" has been fixed to convert an object name that
points at a tag to a refname of the tag. The codepath to handle its
command line arguments, however, fed the commit that the tag points
at to the underlying naming machinery.

With this fix, you will get this:

$ git name-rev --refs=tags/\* --name-only $(git rev-parse v1.8.3 v1.8.3^0)
v1.8.3
v1.8.3^0

which is the same as what you would get from the fixed "--stdin" variant:

$ git rev-parse v1.8.3 v1.8.3^0 | git name-rev --refs=tags/\* --name-only
v1.8.3
v1.8.3^0

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

Update draft release notes to 1.8.4Junio C Hamano Thu, 18 Jul 2013 19:57:38 +0000 (12:57 -0700)

Update draft release notes to 1.8.4

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

Merge branch 'jc/revert-clone-doc-update-for-push-from... Junio C Hamano Thu, 18 Jul 2013 19:59:59 +0000 (12:59 -0700)

Merge branch 'jc/revert-clone-doc-update-for-push-from-shallow'

* jc/revert-clone-doc-update-for-push-from-shallow:
Revert "git-clone.txt: remove the restriction on pushing from a shallow clone"

Merge branch 'rs/mailmap-himself'Junio C Hamano Thu, 18 Jul 2013 19:59:58 +0000 (12:59 -0700)

Merge branch 'rs/mailmap-himself'

* rs/mailmap-himself:
.mailmap: René Scharfe has a new email address

Merge branch 'sb/mailmap-updates'Junio C Hamano Thu, 18 Jul 2013 19:59:56 +0000 (12:59 -0700)

Merge branch 'sb/mailmap-updates'

* sb/mailmap-updates:
.mailmap: combine more (email, name) to individual persons
.mailmap: Combine more (email, name) to individual persons
.mailmap: Map email addresses to names

Merge branch 'jk/in-pack-size-measurement'Junio C Hamano Thu, 18 Jul 2013 19:59:41 +0000 (12:59 -0700)

Merge branch 'jk/in-pack-size-measurement'

"git cat-file --batch-check=<format>" is added, primarily to allow
on-disk footprint of objects in packfiles (often they are a lot
smaller than their true size, when expressed as deltas) to be
reported.

* jk/in-pack-size-measurement:
pack-revindex: radix-sort the revindex
pack-revindex: use unsigned to store number of objects
cat-file: split --batch input lines on whitespace
cat-file: add %(objectsize:disk) format atom
cat-file: add --batch-check=<format>
cat-file: refactor --batch option parsing
cat-file: teach --batch to stream blob objects
t1006: modernize output comparisons
teach sha1_object_info_extended a "disk_size" query
zero-initialize object_info structs

Merge branch 'bp/mediawiki-preview'Junio C Hamano Thu, 18 Jul 2013 19:59:34 +0000 (12:59 -0700)

Merge branch 'bp/mediawiki-preview'

Add a command to allow previewing the contents locally before
pushing it out, when working with a MediaWiki remote.

I personally do not think this belongs to Git. If you are working
on a set of AsciiDoc source files, you sure do want to locally
format to preview what you will be pushing out, and if you are
working on a set of C or Java source files, you do want to test it
before pushing it out, too. That kind of thing belongs to your
build script, not to your SCM.

But I'll let it pass, as this is only a contrib/ thing.

* bp/mediawiki-preview:
git-remote-mediawiki: add preview subcommand into git mw
git-remote-mediawiki: add git-mw command
git-remote-mediawiki: factoring code between git-remote-mediawiki and Git::Mediawiki
git-remote-mediawiki: update tests to run with the new bin-wrapper
git-remote-mediawiki: add a git bin-wrapper for developement
wrap-for-bin: make bin-wrappers chainable
git-remote-mediawiki: introduction of Git::Mediawiki.pm

Merge branch 'bc/commit-invalid-utf8'Junio C Hamano Thu, 18 Jul 2013 19:58:19 +0000 (12:58 -0700)

Merge branch 'bc/commit-invalid-utf8'

Logic to auto-detect character encodings in the commit log message
did not reject overlong and invalid UTF-8 characters.

* bc/commit-invalid-utf8:
commit: reject non-characters
commit: reject overlong UTF-8 sequences
commit: reject invalid UTF-8 codepoints

Merge branch 'es/overlapping-range-set'Junio C Hamano Thu, 18 Jul 2013 19:58:17 +0000 (12:58 -0700)

Merge branch 'es/overlapping-range-set'

* es/overlapping-range-set:
range_set: fix coalescing bug when range is a subset of another
t4211: fix broken test when one -L range is subset of another

Merge branch 'jk/maint-clone-shared-no-connectivity... Junio C Hamano Thu, 18 Jul 2013 19:48:28 +0000 (12:48 -0700)

Merge branch 'jk/maint-clone-shared-no-connectivity-validation'

"git clone -s/-l" is a filesystem level copy and does not offer any
protection against source repository being corrupt. While the
connectivity validation checks commits and trees being readable, it
made the otherwise instantaneous local modes of clone much more
expensive, without protecting blob data from bitflips.

* jk/maint-clone-shared-no-connectivity-validation:
clone: drop connectivity check for local clones

Merge branch 'bc/push-match-many-refs'Junio C Hamano Thu, 18 Jul 2013 19:48:25 +0000 (12:48 -0700)

Merge branch 'bc/push-match-many-refs'

Pushing to repositories with many refs employed O(m*n) algorithm
where n is the number of refs on the receiving end.

* bc/push-match-many-refs:
remote.c: avoid O(m*n) behavior in match_push_refs

Merge branch 'rr/rebase-reflog-message-reword'Junio C Hamano Thu, 18 Jul 2013 19:48:20 +0000 (12:48 -0700)

Merge branch 'rr/rebase-reflog-message-reword'

"git rebase [-i]" used to leave just "rebase" as its reflog message
for some operations. This rewords them to be more informative.

* rr/rebase-reflog-message-reword:
rebase -i: use a better reflog message
rebase: use a better reflog message

show-branch: fix description of --date-orderThomas Rast Thu, 18 Jul 2013 12:26:56 +0000 (14:26 +0200)

show-branch: fix description of --date-order

The existing description reads as if it somehow applies a filter.
Change it to explain that it is merely about the ordering.

Message-proposed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

apply, entry: speak of submodules instead of subprojectsThomas Rast Thu, 18 Jul 2013 12:26:55 +0000 (14:26 +0200)

apply, entry: speak of submodules instead of subprojects

There are only four (with some generous rounding) instances in the
current source code where we speak of "subproject" instead of
"submodule". They are as follows:

* one error message in git-apply and two in entry.c

* the patch format for submodule changes

The latter was introduced in 0478675 (Expose subprojects as special
files to "git diff" machinery, 2007-04-15), apparently before the
terminology was settled. We can of course not change the patch
format.

Let's at least change the error messages to consistently call them
"submodule".

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

cygwin: Remove the Win32 l/stat() implementationRamsay Jones Sat, 22 Jun 2013 19:42:47 +0000 (20:42 +0100)

cygwin: Remove the Win32 l/stat() implementation

Commit adbc0b6b ("cygwin: Use native Win32 API for stat", 30-09-2008)
added a Win32 specific implementation of the stat functions. In order
to handle absolute paths, cygwin mount points and symbolic links, this
implementation may fall back on the standard cygwin l/stat() functions.
Also, the choice of cygwin or Win32 functions is made lazily (by the
first call(s) to l/stat) based on the state of some config variables.

Unfortunately, this "schizophrenic stat" implementation has been the
source of many problems ever since. For example, see commits 7faee6b8,
79748439, 452993c2, 085479e7, b8a97333, 924aaf3e, 05bab3ea and 0117c2f0.

In order to avoid further problems, such as the issue raised by the new
reference handling API, remove the Win32 l/stat() implementation.

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

do_one_ref(): save and restore value of current_refMichael Haggerty Mon, 15 Jul 2013 15:24:17 +0000 (17:24 +0200)

do_one_ref(): save and restore value of current_ref

If do_one_ref() is called recursively, then the inner call should not
permanently overwrite the value stored in current_ref by the outer
call. Aside from the tiny optimization loss, peel_ref() expects the
value of current_ref not to change across a call to peel_entry(). But
in the presence of replace references that assumption could be
violated by a recursive call to do_one_ref:

do_for_each_entry()
do_one_ref()
builtin/describe.c:get_name()
peel_ref()
peel_entry()
peel_object ()
deref_tag_noverify()
parse_object()
lookup_replace_object()
do_lookup_replace_object()
prepare_replace_object()
do_for_each_ref()
do_for_each_entry()
do_for_each_entry_in_dir()
do_one_ref()

The inner call to do_one_ref() was unconditionally setting current_ref
to NULL when it was done, causing peel_ref() to perform an invalid
memory access.

So change do_one_ref() to save the old value of current_ref before
overwriting it, and restore the old value afterward rather than
setting it to NULL.

Reported-by: Mantas Mikulėnas <grawity@gmail.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

.mailmap: combine more (email, name) to individual... Stefan Beller Wed, 17 Jul 2013 20:16:31 +0000 (22:16 +0200)

.mailmap: combine more (email, name) to individual persons

I got more responses from people regarding the .mailmap file.
All added persons gave permission to add them to the .mailmap file.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

parse_object_buffer: correct freeing the bufferStefan Beller Wed, 17 Jul 2013 22:09:42 +0000 (00:09 +0200)

parse_object_buffer: correct freeing the buffer

If we exit early in the function parse_object_buffer, we did not
write to *eaten_p. Then the calling function parse_object, which looks
like the following with respect to the eaten variable, cannot rely on a
proper value set in eaten, hence the freeing of the buffer depends
on random values in memory.

struct object *parse_object(const unsigned char *sha1)
{
int eaten;
...
obj = parse_object_buffer(sha1, type, size, buffer, &eaten);
if (!eaten)
free(buffer);
}

This change makes sure, the buffer freeing condition is deterministic.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

blame-options.txt: explain that -L <start> and <end... Eric Sunshine Wed, 17 Jul 2013 21:25:32 +0000 (17:25 -0400)

blame-options.txt: explain that -L <start> and <end> are optional

The ability to omit either end of the -L range is a handy but
undocumented shortcut, and is thus not easily discovered. Fix this
shortcoming.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

blame-options.txt: place each -L option variation on... Eric Sunshine Wed, 17 Jul 2013 21:25:31 +0000 (17:25 -0400)

blame-options.txt: place each -L option variation on its own line

Standard practice in Git documentation is for each variation of an
option (such as: -p / --porcelain) to be placed on its own line in the
OPTIONS table. The -L option does not follow suit. It cuddles
"-L <start>,<end>" and "-L :<regex>", separated by a comma. This is
inconsistent and potentially confusing since the comma separating them
is typeset the same as the comma in "<start>,<end>". Fix this by placing
each variation on its own line.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t8001/t8002 (blame): add blame -L :funcname testsEric Sunshine Wed, 17 Jul 2013 21:25:30 +0000 (17:25 -0400)

t8001/t8002 (blame): add blame -L :funcname tests

git-blame inherited "-L :funcname" support when "-L :funcname:file" was
implemented for git-log. Add tests.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t8001/t8002 (blame): add blame -L testsEric Sunshine Wed, 17 Jul 2013 21:25:29 +0000 (17:25 -0400)

t8001/t8002 (blame): add blame -L tests

With the exception of a couple "corner case" checks in t8003 (and some
indirect tests in t4211 of -L parsing code shared by log -L), there is
no systematic checking of blame -L. Add tests to check blame -L
directly.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t8001/t8002 (blame): modernize styleEric Sunshine Wed, 17 Jul 2013 21:25:28 +0000 (17:25 -0400)

t8001/t8002 (blame): modernize style

In particular,

- indent with tabs
- cuddle test description and opening body quote with test_expect_foo
- normalize test descriptions and case
- remove whitepsace following redirection operator
- use standardized filenames (such as "actual", "expected")

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

line-range: fix "blame -L X,-N" regressionEric Sunshine Wed, 17 Jul 2013 21:25:27 +0000 (17:25 -0400)

line-range: fix "blame -L X,-N" regression

"blame -L X,-N" is documented as blaming "N lines ending at X". In
practice, the behavior is achieved by swapping the two range endpoints
if the second is less than the first. 25ed3412 (Refactor parse_loc;
2013-03-28) broke this interpretation by removing the swapping code from
blame.c and failing to add it to line-range.c along with other code
relocated from blame.c. Thus, such a range is effectively treated as
empty. Fix this regression.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

.mailmap: René Scharfe has a new email addressRené Scharfe Wed, 17 Jul 2013 19:54:25 +0000 (21:54 +0200)

.mailmap: René Scharfe has a new email address

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

show-ref: make --head always show the HEAD refDoug Bell Wed, 17 Jul 2013 00:05:14 +0000 (19:05 -0500)

show-ref: make --head always show the HEAD ref

The docs seem to say that doing

git show-ref --head --tags

would show both the HEAD ref and all the tag refs. However, doing
both --head and either of --tags or --heads would filter out the HEAD
ref.

Also update the documentation to describe the new behavior and add
tests for the show-ref command.

[jc: Doug did proofread the tests, but it was done by me and bugs in
it are mine].

Signed-off-by: Doug Bell <madcityzen@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git-log.txt: capitalize section namesMatthieu Moy Tue, 16 Jul 2013 08:05:40 +0000 (10:05 +0200)

Documentation/git-log.txt: capitalize section names

This is the convention in most other files and even at the beginning of
git-log.txt

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: move description of -s, --no-patch to... Matthieu Moy Tue, 16 Jul 2013 08:05:39 +0000 (10:05 +0200)

Documentation: move description of -s, --no-patch to diff-options.txt

Technically, "-s, --no-patch" is implemented in diff.c ("git diff
--no-patch" is essentially useless, but valid). From the user point of
view, this allows the documentation to show up in "git show --help",
which is one of the most useful use of the option.

While we're there, add a sentence explaining why the option can be
useful.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git-show.txt: include common diff options... Matthieu Moy Tue, 16 Jul 2013 08:05:38 +0000 (10:05 +0200)

Documentation/git-show.txt: include common diff options, like git-log.txt

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: allow --patch & cie to override -s/--no-patchMatthieu Moy Tue, 16 Jul 2013 08:05:37 +0000 (10:05 +0200)

diff: allow --patch & cie to override -s/--no-patch

All options that trigger a patch output now override --no-patch.

The case of --binary deserves extra attention: the name may suggest that
it turns a normal patch into a binary patch, but it actually already
enables patch output when normally disabled (e.g. "git log --binary"
displays a patch), hence it makes sense for "git show --no-patch
--binary" to display the binary patch.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: allow --no-patch as synonym for -sMatthieu Moy Tue, 16 Jul 2013 08:05:36 +0000 (10:05 +0200)

diff: allow --no-patch as synonym for -s

This follows the usual convention of having a --no-foo option to negate
--foo.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4000-diff-format.sh: modernize styleMatthieu Moy Tue, 16 Jul 2013 08:05:35 +0000 (10:05 +0200)

t4000-diff-format.sh: modernize style

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-log.txt: fix typesetting of example "git-log -L... Eric Sunshine Tue, 16 Jul 2013 00:10:36 +0000 (20:10 -0400)

git-log.txt: fix typesetting of example "git-log -L" invocation

All surrounding examples are typeset as monospaced text. Follow suit.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Acked-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git: ensure 0/1/2 are open in main()Thomas Rast Tue, 16 Jul 2013 09:27:37 +0000 (11:27 +0200)

git: ensure 0/1/2 are open in main()

Not having an open FD in the 0--2 range can lead to strange results,
for example, a subsequent open() may return 2 (stderr) and then a
die() would clobber this file.

git-daemon and git-shell already guarded against this, but apparently
users also manage to trip over it in other git commands. So we call
sanitize_stdfds() during main git startup.

Since these FDs are inherited, this covers all use of 'git foo ...',
and all internal C commands when called directly. It does not fix
shell/perl commands called directly.

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

daemon/shell: refactor redirection of 0/1/2 from /dev... Thomas Rast Tue, 16 Jul 2013 09:27:36 +0000 (11:27 +0200)

daemon/shell: refactor redirection of 0/1/2 from /dev/null

Both daemon.c and shell.c contain logic to open FDs 0/1/2 from
/dev/null if they are not already open. Move the function in daemon.c
to setup.c and use it in shell.c, too.

While there, remove a 'not' that inverted the meaning of the comment.
The point is indeed to *avoid* messing up.

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

request-pull: improve error message for invalid revisio... Dirk Wallenstein Wed, 17 Jul 2013 17:28:11 +0000 (19:28 +0200)

request-pull: improve error message for invalid revision args

Currently, when an invalid revision is specified, the error message is:

fatal: Needed a single revision

This is misleading because, you might think there is something wrong
with the command line as a whole.

Now the user gets a more meaningful error message, showing the invalid
revision.

Signed-off-by: Dirk Wallenstein <halsmit@t-online.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-multimail: an improved replacement for post-receive... Michael Haggerty Sun, 14 Jul 2013 08:09:02 +0000 (10:09 +0200)

git-multimail: an improved replacement for post-receive-email

Add git-multimail, a tool for generating notification emails for
pushes to a Git repository. It is largely plug-in compatible with
post-receive-email, and is proposed to eventually replace that script.
The advantages of git-multimail relative to post-receive-email are
described in README.migrate-from-post-receive-email.

git-multimail is organized in a directory contrib/hooks/multimail.
The directory contains:

* git_multimail.py -- a Python module that can generate notification
emails for pushes to a Git repository. The file can be used
directly as a post-receive script (configured via git config
settings), or it can be imported as a Python module and configured
via arbitrary Python code.

* README -- user-level documentation for configuring and using
git-multimail.

* post-receive -- an example of building a post-receive script that
imports git_multimail.py as a Python module, with an example of how
to change the email templates.

* README.migrate-from-post-receive-email -- documentation targeted at
current users of post-receive-email, explaining the differences and
how to migrate a post-receive-email configuration to git-multimail.

* migrate-mailhook-config -- a script that can migrate a user's
post-receive-email configuration options to the equivalent
git-multimail options.

* README.Git -- a short explanation of the relationship between
git-multimail and the rest of the Git project, plus the exact date
and revision when this version was taken from the upstream project.

All but the last file are taken verbatim from the upstream
git-multimail project.

git-multimail is originally derived from post-receive-email and also
incorporates suggestions from the mailing list as well as patches by
the people listed below.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Contributions-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Contributions-by: Ramkumar Ramachandra <artagnon@gmail.com>
Contributions-by: Chris Hiestand <chrishiestand@gmail.com>
Contributions-by: Michiel Holtkamp <git@elfstone.nl>
Contributions-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

upload-pack: remove a piece of dead codeMatthijs Kooijman Thu, 11 Jul 2013 11:25:52 +0000 (13:25 +0200)

upload-pack: remove a piece of dead code

Commit 682c7d2 (upload-pack: fix off-by-one depth calculation in shallow
clone) introduced a new check in get_shallow_commits to decide when to
stop traversing the history and mark the current commit as a shallow
root.

With this new check in place, the old check can no longer be true, since
the first check always fires first. This commit removes that check,
making the code a bit more simple again.

Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 1.8.4Junio C Hamano Mon, 15 Jul 2013 17:33:21 +0000 (10:33 -0700)

Update draft release notes to 1.8.4

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

Sync with 1.8.3.3Junio C Hamano Mon, 15 Jul 2013 17:45:02 +0000 (10:45 -0700)

Sync with 1.8.3.3

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

Git 1.8.3.3 v1.8.3.3Junio C Hamano Mon, 15 Jul 2013 17:39:43 +0000 (10:39 -0700)

Git 1.8.3.3

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

Merge branch 'tr/maint-apply-non-git-patch-parsefix... Junio C Hamano Mon, 15 Jul 2013 17:36:14 +0000 (10:36 -0700)

Merge branch 'tr/maint-apply-non-git-patch-parsefix' into maint

"git apply" parsed patches that add new files, generated by programs
other than Git, incorrectly. This is an old breakage in v1.7.11.

* tr/maint-apply-non-git-patch-parsefix:
apply: carefully strdup a possibly-NULL name

Merge branch 'bc/http-keep-memory-given-to-curl' into... Junio C Hamano Mon, 15 Jul 2013 17:36:01 +0000 (10:36 -0700)

Merge branch 'bc/http-keep-memory-given-to-curl' into maint

Older cURL wanted piece of memory we call it with to be stable, but
we updated the auth material after handing it to a call.

* bc/http-keep-memory-given-to-curl:
http.c: don't rewrite the user:passwd string multiple times

Merge branch 'jk/pull-into-dirty-unborn' into maintJunio C Hamano Mon, 15 Jul 2013 17:35:43 +0000 (10:35 -0700)

Merge branch 'jk/pull-into-dirty-unborn' into maint

"git pull" into nothing trashed "local changes" that were in the
index.

* jk/pull-into-dirty-unborn:
pull: merge into unborn by fast-forwarding from empty tree
pull: update unborn branch tip after index

Merge branch 'fg/submodule-non-ascii-path' into maintJunio C Hamano Mon, 15 Jul 2013 17:35:17 +0000 (10:35 -0700)

Merge branch 'fg/submodule-non-ascii-path' into maint

Many "git submodule" operations did not work on a submodule at a
path whose name is not in ASCII.

* fg/submodule-non-ascii-path:
t7400: test of UTF-8 submodule names pass under Mac OS
handle multibyte characters in name

Merge branch 'fc/sequencer-plug-leak' into maintJunio C Hamano Mon, 15 Jul 2013 17:35:04 +0000 (10:35 -0700)

Merge branch 'fc/sequencer-plug-leak' into maint

"cherry-pick" had a small leak in its error codepath.

* fc/sequencer-plug-leak:
sequencer: avoid leaking message buffer when refusing to create an empty commit
sequencer: remove useless indentation

Merge branch 'mt/send-email-cc-match-fix' into maintJunio C Hamano Mon, 15 Jul 2013 17:34:36 +0000 (10:34 -0700)

Merge branch 'mt/send-email-cc-match-fix' into maint

Logic used by git-send-email to suppress cc mishandled names like "A
U. Thor" <author@example.xz>, where the human readable part needs to
be quoted (the user input may not have the double quotes around the
name, and comparison was done between quoted and unquoted strings).
It also mishandled names that need RFC2047 quoting.

* mt/send-email-cc-match-fix:
send-email: sanitize author when writing From line
send-email: add test for duplicate utf8 name
test-send-email: test for pre-sanitized self name
t/send-email: test suppress-cc=self with non-ascii
t/send-email: add test with quoted sender
send-email: make --suppress-cc=self sanitize input
t/send-email: test suppress-cc=self on cccmd
send-email: fix suppress-cc=self on cccmd
t/send-email.sh: add test for suppress-cc=self

Merge branch 'bc/send-email-use-port-as-separate-param'Junio C Hamano Mon, 15 Jul 2013 17:28:50 +0000 (10:28 -0700)

Merge branch 'bc/send-email-use-port-as-separate-param'

Pass port number as a separate argument when send-email initializes
Net::SMTP, instead of as a part of the hostname, i.e. host:port.
This allows GSSAPI codepath to match with the hostname given.

* bc/send-email-use-port-as-separate-param:
send-email: provide port separately from hostname

Merge branch 'fg/submodule-clone-depth'Junio C Hamano Mon, 15 Jul 2013 17:28:48 +0000 (10:28 -0700)

Merge branch 'fg/submodule-clone-depth'

Allow shallow-cloning of submodules with "git submodule update".

* fg/submodule-clone-depth:
Add --depth to submodule update/add

Merge branch 'cp/submodule-custom-update'Junio C Hamano Mon, 15 Jul 2013 17:28:44 +0000 (10:28 -0700)

Merge branch 'cp/submodule-custom-update'

In addition to the choice from "rebase, merge, or checkout-detach",
allow a custom command to be used in "submodule update" to update
the working tree of submodules.

* cp/submodule-custom-update:
submodule update: allow custom command to update submodule working tree

Merge branch 'jk/format-patch-from'Junio C Hamano Mon, 15 Jul 2013 17:28:39 +0000 (10:28 -0700)

Merge branch 'jk/format-patch-from'

"git format-patch" learned "--from[=whom]" option, which sets the
"From: " header to the specified person (or the person who runs the
command, if "=whom" part is missing) and move the original author
information to an in-body From: header as necessary.

* jk/format-patch-from:
teach format-patch to place other authors into in-body "From"
pretty.c: drop const-ness from pretty_print_context

Merge branch 'mv/merge-ff-tristate'Junio C Hamano Mon, 15 Jul 2013 17:28:34 +0000 (10:28 -0700)

Merge branch 'mv/merge-ff-tristate'

The configuration variable "merge.ff" was cleary a tri-state to
choose one from "favor fast-forward when possible", "always create
a merge even when the history could fast-forward" and "do not
create any merge, only update when the history fast-forwards", but
the command line parser did not implement the usual convention of
"last one wins, and command line overrides the configuration"
correctly.

* mv/merge-ff-tristate:
merge: handle --ff/--no-ff/--ff-only as a tri-state option

Merge branch 'jk/fetch-pack-many-refs'Junio C Hamano Mon, 15 Jul 2013 17:28:31 +0000 (10:28 -0700)

Merge branch 'jk/fetch-pack-many-refs'

Fetching between repositories with many refs employed O(n^2)
algorithm to match up the common objects, which has been corrected.

* jk/fetch-pack-many-refs:
fetch-pack: avoid quadratic behavior in rev_list_push
commit.c: make compare_commits_by_commit_date global
fetch-pack: avoid quadratic list insertion in mark_complete

templates: spell ASCII in uppercase in pre-commit hookRichard Hartmann Sun, 14 Jul 2013 16:21:16 +0000 (18:21 +0200)

templates: spell ASCII in uppercase in pre-commit hook

The name of the encoding is ASCII, not ascii.

Signed-off-by: Richard Hartmann <richih.mailinglist@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

templates: Reformat pre-commit hook's messageRichard Hartmann Sun, 14 Jul 2013 16:21:15 +0000 (18:21 +0200)

templates: Reformat pre-commit hook's message

Now that we're using heredoc, the message can span the full 80 chars.

Signed-off-by: Richard Hartmann <richih.mailinglist@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

templates: Use heredoc in pre-commit hookRichard Hartmann Sun, 14 Jul 2013 16:21:14 +0000 (18:21 +0200)

templates: Use heredoc in pre-commit hook

This way, it is easier to see how the text we give the end users
would look like, and it will allow us to use (near) full width
of the source file.

Signed-off-by: Richard Hartmann <richih.mailinglist@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff.c: Do not initialize a variable, which gets reassi... Stefan Beller Sun, 14 Jul 2013 21:35:49 +0000 (23:35 +0200)

diff.c: Do not initialize a variable, which gets reassigned anyway.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: Fix a memory leak in determine_author_infoStefan Beller Sun, 14 Jul 2013 21:35:47 +0000 (23:35 +0200)

commit: Fix a memory leak in determine_author_info

The date variable is assigned new memory via xmemdupz and 2 lines later
it is assigned new memory again via xmalloc, but the first assignment
is never freed nor used.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

daemon.c:handle: Remove unneeded check for null pointer.Stefan Beller Sun, 14 Jul 2013 21:35:46 +0000 (23:35 +0200)

daemon.c:handle: Remove unneeded check for null pointer.

addr doesn't need to be checked at that line as it it already accessed
7 lines before in the if (addr->sa_family).

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Revert "git-clone.txt: remove the restriction on pushin... Junio C Hamano Mon, 15 Jul 2013 15:31:52 +0000 (08:31 -0700)

Revert "git-clone.txt: remove the restriction on pushing from a shallow clone"

This reverts commit dacd2bcc414e0b7aac36aaa400da0a743c4741cc.

"It fails reliably without corrupting the receiving repository when
it should fail" may be better than the situation before the receiving
end was hardened recently, but the fact that sometimes the push does
not go through still remains. It is better to advice the users that
they cannot push from a shallow repository as a limitation before
they decide to use (or not to use) a shallow clone.

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

mailmap: style fixesJunio C Hamano Mon, 15 Jul 2013 06:54:13 +0000 (02:54 -0400)

mailmap: style fixes

Wrap overlong lines and format the multi-line comments to match our
coding style.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailmap: debug: avoid passing NULL to fprintf() '%s... Eric Sunshine Mon, 15 Jul 2013 06:54:12 +0000 (02:54 -0400)

mailmap: debug: avoid passing NULL to fprintf() '%s' conversion specification

POSIX does not state the behavior of '%s' conversion when passed a
NULL pointer. Some implementations interpolate literal "(null)";
others may crash.

Callers of debug_mm() often pass NULL as indication of either a
missing name or email address. Instead, let's always supply a
proper string pointer, and make it a bit more descriptive: "(none)"

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailmap: debug: eliminate -Wformat field precision... Eric Sunshine Mon, 15 Jul 2013 06:54:11 +0000 (02:54 -0400)

mailmap: debug: eliminate -Wformat field precision type warning

The compiler complains that '*' in fprintf() format "%.*s" should
have type int, but we pass size_t. Fix this.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailmap: debug: fix malformed fprintf() format conversi... Eric Sunshine Mon, 15 Jul 2013 06:54:10 +0000 (02:54 -0400)

mailmap: debug: fix malformed fprintf() format conversion specification

Resolve segmentation fault due to size_t variable being consumed by
'%s'.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailmap: debug: fix out-of-order fprintf() argumentsEric Sunshine Mon, 15 Jul 2013 06:54:09 +0000 (02:54 -0400)

mailmap: debug: fix out-of-order fprintf() arguments

Resolve segmentation fault due to arguments passed in wrong order.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailmap: do not downcase mailmap entriesJunio C Hamano Mon, 15 Jul 2013 06:54:08 +0000 (02:54 -0400)

mailmap: do not downcase mailmap entries

The email addresses in the records read from the .mailmap file are
downcased very early, and then used to match against e-mail
addresses in the input. Because we do use case insensitive version
of string list to manage these entries, there is no need to do this,
and worse yet, downcasing the rewritten/canonical e-mail read from
the .mailmap file loses information.

Stop doing that, and also make the string list used to keep multiple
names for an mailmap entry case insensitive (the code that uses the
list, lookup_prefix(), expects a case insensitive match).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4203: demonstrate loss of uppercase characters in... Eric Sunshine Mon, 15 Jul 2013 06:54:07 +0000 (02:54 -0400)

t4203: demonstrate loss of uppercase characters in canonical email

The email addresses read from .mailmap are downcased before being
inserted into the mailmap data structure, which undesirably loses
information. It is impossible, for instance, to map <first.last@host>
to <First.Last@host>. Demonstrate this problem.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailmap: do not lose single-letter namesJunio C Hamano Mon, 15 Jul 2013 06:54:06 +0000 (02:54 -0400)

mailmap: do not lose single-letter names

In parse_name_and_email() function, there is this line:

*name = (nstart < nend ? nstart : NULL);

When the function is given a buffer "A <A@example.org> <old@x.z>",
nstart scans from the beginning of the buffer, skipping whitespaces
(there isn't any, so nstart points at the buffer), while nend starts
from one byte before the first '<' and skips whitespaces backwards
and stops at the first non-whitespace (i.e. it hits "A" at the
beginning of the buffer). nstart == nend in this case for a
single-letter name, and an off-by-one error makes it fail to pick up
the name, which makes the entry equivalent to

<A@example.org> <old@x.z>

without the name.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4203: demonstrate loss of single-character name in... Eric Sunshine Mon, 15 Jul 2013 06:54:05 +0000 (02:54 -0400)

t4203: demonstrate loss of single-character name in mailmap entry

A bug in mailmap.c:parse_name_and_email() causes it to overlook the
single-character name in "A <user@host>" and parse it only as
"<user@host>". Demonstrate this problem.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

.mailmap: Combine more (email, name) to individual... Stefan Beller Sun, 14 Jul 2013 10:14:59 +0000 (12:14 +0200)

.mailmap: Combine more (email, name) to individual persons

I got more responses from people regarding the .mailmap file.
All added persons gave permission to add them to the .mailmap file.

It's mostly email mappings again. However we also have Nick Stokoe,
who contributed as Nick Woolley. He changed his name, but kept the email.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4203: test check-mailmap command invocationEric Sunshine Sat, 13 Jul 2013 00:53:11 +0000 (20:53 -0400)

t4203: test check-mailmap command invocation

Test the command-line interface of check-mailmap.

(Actual .mailmap functionality is already covered by existing tests.)

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin: add git-check-mailmap commandEric Sunshine Sat, 13 Jul 2013 00:53:10 +0000 (20:53 -0400)

builtin: add git-check-mailmap command

Introduce command check-mailmap, similar to check-attr and check-ignore,
which allows direct testing of .mailmap configuration.

As plumbing accessible to scripts and other porcelain, check-mailmap
publishes the stable, well-tested .mailmap functionality employed by
built-in Git commands. Consequently, script authors need not
re-implement .mailmap functionality manually, thus avoiding potential
quirks and behavioral differences.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

.mailmap: Map email addresses to namesStefan Beller Fri, 12 Jul 2013 19:21:21 +0000 (21:21 +0200)

.mailmap: Map email addresses to names

People change email addresses quite often and sometimes forget to
add their entry to the mailmap file. I have contacted lots of
people, whose name occurs multiple times in the short log having
different email addresses. The entries in the mailmap of this patch
are either confirmed by them or are trivial. Trivial means
different capitalisation of the domain (@MIT.EDU and @mit.edu) or
the domain was localhost, (none) or @local.

Additionally to adding (name, email) mappings to the .mailmap file,
it has also been sorted ("LC_ALL=C /usr/bin/sort", byte-value sort).

While the most changes happen at the email addresses, we also have a
name change in here. Karl Hasselström is now known as Karl Wiberg
due to marriage. Congratulations!

To find out whom to contact I used the following small
script:

#!/bin/bash
git shortlog -sne |awk '{ NF--; $1=""; print }' |sort |uniq -d > mailmapdoubles
while read line ; do
# remove leading whitespace
trimmed=$(echo $line | sed -e 's/^ *//g' -e 's/ *$//g')
echo "git shortlog -sne | grep \""$trimmed"\""
done < mailmapdoubles > mailmapdoubles2
sh mailmapdoubles2
rm mailmapdoubles
rm mailmapdoubles2

Also interesting for similar tasks are these snippets:

# Finding out duplicates by comparing email addresses:
git shortlog -sne |awk '{ print $NF }' |sort |uniq -d

# Finding out duplicates by comparing names:
git shortlog -sne |awk '{ NF--; $1=""; print }' |sort |uniq -d

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes for 1.8.4Junio C Hamano Fri, 12 Jul 2013 17:49:34 +0000 (10:49 -0700)

Update draft release notes for 1.8.4

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

Merge branch 'jc/remote-http-argv-array'Junio C Hamano Fri, 12 Jul 2013 19:04:19 +0000 (12:04 -0700)

Merge branch 'jc/remote-http-argv-array'

* jc/remote-http-argv-array:
remote-http: use argv-array

Merge branch 'rs/pickaxe-simplify'Junio C Hamano Fri, 12 Jul 2013 19:04:17 +0000 (12:04 -0700)

Merge branch 'rs/pickaxe-simplify'

* rs/pickaxe-simplify:
diffcore-pickaxe: simplify has_changes and contains

Merge branch 'tr/test-lint-no-export-assignment-in... Junio C Hamano Fri, 12 Jul 2013 19:04:16 +0000 (12:04 -0700)

Merge branch 'tr/test-lint-no-export-assignment-in-shell'

* tr/test-lint-no-export-assignment-in-shell:
test-lint: detect 'export FOO=bar'
t9902: fix 'test A == B' to use = operator

Merge branch 'rr/name-rev-stdin-doc'Junio C Hamano Fri, 12 Jul 2013 19:04:14 +0000 (12:04 -0700)

Merge branch 'rr/name-rev-stdin-doc'

* rr/name-rev-stdin-doc:
name-rev doc: rewrite --stdin paragraph

Merge branch 'ft/diff-rename-default-score-is-half'Junio C Hamano Fri, 12 Jul 2013 19:04:12 +0000 (12:04 -0700)

Merge branch 'ft/diff-rename-default-score-is-half'

* ft/diff-rename-default-score-is-half:
diff-options: document default similarity index

Merge branch 'ml/cygwin-does-not-have-fifo'Junio C Hamano Fri, 12 Jul 2013 19:04:10 +0000 (12:04 -0700)

Merge branch 'ml/cygwin-does-not-have-fifo'

* ml/cygwin-does-not-have-fifo:
test-lib.sh - cygwin does not have usable FIFOs

Merge branch 'tf/gitweb-extra-breadcrumbs'Junio C Hamano Fri, 12 Jul 2013 19:04:09 +0000 (12:04 -0700)

Merge branch 'tf/gitweb-extra-breadcrumbs'

An Gitweb installation that is a part of larger site can optionally
show extra links that point at the levels higher than the Gitweb
pages itself in the link hierarchy of pages.

* tf/gitweb-extra-breadcrumbs:
gitweb: allow extra breadcrumbs to prefix the trail

Merge branch 'ms/remote-tracking-branches-in-doc'Junio C Hamano Fri, 12 Jul 2013 19:04:07 +0000 (12:04 -0700)

Merge branch 'ms/remote-tracking-branches-in-doc'

* ms/remote-tracking-branches-in-doc:
Change "remote tracking" to "remote-tracking"

Merge branch 'jk/pull-to-integrate'Junio C Hamano Fri, 12 Jul 2013 19:04:06 +0000 (12:04 -0700)

Merge branch 'jk/pull-to-integrate'

* jk/pull-to-integrate:
pull: change the description to "integrate" changes
push: avoid suggesting "merging" remote changes

Merge branch 'jk/maint-config-multi-order'Junio C Hamano Fri, 12 Jul 2013 19:04:04 +0000 (12:04 -0700)

Merge branch 'jk/maint-config-multi-order'

* jk/maint-config-multi-order:
git-config(1): clarify precedence of multiple values

Merge branch 'as/log-output-encoding-in-user-format'Junio C Hamano Fri, 12 Jul 2013 19:04:01 +0000 (12:04 -0700)

Merge branch 'as/log-output-encoding-in-user-format'

"log --format=" did not honor i18n.logoutputencoding configuration
and this attempts to fix it.

* as/log-output-encoding-in-user-format:
t4205 (log-pretty-formats): avoid using `sed`
t6006 (rev-list-format): add tests for "%b" and "%s" for the case i18n.commitEncoding is not set
t4205, t6006, t7102: make functions better readable
t4205 (log-pretty-formats): revert back single quotes
t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1
t4205: replace .\+ with ..* in sed commands
pretty: --format output should honor logOutputEncoding
pretty: Add failing tests: --format output should honor logOutputEncoding
t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs
t7102 (reset): don't hardcode SHA-1 in expected outputs
t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs

git-clone.txt: remove the restriction on pushing from... Nguyễn Thái Ngọc Duy Fri, 12 Jul 2013 05:37:42 +0000 (12:37 +0700)

git-clone.txt: remove the restriction on pushing from a shallow clone

The document says one cannot push from a shallow clone. But that is
not true (maybe it was at some point in the past). The client does not
stop such a push nor does it give any indication to the receiver that
this is a shallow push. If the receiver accepts it, it's in.

Since 52fed6e (receive-pack: check connectivity before concluding "git
push" - 2011-09-02), receive-pack is prepared to deal with broken
push, a shallow push can't cause any corruption. Update the document
to reflect that.

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

run-command: dup_devnull(): guard against syscalls... Thomas Rast Fri, 12 Jul 2013 08:58:36 +0000 (10:58 +0200)

run-command: dup_devnull(): guard against syscalls failing

dup_devnull() did not check the return values of open() and dup2().
Fix this omission.

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

git_mkstemps: correctly test return value of open()Dale R. Worley Fri, 12 Jul 2013 08:58:35 +0000 (10:58 +0200)

git_mkstemps: correctly test return value of open()

open() returns -1 on failure, and indeed 0 is a possible success value
if the user closed stdin in our process. Fix the test.

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

sha1_object_info_extended: pass object_info to helpersJeff King Fri, 12 Jul 2013 06:37:53 +0000 (02:37 -0400)

sha1_object_info_extended: pass object_info to helpers

We take in a "struct object_info" which contains pointers to
storage for items the caller cares about. But then rather
than pass the whole object to the low-level loose/packed
helper functions, we pass the individual pointers.

Let's pass the whole struct instead, which will make adding
more items later easier.

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

sha1_object_info_extended: make type calculation optionalJeff King Fri, 12 Jul 2013 06:34:57 +0000 (02:34 -0400)

sha1_object_info_extended: make type calculation optional

Each caller of sha1_object_info_extended sets up an
object_info struct to tell the function which elements of
the object it wants to get. Until now, getting the type of
the object has always been required (and it is returned via
the return type rather than a pointer in object_info).

This can involve actually opening a loose object file to
determine its type, or following delta chains to determine a
packed file's base type. These effects produce a measurable
slow-down when doing a "cat-file --batch-check" that does
not include %(objecttype).

This patch adds a "typep" query to struct object_info, so
that it can be optionally queried just like size and
disk_size. As a result, the return type of the function is
no longer the object type, but rather 0/-1 for success/error.

As there are only three callers total, we just fix up each
caller rather than keep a compatibility wrapper:

1. The simpler sha1_object_info wrapper continues to
always ask for and return the type field.

2. The istream_source function wants to know the type, and
so always asks for it.

3. The cat-file batch code asks for the type only when
%(objecttype) is part of the format string.

On linux.git, the best-of-five for running:

$ git rev-list --objects --all >objects
$ time git cat-file --batch-check='%(objectsize:disk)'

on a fully packed repository goes from:

real 0m8.680s
user 0m8.160s
sys 0m0.512s

to:

real 0m7.205s
user 0m6.580s
sys 0m0.608s

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

packed_object_info: make type lookup optionalJeff King Fri, 12 Jul 2013 06:32:25 +0000 (02:32 -0400)

packed_object_info: make type lookup optional

Currently, packed_object_info can save some work by not
calculating the size or disk_size of the object if the
caller is not interested. However, it always calculates the
true object type, whether the caller cares or not, and only
optionally returns the easy-to-get "representation type".

Let's swap these types. The function will now return the
representation type (or OBJ_BAD on failure), and will only
optionally fill in the true type.

There should be no behavior change yet, as the only caller,
sha1_object_info_extended, will always feed it a type
pointer.

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

packed_object_info: hoist delta type resolution to... Jeff King Fri, 12 Jul 2013 06:31:57 +0000 (02:31 -0400)

packed_object_info: hoist delta type resolution to helper

To calculate the type of a packed object, we must walk down
its delta chain until we hit a true base object with a real
type. Most of the code in packed_object_info is for handling
this case.

Let's hoist it out into a separate helper function, which
will make it easier to make the type-lookup optional in the
future (and keep our indentation level sane).

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

sha1_loose_object_info: make type lookup optionalJeff King Fri, 12 Jul 2013 06:30:48 +0000 (02:30 -0400)

sha1_loose_object_info: make type lookup optional

Until recently, the only items to request from
sha1_object_info_extended were type and size. This meant
that we always had to open a loose object file to determine
one or the other. But with the addition of the disk_size
query, it's possible that we can fulfill the query without
even opening the object file at all. However, since the
function interface always returns the type, we have no way
of knowing whether the caller cares about it or not.

This patch only modified sha1_loose_object_info to make type
lookup optional using an out-parameter, similar to the way
the size is handled (and the return value is "0" or "-1" for
success or error, respectively).

There should be no functional change yet, though, as
sha1_object_info_extended, the only caller, will always ask
for a type.

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

sha1_object_info_extended: rename "status" to "type"Jeff King Fri, 12 Jul 2013 06:21:22 +0000 (02:21 -0400)

sha1_object_info_extended: rename "status" to "type"

The value we get from each low-level object_info function
(e.g., loose, packed) is actually the object type (or -1 for
error). Let's explicitly call it "type", which will make
further refactorings easier to read.

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

cat-file: disable object/refname ambiguity check for... Jeff King Fri, 12 Jul 2013 06:20:05 +0000 (02:20 -0400)

cat-file: disable object/refname ambiguity check for batch mode

A common use of "cat-file --batch-check" is to feed a list
of objects from "rev-list --objects" or a similar command.
In this instance, all of our input objects are 40-byte sha1
ids. However, cat-file has always allowed arbitrary revision
specifiers, and feeds the result to get_sha1().

Fortunately, get_sha1() recognizes a 40-byte sha1 before
doing any hard work trying to look up refs, meaning this
scenario should end up spending very little time converting
the input into an object sha1. However, since 798c35f
(get_sha1: warn about full or short object names that look
like refs, 2013-05-29), when we encounter this case, we
spend the extra effort to do a refname lookup anyway, just
to print a warning. This is further exacerbated by ca91993
(get_packed_ref_cache: reload packed-refs file when it
changes, 2013-06-20), which makes individual ref lookup more
expensive by requiring a stat() of the packed-refs file for
each missing ref.

With no patches, this is the time it takes to run:

$ git rev-list --objects --all >objects
$ time git cat-file --batch-check='%(objectname)' <objects

on the linux.git repository:

real 1m13.494s
user 0m25.924s
sys 0m47.532s

If we revert ca91993, the packed-refs up-to-date check, it
gets a little better:

real 0m54.697s
user 0m21.692s
sys 0m32.916s

but we are still spending quite a bit of time on ref lookup
(and we would not want to revert that patch, anyway, which
has correctness issues). If we revert 798c35f, disabling
the warning entirely, we get a much more reasonable time:

real 0m7.452s
user 0m6.836s
sys 0m0.608s

This patch does the moral equivalent of this final case (and
gets similar speedups). We introduce a global flag that
callers of get_sha1() can use to avoid paying the price for
the warning.

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

Merge branch 'nd/warn-ambiguous-object-name' into jk... Junio C Hamano Fri, 12 Jul 2013 17:09:50 +0000 (10:09 -0700)

Merge branch 'nd/warn-ambiguous-object-name' into jk/cat-file-batch-optim

* nd/warn-ambiguous-object-name:
get_sha1: warn about full or short object names that look like refs

do not die when error in config parsing of buf occursHeiko Voigt Thu, 11 Jul 2013 22:48:30 +0000 (00:48 +0200)

do not die when error in config parsing of buf occurs

If a config parsing error in a file occurs we can die and let the user
fix the issue. This is different for the buf parsing function since it
can be used to parse blobs of .gitmodules files. If a parsing error
occurs here we should proceed since otherwise a database containing such
an error in a single revision could be rendered unusable.

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

teach config --blob option to parse config from databaseHeiko Voigt Thu, 11 Jul 2013 22:46:47 +0000 (00:46 +0200)

teach config --blob option to parse config from database

This can be used to read configuration values directly from git's
database. For example it is useful for reading to be checked out
.gitmodules files directly from the database.

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

config: make parsing stack struct independent from... Heiko Voigt Thu, 11 Jul 2013 22:44:39 +0000 (00:44 +0200)

config: make parsing stack struct independent from actual data source

To simplify adding other sources we extract all functions needed for
parsing into a list of callbacks. We implement those callbacks for the
current file parsing. A new source can implement its own set of callbacks.

Instead of storing the concrete FILE pointer for parsing we store a void
pointer. A new source can use this to store its custom data.

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