gitweb.git
git p4 test: use client_view to build the initial clientPete Wyckoff Sun, 27 Jan 2013 03:11:07 +0000 (22:11 -0500)

git p4 test: use client_view to build the initial client

Simplify the code a bit by using an existing function.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: generate better error message for bad depot... Pete Wyckoff Sun, 27 Jan 2013 03:11:06 +0000 (22:11 -0500)

git p4: generate better error message for bad depot path

Depot paths must start with //. Exit with a better explanation
when a bad depot path is supplied.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: remove unused importsPete Wyckoff Sun, 27 Jan 2013 03:11:05 +0000 (22:11 -0500)

git p4: remove unused imports

Found by "pyflakes" checker tool.
Modules shelve, getopt were unused.
Module os.path is exported by os.
Reformat one-per-line as is PEP008 suggested style.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: temp branch name should use / even on windowsPete Wyckoff Sun, 27 Jan 2013 03:11:04 +0000 (22:11 -0500)

git p4: temp branch name should use / even on windows

Commit fed2369 (git-p4: Search for parent commit on branch creation,
2012-01-25) uses temporary branches to help find the parent of a
new p4 branch. The temp branches are of the form "git-p4-tmp/%d"
for some p4 change number. Mistakenly, this string was made
using os.path.join() instead of just string concatenation. On
windows, this turns into a backslash (\), which is not allowed in
git branch names.

Reported-by: Casey McGinty <casey.mcginty@gmail.com>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jk/maint-gc-auto-after-fetch' into jk... Junio C Hamano Sun, 27 Jan 2013 03:42:09 +0000 (19:42 -0800)

Merge branch 'jk/maint-gc-auto-after-fetch' into jk/gc-auto-after-fetch

* jk/maint-gc-auto-after-fetch:
fetch-pack: avoid repeatedly re-scanning pack directory
fetch: run gc --auto after fetching

fetch-pack: avoid repeatedly re-scanning pack directoryJeff King Sat, 26 Jan 2013 22:40:43 +0000 (17:40 -0500)

fetch-pack: avoid repeatedly re-scanning pack directory

When we look up a sha1 object for reading via parse_object() =>
read_sha1_file() => read_object() callpath, we first check
packfiles, and then loose objects. If we still haven't found it, we
re-scan the list of packfiles in `objects/pack`. This final step
ensures that we can co-exist with a simultaneous repack process
which creates a new pack and then prunes the old object.

This extra re-scan usually does not have a performance impact for
two reasons:

1. If an object is missing, then typically the re-scan will find a
new pack, then no more misses will occur. Or if it truly is
missing, then our next step is usually to die().

2. Re-scanning is cheap enough that we do not even notice.

However, these do not always hold. The assumption in (1) is that the
caller is expecting to find the object. This is usually the case,
but the call to `parse_object` in `everything_local` does not follow
this pattern. It is looking to see whether we have objects that the
remote side is advertising, not something we expect to
have. Therefore if we are fetching from a remote which has many refs
pointing to objects we do not have, we may end up re-scanning the
pack directory many times.

Even with this extra re-scanning, the impact is often not noticeable
due to (2); we just readdir() the packs directory and skip any packs
that are already loaded. However, if there are a large number of
packs, even enumerating the directory can be expensive, especially
if we do it repeatedly.

Having this many packs is a good sign the user should run `git gc`,
but it would still be nice to avoid having to scan the directory at
all.

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

fetch: run gc --auto after fetchingJeff King Sat, 26 Jan 2013 22:40:38 +0000 (17:40 -0500)

fetch: run gc --auto after fetching

We generally try to run "gc --auto" after any commands that
might introduce a large number of new objects. An obvious
place to do so is after running "fetch", which may introduce
new loose objects or packs (depending on the size of the
fetch).

While an active developer repository will probably
eventually trigger a "gc --auto" on another action (e.g.,
git-rebase), there are two good reasons why it is nicer to
do it at fetch time:

1. Read-only repositories which track an upstream (e.g., a
continuous integration server which fetches and builds,
but never makes new commits) will accrue loose objects
and small packs, but never coalesce them into a more
efficient larger pack.

2. Fetching is often already perceived to be slow to the
user, since they have to wait on the network. It's much
more pleasant to include a potentially slow auto-gc as
part of the already-long network fetch than in the
middle of productive work with git-rebase or similar.

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

git-p4.py: support Python 2.4Brandon Casey Sat, 26 Jan 2013 19:14:33 +0000 (11:14 -0800)

git-p4.py: support Python 2.4

Python 2.4 lacks the following features:

subprocess.check_call
struct.pack_into

Take a cue from 460d1026 and provide an implementation of the
CalledProcessError exception. Then replace the calls to
subproccess.check_call with calls to subprocess.call that check the return
status and raise a CalledProcessError exception if necessary.

The struct.pack_into in t/9802 can be converted into a single struct.pack
call which is available in Python 2.4.

Signed-off-by: Brandon Casey <bcasey@nvidia.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4.py: support Python 2.5Brandon Casey Sat, 26 Jan 2013 19:14:32 +0000 (11:14 -0800)

git-p4.py: support Python 2.5

Python 2.5 and older do not accept None as the first argument to
translate() and complain with:

TypeError: expected a character buffer object

As suggested by Pete Wyckoff, let's just replace the call to translate()
with a regex search which should be more clear and more portable.

This allows git-p4 to be used with Python 2.5.

Signed-off-by: Brandon Casey <bcasey@nvidia.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

logmsg_reencode: lazily load missing commit buffersJeff King Sat, 26 Jan 2013 09:44:28 +0000 (04:44 -0500)

logmsg_reencode: lazily load missing commit buffers

Usually a commit that makes it to logmsg_reencode will have
been parsed, and the commit->buffer struct member will be
valid. However, some code paths will free commit buffers
after having used them (for example, the log traversal
machinery will do so to keep memory usage down).

Most of the time this is fine; log should only show a commit
once, and then exits. However, there are some code paths
where this does not work. At least two are known:

1. A commit may be shown as part of a regular ref, and
then it may be shown again as part of a submodule diff
(e.g., if a repo contains refs to both the superproject
and subproject).

2. A notes-cache commit may be shown during "log --all",
and then later used to access a textconv cache during a
diff.

Lazily loading in logmsg_reencode does not necessarily catch
all such cases, but it should catch most of them. Users of
the commit buffer tend to be either parsing for structure
(in which they will call parse_commit, and either we will
already have parsed, or we will load commit->buffer lazily
there), or outputting (either to the user, or fetching a
part of the commit message via format_commit_message). In
the latter case, we should always be using logmsg_reencode
anyway (and typically we do so via the pretty-print
machinery).

If there are any cases that this misses, we can fix them up
to use logmsg_reencode (or handle them on a case-by-case
basis if that is inappropriate).

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

logmsg_reencode: never return NULLJeff King Sat, 26 Jan 2013 09:44:06 +0000 (04:44 -0500)

logmsg_reencode: never return NULL

