gitweb.git
docs/clone: mention that --local may be ignoredJeff King Wed, 30 May 2012 11:09:08 +0000 (07:09 -0400)

docs/clone: mention that --local may be ignored

The --local flag is not "treat this like a local
repository", but rather "if we are local, turn on
optimizations". Therefore it does nothing in the case of:

git clone --local file:///path/to/repo

Let's make that more clear in the documentation.

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

Merge git://bogomips.org/git-svnJunio C Hamano Tue, 29 May 2012 20:47:55 +0000 (13:47 -0700)

Merge git://bogomips.org/git-svn

By Jonathan Nieder
via Eric Wong
* git://bogomips.org/git-svn:
git-svn: make Git::SVN::Fetcher a separate file
git-svn: rename SVN::Git::* packages to Git::SVN::*
git-svn: move Git::SVN::Prompt into its own file

t5701: modernize styleJeff King Sat, 26 May 2012 03:42:53 +0000 (23:42 -0400)

t5701: modernize style

This test is pretty old and did not follow some of our more
modern best practices. In particular:

1. It chdir'd all over the place, leaving later tests to
deal with the fallout. Do our chdirs in subshells
instead.

2. It did not use test_must_fail.

3. It did not use test_line_count.

4. It checked for the non-existence of a ref by looking in the
.git/refs directory (since we pack refs during clone
these days, this will always be succeed, making the
test useless).

Note that one call to "-e .git/refs/..." remains,
because it is checking for the existence of a symbolic
ref, not a ref itself.

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

Merge branch 'va/git-p4-test'Junio C Hamano Tue, 29 May 2012 20:09:20 +0000 (13:09 -0700)

Merge branch 'va/git-p4-test'

By Vitor Antunes
* va/git-p4-test:
git-p4: Clean up branch test cases
git-p4: Verify detection of "empty" branch creation
git-p4: Test changelists touching two branches

Merge branch 'jk/ident-gecos-strbuf'Junio C Hamano Tue, 29 May 2012 20:09:13 +0000 (13:09 -0700)

Merge branch 'jk/ident-gecos-strbuf'

Fixes quite a lot of brokenness when ident information needs to be taken
from the system and cleans up the code.

By Jeff King
* jk/ident-gecos-strbuf: (22 commits)
format-patch: do not use bogus email addresses in message ids
ident: reject bogus email addresses with IDENT_STRICT
ident: rename IDENT_ERROR_ON_NO_NAME to IDENT_STRICT
format-patch: use GIT_COMMITTER_EMAIL in message ids
ident: let callers omit name with fmt_indent
ident: refactor NO_DATE flag in fmt_ident
ident: reword empty ident error message
format-patch: refactor get_patch_filename
ident: trim whitespace from default name/email
ident: use a dynamic strbuf in fmt_ident
ident: use full dns names to generate email addresses
ident: report passwd errors with a more friendly message
drop length limitations on gecos-derived names and emails
ident: don't write fallback username into git_default_name
fmt_ident: drop IDENT_WARN_ON_NO_NAME code
format-patch: use default email for generating message ids
ident: trim trailing newline from /etc/mailname
move git_default_* variables to ident.c
move identity config parsing to ident.c
fmt-merge-msg: don't use static buffer in record_person
...

Merge branch 'jk/fetch-pack-remove-dups-optim'Junio C Hamano Tue, 29 May 2012 20:09:08 +0000 (13:09 -0700)

Merge branch 'jk/fetch-pack-remove-dups-optim'

The way "fetch-pack" that is given multiple references to fetch tried to
remove duplicates was very inefficient.

By Jeff King
* jk/fetch-pack-remove-dups-optim:
fetch-pack: sort incoming heads list earlier
fetch-pack: avoid quadratic loop in filter_refs
fetch-pack: sort the list of incoming refs
add sorting infrastructure for list refs
fetch-pack: avoid quadratic behavior in remove_duplicates
fetch-pack: sort incoming heads

Merge branch 'rs/refs-string-slice'Junio C Hamano Tue, 29 May 2012 20:09:02 +0000 (13:09 -0700)

Merge branch 'rs/refs-string-slice'

Avoid unnecessary temporary allocations while looking for matching refs
inside refs API.

By René Scharfe (3) and Junio C Hamano (1)
* rs/refs-string-slice:
refs: do not create ref_entry when searching
refs: use strings directly in find_containing_dir()
refs: convert parameter of create_dir_entry() to length-limited string
refs: convert parameter of search_ref_dir() to length-limited string

Merge branch 'mh/fetch-pack-constness'Junio C Hamano Tue, 29 May 2012 20:08:53 +0000 (13:08 -0700)

Merge branch 'mh/fetch-pack-constness'

Tighten constness of some local variables in a callchain.

By Michael Haggerty
* mh/fetch-pack-constness:
cmd_fetch_pack(): respect constness of argv parameter
cmd_fetch_pack(): combine the loop termination conditions
cmd_fetch_pack(): handle non-option arguments outside of the loop
cmd_fetch_pack(): declare dest to be const

Merge branch 'mh/ref-api-lazy-loose'Junio C Hamano Tue, 29 May 2012 20:08:35 +0000 (13:08 -0700)

Merge branch 'mh/ref-api-lazy-loose'

The code to lazily read loose refs unnecessarily read the refs in a
subhierarchy by mistake when we free the data for the subhierarchy.

By Michael Haggerty
* mh/ref-api-lazy-loose:
free_ref_entry(): do not trigger reading of loose refs

Merge branch 'ng/pack-objects-cleanup'Junio C Hamano Tue, 29 May 2012 20:08:30 +0000 (13:08 -0700)

Merge branch 'ng/pack-objects-cleanup'

By Nguyễn Thái Ngọc Duy
* ng/pack-objects-cleanup:
pack-objects: refactor write_object() into helper functions
pack-objects, streaming: turn "xx >= big_file_threshold" to ".. > .."

git-p4: Clean up branch test casesVitor Antunes Sat, 26 May 2012 09:56:06 +0000 (10:56 +0100)

git-p4: Clean up branch test cases

Correct submit description in one test and remove not required commands
from another.

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

