Git::SVN{,::Ra}: canonicalize earlier

This canonicalizes paths and urls as early as possible so we don't
have to remember to do it at the point of use.  It will fix a swath
of SVN 1.7 problems in one go.

Its ok to double canonicalize things.

SVN 1.7 still fails, still not worrying about that.

[ew: commit title]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
t9118: workaround inconsistency between SVN versions

SVN 1.7 will truncate "not-a%40{0}" to just "not-a".

Rather than guess what SVN is going to do for each version, make the test use
the branch name that was actually created.

[ew: commit title]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
t9107: fix typo

Test to check that the migration got rid of the old style git-svn directory.
It wasn't failing, just throwing a message to STDERR.

[ew: commit title]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn: attempt to mimic SVN 1.7 URL canonicalization

Previously, our URL canonicalization didn't do much of anything.
Now it actually escapes and collapses slashes.  This is mostly a cut & paste
of escape_url from git-svn.

This is closer to how SVN 1.7's canonicalization behaves.  Doing it with
1.6 lets us chase down some problems caused by more effective canonicalization
without having to deal with all the other 1.7 issues on top of that.

* Remote URLs have to be canonicalized otherwise Git::SVN->find_existing_remote
  will think they're different.

* The SVN remote is now written to the git config canonicalized.  That
  should be ok.  Adjust a test to account for that.

[ew: commit title]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn: replace URL escapes with canonicalization

The old hand-rolled URL escape functions were inferior to
canonicalization functions.

Continuing to move towards getting everything canonicalizing the same way.

* Git::SVN->init_remote_config and Git::SVN::Ra->minimize_url both
  have to canonicalize the same way else init_remote_config
  will incorrectly think they're different URLs causing
  t9107-git-svn-migrate.sh to fail.

[ew: commit title]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn: canonicalize earlier

Just a few things I noticed.  Its good to canonicalize as early as
possible.

[ew: commit title]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn: introduce add_path_to_url function

Remove the ad-hoc versions.

This is mostly to normalize the process and ensure the URLs produced
don't have double slashes or anything.

Also provides a place to fix the corner case where a file path
contains a percent sign.

[ew: commit title]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn: canonicalize newly-minted URLs

Go through all the spots that use the new add_path_to_url() to
make a new URL and canonicalize them.

* copyfrom_path has to be canonicalized else find_parent_branch
  will get confused

* due to the `canonicalize_url($full_url) ne $full_url)` line of
  logic in gs_do_switch(), $full_url is left alone until after.

At this point SVN 1.7 passes except for 3 tests in
t9100-git-svn-basic.sh that look like an SVN bug to do with
symlinks.

[ew: commit title]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn: remove ad-hoc canonicalizations

[ew: commit title]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
l10n: vi.po update to follow POT in 3b613

* Translated 76 new messages

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
setup: clarify error messages for file/revisions ambiguity

The previous "Use '--' to separate filenames from revisions" may sound
obvious for an old-time Unix user, but does not make it clear how to use
this '--'. In addition to mentionning this '--', give an idea of what the
new command should look like.

Ideally, we could provide cut-and-paste ready commands based on the
command that just failed, but we have no easy access to argv[] in this
place of the code.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-remote-mediawiki: replace TODO-list in comment by appropriate link

My account on Github is now used as wiki and issue tracking. This will be
more flexible than in-tree management of a TODO-list.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
grep: add a grep.patternType configuration setting

The grep.extendedRegexp configuration setting enables the -E flag on grep
by default but there are no equivalents for the -G, -F and -P flags.

Rather than adding an additional setting for grep.fooRegexp for current
and future pattern matching options, add a grep.patternType setting that
can accept appropriate values for modifying the default grep pattern
matching behavior. The current values are "basic", "extended", "fixed",
"perl" and "default" for setting -G, -E, -F, -P and the default behavior
respectively.

When grep.patternType is set to a value other than "default", the
grep.extendedRegexp setting is ignored. The value of "default" restores
the current default behavior, including the grep.extendedRegexp
behavior.

Signed-off-by: J Smith <dark.panda@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff_setup_done(): return void

diff_setup_done() has historically returned an error code, but lost
the last nonzero return in 943d5b7 (allow diff.renamelimit to be set
regardless of -M/-C, 2006-08-09).  The callers were in a pretty
confused state: some actually checked for the return code, and some
did not.

Let it return void, and patch all callers to take this into account.
This conveniently also gets rid of a handful of different(!) error
messages that could never be triggered anyway.

Note that the function can still die().

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-recursive: eliminate flush_buffer() in favor of write_in_full()

flush_buffer() is a thin wrapper around write_in_full() with two very
confusing properties:

* It runs a loop to handle short reads, ensuring that we write
  everything.  But that is precisely what write_in_full() does!

* It checks for a return value of 0 from write_in_full(), which cannot
  happen: it returns this value only if count=0, but flush_buffer()
  will never call write_in_full() in this case.

Remove it.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
include agent identifier in capability string

Instead of having the client advertise a particular version
number in the git protocol, we have managed extensions and
backwards compatibility by having clients and servers
advertise capabilities that they support. This is far more
robust than having each side consult a table of
known versions, and provides sufficient information for the
protocol interaction to complete.

However, it does not allow servers to keep statistics on
which client versions are being used. This information is
not necessary to complete the network request (the
capabilities provide enough information for that), but it
may be helpful to conduct a general survey of client
versions in use.

We already send the client version in the user-agent header
for http requests; adding it here allows us to gather
similar statistics for non-http requests.

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

Check if GIT_TRACE env var is set and unset it if it is.

If the environment var GIT_TRACE=1 exists gitk will fail when trying
to find gitdir:
$ git rev-parse --git-dir
trace: built-in: git 'rev-parse' '--git-dir'
.git

Other git commands will also show debug output hence not work as
intended.

Signed-off-by: Aske Olsson <askeolsson@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
tests: Introduce test_seq

Jeff King wrote:

	The seq command is GNU-ism, and is missing at least in older BSD
	releases and their derivatives, not to mention antique
	commercial Unixes.

	We already purged it in b3431bc (Don't use seq in tests, not
	everyone has it, 2007-05-02), but a few new instances have crept
	in. They went unnoticed because they are in scripts that are not
	run by default.

Replace them with test_seq that is implemented with a Perl snippet
(proposed by Jeff).  This is better than inlining this snippet
everywhere it's needed because it's easier to read and it's easier
to change the implementation (e.g. to C) if we ever decide to remove
Perl from the test suite.

Note that test_seq is not a complete replacement for seq(1).  It
just has what we need now, in addition that it makes it possible for
us to do something like "test_seq a m" if we wanted to in the
future.

There are also many places that do `for i in 1 2 3 ...` but I'm not sure
if it's worth converting them to test_seq.  That would introduce running
more processes of Perl.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
l10n: zh_CN.po: translate 76 new messages

Translate 76 new messages came from git.pot update in 3b6137f
(l10n: Update git.pot (76 new, 4 removed messages))

Thynson reviewed this update and also contributed other improvements:

 * blob -> 二进制对象（blob）
 * 共用 -> 同时使用

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Reviewed-by: Thynson <lanxingcan@gmail.com>
merge-recursive: separate message for common ancestors

The function "merge_recursive" prints the count of common ancestors
as "found %u common ancestor(s):".  We should use a singular and a
plural form of this message to help translators.

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