The logmsg_reencode function will return the reencoded
commit buffer, or NULL if reencoding failed or no reencoding
was necessary. Since every caller then ends up checking for NULL
and just using the commit's original buffer, anyway, we can
be a bit more helpful and just return that buffer when we
would have returned NULL.

Since the resulting string may or may not need to be freed,
we introduce a logmsg_free, which checks whether the buffer
came from the commit object or not (callers either
implemented the same check already, or kept two separate
pointers, one to mark the buffer to be used, and one for the
to-be-freed string).

Pushing this logic into logmsg_* simplifies the callers, and
will let future patches lazily load the commit buffer in a
single place.

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

commit: drop useless xstrdup of commit messageJeff King Sat, 26 Jan 2013 09:42:45 +0000 (04:42 -0500)

commit: drop useless xstrdup of commit message

When git-commit is asked to reuse a commit message via "-c",
we call read_commit_message, which looks up the commit and
hands back either the re-encoded result, or a copy of the
original. We make a copy in the latter case so that the
ownership semantics of the return value are clear (in either
case, it can be freed).

However, since we return a "const char *", and since the
resulting buffer's lifetime is the same as that of the whole
program, we never bother to free it at all.

Let's just drop the copy. That saves us a copy in the common
case. While it does mean we leak in the re-encode case, it
doesn't matter, since we are relying on program exit to free
the memory anyway.

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

Merge branch 'for-junio' of git://bogomips.org/git-svnJunio C Hamano Fri, 25 Jan 2013 20:53:31 +0000 (12:53 -0800)

Merge branch 'for-junio' of git://bogomips.org/git-svn

* 'for-junio' of git://bogomips.org/git-svn:
git-svn: Simplify calculation of GIT_DIR
git-svn: cleanup sprintf usage for uppercasing hex

Update draft release notes to 1.8.2Junio C Hamano Fri, 25 Jan 2013 20:52:55 +0000 (12:52 -0800)

Update draft release notes to 1.8.2

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

Merge branch 'nd/retire-fnmatch'Junio C Hamano Fri, 25 Jan 2013 20:34:55 +0000 (12:34 -0800)

Merge branch 'nd/retire-fnmatch'

Replace our use of fnmatch(3) with a more feature-rich wildmatch.
A handful patches at the bottom have been moved to nd/wildmatch to
graduate as part of that branch, before this series solidifies.

We may want to mark USE_WILDMATCH as an experimental curiosity a
bit more clearly (i.e. should not be enabled in production
environment, because it will make the behaviour between builds
unpredictable).

* nd/retire-fnmatch:
Makefile: add USE_WILDMATCH to use wildmatch as fnmatch
wildmatch: advance faster in <asterisk> + <literal> patterns
wildmatch: make a special case for "*/" with FNM_PATHNAME
test-wildmatch: add "perf" command to compare wildmatch and fnmatch
wildmatch: support "no FNM_PATHNAME" mode
wildmatch: make dowild() take arbitrary flags
wildmatch: rename constants and update prototype

Merge branch 'jc/doc-maintainer'Junio C Hamano Fri, 25 Jan 2013 20:34:52 +0000 (12:34 -0800)

Merge branch 'jc/doc-maintainer'

Describe tools for automation that were invented since this
document was originally written.

* jc/doc-maintainer:
howto/maintain: document "### match next" convention in jch/pu branch
howto/maintain: mark titles for asciidoc
Documentation: update "howto maintain git"

howto/maintain: document "### match next" convention... Junio C Hamano Fri, 25 Jan 2013 20:33:57 +0000 (12:33 -0800)

howto/maintain: document "### match next" convention in jch/pu branch

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

ident: do not drop username when reading from /etc... Jonathan Nieder Thu, 24 Jan 2013 23:21:46 +0000 (15:21 -0800)

ident: do not drop username when reading from /etc/mailname

An earlier conversion from fgets() to strbuf_getline() in the
codepath to read from /etc/mailname to learn the default host-part
of the ident e-mail address forgot that strbuf_getline() stores the
line at the beginning of the buffer just like fgets().

The "username@" the caller has prepared in the strbuf, expecting the
function to append the host-part to it, was lost because of this.

Reported-by: Mihai Rusu <dizzy@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

push: finishing touches to explain REJECT_ALREADY_EXIST... Junio C Hamano Fri, 25 Jan 2013 05:09:00 +0000 (21:09 -0800)

push: finishing touches to explain REJECT_ALREADY_EXISTS better

Now that "already exists" errors are given only when a push tries to
update an existing ref in refs/tags/ hierarchy, we can say "the
tag", instead of "the destination reference", and that is far easier
to understand.

Pointed out by Chris Rorvick.

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

git-remote-testpy: call print as a functionJohn Keeping Sun, 20 Jan 2013 13:15:38 +0000 (13:15 +0000)

git-remote-testpy: call print as a function

This is harmless in Python 2, which sees the parentheses as redundant
grouping, but is required for Python 3. Since this is the only change
required to make this script just run under Python 3 without needing
2to3 it seems worthwhile.

The case of an empty print must be handled specially because in that
case Python 2 will interpret '()' as an empty tuple and print it as
'()'; inserting an empty string fixes this.

Signed-off-by: John Keeping <john@keeping.me.uk>
Acked-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-remote-testpy: don't do unbuffered text I/OJohn Keeping Sun, 20 Jan 2013 13:15:37 +0000 (13:15 +0000)

git-remote-testpy: don't do unbuffered text I/O

Python 3 forbids unbuffered I/O in text mode. Change the reading of
stdin in git-remote-testpy so that we read the lines as bytes and then
decode them a line at a time.

This allows us to keep the I/O unbuffered in order to avoid
reintroducing the bug fixed by commit 7fb8e16 (git-remote-testgit: fix
race when spawning fast-import).

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-remote-testpy: hash bytes explicitlyJohn Keeping Sun, 20 Jan 2013 13:15:36 +0000 (13:15 +0000)

git-remote-testpy: hash bytes explicitly

Under Python 3 'hasher.update(...)' must take a byte string and not a
unicode string. Explicitly encode the argument to this method to hex
bytes so that we don't need to worry about failures to encode that might
occur if we chose a textual encoding.

This changes the directory used by git-remote-testpy for its git mirror
of the remote repository, but this tool should not have any serious
users as it is used primarily to test the Python remote helper
framework.

The use of encode() moves the required Python version forward to 2.0.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

svn-fe: allow svnrdump_sim.py to run with Python 3John Keeping Sun, 20 Jan 2013 13:15:35 +0000 (13:15 +0000)

svn-fe: allow svnrdump_sim.py to run with Python 3

The changes to allow this script to run with Python 3 are minimal and do
not affect its functionality on the versions of Python 2 that are
already supported (2.4 onwards).

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git_remote_helpers: use 2to3 if building with Python 3John Keeping Sun, 20 Jan 2013 13:15:34 +0000 (13:15 +0000)

git_remote_helpers: use 2to3 if building with Python 3