git-p4: Verify detection of "empty" branch creationVitor Antunes Sat, 26 May 2012 09:56:05 +0000 (10:56 +0100)

git-p4: Verify detection of "empty" branch creation

Current implementation of new branch parent detection works on the
principle that the new branch is a complete integration, with no
changes, of the original files.
This test shows this deficiency in the particular case when the new
branch is created from a subset of the original files.

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

git-p4: Test changelists touching two branchesVitor Antunes Sat, 26 May 2012 09:56:04 +0000 (10:56 +0100)

git-p4: Test changelists touching two branches

It is possible to modify two different branches in P4 in a single
changelist. git-p4 correctly detects this and commits the relevant
changes to the different branches separately. This test proves that and
avoid future regressions in this behavior.

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

git-svn: make Git::SVN::Fetcher a separate fileJonathan Nieder Mon, 28 May 2012 07:03:58 +0000 (02:03 -0500)

git-svn: make Git::SVN::Fetcher a separate file

This patch removes a chunk of code (the Git::SVN::Fetcher consumer of
libsvn's tree delta protocol) from git-svn.perl and documents its
interface so the hurried reader does not have to read that code right
away.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>

git-svn: rename SVN::Git::* packages to Git::SVN::*Jonathan Nieder Mon, 28 May 2012 07:00:46 +0000 (02:00 -0500)

git-svn: rename SVN::Git::* packages to Git::SVN::*

Using names in the Git:: namespace means these cannot conflict with a
hypothetical binding teaching Subversion to interact with git
repositories.

Currently the packages are private to git-svn.perl so the choice of
name isn't likely to make much difference. This change is mainly
meant as preparation for splitting out the packages in question as
modules on the public search path.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>

git-svn: move Git::SVN::Prompt into its own fileJonathan Nieder Mon, 28 May 2012 00:39:01 +0000 (19:39 -0500)

git-svn: move Git::SVN::Prompt into its own file

git-svn.perl is very long (around 6500 lines) and although it is
nicely split into modules, some new readers do not even notice --- it
is too distracting to see all this functionality collected in a single
file.

Splitting it into multiple files would make it easier for people
to read individual modules straight through and to experiment with
components separately.

Let's start with Git::SVN::Prompt. For simplicity, we install this as
a module in the standard search path, just like the existing Git and
Git::I18N modules. In the process, add a manpage explaining its
interface and that it is not likely to be useful for other projects to
avoid confusion.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>

Git 1.7.11-rc0 v1.7.11-rc0Junio C Hamano Fri, 25 May 2012 19:19:45 +0000 (12:19 -0700)

Git 1.7.11-rc0

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

Merge branch 'sp/sh-windows-pwd'Junio C Hamano Fri, 25 May 2012 19:08:26 +0000 (12:08 -0700)

Merge branch 'sp/sh-windows-pwd'

* sp/sh-windows-pwd:
git-sh-setup: define workaround wrappers before they are used

Merge branch 'mh/test-keep-prove-cache'Junio C Hamano Fri, 25 May 2012 19:08:21 +0000 (12:08 -0700)

Merge branch 'mh/test-keep-prove-cache'

By Michael Haggerty
* mh/test-keep-prove-cache:
t/Makefile: retain cache t/.prove across prove runs

Merge branch 'rs/dir-strbuf-read-recursive-fix'Junio C Hamano Fri, 25 May 2012 19:07:52 +0000 (12:07 -0700)

Merge branch 'rs/dir-strbuf-read-recursive-fix'

Simplification for the codepath to read directories recursively.

By René Scharfe
* rs/dir-strbuf-read-recursive-fix:
dir: simplify fill_directory()
dir: respect string length argument of read_directory_recursive()

Merge branch 'fc/git-complete-helper-fix'Junio C Hamano Fri, 25 May 2012 19:07:09 +0000 (12:07 -0700)

Merge branch 'fc/git-complete-helper-fix'

Resurrects old behaviour of _git/_gitk for external users.

Merge branch 'ap/checkout-no-progress-for-non-tty'Junio C Hamano Fri, 25 May 2012 19:06:34 +0000 (12:06 -0700)

Merge branch 'ap/checkout-no-progress-for-non-tty'

The progress indicator for a large "git checkout" was sent to stderr
even if it is not a terminal.

Merge branch 'jk/format-person-part-buffer-limit'Junio C Hamano Fri, 25 May 2012 19:06:16 +0000 (12:06 -0700)

Merge branch 'jk/format-person-part-buffer-limit'

Avoid buffer overflow in format_person_part() function

Merge branch 'jk/pretty-commit-header-incomplete-line'Junio C Hamano Fri, 25 May 2012 19:05:35 +0000 (12:05 -0700)

Merge branch 'jk/pretty-commit-header-incomplete-line'

Fixes error codepath when a malformed commit object has a header line
chomped in the middle.

Merge branch 'jk/ident-split-fix'Junio C Hamano Fri, 25 May 2012 19:05:26 +0000 (12:05 -0700)

Merge branch 'jk/ident-split-fix'

An author/committer name that is a single character was mishandled as an
invalid name by mistake.

Merge branch 'rs/xdiff-fast-hash-fix'Junio C Hamano Fri, 25 May 2012 19:05:02 +0000 (12:05 -0700)

Merge branch 'rs/xdiff-fast-hash-fix'

Fixes compilation issue on 32-bit in an earlier series.

Merge branch 'mh/ref-api'Junio C Hamano Fri, 25 May 2012 19:04:36 +0000 (12:04 -0700)

Merge branch 'mh/ref-api'

Fixes a performance regression in the earlier series.

Merge branch 'rs/maint-grep-F'Junio C Hamano Fri, 25 May 2012 19:04:19 +0000 (12:04 -0700)

Merge branch 'rs/maint-grep-F'

"git grep -e '$pattern'", unlike the case where the patterns are read from
a file, did not treat individual lines in the given pattern argument as
separate regular expressions as it should.

Sync with 1.7.10.3Junio C Hamano Fri, 25 May 2012 18:36:25 +0000 (11:36 -0700)

Sync with 1.7.10.3

Git 1.7.10.3 v1.7.10.3Junio C Hamano Fri, 25 May 2012 18:28:43 +0000 (11:28 -0700)

Git 1.7.10.3

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

Merge branch 'hv/submodule-alt-odb' into maintJunio C Hamano Fri, 25 May 2012 18:26:38 +0000 (11:26 -0700)

Merge branch 'hv/submodule-alt-odb' into maint

When a submodule repository uses alternate object store mechanism, some
commands that were started from the superproject did not notice it and
failed with "No such object" errors. The subcommands of "git submodule"
command that recursed into the submodule in a separate process were OK;
only the ones that cheated and peeked directly into the submodule's
repository from the primary process were affected.

By Heiko Voigt
* hv/submodule-alt-odb:
teach add_submodule_odb() to look for alternates

Merge branch 'bp/diff-no-index-strbuf-fix' into maintJunio C Hamano Fri, 25 May 2012 18:25:36 +0000 (11:25 -0700)

Merge branch 'bp/diff-no-index-strbuf-fix' into maint

The directory path used in "git diff --no-index", when it recurses
down, was broken with a recent update after v1.7.10.1 release.

By Bobby Powers
* bp/diff-no-index-strbuf-fix:
diff --no-index: don't leak buffers in queue_diff
diff --no-index: reset temporary buffer lengths on directory iteration

fmt-merge-message: add empty line between tag and signa... Linus Torvalds Fri, 25 May 2012 16:02:03 +0000 (09:02 -0700)

fmt-merge-message: add empty line between tag and signature verification

When adding the information from a tag, put an empty line between the
message of the tag and the commented-out signature verification
information.

At least for the kernel workflow, I often end up re-formatting the message
that people send me in the tag data. In that situation, putting the tag
message and the tag signature verification back-to-back then means that
normal editor "reflow parapgraph" command will get confused and think that
the signature is a continuation of the last message paragraph.

So I always end up having to first add an empty line, and then go back and
reflow the last paragraph. Let's just do it in git directly.

The extra vertical space also makes the verification visually stand out
more from the user-supplied message, so it looks a bit more readable to me
too, but that may be just an odd personal preference.

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

config doc: remove confusion about relative GIT_DIR... Jonathan Nieder Fri, 25 May 2012 18:12:04 +0000 (13:12 -0500)

config doc: remove confusion about relative GIT_DIR from FILES section

From the FILES section of the git-config(1) manual:

$GIT_DIR/config::
Repository specific configuration file. (The filename is
of course relative to the repository root, not the working
directory.)

That's confusing because $GIT_DIR really is relative to the working
directory.

$ GIT_DIR=.git GIT_EDITOR='pwd; echo editing'
$ export GIT_DIR GIT_EDITOR
$ git config --edit --local
/home/jrn/src/git/Documentation
editing .git/config

It turns out that the comment is a remnant from older days when the
heading said ".git/config" (which is indeed relative to the top of the
worktree).

It was only when the heading was changed to refer more precisely to
<git dir>/config (see v1.5.3.2~18, AsciiDoc tweak to avoid leading
dot, 2007-09-14) that the parenthesis stopped making sense. Remove
it.

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

format-patch: do not use bogus email addresses in messa... Jeff King Thu, 24 May 2012 23:32:52 +0000 (19:32 -0400)

format-patch: do not use bogus email addresses in message ids

We can ask git_committer_info to be strict about coming up
with an email, which will die automatically on a poorly
configured machine. This is better than letting invalid
message-ids into the wild.

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

ident: reject bogus email addresses with IDENT_STRICTJeff King Thu, 24 May 2012 23:32:37 +0000 (19:32 -0400)

ident: reject bogus email addresses with IDENT_STRICT

If we come up with a hostname like "foo.(none)" because the
user's machine is not fully qualified, we should reject this
in strict mode (e.g., when we are making a commit object),
just as we reject an empty gecos username.

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

Sync with maintJunio C Hamano Fri, 25 May 2012 00:37:40 +0000 (17:37 -0700)

Sync with maint

By Jeff King (1) and Junio C Hamano (1)
* maint:
Update draft release notes to 1.7.10.3
osxkeychain: pull make config from top-level directory

Update draft release notes to 1.7.10.3Junio C Hamano Fri, 25 May 2012 00:37:29 +0000 (17:37 -0700)

Update draft release notes to 1.7.10.3

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

Merge branch 'jk/maint-status-porcelain-z-b' into maintJunio C Hamano Fri, 25 May 2012 00:32:30 +0000 (17:32 -0700)

Merge branch 'jk/maint-status-porcelain-z-b' into maint

"git status --porcelain" ignored "--branch" option by mistake. The output
for "git status --branch -z" was also incorrect and did not terminate the
record for the current branch name with NUL as asked.

By Jeff King
* jk/maint-status-porcelain-z-b:
status: respect "-b" for porcelain format
status: fix null termination with "-b"
status: refactor null_termination option
commit: refactor option parsing

ident: rename IDENT_ERROR_ON_NO_NAME to IDENT_STRICTJeff King Thu, 24 May 2012 23:28:40 +0000 (19:28 -0400)

ident: rename IDENT_ERROR_ON_NO_NAME to IDENT_STRICT

Callers who ask for ERROR_ON_NO_NAME are not so much
concerned that the name will be blank (because, after all,
we will fall back to using the username), but rather it is a
check to make sure that low-quality identities do not end up
in things like commit messages or emails (whereas it is OK
for them to end up in things like reflogs).

When future commits add more quality checks on the identity,
each of these callers would want to use those checks, too.
Rather than modify each of them later to add a new flag,
let's refactor the flag.

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

format-patch: use GIT_COMMITTER_EMAIL in message idsJeff King Thu, 24 May 2012 23:28:25 +0000 (19:28 -0400)

format-patch: use GIT_COMMITTER_EMAIL in message ids

Before commit 43ae9f4, we generated the tail of a message id
by calling git_committer_info and parsing the email out of
the result. 43ae9f4 changed to use ident_default_email
directly, so we didn't have to bother with parsing. As a
side effect, it meant we no longer used GIT_COMMITTER_EMAIL
at all.

In general, this is probably reasonable behavior. Either the
default email is sane on your system, or you are using
user.email to provide something sane. The exception is if
you rely on GIT_COMMITTER_EMAIL being set all the time to
override the bogus generated email.

This is unlikely to match anybody's real-life setup, but we
do use it in the test environment. And furthermore, it's
what we have always done, and the change in 43ae9f4 was
about cleaning up, not fixing any bug; we should be
conservative and keep the behavior identical.

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

ident: let callers omit name with fmt_indentJeff King Thu, 24 May 2012 23:27:24 +0000 (19:27 -0400)

ident: let callers omit name with fmt_indent

Most callers want to see all of "$name <$email> $date", but
a few want only limited parts, omitting the date, or even
the name. We already have IDENT_NO_DATE to handle the date
part, but there's not a good option for getting just the
email. Callers have to done one of:

1. Call ident_default_email; this does not respect
environment variables, nor does it promise to trim
whitespace or other crud from the result.

2. Call git_{committer,author}_info; this returns the name
and email, leaving the caller to parse out the wanted
bits.

This patch adds IDENT_NO_NAME; it stops short of adding
IDENT_NO_EMAIL, as no callers want it (nor are likely to),
and it complicates the error handling of the function.

When no name is requested, the angle brackets (<>) around
the email address are also omitted.

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

ident: refactor NO_DATE flag in fmt_identJeff King Thu, 24 May 2012 23:26:50 +0000 (19:26 -0400)

ident: refactor NO_DATE flag in fmt_ident

As a short-hand, we extract this flag into the local
variable "name_addr_only". It's more accurate to simply
negate this and refer to it as "want_date", which will be
less confusing when we add more NO_* flags.

While we're touching this part of the code, let's move the
call to ident_default_date() only when we are actually going
to use it, not when we have NO_DATE set, or when we get a
date from the environment.

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

ident: reword empty ident error messageJeff King Thu, 24 May 2012 23:26:32 +0000 (19:26 -0400)

ident: reword empty ident error message

There's on point in printing the name, since it is by
definition the empty string if we have reached this code
path. Instead, let's be more clear that we are complaining
about the empty name, but still show the email address that
it is attached to (since that may provide some context to
the user).

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

Avoid sorting if references are added to ref_cache... Michael Haggerty Thu, 24 May 2012 12:16:50 +0000 (14:16 +0200)

Avoid sorting if references are added to ref_cache in order

The old code allowed many references to be efficiently added to a
single directory, because it just appended the references to the
containing directory unsorted without doing any searching (and
therefore without requiring any intermediate sorting). But the old
code was inefficient when a large number of subdirectories were added
to a directory, because the directory always had to be searched to see
if the new subdirectory already existed, and this search required the
directory to be sorted first. The same was repeated for every new
subdirectory, so the time scaled like O(N^2), where N is the number of
subdirectories within a single directory.

In practice, references are often added to the ref_cache in
lexicographic order, for example when reading the packed-refs file.
So build some intelligence into add_entry_to_dir() to optimize for the
case of references and/or subdirectories being added in lexicographic
order: if the existing entries were already sorted, and the new entry
comes after the last existing entry, then adjust ref_dir::sorted to
reflect the fact that the ref_dir is still sorted.

Thanks to Peff for pointing out the performance regression that
inspired this change.

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

checkout: no progress messages if !isatty(2).Avery Pennarun Thu, 24 May 2012 06:12:24 +0000 (02:12 -0400)

checkout: no progress messages if !isatty(2).

If stderr isn't a tty, we shouldn't be printing incremental progress
messages. In particular, this affects 'git checkout -f . >&logfile'
unless you provided -q. And git-new-workdir has no way to provide -q.

It would probably be better to have progress.c check isatty(2) all the time,
but that wouldn't allow things like 'git push --progress' to force progress
reporting to on, so I won't try to solve the general case right now.

Actual fix suggested by Jeff King.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

osxkeychain: pull make config from top-level directoryJeff King Wed, 23 May 2012 17:36:53 +0000 (13:36 -0400)

osxkeychain: pull make config from top-level directory

The default compiler and cflags were mostly "works for me"
when I built the original version. We need to be much less
careful here than usual, because we know we are building
only on OS X. But it's only polite to at least respect the
CFLAGS and CC definitions that the user may have provided
earlier.

While we're at it, let's update our definitions and rules to
be more like the top-level Makefile; default our CFLAGS to
include -O2, and make sure we use CFLAGS and LDFLAGS when
linking.

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

fetch-pack: sort incoming heads list earlierJeff King Thu, 24 May 2012 06:04:51 +0000 (02:04 -0400)

fetch-pack: sort incoming heads list earlier

Commit 4435968 started sorting heads fed to fetch-pack so
that later commits could use more optimized algorithms;
commit 7db8d53 switched the remove_duplicates function to
such an algorithm.

Of course, the sorting is more effective if you do it
_before_ the algorithm in question.

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

Update draft release notes to 1.7.11Junio C Hamano Wed, 23 May 2012 20:54:23 +0000 (13:54 -0700)

Update draft release notes to 1.7.11

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

Merge branch 'rs/archive-tree-in-tip-simplify'Junio C Hamano Wed, 23 May 2012 20:35:22 +0000 (13:35 -0700)

Merge branch 'rs/archive-tree-in-tip-simplify'

By René Scharfe
* rs/archive-tree-in-tip-simplify:
archive-tar: keep const in checksum calculation
archive: simplify refname handling

Merge branch 'js/rev-parse-doc-fix'Junio C Hamano Wed, 23 May 2012 20:35:19 +0000 (13:35 -0700)

Merge branch 'js/rev-parse-doc-fix'

By Jon Seymour
* js/rev-parse-doc-fix:
rev-parse doc: --git-dir does not always show a relative path

Merge branch 'js/rebase-i-p-test-fix'Junio C Hamano Wed, 23 May 2012 20:35:15 +0000 (13:35 -0700)

Merge branch 'js/rebase-i-p-test-fix'

By Johannes Sixt
* js/rebase-i-p-test-fix:
Fix t3411.3 to actually rebase something

Merge branch 'bp/diff-no-index-strbuf-fix'Junio C Hamano Wed, 23 May 2012 20:35:12 +0000 (13:35 -0700)

Merge branch 'bp/diff-no-index-strbuf-fix'

Fix regressions to "git diff --no-index" when it recurses down.

By Bobby Powers
* bp/diff-no-index-strbuf-fix:
diff --no-index: don't leak buffers in queue_diff
diff --no-index: reset temporary buffer lengths on directory iteration

Merge branch 'hv/submodule-alt-odb'Junio C Hamano Wed, 23 May 2012 20:35:05 +0000 (13:35 -0700)

Merge branch 'hv/submodule-alt-odb'

When peeking into object stores of submodules, the code forgot that they
might borrow objects from alternate object stores on their own.

By Heiko Voigt
* hv/submodule-alt-odb:
teach add_submodule_odb() to look for alternates

xdiff: import new 32-bit version of count_masked_bytes()René Scharfe Tue, 22 May 2012 20:36:57 +0000 (22:36 +0200)

xdiff: import new 32-bit version of count_masked_bytes()

Import the latest 32-bit implementation of count_masked_bytes() from
Linux (arch/x86/include/asm/word-at-a-time.h). It's shorter and avoids
overflows and negative numbers.

This fixes test failures on 32-bit, where negative partial results had
been shifted right using the "wrong" method (logical shift right instead
of arithmetic short right). The compiler is free to chose the method,
so it was only wrong in the sense that it didn't work as intended by us.

Reported-by: Øyvind A. Holm <sunny@sunbase.org>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

xdiff: avoid more compiler warnings with XDL_FAST_HASH... René Scharfe Tue, 22 May 2012 20:36:39 +0000 (22:36 +0200)

xdiff: avoid more compiler warnings with XDL_FAST_HASH on 32-bit machines

Hide literals that can cause compiler warnings for 32-bit architectures in
expressions that evaluate to small numbers there. Some compilers warn that
0x0001020304050608 won't fit into a 32-bit long, others that shifting right
by 56 bits clears a 32-bit value completely.

The correct values are calculated in the 64-bit case, which is all that matters
in this if-branch.

Reported-by: Øyvind A. Holm <sunny@sunbase.org>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Acked-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

xdiff: avoid compiler warnings with XDL_FAST_HASH on... René Scharfe Tue, 22 May 2012 20:36:25 +0000 (22:36 +0200)

xdiff: avoid compiler warnings with XDL_FAST_HASH on 32-bit machines

Import macro REPEAT_BYTE from Linux (arch/x86/include/asm/word-at-a-time.h)
to avoid 64-bit integer literals, which cause some 32-bit compilers to
print warnings.

Reported-by: Øyvind A. Holm <sunny@sunbase.org>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: do not create ref_entry when searchingJunio C Hamano Tue, 22 May 2012 21:03:29 +0000 (14:03 -0700)

refs: do not create ref_entry when searching

The search_ref_dir() function is about looking up an existing ref_entry in
a sorted array of ref_entry stored in dir->entries, but it still allocates
a new ref_entry and frees it before returning. This is only because the
call to bsearch(3) was coded in a suboptimal way. Unlike the comparison
function given to qsort(3), the first parameter to its comparison function
does not need to point at an object that is shaped like an element in the
array.

Introduce a new comparison function that takes a counted string as the key
and an element in an array of ref_entry and give it to bsearch(), so that
we do not have to allocate a new ref_entry that we will never return to
the caller anyway.

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

refs: use strings directly in find_containing_dir()René Scharfe Tue, 22 May 2012 18:50:58 +0000 (20:50 +0200)

refs: use strings directly in find_containing_dir()

Convert the parameter subdirname of search_for_subdir() to a
length-limted string and then simply pass the interesting slice of the
refname from find_containing_dir(), thereby avoiding to duplicate the
string.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: convert parameter of create_dir_entry() to length... René Scharfe Tue, 22 May 2012 18:50:52 +0000 (20:50 +0200)

refs: convert parameter of create_dir_entry() to length-limited string

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: convert parameter of search_ref_dir() to length... René Scharfe Tue, 22 May 2012 18:50:39 +0000 (20:50 +0200)

refs: convert parameter of search_ref_dir() to length-limited string

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fetch-pack: avoid quadratic loop in filter_refsJeff King Mon, 21 May 2012 22:23:29 +0000 (18:23 -0400)

fetch-pack: avoid quadratic loop in filter_refs

We have a list of refs that we want to compare against the
"match" array. The current code searches the match list
linearly, giving quadratic behavior over the number of refs
when you want to fetch all of them.

Instead, we can compare the lists as we go, giving us linear
behavior.

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

fetch-pack: sort the list of incoming refsJeff King Mon, 21 May 2012 22:19:51 +0000 (18:19 -0400)

fetch-pack: sort the list of incoming refs

Having the list sorted means we can avoid some quadratic
algorithms when comparing lists.

These should typically be sorted already, but they do come
from the remote, so let's be extra careful. Our ref-sorting
implementation does a mergesort, so we do not have to care
about performance degrading in the common case that the list
is already sorted.

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

add sorting infrastructure for list refsJeff King Mon, 21 May 2012 22:19:28 +0000 (18:19 -0400)

add sorting infrastructure for list refs

Since we store lists of refs as linked lists, we can use
llist_mergesort to efficiently sort them.

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

fetch-pack: avoid quadratic behavior in remove_duplicatesJeff King Mon, 21 May 2012 22:17:20 +0000 (18:17 -0400)

fetch-pack: avoid quadratic behavior in remove_duplicates

We remove duplicate entries from the list of refs we are
fed in fetch-pack. The original algorithm is quadratic over
the number of refs, but since the list is now guaranteed to
be sorted, we can do it in linear time.

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

fetch-pack: sort incoming headsJeff King Mon, 21 May 2012 22:17:02 +0000 (18:17 -0400)

fetch-pack: sort incoming heads

There's no reason to preserve the incoming order of the
heads we're requested to fetch. By having them sorted, we
can replace some of the quadratic algorithms with linear
ones.

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

cmd_fetch_pack(): respect constness of argv parameterMichael Haggerty Mon, 21 May 2012 07:59:59 +0000 (09:59 +0200)

cmd_fetch_pack(): respect constness of argv parameter

The old code cast away the constness of the strings passed to the
function in argument argv[], which could result in their being
modified by filter_refs(). Fix by copying reference names from argv
and putting them into our own array (similarly to how refnames passed
to stdin were already handled).

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

cmd_fetch_pack(): combine the loop termination conditionsMichael Haggerty Mon, 21 May 2012 07:59:58 +0000 (09:59 +0200)

cmd_fetch_pack(): combine the loop termination conditions

If an argument that does not start with '-' is found, the loop is
terminated. So move that check into the for-loop condition.

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

cmd_fetch_pack(): handle non-option arguments outside... Michael Haggerty Mon, 21 May 2012 07:59:57 +0000 (09:59 +0200)

cmd_fetch_pack(): handle non-option arguments outside of the loop

This makes it more obvious that the code is always executed unless
there is an error, and that the first initialization of nr_heads is
unnecessary.

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

cmd_fetch_pack(): declare dest to be constMichael Haggerty Mon, 21 May 2012 07:59:56 +0000 (09:59 +0200)

cmd_fetch_pack(): declare dest to be const

There is no need for it to be non-const, and this avoids the need
for casting away the constness of an argv element.

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

avoid segfault when reading header of malformed commitsJeff King Tue, 22 May 2012 04:52:17 +0000 (00:52 -0400)

avoid segfault when reading header of malformed commits

If a commit object has a header line at the end of the
buffer that is missing its newline (or if it appears so
because the content on the header line contains a stray
NUL), then git will segfault.

Interestingly, this case is explicitly handled and we do
correctly scan the final line for the header we are looking
for. But if we don't find it, we will dereference NULL while
trying to look at the next line.

Git will never generate such a commit, but it's good to be
defensive. We could die() in such a case, but since it's
easy enough to handle it gracefully, let's just issue a
warning and continue (so you could still view such a commit
with "git show", though you might be missing headers after
the NUL).

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

pretty: avoid buffer overflow in format_person_partJeff King Tue, 22 May 2012 05:45:08 +0000 (01:45 -0400)

pretty: avoid buffer overflow in format_person_part

When we parse the name and email from a commit to
pretty-print them, we usually can just put the result
directly into our strbuf result. However, if we are going to
use the mailmap, then we must first copy them into a
NUL-terminated buffer to feed to the mailmap machinery.

We did so by using strlcpy into a static buffer, but we used
it wrong. We fed it the length of the substring we wanted to
copy, but never checked that that length was less than the
size of the destination buffer.

The simplest fix is to just use snprintf to copy the
substring properly while still respecting the destination
buffer's size. It might seem like replacing the static
buffer with a strbuf would help, but we need to feed a
static buffer to the mailmap machinery anyway, so there's
not much benefit to handling arbitrary sizes.

A more ideal solution would be for mailmap to grow an
interface that:

1. Takes a pointer and length combination, instead of
assuming a NUL-terminated string.

2. Returns a pointer to the mailmap's allocated string,
rather than copying it into the buffer.

Then we could avoid the need for an extra buffer entirely.
However, doing this would involve a lot of refactoring of
mailmap and of string_list (which mailmap uses to store the
map itself). For now, let's do the simplest thing to fix the
bug.

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

fix off-by-one error in split_ident_lineJeff King Tue, 22 May 2012 06:12:20 +0000 (02:12 -0400)

fix off-by-one error in split_ident_line

Commit 4b340cf split the logic to parse an ident line out of
pretty.c's format_person_part. But in doing so, it
accidentally introduced an off-by-one error that caused it
to think that single-character names were invalid.

This manifested itself as the "%an" format failing to show
anything at all for a single-character name.

Reported-by: Brian Turner <bturner@atlassian.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format-patch: refactor get_patch_filenameJeff King Mon, 21 May 2012 23:10:32 +0000 (19:10 -0400)

format-patch: refactor get_patch_filename

The get_patch_filename function expects a commit argument
and uses it to get the sanitized subject line when making a
patch filename. However, we also want to use this same
function for the cover letter, which does not have a commit
object. The current solution is to create a fake commit with
the subject "cover letter". Instead, let's make the
get_patch_filename interface more flexibile, and allow
passing a direct subject.

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

ident: trim whitespace from default name/emailJeff King Mon, 21 May 2012 23:10:29 +0000 (19:10 -0400)

ident: trim whitespace from default name/email

Usually these values get fed to fmt_ident, which will trim
any cruft anyway, but there are a few code paths which use
them directly. Let's clean them up for the benefit of those
callers. Furthermore, fmt_ident will look at the pre-trimmed
value and decide whether to invoke ERROR_ON_NO_NAME; this
check can be fooled by a name consisting only of spaces.

Note that we only bother to clean up when we are pulling the
information from gecos or from system files. Any other value
comes from a config file, where we will have cleaned up
accidental whitespace already.

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

ident: use a dynamic strbuf in fmt_identJeff King Mon, 21 May 2012 23:10:26 +0000 (19:10 -0400)

ident: use a dynamic strbuf in fmt_ident

Now that we accept arbitrary-sized names and email
addresses, the only remaining limit is in the actual
formatting of the names into a buffer. The current limit is
1000 characters, which is not likely to be reached, but
using a strbuf is one less error condition we have to worry
about.

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

ident: use full dns names to generate email addressesJeff King Mon, 21 May 2012 23:10:23 +0000 (19:10 -0400)

ident: use full dns names to generate email addresses

When we construct an email address from the username and
hostname, we generate the host part of the email with this
procedure:

1. add the result of gethostname

2. if it has a dot, ok, it's fully qualified

3. if not, then look up the unqualified hostname via
gethostbyname; take the domain name of the result and
append it to the hostname

Step 3 can actually produce a bogus result, as the name
returned by gethostbyname may not be related to the hostname
we fed it (e.g., consider a machine "foo" with names
"foo.one.example.com" and "bar.two.example.com"; we may have
the latter returned and generate the bogus name
"foo.two.example.com").

This patch simply uses the full hostname returned by
gethostbyname. In the common case that the first part is the
same as the unqualified hostname, the behavior is identical.
And in the case that it is not the same, we are much more
likely to be generating a valid name.

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

ident: report passwd errors with a more friendly messageJeff King Mon, 21 May 2012 23:10:20 +0000 (19:10 -0400)

ident: report passwd errors with a more friendly message

When getpwuid fails, we give a cute but cryptic message.
While it makes sense if you know that getpwuid or identity
functions are being called, this code is triggered behind
the scenes by quite a few git commands these days (e.g.,
receive-pack on a remote server might use it for a reflog;
the current message is hard to distinguish from an
authentication error). Let's switch to something that gives
a little more context.

While we're at it, we can factor out all of the
cut-and-pastes of the "you don't exist" message into a
wrapper function. Rather than provide xgetpwuid, let's make
it even more specific to just getting the passwd entry for
the current uid. That's the only way we use getpwuid anyway,
and it lets us make an even more specific error message.

The current message also fails to mention errno. While the
usual cause for getpwuid failing is that the user does not
exist, mentioning errno makes it easier to diagnose these
problems. Note that POSIX specifies that errno remain
untouched if the passwd entry does not exist (but will be
set on actual errors), whereas some systems will return
ENOENT or similar for a missing entry. We handle both cases
in our wrapper.

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

drop length limitations on gecos-derived names and... Jeff King Mon, 21 May 2012 23:10:17 +0000 (19:10 -0400)

drop length limitations on gecos-derived names and emails

When we pull the user's name from the GECOS field of the
passwd file (or generate an email address based on their
username and hostname), we put the result into a
static buffer. While it's extremely unlikely that anybody
ever hit these limits (after all, in such a case their
parents must have hated them), we still had to deal with the
error cases in our code.

Converting these static buffers to strbufs lets us simplify
the code and drop some error messages from the documentation
that have confused some users.

The conversion is mostly mechanical: replace string copies
with strbuf equivalents, and access the strbuf.buf directly.
There are a few exceptions:

- copy_gecos and copy_email are the big winners in code
reduction (since they no longer have to manage the
string length manually)

- git_ident_config wants to replace old versions of
the default name (e.g., if we read the config multiple
times), so it must reset+add to the strbuf instead of
just adding

Note that there is still one length limitation: the
gethostname interface requires us to provide a static
buffer, so we arbitrarily choose 1024 bytes for the
hostname.

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

ident: don't write fallback username into git_default_nameJeff King Mon, 21 May 2012 23:10:14 +0000 (19:10 -0400)

ident: don't write fallback username into git_default_name

The fmt_ident function gets a flag that tells us whether to
die if the name field is blank. If it is blank and we don't
die, then we fall back to the username from the passwd file.

The current code writes the value into git_default_name.
However, that's not necessarily correct, as the empty value
might have come from git_default_name, or it might have been
passed in. This leads to two potential problems:

1. If we are overriding an empty name in the passed-in
value, then we may be overwriting a perfectly good name
(from gitconfig or gecos) in the git_default_name
buffer. Later calls to fmt_ident will end up using the
fallback name, even though a better name was available.

2. If we override an empty gecos name, we end up with the
fallback name in git_default_name. A later call that
uses IDENT_ERROR_ON_NO_NAME will see the fallback name
and think that it is a good name, instead of producing
an error. In other words, a blank gecos name would
cause an error with this code:

git_committer_info(IDENT_ERROR_ON_NO_NAME);

but not this:

git_committer_info(0);
git_committer_info(IDENT_ERROR_ON_NO_NAME);

because in the latter case, the first call has polluted
the name buffer.

Instead, let's make the fallback a per-invocation variable.
We can just use the pw->pw_name string directly, since it
only needs to persist through the rest of the function (and
we don't do any other getpwent calls).

Note that while this solves (1) for future invocations of
fmt_indent, the current invocation might use the fallback
when it could in theory load a better value from
git_default_name. However, by not passing
IDENT_ERROR_ON_NO_NAME, the caller is indicating that it
does not care too much about the name, anyway, so we don't
bother; this is primarily about protecting future callers
who do care.

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

fmt_ident: drop IDENT_WARN_ON_NO_NAME codeJeff King Mon, 21 May 2012 23:10:11 +0000 (19:10 -0400)

fmt_ident: drop IDENT_WARN_ON_NO_NAME code

There are no more callers who want this, so we can drop it.

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

format-patch: use default email for generating message idsJeff King Mon, 21 May 2012 23:10:08 +0000 (19:10 -0400)

format-patch: use default email for generating message ids

We try to generate a sane message id for cover letters and
threading by appending some changing bits to the front of
the user's email address. The current code parses the email
out of the results of git_committer_info, but we can do this
much more easily by just calling ident_default_email
ourselves.

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

ident: trim trailing newline from /etc/mailnameJeff King Mon, 21 May 2012 23:10:02 +0000 (19:10 -0400)

ident: trim trailing newline from /etc/mailname

We use fgets to read the /etc/mailname file, which means we
will typically end up with an extra newline in our
git_default_email. Most of the time this doesn't matter, as
fmt_ident will skip it as cruft, but there is one code path
that accesses it directly (in http-push.c:lock_remote).

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

move git_default_* variables to ident.cJeff King Mon, 21 May 2012 23:09:57 +0000 (19:09 -0400)

move git_default_* variables to ident.c

There's no reason anybody outside of ident.c should access
these directly (they should use the new accessors which make
sure the variables are initialized), so we can make them
file-scope statics.

While we're at it, move user_ident_explicitly_given into
ident.c; while still globally visible, it makes more sense
to reside with the ident code.

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

move identity config parsing to ident.cJeff King Mon, 21 May 2012 23:09:54 +0000 (19:09 -0400)

move identity config parsing to ident.c

There's no reason for this to be in config, except that once
upon a time all of the config parsing was there. It makes
more sense to keep the ident code together.

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

fmt-merge-msg: don't use static buffer in record_personJeff King Mon, 21 May 2012 23:09:51 +0000 (19:09 -0400)

fmt-merge-msg: don't use static buffer in record_person

The record_person function just parses out the "name" field
of the person line in a commit and adds it to a string_list.
The only reason we need an extra buffer is that the
string_list functions require a NUL-terminated string.

Instead of the static buffer, we can just allocate a
temporary NUL-terminated copy. In addition to removing a
useless limit, this removes the only user of MAX_GITNAME
outside of ident.c.

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

http-push: do not access git_default_email directlyJeff King Mon, 21 May 2012 23:09:47 +0000 (19:09 -0400)

http-push: do not access git_default_email directly

By calling the ident_default_email accessor, we can be sure
that the default value is actually filled-in.

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

ident: split setup_ident into separate functionsJeff King Mon, 21 May 2012 23:09:43 +0000 (19:09 -0400)

ident: split setup_ident into separate functions

This function sets up the default name, email, and date, and
is not publicly available. Let's split it into three public
functions so that callers can get just the parts they need.

While we're at it, let's change the interface to simple
accessors. The original function was called only by fmt_ident,
and contained logic for "if we already have some other
value, don't load the default" which properly belongs in
fmt_ident.

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

grep: stop leaking line strings with -fRené Scharfe Mon, 21 May 2012 16:10:09 +0000 (18:10 +0200)

grep: stop leaking line strings with -f

When reading patterns from a file, we pass the lines as allocated string
buffers to append_grep_pat() and never free them. That's not a problem
because they are needed until the program ends anyway.

However, now that the function duplicates the pattern string, we can
reuse the strbuf after calling that function. This simplifies the code
a bit and plugs a minor memory leak.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote: fix typoRalf Thielow Fri, 18 May 2012 16:46:01 +0000 (18:46 +0200)

remote: fix typo

The mapping that describe what ref fetched from the remote is used to
update what ref locally is called "refspec", not "respec".

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

Merge branch 'maint'Junio C Hamano Sun, 20 May 2012 22:45:35 +0000 (15:45 -0700)

Merge branch 'maint'

By Jens Lehmann (1) and Johannes Sixt (1)
* maint:
Consistently use "superproject" instead of "supermodule"
t3404: begin "exchange commits with -p" test with correct preconditions

grep: support newline separated pattern listRené Scharfe Sun, 20 May 2012 14:33:07 +0000 (16:33 +0200)

grep: support newline separated pattern list

Currently, patterns that contain newline characters don't match anything
when given to git grep. Regular grep(1) interprets patterns as lists of
newline separated search strings instead.

Implement this functionality by creating and inserting extra grep_pat
structures for patterns consisting of multiple lines when appending to
the pattern lists. For simplicity, all pattern strings are duplicated.
The original pattern is truncated in place to make it contain only the
first line.

Requested-by: Torne (Richard Coles) <torne@google.com>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: factor out do_append_grep_pat()René Scharfe Sun, 20 May 2012 14:32:54 +0000 (16:32 +0200)

grep: factor out do_append_grep_pat()

Add do_append_grep_pat() as a shared function for adding patterns to
the header pattern list and the general pattern list.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: factor out create_grep_pat()René Scharfe Sun, 20 May 2012 14:32:39 +0000 (16:32 +0200)

grep: factor out create_grep_pat()

Add create_grep_pat(), a shared helper for all grep pattern allocation
and initialization needs.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

free_ref_entry(): do not trigger reading of loose refsMichael Haggerty Sun, 20 May 2012 06:49:32 +0000 (08:49 +0200)

free_ref_entry(): do not trigger reading of loose refs

Do not call get_ref_dir() from within free_ref_entry(), because that
triggers the reading of loose refs, only for them to be freed
immediately.

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

Consistently use "superproject" instead of "supermodule"Jens Lehmann Sun, 20 May 2012 13:28:26 +0000 (15:28 +0200)

Consistently use "superproject" instead of "supermodule"

We fairly consistently say "superproject" and never "supermodule" these
days. But there are seven occurrences of "supermodule" left in the current
work tree. Three appear in Release Notes for 1.5.3 and 1.7.7, three in
test names and one in a C-code comment.

Replace all occurrences of "supermodule" outside of the Release Notes
(which shouldn't be changed after the fact) with "superproject" for
consistency.

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

t3404: begin "exchange commits with -p" test with corre... Johannes Sixt Sat, 19 May 2012 13:14:16 +0000 (15:14 +0200)

t3404: begin "exchange commits with -p" test with correct preconditions

The test case shows a bug in 'rebase -p', but even if the bug were fixed
the test would fail because it did not ensure that the preconditions match
the postconditions that were checked. Insert the suitable 'git checkout'.

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

completion: add support for backwards compatibilityFelipe Contreras Sat, 19 May 2012 02:41:35 +0000 (04:41 +0200)

completion: add support for backwards compatibility

Some people might be relying on _git and _gitk to define custom aliases,
unfortunately, commit 6b179ad (completion: add new __git_complete
helper) broke that support.

"bash: [: 1: unary operator expected"

This can be easily fixed by using __git_complete, but it's not meant to
be public.

Although _git and _gitk are probably not meant to be public, it's easy
to keep having support for them by having a wrapper to the proper
new function that is fully functional.

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

completion: rename internal helpers _git and _gitkFelipe Contreras Sat, 19 May 2012 02:41:34 +0000 (04:41 +0200)

completion: rename internal helpers _git and _gitk

Would be useful to provide backwards compatibility for _git. Also, zsh
completion uses _git, and it cannot be changed.

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

t/Makefile: retain cache t/.prove across prove runsMichael Haggerty Wed, 2 May 2012 15:31:52 +0000 (17:31 +0200)

t/Makefile: retain cache t/.prove across prove runs

prove(1) can write a summary of its test results and timings into a
cache file, t/.prove, then use this information during later runs for
various purposes. But deleting t/.prove after every test run defeats
this purpose. So do not delete t/.prove as part of "make
DEFAILT_TEST_TARGET=prove test". (Continue to delete the file on
"make clean".)

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