Using the approach detailed in the Python documentation[1], run 2to3 on
the code as part of the build if building with Python 3.

The code itself requires no changes to convert cleanly.

[1] http://docs.python.org/3.3/howto/pyporting.html#during-installation

Signed-off-by: John Keeping <john@keeping.me.uk>
Acked-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git_remote_helpers: force rebuild if python version... John Keeping Sun, 20 Jan 2013 13:15:33 +0000 (13:15 +0000)

git_remote_helpers: force rebuild if python version changes

When different version of python are used to build via distutils, the
behaviour can change. Detect changes in version and pass --force in
this case.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t9902: protect test from stray build artifactsJunio C Hamano Thu, 24 Jan 2013 23:08:37 +0000 (15:08 -0800)

t9902: protect test from stray build artifacts

When you have random build artifacts in your build directory, left
behind by running "make" while on another branch, the "git help -a"
command run by __git_list_all_commands in the completion script that
is being tested does not have a way to know that they are not part
of the subcommands this build will ship. Such extra subcommands may
come from the user's $PATH. They will interfere with the tests that
expect a certain prefix to uniquely expand to a known completion.

Instrument the completion script and give it a way for us to tell
what (subset of) subcommands we are going to ship.

Also add a test to "git --help <prefix><TAB>" expansion. It needs
to show not just commands but some selected documentation pages.

Based on an idea by Jeff King.

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

push: introduce REJECT_FETCH_FIRST and REJECT_NEEDS_FORCEJunio C Hamano Wed, 23 Jan 2013 21:55:30 +0000 (13:55 -0800)

push: introduce REJECT_FETCH_FIRST and REJECT_NEEDS_FORCE

When we push to update an existing ref, if:

* the object at the tip of the remote is not a commit; or
* the object we are pushing is not a commit,

it won't be correct to suggest to fetch, integrate and push again,
as the old and new objects will not "merge". We should explain that
the push must be forced when there is a non-committish object is
involved in such a case.

If we do not have the current object at the tip of the remote, we do
not even know that object, when fetched, is something that can be
merged. In such a case, suggesting to pull first just like
non-fast-forward case may not be technically correct, but in
practice, most such failures are seen when you try to push your work
to a branch without knowing that somebody else already pushed to
update the same branch since you forked, so "pull first" would work
as a suggestion most of the time. And if the object at the tip is
not a commit, "pull first" will fail, without making any permanent
damage. As a side effect, it also makes the error message the user
will get during the next "push" attempt easier to understand, now
the user is aware that a non-commit object is involved.

In these cases, the current code already rejects such a push on the
client end, but we used the same error and advice messages as the
ones used when rejecting a non-fast-forward push, i.e. pull from
there and integrate before pushing again.

Introduce new rejection reasons and reword the messages
appropriately.

[jc: with help by Peff on message details]

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

push: further simplify the logic to assign rejection... Junio C Hamano Wed, 23 Jan 2013 21:14:48 +0000 (13:14 -0800)

push: further simplify the logic to assign rejection reason

First compute the reason why this push would fail if done without
"--force", and then fail it by assigning that reason when the push
was not forced (or if there is no reason to require force, allow it
to succeed).

Record the fact that the push was forced in the forced_update field
only when the push would have failed without the option.

The code becomes shorter, less repetitive and easier to read this
way, especially given that the set of rejection reasons will be
extended in a later patch.

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

push: further clean up fields of "struct ref"Junio C Hamano Tue, 22 Jan 2013 04:24:07 +0000 (20:24 -0800)

push: further clean up fields of "struct ref"

The "nonfastforward" and "update" fields are only used while
deciding what value to assign to the "status" locally in a single
function. Remove them from the "struct ref".

The "requires_force" field is not used to decide if the proposed
update requires a --force option to succeed, or to record such a
decision made elsewhere. It is used by status reporting code that
the particular update was "forced". Rename it to "forced_update",
and move the code to assign to it around to further clarify how it
is used and what it is used for.

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

t7102 (reset): don't hardcode SHA-1 in expected outputsAlexey Shumkin Thu, 24 Jan 2013 09:10:26 +0000 (13:10 +0400)

t7102 (reset): don't hardcode SHA-1 in expected outputs

Take the expected SHA-1 digest in a variable, and use it instead of
hardcoding when checking the result.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-cvsimport.txt: cvsps-2 is deprecatedJohn Keeping Thu, 24 Jan 2013 19:18:45 +0000 (19:18 +0000)

git-cvsimport.txt: cvsps-2 is deprecated

git-cvsimport relies on version 2 of cvsps and does not work with the
new version 3. Since cvsps 3.x does not currently work as well as
version 2 for incremental import, document this fact.

Specifically, there is no way to make new git-cvsimport that supports
cvsps 3.x and have a seamless transition for existing users since cvsps
3.x needs a time from which to continue importing and git-cvsimport does
not save the time of the last import or import into a specific namespace
so there is no safe way to calculate the time of the last import.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-svn: Simplify calculation of GIT_DIRBarry Wardell Mon, 21 Jan 2013 01:22:02 +0000 (01:22 +0000)

git-svn: Simplify calculation of GIT_DIR

Since git-rev-parse already checks for the $GIT_DIR environment
variable and that it returns an actual git repository, there is no
need to repeat the checks again here.

This also fixes a problem where git-svn did not work in cases where
.git was a file with a gitdir: link.

[ew: squashed test case,
delay setting GIT_DIR until after `git rev-parse --cdup` to fix t9101,
(thanks to Junio)]

Signed-off-by: Barry Wardell <barry.wardell@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>

git-svn: cleanup sprintf usage for uppercasing hexEric Wong Thu, 24 Jan 2013 00:23:44 +0000 (00:23 +0000)

git-svn: cleanup sprintf usage for uppercasing hex

We do not need to call uc() separately for sprintf("%x")
as sprintf("%X") is available.

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

Merge branch 'as/pre-push-hook'Junio C Hamano Thu, 24 Jan 2013 05:19:25 +0000 (21:19 -0800)

Merge branch 'as/pre-push-hook'

Add an extra hook so that "git push" that is run without making
sure what is being pushed is sane can be checked and rejected (as
opposed to the user deciding not pushing).

* as/pre-push-hook:
Add sample pre-push hook script
push: Add support for pre-push hooks
hooks: Add function to check if a hook exists

Merge branch 'ch/add-auto-submitted-in-sample-post... Junio C Hamano Thu, 24 Jan 2013 05:19:19 +0000 (21:19 -0800)

Merge branch 'ch/add-auto-submitted-in-sample-post-receive-email'

* ch/add-auto-submitted-in-sample-post-receive-email:
Add Auto-Submitted header to post-receive-email

Merge branch 'as/check-ignore'Junio C Hamano Thu, 24 Jan 2013 05:19:10 +0000 (21:19 -0800)

Merge branch 'as/check-ignore'

Add a new command "git check-ignore" for debugging .gitignore
files.

The variable names may want to get cleaned up but that can be done
in-tree.

* as/check-ignore:
clean.c, ls-files.c: respect encapsulation of exclude_list_groups
t0008: avoid brace expansion
add git-check-ignore sub-command
setup.c: document get_pathspec()
add.c: extract new die_if_path_beyond_symlink() for reuse
add.c: extract check_path_for_gitlink() from treat_gitlinks() for reuse
pathspec.c: rename newly public functions for clarity
add.c: move pathspec matchers into new pathspec.c for reuse
add.c: remove unused argument from validate_pathspec()
dir.c: improve docs for match_pathspec() and match_pathspec_depth()
dir.c: provide clear_directory() for reclaiming dir_struct memory
dir.c: keep track of where patterns came from
dir.c: use a single struct exclude_list per source of excludes

Conflicts:
builtin/ls-files.c
dir.c

Merge branch 'rs/clarify-entry-cmp-sslice'Junio C Hamano Thu, 24 Jan 2013 05:19:06 +0000 (21:19 -0800)

Merge branch 'rs/clarify-entry-cmp-sslice'

* rs/clarify-entry-cmp-sslice:
refs: use strncmp() instead of strlen() and memcmp()

Merge branch 'jk/suppress-clang-warning'Junio C Hamano Thu, 24 Jan 2013 05:19:00 +0000 (21:19 -0800)

Merge branch 'jk/suppress-clang-warning'

* jk/suppress-clang-warning:
fix clang -Wunused-value warnings for error functions

Merge branch 'cr/push-force-tag-update'Junio C Hamano Thu, 24 Jan 2013 05:16:49 +0000 (21:16 -0800)

Merge branch 'cr/push-force-tag-update'

Regression fix to stop "git push" complaining "target ref already
exists", when it is not the real reason the command rejected the
request (e.g. non-fast-forward).

* cr/push-force-tag-update:
push: fix "refs/tags/ hierarchy cannot be updated without --force"

Merge branch 'mh/imap-send-shrinkage'Junio C Hamano Thu, 24 Jan 2013 05:16:45 +0000 (21:16 -0800)

Merge branch 'mh/imap-send-shrinkage'

Remove a lot of unused code from "git imap-send".

* mh/imap-send-shrinkage:
imap-send.c: simplify logic in lf_to_crlf()
imap-send.c: fold struct store into struct imap_store
imap-send.c: remove unused field imap_store::uidvalidity
imap-send.c: use struct imap_store instead of struct store
imap-send.c: remove unused field imap_store::trashnc
imap-send.c: remove namespace fields from struct imap
imap-send.c: remove struct imap argument to parse_imap_list_l()
imap-send.c: inline parse_imap_list() in parse_list()
imap-send.c: remove some unused fields from struct store
imap-send.c: remove struct message
imap-send.c: remove struct store_conf
iamp-send.c: remove unused struct imap_store_conf
imap-send.c: remove struct msg_data
imap-send.c: remove msg_data::flags, which was always zero

Merge branch 'mo/cvs-server-updates'Junio C Hamano Thu, 24 Jan 2013 05:16:38 +0000 (21:16 -0800)

Merge branch 'mo/cvs-server-updates'

Various git-cvsserver updates.

* mo/cvs-server-updates:
t9402: Use TABs for indentation
t9402: Rename check.cvsCount and check.list
t9402: Simplify git ls-tree
t9402: Add missing &&; Code style
t9402: No space after IO-redirection
t9402: Dont use test_must_fail cvs
t9402: improve check_end_tree() and check_end_full_tree()
t9402: sed -i is not portable
cvsserver Documentation: new cvs ... -r support
cvsserver: add t9402 to test branch and tag refs
cvsserver: support -r and sticky tags for most operations
cvsserver: Add version awareness to argsfromdir
cvsserver: generalize getmeta() to recognize commit refs
cvsserver: implement req_Sticky and related utilities
cvsserver: add misc commit lookup, file meta data, and file listing functions
cvsserver: define a tag name character escape mechanism
cvsserver: cleanup extra slashes in filename arguments
cvsserver: factor out git-log parsing logic

Merge branch 'jc/makefile-perl-python-path-doc'Junio C Hamano Thu, 24 Jan 2013 05:09:23 +0000 (21:09 -0800)

Merge branch 'jc/makefile-perl-python-path-doc'

* 'jc/makefile-perl-python-path-doc':
Makefile: add description on PERL/PYTHON_PATH

reflog: use parse_config_key in config callbackJeff King Wed, 23 Jan 2013 06:27:37 +0000 (01:27 -0500)

reflog: use parse_config_key in config callback

This doesn't save any lines, but does keep us from doing
error-prone pointer arithmetic with constants.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

help: use parse_config_key for man configJeff King Wed, 23 Jan 2013 06:27:09 +0000 (01:27 -0500)

help: use parse_config_key for man config

The resulting code ends up about the same length, but it is
a little more self-explanatory. It now explicitly documents
and checks the pre-condition that the incoming var starts
with "man.", and drops the magic offset "4".

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: simplify memory handling in config parsingJeff King Wed, 23 Jan 2013 06:26:42 +0000 (01:26 -0500)

submodule: simplify memory handling in config parsing

We keep a strbuf for the name of the submodule, even though
we only ever add one string to it. Let's just use xmemdupz
instead, which is slightly more efficient and makes it
easier to follow what is going on.

Unfortunately, we still end up having to deal with some
memory ownership issues in some code branches, as we have to
allocate the string in order to do a string list lookup, and
then only sometimes want to hand ownership of that string
over to the string_list. Still, making that explicit in the
code (as opposed to sometimes detaching the strbuf, and then
always releasing it) makes it a little more obvious what is
going on.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: use parse_config_key when parsing configJeff King Wed, 23 Jan 2013 06:25:22 +0000 (01:25 -0500)

submodule: use parse_config_key when parsing config

This makes the code a lot simpler to read by dropping a
whole bunch of constant offsets.

As a bonus, it means we also feed the whole config variable
name to our error functions:

[before]
$ git -c submodule.foo.fetchrecursesubmodules=bogus checkout
fatal: bad foo.fetchrecursesubmodules argument: bogus

[after]
$ git -c submodule.foo.fetchrecursesubmodules=bogus checkout
fatal: bad submodule.foo.fetchrecursesubmodules argument: bogus

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

userdiff: drop parse_driver functionJeff King Wed, 23 Jan 2013 06:25:07 +0000 (01:25 -0500)

userdiff: drop parse_driver function

When we parse userdiff config, we generally assume that

diff.name.key

will affect the "key" value of the "name" driver. However,
without confirming that the key is a valid userdiff key, we
may accidentally conflict with the ancient "diff.color.*"
namespace. The current code is careful not to even create a
driver struct if we do not see a key that is known by the
diff-driver code.

However, this carefulness is unnecessary; the default driver
with no keys set behaves exactly the same as having no
driver at all. We can simply set up the driver struct as
soon as we see we have a config key that looks like a
driver. This makes the code a bit more readable.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

convert some config callbacks to parse_config_keyJeff King Wed, 23 Jan 2013 06:24:23 +0000 (01:24 -0500)

convert some config callbacks to parse_config_key

These callers can drop some inline pointer arithmetic and
magic offset constants, making them more readable and less
error-prone (those constants had to match the lengths of
strings, but there is no automatic verification of that
fact).

The "ep" pointer (presumably for "end pointer"), which
points to the final key segment of the config variable, is
given the more standard name "key" to describe its function
rather than its derivation.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

archive-tar: use parse_config_key when parsing configJeff King Wed, 23 Jan 2013 06:23:27 +0000 (01:23 -0500)

archive-tar: use parse_config_key when parsing config

This is fewer lines of code, but more importantly, fixes a
bogus pointer offset. We are looking for "tar." in the
section, but later assume that the dot we found is at offset
9, not 3. This is a holdover from an earlier iteration of
767cf45 which called the section "tarfilter".

As a result, we could erroneously reject some filters with
dots in their name, as well as read uninitialized memory.

Reported by (and test by) René Scharfe.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: add helper function for parsing key namesJeff King Wed, 23 Jan 2013 06:23:05 +0000 (01:23 -0500)

config: add helper function for parsing key names

The config callback functions get keys of the general form:

section.subsection.key

(where the subsection may be contain arbitrary data, or may
be missing). For matching keys without subsections, it is
simple enough to call "strcmp". Matching keys with
subsections is a little more complicated, and each callback
does it in an ad-hoc way, usually involving error-prone
pointer arithmetic.

Let's provide a helper that keeps the pointer arithmetic all
in one place.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge git://ozlabs.org/~paulus/gitkJunio C Hamano Wed, 23 Jan 2013 16:35:03 +0000 (08:35 -0800)

Merge git://ozlabs.org/~paulus/gitk

* git://ozlabs.org/~paulus/gitk:
gitk: Display important heads even when there are many
gitk: Improve display of list of nearby tags and heads
gitk: Fix display of branch names on some commits
gitk: Update Swedish translation (296t)
gitk: When searching, only highlight files when in Patch mode
gitk: Fix error message when clicking on a connecting line
gitk: Fix crash when not using themed widgets
gitk: Use bindshiftfunctionkey to bind Shift-F5
gitk: Refactor code for binding modified function keys
gitk: Work around empty back and forward images when buttons are disabled
gitk: Highlight first search result immediately on incremental search
gitk: Highlight current search hit in orange
gitk: Synchronize highlighting in file view when scrolling diff

Merge branch 'jc/merge-blobs'Junio C Hamano Tue, 22 Jan 2013 18:48:20 +0000 (10:48 -0800)

Merge branch 'jc/merge-blobs'

* jc/merge-blobs:
Makefile: Replace merge-file.h with merge-blobs.h in LIB_H

Makefile: Replace merge-file.h with merge-blobs.h in... Ramsay Jones Tue, 22 Jan 2013 16:47:47 +0000 (16:47 +0000)

Makefile: Replace merge-file.h with merge-blobs.h in LIB_H

Commit fa2364ec ("Which merge_file() function do you mean?", 06-12-2012)
renamed the files merge-file.[ch] to merge-blobs.[ch], but forgot to
rename the header file in the definition of the LIB_H macro.

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

Update draft release notes to 1.8.2Junio C Hamano Tue, 22 Jan 2013 18:01:05 +0000 (10:01 -0800)

Update draft release notes to 1.8.2

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

Merge branch 'mz/reset-misc'Junio C Hamano Tue, 22 Jan 2013 17:36:13 +0000 (09:36 -0800)

Merge branch 'mz/reset-misc'

Various 'reset' optimizations and clean-ups, followed by a change
to allow "git reset" to work even on an unborn branch.

* mz/reset-misc:
reset: update documentation to require only tree-ish with paths
reset [--mixed]: use diff-based reset whether or not pathspec was given
reset: allow reset on unborn branch
reset $sha1 $pathspec: require $sha1 only to be treeish
reset.c: inline update_index_refresh()
reset.c: finish entire cmd_reset() whether or not pathspec is given
reset [--mixed]: only write index file once
reset.c: move lock, write and commit out of update_index_refresh()
reset.c: move update_index_refresh() call out of read_from_tree()
reset.c: replace switch by if-else
reset: avoid redundant error message
reset --keep: only write index file once
reset.c: share call to die_if_unmerged_cache()
reset.c: extract function for updating {ORIG_,}HEAD
reset.c: remove unnecessary variable 'i'
reset.c: extract function for parsing arguments
reset: don't allow "git reset -- $pathspec" in bare repo
reset.c: pass pathspec around instead of (prefix, argv) pair
reset $pathspec: exit with code 0 if successful
reset $pathspec: no need to discard index

Merge branch 'nd/fix-directory-attrs-off-by-one'Junio C Hamano Tue, 22 Jan 2013 17:34:28 +0000 (09:34 -0800)

Merge branch 'nd/fix-directory-attrs-off-by-one'

Fix performance regression introduced by an earlier change to let
attributes apply to directories.

Needs to be merged to maint, as 94bc671a was merged there already.

* nd/fix-directory-attrs-off-by-one:
attr: avoid calling find_basename() twice per path
attr: fix off-by-one directory component length calculation

Enable minimal stat checkingRobin Rosenberg Tue, 22 Jan 2013 07:49:22 +0000 (08:49 +0100)

Enable minimal stat checking

Specifically the fields uid, gid, ctime, ino and dev are set to zero
by JGit. Other implementations, eg. Git in cygwin are allegedly also
somewhat incompatible with Git For Windows and on *nix platforms
the resolution of the timestamps may differ.

Any stat checking by git will then need to check content, which may
be very slow, particularly on Windows. Since mtime and size
is typically enough we should allow the user to tell git to avoid
checking these fields if they are set to zero in the index.

This change introduces a core.checkstat config option where the
the user can select to check all fields (default), or just size
and the whole second part of mtime (minimal).

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'pw/p4-branch-fixes'Junio C Hamano Tue, 22 Jan 2013 04:15:44 +0000 (20:15 -0800)

Merge branch 'pw/p4-branch-fixes'

Fix "git p4" around branch handling.

* pw/p4-branch-fixes:
git p4: fix submit when no master branch
git p4 test: keep P4CLIENT changes inside subshells
git p4: fix sync --branch when no master branch
git p4: fail gracefully on sync with no master branch
git p4: rearrange self.initialParent use
git p4: allow short ref names to --branch
git p4 doc: fix branch detection example
git p4: clone --branch should checkout master
git p4: verify expected refs in clone --bare test
git p4: create p4/HEAD on initial clone
git p4: inline listExistingP4GitBranches
git p4: add comments to p4BranchesInGit
git p4: rearrange and simplify hasOrigin handling
git p4: test sync/clone --branch behavior

Merge branch 'mh/remote-hg-mode-bits-fix'Junio C Hamano Tue, 22 Jan 2013 04:15:40 +0000 (20:15 -0800)

Merge branch 'mh/remote-hg-mode-bits-fix'

Update to the Hg remote helper (in contrib/).

* mh/remote-hg-mode-bits-fix:
remote-hg: fix handling of file perms when pushing

Merge branch 'fc/remote-hg-fixup-url'Junio C Hamano Tue, 22 Jan 2013 04:15:32 +0000 (20:15 -0800)

Merge branch 'fc/remote-hg-fixup-url'

Update to the Hg remote helper (in contrib/).

* fc/remote-hg-fixup-url:
remote-hg: store converted URL

Merge branch 'zk/clean-report-failure'Junio C Hamano Tue, 22 Jan 2013 04:15:24 +0000 (20:15 -0800)

Merge branch 'zk/clean-report-failure'

"git clean" states what it is going to remove and then goes on to
remove it, but sometimes it only discovers things that cannot be
removed after recursing into a directory, which makes the output
confusing and even wrong.

* zk/clean-report-failure:
git-clean: Display more accurate delete messages

Merge branch 'ph/rebase-preserve-all-merges'Junio C Hamano Tue, 22 Jan 2013 04:15:15 +0000 (20:15 -0800)

Merge branch 'ph/rebase-preserve-all-merges'

An earlier change to add --keep-empty option broke "git rebase
--preserve-merges" and lost merge commits that end up being the
same as its parent.

* ph/rebase-preserve-all-merges:
rebase --preserve-merges: keep all merge commits including empty ones

Merge branch 'nd/clone-no-separate-git-dir-with-bare'Junio C Hamano Tue, 22 Jan 2013 04:15:07 +0000 (20:15 -0800)

Merge branch 'nd/clone-no-separate-git-dir-with-bare'

Forbid a useless combination of options to "git clone".

* nd/clone-no-separate-git-dir-with-bare:
clone: forbid --bare --separate-git-dir <dir>

Merge branch 'maint'Junio C Hamano Tue, 22 Jan 2013 01:16:16 +0000 (17:16 -0800)

Merge branch 'maint'

* maint:
git-for-each-ref.txt: 'raw' is a supported date format

t0050: Use TAB for indentationTorsten Bögershausen Mon, 21 Jan 2013 16:46:31 +0000 (17:46 +0100)

t0050: Use TAB for indentation

Use one TAB for indentation and remove empty lines

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0050: honor CASE_INSENSITIVE_FS in add (with different... Torsten Bögershausen Mon, 21 Jan 2013 16:46:15 +0000 (17:46 +0100)

t0050: honor CASE_INSENSITIVE_FS in add (with different case)

The test case "add (with different case)" indicates a
known breakage when run on a case insensitive file system.

The test is invalid for case sensitive file system, it will always fail.

Check the precondition CASE_INSENSITIVE_FS before running it.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0050: known breakage vanished in merge (case change)Torsten Bögershausen Mon, 21 Jan 2013 16:45:43 +0000 (17:45 +0100)

t0050: known breakage vanished in merge (case change)

This test case has passed since this commit:

commit 0047dd2fd1fc1980913901c5fa098357482c2842
Author: Steffen Prohaska <prohaska@zib.de>
Date: Thu May 15 07:19:54 2008 +0200

t0050: Fix merge test on case sensitive file systems

Remove the known breakage by using test_expect_success

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: avoid accepting ambiguous revisionNguyễn Thái Ngọc Duy Mon, 21 Jan 2013 13:00:49 +0000 (20:00 +0700)

grep: avoid accepting ambiguous revision

Unlike other commands that take both revs and pathspecs without "--"
disamiguators only when the boundary is clear, "git grep" treated
what can be interpreted as a rev as-is, without making sure that it
could also have meant a pathspec. E.g.

$ git grep -e foo master

when 'master' is in the working tree, should have triggered an
ambiguity error, but it didn't, and searched in the tree of the
commit named by 'master'.

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

Update :/abc ambiguity checkNguyễn Thái Ngọc Duy Mon, 21 Jan 2013 13:00:48 +0000 (20:00 +0700)

Update :/abc ambiguity check

:/abc may mean two things:

- as a revision, it means the revision that has "abc" in commit
message.

- as a pathpec, it means "abc" from root.

Currently we see ":/abc" as a rev (most of the time), but never see it
as a pathspec even if "abc" exists and "git log :/abc" will gladly
take ":/abc" as rev even it's ambiguous. This patch makes it:

- ambiguous when "abc" exists on worktree
- a rev if abc does not exist on worktree
- a path if abc is not found in any commits (although better use
"--" to avoid ambiguation because searching through commit DAG is
expensive)

A plus from this patch is, because ":/" never matches anything as a
rev, it is never considered a valid rev and because root directory
always exists, ":/" is always unambiguously seen as a pathspec.

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

git-for-each-ref.txt: 'raw' is a supported date formatJohn Keeping Mon, 21 Jan 2013 16:22:06 +0000 (16:22 +0000)

git-for-each-ref.txt: 'raw' is a supported date format

Commit 7dff9b3 (Support 'raw' date format) added a raw date format.
Update the git-for-each-ref documentation to include this.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 1.8.2Junio C Hamano Mon, 21 Jan 2013 01:28:13 +0000 (17:28 -0800)

Update draft release notes to 1.8.2

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

Merge branch 'maint'Junio C Hamano Mon, 21 Jan 2013 01:27:27 +0000 (17:27 -0800)

Merge branch 'maint'

Start preparing for 1.8.1.2Junio C Hamano Mon, 21 Jan 2013 01:26:04 +0000 (17:26 -0800)

Start preparing for 1.8.1.2

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

Merge branch 'nz/send-email-headers-are-case-insensitiv... Junio C Hamano Mon, 21 Jan 2013 01:22:49 +0000 (17:22 -0800)

Merge branch 'nz/send-email-headers-are-case-insensitive' into maint

When users spell "cc:" in lowercase in the fake "header" in the
trailer part, "git send-email" failed to pick up the addresses from
there. As e-mail headers field names are case insensitive, this
script should follow suit and treat "cc:" and "Cc:" the same way.

* nz/send-email-headers-are-case-insensitive:
git-send-email: treat field names as case-insensitively

Merge branch 'rs/zip-with-uncompressed-size-in-the... Junio C Hamano Mon, 21 Jan 2013 01:22:27 +0000 (17:22 -0800)

Merge branch 'rs/zip-with-uncompressed-size-in-the-header' into maint

"git archive" did not record uncompressed size in the header when
streaming a zip archive, which confused some implementations of
unzip.

* rs/zip-with-uncompressed-size-in-the-header:
archive-zip: write uncompressed size into header even with streaming

Merge branch 'rs/zip-tests' into maintJunio C Hamano Mon, 21 Jan 2013 01:22:22 +0000 (17:22 -0800)

Merge branch 'rs/zip-tests' into maint

* rs/zip-tests:
t5003: check if unzip supports symlinks
t5000, t5003: move ZIP tests into their own script
t0024, t5000: use test_lazy_prereq for UNZIP
t0024, t5000: clear variable UNZIP, use GIT_UNZIP instead

Merge git://git.bogomips.org/git-svnJunio C Hamano Mon, 21 Jan 2013 01:08:46 +0000 (17:08 -0800)

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

* git://git.bogomips.org/git-svn:
git-svn: do not escape certain characters in paths

Merge branch 'rt/commit-cleanup-config'Junio C Hamano Mon, 21 Jan 2013 01:07:04 +0000 (17:07 -0800)

Merge branch 'rt/commit-cleanup-config'

Add a configuration variable to set default clean-up mode other
than "strip".

* rt/commit-cleanup-config:
commit: make default of "cleanup" option configurable

Merge branch 'ap/log-mailmap'Junio C Hamano Mon, 21 Jan 2013 01:06:52 +0000 (17:06 -0800)

Merge branch 'ap/log-mailmap'

Teach commands in the "log" family to optionally pay attention to
the mailmap.

* ap/log-mailmap:
log --use-mailmap: optimize for cases without --author/--committer search
log: add log.mailmap configuration option
log: grep author/committer using mailmap
test: add test for --use-mailmap option
log: add --use-mailmap option
pretty: use mailmap to display username and email
mailmap: add mailmap structure to rev_info and pp
mailmap: simplify map_user() interface
mailmap: remove email copy and length limitation
Use split_ident_line to parse author and committer
string-list: allow case-insensitive string list

git_remote_helpers: fix input when running under Python 3John Keeping Sun, 20 Jan 2013 13:15:32 +0000 (13:15 +0000)

git_remote_helpers: fix input when running under Python 3

Although 2to3 will fix most issues in Python 2 code to make it run under
Python 3, it does not handle the new strict separation between byte
strings and unicode strings. There is one instance in
git_remote_helpers where we are caught by this, which is when reading
refs from "git for-each-ref".

Fix this by operating on the returned string as a byte string rather
than a unicode string. As this method is currently only used internally
by the class this does not affect code anywhere else.

Note that we cannot use byte strings in the source as the 'b' prefix is
not supported before Python 2.7 so in order to maintain compatibility
with the maximum range of Python versions we use an explicit call to
encode().

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git_remote_helpers: allow building with Python 3John Keeping Sun, 20 Jan 2013 13:15:31 +0000 (13:15 +0000)

git_remote_helpers: allow building with Python 3

Change inline Python to call "print" as a function not a statement.

This is harmless because Python 2 will see the parentheses as redundant
grouping but they are necessary to run this code with Python 3.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-svn: do not escape certain characters in pathsPeter Wu Thu, 17 Jan 2013 22:07:31 +0000 (23:07 +0100)

git-svn: do not escape certain characters in paths

Subversion 1.7 and newer implement HTTPv2, an extension that should make HTTP
more efficient. Servers with support for this protocol will make the subversion
client library take an alternative code path that checks (with assertions)
whether the URL is "canonical" or not.

This patch fixes an issue I encountered while trying to `git svn dcommit` a
rename action for a file containing a single quote character ("User's Manual"
to "UserMan.tex"). It does not happen for older subversion 1.6 servers nor
non-HTTP(S) protocols such as the native svn protocol, only on an Apache server
shipping SVN 1.7. Trying to `git svn dcommit` under the aforementioned
conditions yields the following error which aborts the commit process:

Committing to http://example.com/svn ...
perl: subversion/libsvn_subr/dirent_uri.c:1520: uri_skip_ancestor:
Assertion `svn_uri_is_canonical(child_uri, ((void *)0))' failed.
error: git-svn died of signal 6

An analysis of the subversion source for the cause:

- The assertion originates from uri_skip_ancestor which calls
svn_uri_is_canonical, which fails when the URL contains percent-encoded values
that do not necessarily have to be encoded (not "canonical" enough). This is
done by a table lookup in libsvn_subr/path.c. Putting some debugging prints
revealed that the character ' is indeed encoded to %27 which is not
considered canonical.
- url_skip_ancestor is called by svn_ra_neon__get_baseline_info with the root
repository URL and path as parameters;
- which is called by copy_resource (libsvn_ra_neon/commit.c) for a copy action
(or in my case, renaming which is actually copy + delete old);
- which is called by commit_add_dir;
- which is assigned as a structure method "add_file" in
svn_ra_neon__get_commit_editor.

In the whole path, the path argument is not modified.

Through some more uninteresting wrapper functions, the Perl bindings gives you
access to the add_file method which will pass the path argument without
modifications to svn.

git-svn calls the "R"(ename) subroutine in Git::SVN::Editor which contains:
326 my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
327 $self->url_path($m->{file_a}), $self->{r});
"repo_path" basically returns the path as-is, unless the "svn.pathnameencoding"
configuration property is set. "url_path" tries to escape some special
characters, but does not take all special characters into account, thereby
causing the path to contain some escaped characters which do not have to be
escaped.

The list of characters not to be escaped are taken from the
subversion/libsvn_subr/path.c file to fully account for all characters. Tested
with a filename containing all characters in the range 0x20 to 0x78 (inclusive).

Signed-off-by: Peter Wu <lekensteyn@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>

help: include <common-cmds.h> only in one fileJunio C Hamano Sat, 19 Jan 2013 06:35:04 +0000 (22:35 -0800)

help: include <common-cmds.h> only in one file

This header not only declares but also defines the contents of the
array that holds the list of command names and help text. Do not
include it in multiple places to waste text space.

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

Merge git://bogomips.org/git-svnJunio C Hamano Fri, 18 Jan 2013 20:40:28 +0000 (12:40 -0800)

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

* git://bogomips.org/git-svn:
git-svn: teach find-rev to find near matches
git svn: do not overescape URLs (fallback case)
Git::SVN::Editor::T: pass $deletions to ->A and ->D

am: invoke perl's strftime in C localeDmitry V. Levin Mon, 14 Jan 2013 20:59:33 +0000 (00:59 +0400)

am: invoke perl's strftime in C locale

We used to convert timestamps in metadata comment of Hg patch to
mbox-looking Date: field using strftime, without making sure the
resulting string is not translated. Always use C locale for this.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-completion.bash: replace zsh notation that breaks... Brandon Casey Fri, 18 Jan 2013 19:24:01 +0000 (11:24 -0800)

git-completion.bash: replace zsh notation that breaks bash 3.X

When commit d8b45314 began separating the zsh completion from the bash
completion, it introduced a zsh completion "bridge" section into the bash
completion script for zsh users to use until they migrated to the zsh
script. The zsh '+=()' append-to-array notation prevents bash 3.00.15 on
CentOS 4.x from loading the completion script and breaks test 9902. We can
easily work around this by using standard Bash array notation.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 1.8.2Junio C Hamano Fri, 18 Jan 2013 19:26:11 +0000 (11:26 -0800)

Update draft release notes to 1.8.2

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

Merge branch 'ss/help-htmlpath-config-doc'Junio C Hamano Fri, 18 Jan 2013 19:20:20 +0000 (11:20 -0800)

Merge branch 'ss/help-htmlpath-config-doc'

Add missing doc.

* ss/help-htmlpath-config-doc:
config.txt: Document help.htmlpath config parameter

Merge branch 'nd/fix-perf-parameters-in-tests'Junio C Hamano Fri, 18 Jan 2013 19:20:15 +0000 (11:20 -0800)

Merge branch 'nd/fix-perf-parameters-in-tests'

Allow GIT_PERF_* environment variables to be passed through the
test framework.

* nd/fix-perf-parameters-in-tests:
test-lib.sh: unfilter GIT_PERF_*

Merge branch 'nd/attr-debug-fix'Junio C Hamano Fri, 18 Jan 2013 19:20:11 +0000 (11:20 -0800)

Merge branch 'nd/attr-debug-fix'

Fix debugging support that was broken in earlier change.

* nd/attr-debug-fix:
attr: make it build with DEBUG_ATTR again

Merge branch 'rs/pretty-use-prefixcmp'Junio C Hamano Fri, 18 Jan 2013 19:20:08 +0000 (11:20 -0800)

Merge branch 'rs/pretty-use-prefixcmp'

* rs/pretty-use-prefixcmp:
pretty: use prefixcmp instead of memcmp on NUL-terminated strings

Merge branch 'ds/completion-silence-in-tree-path-probe'Junio C Hamano Fri, 18 Jan 2013 19:20:03 +0000 (11:20 -0800)

Merge branch 'ds/completion-silence-in-tree-path-probe'

An internal ls-tree call made by completion code only to probe if
a path exists in the tree recorded in a commit object leaked error
messages when the path is not there. It is not an error at all and
should not be shown to the end user.

* ds/completion-silence-in-tree-path-probe:
git-completion.bash: silence "not a valid object" errors

Merge branch 'jn/maint-trim-vim-contrib'Junio C Hamano Fri, 18 Jan 2013 19:19:39 +0000 (11:19 -0800)

Merge branch 'jn/maint-trim-vim-contrib'

Remove instructions for old vim support, which is better described
in the upstream vim documentation.

* jn/maint-trim-vim-contrib:
contrib/vim: simplify instructions for old vim support

Merge branch 'pe/doc-email-env-is-trumped-by-config'Junio C Hamano Fri, 18 Jan 2013 19:19:33 +0000 (11:19 -0800)

Merge branch 'pe/doc-email-env-is-trumped-by-config'

In the precedence order, the environment variable $EMAIL comes
between the built-in default (i.e. taking value by asking the
system's gethostname() etc.) and the user.email configuration
variable; the documentation implied that it is stronger than the
configuration like $GIT_COMMITTER_EMAIL is, which is wrong.

* pe/doc-email-env-is-trumped-by-config:
git-commit-tree(1): correct description of defaults

Merge branch 'mk/complete-tcsh'Junio C Hamano Fri, 18 Jan 2013 19:19:28 +0000 (11:19 -0800)

Merge branch 'mk/complete-tcsh'

Update tcsh command line completion so that an unwanted space is
not added to a single directory name.

* mk/complete-tcsh:
Prevent space after directories in tcsh completion

Add sample pre-push hook scriptAaron Schrab Sun, 13 Jan 2013 05:17:04 +0000 (00:17 -0500)

Add sample pre-push hook script

Create a sample of a script for a pre-push hook. The main purpose is to
illustrate how a script may parse the information which is supplied to
such a hook. The script may also be useful to some people as-is for
avoiding to push commits which are marked as a work in progress.

Signed-off-by: Aaron Schrab <aaron@schrab.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

push: Add support for pre-push hooksAaron Schrab Sun, 13 Jan 2013 05:17:03 +0000 (00:17 -0500)

push: Add support for pre-push hooks

Add support for a pre-push hook which can be used to determine if the
set of refs to be pushed is suitable for the target repository. The
hook is run with two arguments specifying the name and location of the
destination repository.

Information about what is to be pushed is provided by sending lines of
the following form to the hook's standard input:

<local ref> SP <local sha1> SP <remote ref> SP <remote sha1> LF

If the hook exits with a non-zero status, the push will be aborted.

This will allow the script to determine if the push is acceptable based
on the target repository and branch(es), the commits which are to be
pushed, and even the source branches in some cases.

Signed-off-by: Aaron Schrab <aaron@schrab.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-svn: teach find-rev to find near matchesJohn Keeping Thu, 17 Jan 2013 22:19:33 +0000 (22:19 +0000)

git-svn: teach find-rev to find near matches

When a single SVN repository is split into multiple Git repositories
many SVN revisions will exist in only one of the Git repositories
created. For some projects the only way to build a working artifact is
to check out corresponding versions of various repositories, with no
indication of what those are in the Git world - in the SVN world the
revision numbers are sufficient.

By adding "--before" to "git-svn find-rev" we can say "tell me what this
repository looked like when that other repository looked like this":

git svn find-rev --before \
r$(git --git-dir=/over/there.git svn find-rev HEAD)

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Eric Wong <normalperson@yhbt.net>

git svn: do not overescape URLs (fallback case)Jonathan Nieder Sun, 14 Oct 2012 11:45:21 +0000 (04:45 -0700)

git svn: do not overescape URLs (fallback case)

Subversion's canonical URLs are intended to make URL comparison easy
and therefore have strict rules about what characters are special
enough to urlencode and what characters should be left alone.

When in the fallback codepath because unable to use libsvn's own
canonicalization function for some reason, escape special characters
in URIs according to the svn_uri__char_validity[] table in
subversion/libsvn_subr/path.c (r935829). The libsvn versions that
trigger this code path are not likely to be strict enough to care, but
it's nicer to be consistent.

Noticed by using SVN 1.6.17 perl bindings, which do not provide
SVN::_Core::svn_uri_canonicalize (triggering the fallback code),
with libsvn 1.7.5, whose do_switch is fussy enough to care:

Committing to file:///home/jrn/src/git/t/trash%20directory.\
t9118-git-svn-funky-branch-names/svnrepo/pr%20ject/branches\
/more%20fun%20plugin%21 ...
svn: E235000: In file '[...]/subversion/libsvn_subr/dirent_uri.c' \
line 2291: assertion failed (svn_uri_is_canonical(url, pool))
error: git-svn died of signal 6
not ok - 3 test dcommit to funky branch

After this change, the '!' in 'more%20fun%20plugin!' is not urlencoded
and t9118 passes again.

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

Git::SVN::Editor::T: pass $deletions to ->A and ->DJonathan Nieder Wed, 10 Oct 2012 21:02:18 +0000 (14:02 -0700)

Git::SVN::Editor::T: pass $deletions to ->A and ->D

This shouldn't make a difference because the $deletions hash is
only used when adding a directory (see 379862ec, 2012-02-20) but
it's nice to be consistent to make reading smoother anyway. No
functional change intended.

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