1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-01 23:07:55 +01:00
Commit graph

573 commits

Author SHA1 Message Date
Junio C Hamano
e834fa0d5c Merge branch 'jk/maint-gitweb-test-use-sane-perl'
When using a Perl script on a system where "perl" found on user's $PATH
could be ancient or otherwise broken, we allow builders to specify the
path to a good copy of Perl with $PERL_PATH.  The gitweb test forgot to
use that Perl when running its test.

By Jeff King (1) and Zbigniew Jędrzejewski-Szmek (1)
* jk/maint-gitweb-test-use-sane-perl:
  Consistently use perl from /usr/bin/ for scripts
  t/gitweb-lib: use $PERL_PATH to run gitweb
2012-05-02 13:53:40 -07:00
Junio C Hamano
f760c903b8 git-svn: introduce SVN version comparison function
With double-digit version components in SVN::Core::VERSION,
a naive string comparison is no longer sufficient and
a numeric comparison is required for correct results.

This fixes a regression introduced in
commit 082afee621
("git-svn: use platform specific auth providers")
where SVN version "1.6.6" was incorrectly assumed to
be newer than the required "1.6.12" version.

[mk: fix namespace references]
[ew: commit message]

Tested-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-02 20:11:18 +00:00
Zbigniew Jędrzejewski-Szmek
0754e089c1 Consistently use perl from /usr/bin/ for scripts
While the majority of scripts use '#!/usr/bin/perl', some use
'#!/usr/bin/env perl'. In the end there is no difference, because the
Makefile rewrites "#!.*perl" with "#!$PERL_PATH" in scripted
Porcelains before installing. Nevertheless, the second form can be
misleading, because it suggests that perl found first in $PATH will be
used.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-01 13:32:17 -07:00
Matthijs Kooijman
082afee621 git-svn: use platform specific auth providers
On Linux, this makes authentication using passwords from gnome-keyring
and kwallet work (only the former was tested). On Mac OS X, this allows
using the OS X Keychain.

Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Eric Wong <normalperson@yhbt.net>
2012-04-27 08:28:54 +00:00
Roman Kagan
8c3a534c50 git-svn: drop redundant blocking of SIGPIPE
Now that SIGPIPE is ignored there's no point blocking it.

Signed-off-by: Roman Kagan <rkagan@mail.ru>
Acked-by: Eric Wong <normalperson@yhbt.net>
2012-04-24 09:42:08 +00:00
Roman Kagan
6ade9bdada git-svn: ignore SIGPIPE
In HTTP with keep-alive it's not uncommon for the client to notice that
the server decided to stop maintaining the current connection only when
sending a new request.  This naturally results in -EPIPE and possibly
SIGPIPE.

The subversion library itself makes no provision for SIGPIPE.  Some
combinations of the underlying libraries do (typically SIG_IGN-ing it),
some don't.

Presumably for that reason all subversion commands set SIGPIPE to
SIG_IGN early in their main()-s.

So should we.

This, together with the previous patch, fixes the notorious "git-svn
died of signal 13" problem (see e.g.
http://thread.gmane.org/gmane.comp.version-control.git/134936).

Signed-off-by: Roman Kagan <rkagan@mail.ru>
Acked-by: Eric Wong <normalperson@yhbt.net>
2012-04-24 09:42:08 +00:00
Roman Kagan
037a98cd3f git-svn: use POSIX::sigprocmask to block signals
In order to maintain consistency of the database mapping svn revision
numbers to git commit ids, rev_map_set() defers signal processing until
it's finished with an append transaction.[*]

The conventional way to achieve this is through sigprocmask(), which is
available in perl in the standard POSIX module.

This is implemented by this patch.  One important consequence of it is
that the signal handlers won't be unconditionally set to SIG_DFL anymore
upon the first invocation of rev_map_set() as they used to.  As a
result, the signals ignored by git-svn parent will remain ignored;
otherwise the behavior remains the same.

This patch paves the way to ignoring SIGPIPE throughout git-svn which
will be done in the followup patch.

[*] Deferring signals is not enough to ensure the database consistency:
the program may die on SIGKILL or power loss, run out of disk space,
etc.  However that's a separate issue that this patch doesn't address.

Signed-off-by: Roman Kagan <rkagan@mail.ru>
Acked-by: Eric Wong <normalperson@yhbt.net>
2012-04-24 09:42:08 +00:00
Steven Walter
379862ec5a git-svn.perl: fix a false-positive in the "already exists" test
open_or_add_dir checks to see if the directory already exists or not.
If it already exists and is not a directory, then we fail.  However,
open_or_add_dir did not previously account for the possibility that the
path did exist as a file, but is deleted in the current commit.

In order to prevent this legitimate case from failing, open_or_add_dir
needs to know what files are deleted in the current commit.
Unfortunately that information has to be plumbed through a couple of
layers.

Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2012-02-21 21:37:31 +00:00
Steven Walter
5ec514bd2f git-svn.perl: perform deletions before anything else
If we delete a file and recreate it as a directory in a single commit,
we have to tell the server about the deletion first or else we'll get
"RA layer request failed: Server sent unexpected return value (405
Method Not Allowed) in response to MKCOL request"

Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2012-02-21 21:37:31 +00:00
Wei-Yin Chen (陳威尹)
6aa17fc69b git-svn: Fix time zone in --localtime
Use numerical form of time zone to replace alphabetic time zone
abbreviation generated by "%Z". "%Z" is not portable and contain
ambiguity for many areas. For example, CST could be "Central
Standard Time" (GMT-0600) and "China Standard Time" (GMT+0800).
Alphabetic time zone abbreviation is meant for human readability,
not for specifying a time zone for machines.

Failed case can be illustrated like this in linux shell:
  > echo $TZ
  Asia/Taipei
  > date +%Z
  CST
  > env TZ=`date +%Z` date
  Mon Dec 19 06:03:04 CST 2011
  > date
  Mon Dec 19 14:03:04 CST 2011

[ew: fixed bad package reference inside Git::SVN::Log]

Signed-off-by: Wei-Yin Chen (陳威尹) <chen.weiyin@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2012-02-21 21:37:31 +00:00
Ævar Arnfjörð Bjarmason
83cf21f985 git-svn: un-break "git svn rebase" when log.abbrevCommit=true
Change git-svn to use git-rev-list(1) instead of git-log(1) since the
latter is porcelain that'll cause "git svn rebase" to fail completely
if log.abbrevCommit is set to true in the configuration.

Without this patch the code will fail to parse a SHA1, and then just
spew a bunch of "Use of uninitialized value $hash in string eq"
warnings at "if ($c && $c eq $hash) { ..." and never do anything
useful.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2012-02-21 21:37:31 +00:00
Ævar Arnfjörð Bjarmason
b380e3a792 git-svn: remove redundant porcelain option to rev-list
Change an invocation of git-rev-list(1) to not use --no-color,
git-rev-list(1) will always ignore that option and the --color option,
so there's no need to pass it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2012-02-21 21:37:31 +00:00
Steven Walter
93ccbba6ee git-svn.perl: close the edit for propedits even with no mods
It's legitimate to update the mergeinfo property without
actually changing any files.  This can happen when changes are
backported to a branch, and then that branch is merged back
into mainline.  We still want to record the updated mergeinfo
for book-keeping.

Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2011-12-01 14:25:30 -08:00
Ted Percival
0e7e30f560 svn: Quote repository root in regex match
Fixes a problem matching repository URLs, especially those with a '+' in
the URL, such as svn+ssh:// URLs. Parts of the URL were interpreted as
special characters by the regex matching.

Signed-off-by: Ted Percival <ted.percival@quest.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2011-11-01 20:05:33 +00:00
Junio C Hamano
578183bcb0 Merge branch 'pt/mingw-misc-fixes'
* pt/mingw-misc-fixes:
  t9901: fix line-ending dependency on windows
  mingw: ensure sockets are initialized before calling gethostname
  mergetools: use the correct tool for Beyond Compare 3 on Windows
  t9300: do not run --cat-blob-fd related tests on MinGW
  git-svn: On MSYS, escape and quote SVN_SSH also if set by the user
  t9001: do not fail only due to CR/LF issues
  t1020: disable the pwd test on MinGW
2011-10-18 21:59:11 -07:00
Michael Olson
cdb51a13c3 git-svn: Allow certain refs to be ignored
Implement a new --ignore-refs option which specifies a regex of refs
to ignore while importing svn history.

This is a useful supplement to the --ignore-paths option, as that
option only operates on the contents of branches and tags, not the
branches and tags themselves.

Signed-off-by: Michael Olson <mwolson@gnu.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
2011-10-16 08:22:27 +00:00
Frédéric Heitzmann
afd7f1eb0f git svn dcommit: new option --interactive.
Allow the user to check the patch set before it is commited to SVN. It is
then possible to accept/discard one patch, accept all, or quit.

This interactive mode is similar with 'git send email' behaviour. However,
'git svn dcommit' returns as soon as one patch is discarded.
Part of the code was taken from git-send-email.perl (see 'ask' function)

Tests several combinations of potential answers to
'git svn dcommit --interactive'. For each of them, test whether patches
were commited to SVN or not.

Thanks-to Eric Wong <normalperson@yhbt.net> for the initial idea.

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Frédéric Heitzmann <frederic.heitzmann@gmail.com>
2011-10-16 08:12:26 +00:00
Sebastian Schuberth
184892fb3e git-svn: On MSYS, escape and quote SVN_SSH also if set by the user
While GIT_SSH does not require any escaping / quoting (e.g. for paths
containing spaces), SVN_SSH requires it due to its use in a Perl script.

Previously, SVN_SSH has only been escaped and quoted automatically if it
was unset and thus derived from GIT_SSH. For user convenience, do the
escaping and quoting also for a SVN_SSH set by the user. This way, the
user is able to use the same unescaped and unquoted syntax for GIT_SSH
and SVN_SSH.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-14 22:38:15 -07:00
Clemens Buchacher
87182b17ed use -h for synopsis and --help for manpage consistently
A few scripted Porcelain implementations pretend as if the routine to show
their own help messages are triggered upon "git cmd --help", but a command
line parser of "git" will hijack such a request and shows the manpage for
the cmd subcommand.

Leaving the code to handle such input is simply misleading.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05 10:47:10 -07:00
Bryan Jacobs
1e5814f3de git-svn: teach git-svn to populate svn:mergeinfo
Allow git-svn to populate the svn:mergeinfo property automatically in
a narrow range of circumstances. Specifically, when dcommitting a
revision with multiple parents, all but (potentially) the first of
which have been committed to SVN in the same repository as the target
of the dcommit.

In this case, the merge info is the union of that given by each of the
parents, plus all changes introduced to the first parent by the other
parents.

In all other cases where a revision to be committed has multiple
parents, cause "git svn dcommit" to raise an error rather than
completing the commit and potentially losing history information in
the upstream SVN repository.

This behavior is disabled by default, and can be enabled by setting
the svn.pushmergeinfo config option.

[ew: minor style changes and manpage merge fix]

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Bryan Jacobs <bjacobs@woti.com>
2011-09-13 08:12:13 +00:00
Bryan Jacobs
98c4ab32f8 git-svn: Teach dcommit --mergeinfo to handle multiple lines
"svn dcommit --mergeinfo" replaces the svn:mergeinfo property in an
upstream SVN repository with the given text. The svn:mergeinfo
property may contain commits originating on multiple branches,
separated by newlines.

Cause space characters in the mergeinfo to be replaced by newlines,
allowing a user to create history representing multiple branches being
merged into one.

Update the corresponding documentation and add a test for the new
functionality.

Signed-off-by: Bryan Jacobs <bjacobs@woti.com>
Acked-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2011-09-01 19:55:09 +00:00
Eric Wong
85f022e9c1 git-svn: fix fetch with moved path when using rewriteRoot
The matching step in commit 3235b7053c
did not properly account for users of the "rewriteRoot"
configuration parameter.

ref: <CANWsHyfHtr0EaJtNsDK9UTcmb_AbLg-1jUA-0uWJ-nEeNosb7w@mail.gmail.com>

Suggested-by: H Krishnan <hetchkay@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2011-09-01 07:10:22 +00:00
Ray Chen
40a1530c07 git-svn: New flag to emulate empty directories
Adds a --preserve-empty-dirs flag to the clone operation that will detect
empty directories in the remote Subversion repository and create placeholder
files in the corresponding local Git directories.  This allows "empty"
directories to exist in the history of a Git repository.

Also adds the --placeholder-file flag to control the name of any placeholder
files created.  Default value is ".gitignore".

Signed-off-by: Ray Chen <rchen@cs.umd.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
2011-09-01 07:10:22 +00:00
Michael Haggerty
124b70a2ad git-svn: Correctly handle root commits in mergeinfo ranges
If the bottom of a mergeinfo range is a commit that maps to a git root
commit, then it doesn't have a parent.  In such a case, use git commit
range "$top_commit" rather than "$bottom_commit^..$top_commit".

[ew: line-wrap at 80 columns]

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
2011-06-28 03:26:11 +00:00
Michael Haggerty
eabd73a3b5 git-svn: Disambiguate rev-list arguments to improve error message
Add "--" in the "git rev-list" command line so that if there is a bug
and the revisions cannot be found, the error message is a bit less
cryptic.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
2011-06-28 03:26:08 +00:00
Junio C Hamano
391b14278e Merge branch 'maint'
* maint:
  git-svn: Fix git svn log --show-commit
2011-05-20 18:50:29 -07:00
Michael J Gruber
9963e025e8 git-svn: Fix git svn log --show-commit
git svn log --show-commit had no tests and, consequently, no attention
by the author of

b1b4755 (git-log: put space after commit mark, 2011-03-10)

who kept git svn log working only without --show-commit.

Introduce a test and fix it.

Reported-by: Bernt Hansen <bernt@norang.ca>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-20 09:30:09 -07:00
Junio C Hamano
698a9ab3f1 Merge branch 'mh/git-svn-automkdirs'
* mh/git-svn-automkdirs:
  git-svn: add an option to skip the creation of empty directories
2011-04-27 11:36:41 -07:00
James Y Knight
f5549afd5d git-svn: Cache results of running the executable "git config"
Running programs is not cheap!

Signed-off-by: James Y Knight <jknight@itasoftware.com>
Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
2011-04-09 22:43:35 +00:00
Alejandro R. Sedeño
12a296bca3 git-svn: Add a svn-remote.<name>.pushurl config key
Similar to the 'remote.<name>.pushurl' config key for git remotes,
'pushurl' is designed to be used in cases where 'url' points to an SVN
repository via a read-only transport, to provide an alternate
read/write transport. It is assumed that both keys point to the same
repository.

The 'pushurl' key is distinct from the 'commiturl' key in that
'commiturl' is a full svn path while 'pushurl' (like 'url') is a base
path. 'commiturl' takes precendece over 'pushurl' in cases where
either might be used.

The 'pushurl' is used by git-svn's dcommit and branch commands.

Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
Reviewed-by: James Y Knight <jknight@itasoftware.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2011-04-09 22:43:35 +00:00
Michael Haggerty
55f9d7a75c git-svn: add an option to skip the creation of empty directories
"git svn mkdirs" (which creates empty directories in the current
working copy) can be very slow and is often unnecessary.  Provide a
config file option "svn-remote.<name>.automkdirs" that prevents empty
directories from being created automatically.  (They are still created
if "git svn mkdirs" is invoked explicitly.)

Based-on-patch-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-01 12:53:18 -07:00
Michael J Gruber
b1b47554ae git-log: put space after commit mark
Currently, commit marks (left, right, boundary, cherry) are output right
before the commit sha1, which makes it difficult to copy sha1s. Sample
output for "git log --oneline --cherry":

=049c269 t6007: test rev-list --cherry

Change this to

= 049c269 t6007: test rev-list --cherry

which matches exactly the current output of "git log --graph".

Leave "git rev-list" output as is (no space) so that they do not break.

Adjust "git-svn" which uses "git log --pretty=raw --boundary".

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-10 21:55:29 -08:00
Steven Walter
6abd9332f9 git-svn: allow the mergeinfo property to be set
As a first step towards preserving merges across dcommit, we need a
mechanism to update the svn:mergeinfo property.

[ew: fixed bashism and style issues in test case]

Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-12-10 04:09:48 +08:00
Junio C Hamano
9b73ce74e6 Merge branch 'ab/require-perl-5.8'
* ab/require-perl-5.8:
  perl: use "use warnings" instead of -w
  perl: bump the required Perl version to 5.8 from 5.6.[21]
2010-10-26 21:57:31 -07:00
Ævar Arnfjörð Bjarmason
d48b284183 perl: bump the required Perl version to 5.8 from 5.6.[21]
Formalize our dependency on perl 5.8, bumped from 5.6.[12]. We already
used the three-arg form of open() which was introduced in 5.6.1, but
t/t9700/test.pl explicitly depended on 5.6.2.

However git-add--interactive.pl has been failing on the 5.6 line since
it was introduced in v1.5.0-rc0~12^2~2 back in 2006 due to this open
syntax:

    sub run_cmd_pipe {
           my $fh = undef;
           open($fh, '-|', @_) or die;
           return <$fh>;
    }

Which when executed dies on "Can't use an undefined value as
filehandle reference". Several of our tests also fail on 5.6 (even
more when compiled with NO_PERL_MAKEMAKER=1):

    t2016-checkout-patch.sh
    t3904-stash-patch.sh
    t3701-add-interactive.sh
    t7105-reset-patch.sh
    t7501-commit.sh
    t9700-perl-git.sh

Our code is bitrotting on 5.6 with no-one interested in fixing it, and
pinning us to such an ancient release of Perl is keeping us from using
useful features introduced in the 5.8 release.

The 5.6 series is now over 10 years old, and the 5.6.2 maintenance
release almost 7. 5.8 on the other hand is more than 8 years old.

All the modern Unix-like operating systems have now upgraded to it or
a later version, and 5.8 packages are available for old IRIX, AIX
Solaris and Tru64 systems.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Tor Arntsen <tor@spacetec.no>
Acked-by: Randal L. Schwartz <merlyn@stonehenge.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27 12:37:41 -07:00
Mathias Lafeldt
8565a568cd git-svn: fix processing of decorated commit hashes
The function working_head_info() fails to parse commit hashes if they
are decorated (i.e. log.decorate is true), causing dcommit, rebase, and
other vital git-svn commands to malfunction.

This patch disables decorated log output with --no-decorate.

[ew: wrapped long line]

Signed-off-by: Mathias Lafeldt <misfire@debugon.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-09-24 16:24:20 +00:00
Steven Walter
a3c75056dc git-svn: check_cherry_pick should exclude commits already in our history
The merge-base between @$parents and $merge_tip may have been reached
through a merge commit.  This means that some commits that are ancestors
of @$parents will not be ancestors of $merge_base.  The mergeinfo
property will not list commits that are ancestors of @$parents, so we
need to explicitly exclude them.

[ew: squashed and cleaned up test case from Steven]

Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-09-24 08:23:53 +00:00
David D. Kilzer
3235b7053c git-svn: fix fetch with deleted tag
Currently git-svn assumes that two tags created from the same
revision will have the same repo url, so it uses a ref to the
tag without checking that its url matches the current url.

This causes issues when fetching an svn repo where a tag was
created, deleted, and then recreated under the following
circumstances:

- Both tags were copied from the same revision.
- Both tags had the same name.
- Both tags had different repository paths.
- [Optional] Both tags have a file with the same name but
  different content.

When all four conditions are met, a checksum mismatch error
occurs because the content of two files with the same path
differs (see t/t9155--git-svn-fetch-deleted-tag.sh):

    Checksum mismatch: ChangeLog 065854....
    expected: ce771b....
         got: 9563fd....

When only the first three conditions are met, no error occurs
but the tag in git matches the first (deleted) tag instead of
the last (most recent) tag (see
t/t9156-git-svn-fetch-deleted-tag-2.sh).

The fix is to verify that the repo url for the ref matches the
current url.  If the urls do not match, then a "tail" is grown
on the tag name by appending a dash and rechecking the new ref's
repo url until either a matching repo url is found or a new tag
is created.

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-08-15 23:43:37 +00:00
David D. Kilzer
54fb7f9b08 git-svn: fix regex to remove "tail" from svn tags
Fix a regular expression used to remove the revision from the
end of an svn tag or branch name.  The regex did not account for
any "tail" (dashes) that may have been added to the end of the
tag name (which first appeared in v1.4.1-rc2~11).  If not fixed,
tags with names like "tags/mytag@5--@2" may be created.

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-08-15 23:43:35 +00:00
Steven Walter
46cb16fb59 git svn: URL-decode left-hand side of svn refspec
This change allows git-svn to handle an URL with colons in the path

[ew: rewritten to use uri_decode() function]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2010-08-05 06:33:23 +00:00
David D. Kilzer
181264ad59 git svn: fix dcommit to work with touched files
The dcommit command fails if an otherwise unmodified file has
been touched in the working directory:

    Cannot dcommit with a dirty index.  Commit your changes
    first, or stash them with `git stash'.

This happens because "git diff-index" reports a difference
between the index and the filesystem:

    :100644 100644 d00491...... 000000...... M      file

The fix is to run "git update-index --refresh" before
"git diff-index" as is done in git-rebase and
git-rebase--interactive before "git diff-files".

This changes dcommit to display a list of modified files before
exiting.

Also add a similar test case for "git svn rebase".

[ew: rearranged commit message subject]

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-08-02 21:21:56 +00:00
Dmitry Statyvka
3713e2226b git svn: add an option to recode pathnames
Introduce a new option 'svn.pathnameencoding' that instructs git svn to
recode pathnames to a given encoding.  It can be used by windows users
and by those who work in non-utf8 locales to avoid corrupted file names
with non-ascii characters.

[rp: renamed the option and added manpage documentation]

Signed-off-by: Dmitry Statyvka <dstatyvka@tmsoft-ltd.kiev.ua>
Signed-off-by: Robert Pollak <robert.pollak@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-07-30 07:49:21 +00:00
Sergey Vlasov
8ac3a66702 git-svn: write memoized data explicitly to avoid Storable bug
Apparently using the Storable module during global destruction is
unsafe - there is a bug which can cause segmentation faults:

  http://rt.cpan.org/Public/Bug/Display.html?id=36087
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482355

The persistent memoization support introduced in commit 8bff7c538
relied on global destruction to write cached data, which was leading
to segfaults in some Perl configurations.  Calling Memoize::unmemoize
in the END block forces the cache writeout to be performed earlier,
thus avoiding the bug.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-07-19 06:31:04 +00:00
Eric Wong
b1a954a37c git svn: avoid unnecessary '/' in paths for SVN
svn:// servers are more picky regarding redundant slashes
than file:// and http(s)://-backed respositories.  Since
the last commit, we avoid putting unnecessary slashes in
$GIT_CONFIG, but this doesn't help users who are already
set up that way.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2010-06-14 04:49:22 +00:00
Jonathan Nieder
b4b3360078 git-svn: strip off leading slashes on --trunk argument
The following command

 git svn clone \
	-r9500:10006 \
	svn://svn.debian.org/svn/pkg-games/packages \
	--trunk=/trunk/freedoom \
	--branches=/branches/freedoom \
	--tags=/tags/freedoom \
	freedoom.git.2009091

produces strange results:

With v1.6.3.3 (and perhaps earlier versions), this would fetch up to
and including r9978 (the last revision of the no_iwad_alternatives
branch before it was deleted), check it out, and prematurely declare
success, leaving out some commits to the trunk (r9984, r9985, r10006)
from after the branch was merged.

With v1.6.5-rc0~74 (svn: allow branches outside of refs/remotes,
2009-08-11) and later, this fetches up to and including r9978 and then
attempts a post-fetch checkout and fails.

 r9978 = 25f0920175c395f0f22f54ae7a2318147f745274
 (refs/remotes/no_iwad_alternatives)
 fatal: refs/remotes/trunk: not a valid SHA1
 update-ref refs/heads/master refs/remotes/trunk: command returned error: 128

Checking .git/config reveals

 fetch = packages//trunk/freedoom:refs/remotes/trunk

And with both 1.6.3.3 and 1.7.1, using --trunk=trunk/freedom without
the leading slash (/) works fine.

Moral: git-svn needs to scrub an initial / from $_trunk and related
arguments it receives.  Make it so.

Reported-by: Jon Dowland <jmtd@debian.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-06-14 04:44:02 +00:00
Michael J. Kiwala
7c42e390a3 git svn: fix empty directory creation
Avoid attempts to stat() the contents of '', which could happen
when the root directory is empty.  Additionally, remove the
unnecessary '_' stat optimization since it was confusing and
possibly throwing off the non-existent case.

[ew: fixed indentation, rewrote commit message]

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Michael J. Kiwala <mkiwala@genome.wustl.edu>
2010-06-03 20:51:41 +00:00
Torsten Schmutzler
73d419558d git-svn: mangle refnames forbidden in git
git-check-ref-format(1) describes names which
cannot be used as refnames for git.  Some are
legal branchnames in subversion however.
Mangle the not yet handled cases.

Signed-off-by: Torsten Schmutzler <git-ts@theblacksun.eu>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-05-09 01:25:19 -07:00
Ævar Arnfjörð Bjarmason
1174768b46 git-svn: Remove unused use of File::Temp
The use line was added in ffe256f9. File::Temp calls were later moved
to Git.pm in 0b19138b, but that commit neglected to remove the
now-redundant import.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-05-09 01:25:19 -07:00
Jonathan Nieder
70ee0b7797 git svn: avoid uninitialized var in 'reset'
When "git svn reset" is called with an invalid revision, we
bail out and show the user a proper error message instead
of giving them a cryptic one related to git-svn internals.

ref: http://bugs.debian.org/578908
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Reported-by: Jens Seidel <jensseidel@users.sf.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-05-09 01:22:31 -07:00
Junio C Hamano
2e5b98d906 Merge branch 'fl/askpass'
* fl/askpass:
  git-core: Support retrieving passwords with GIT_ASKPASS
  git-svn: Support retrieving passwords with GIT_ASKPASS
2010-03-20 11:29:35 -07:00
Tuomas Suutari
bf60fff8f1 git-svn: Fix merge detecting with rewrite-root
Detecting of merges from svn:mergeinfo or svk merge tickets failed
with rewrite-root option. This fixes it.

Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-03-13 01:16:17 -08:00
Michael J Gruber
b0779246a1 git-svn: make git svn --version work again
by requesting SVN::Core which is needed for the svn version.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-03-05 03:02:51 -08:00
Erik Faye-Lund
942c9aad4f Revert "git-svn: always initialize with core.autocrlf=false"
git-svn rebase used to have issues with CRLF conversion. Since these issues
have been fixed, we can safely revert the work-around that disables CRLF
conversion.

This reverts commit d3c9634eac.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-03-05 02:58:11 -08:00
Michael J Gruber
b91a8a3ee1 git-svn: req_svn when needed
The delayed loading of SVN missed a place where SVN::Core is used. Make
sure to load the package before trying to use it.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-03-04 01:45:15 -08:00
Frank Li
56a853b62c git-svn: Support retrieving passwords with GIT_ASKPASS
git-svn reads passwords from an interactive terminal.
This behavior cause GUIs to hang waiting for git-svn to
complete

Fix this problem by allowing a password-retrieving command
to be specified in GIT_ASKPASS. SSH_ASKPASS is supported
as a fallback when GIT_ASKPASS is not provided.

Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-02 12:52:51 -08:00
Junio C Hamano
52ebb06f14 Merge branch 'jn/maint-fix-pager'
* jn/maint-fix-pager:
  tests: Fix race condition in t7006-pager
  t7006-pager: if stdout is not a terminal, make a new one
  tests: Add tests for automatic use of pager
  am: Fix launching of pager
  git svn: Fix launching of pager
  git.1: Clarify the behavior of the --paginate option
  Make 'git var GIT_PAGER' always print the configured pager
  Fix 'git var' usage synopsis
2010-03-02 12:44:11 -08:00
josh robb
d32fad2b89 git svn: delay importing SVN::Base until it is needed
Importing functions from a .dll into Git for Windows' perl is pretty slow,
so let's avoid importing if it is not necessary.

This seems particularly slow in virtualized enviroments. Before this
change (on my machine):

$ time perl /libexec/git-core/git-svn rebase
Current branch master is up to date.

real 2m56.750s
user 0m3.129s
sys 2m39.232s

Afterwards:

$ time perl /libexec/git-core/git-svn rebase
Current branch master is up to date.

real 0m33.407s
user 0m1.409s
sys 0m23.054s

git svn rebase -n goes from 3m7.046s to 0m10.312s.

Signed-off-by: Josh Robb <josh_robb@fastmail.fm>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-02-26 01:33:56 -08:00
Tuomas Suutari
6a2009e7f3 git-svn: Fix discarding of extra parents from svn:mergeinfo
If parent J is an ancestor of parent I, then parent J should be
discarded, not I.

Note that J is an ancestor of I if and only if rev-list I..J is emtpy,
which is what we are testing here.

Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-02-26 01:30:23 -08:00
Jonathan Nieder
190c1cda7e git svn: Fix launching of pager
In commit dec543e (am -i, git-svn: use "git var GIT_PAGER"), I tried
to teach git svn to defer to git var on what pager to use. In the
process, I introduced two bugs:

 - The value set for $pager in config_pager has local scope, so
   run_pager never sees it;

 - git var cannot tell whether git svn’s output is going to a
   terminal, so the value chosen for $pager does not reflect that
   information.

Fix them.

Reported-by: Sebastian Celis <sebastian@sebastiancelis.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-14 18:23:17 -08:00
Andrew Myrick
8bff7c5383 git-svn: persistent memoization
Make memoization of the svn:mergeinfo processing functions persistent with
Memoize::Storable so that the memoization tables don't need to be regenerated
every time the user runs git-svn fetch.

The Memoize::Storable hashes are stored in ENV{GIT_DIR}/svn/.caches.

[ew: changed caches path to avoid conflicts with old repos]
[ew: File::Path::{make_path => mkpath} for compatibility]
[ew: line-wrapped at 80 chars]

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Andrew Myrick <amyrick@apple.com>
2010-02-04 23:33:25 -08:00
Sebastian Schuberth
a004fb923d If deriving SVN_SSH from GIT_SSH on msys, also add quotes
In contrast to GIT_SSH, SVN_SSH requires quotes for paths that contain
spaces. As GIT_SSH will not work if it contains quotes, it is safe to
assume it never contains quotes. Also, adding quotes to SVN_SSH for paths
that do not contain spaces does no harm. So we always add quotes when
deriving SVN_SSH from GIT_SSH on msys.

This fixes msysGit issue 385, see
http://code.google.com/p/msysgit/issues/detail?id=385

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-29 19:37:54 -08:00
Jay Soffian
075762085c git-svn: allow subset of branches/tags to be specified in glob spec
For very large projects it is useful to be able to clone a subset of the
upstream SVN repo's branches. Allow for this by letting the left-side of
the branches and tags glob specs contain a brace-delineated comma-separated
list of names. e.g.:

	branches = branches/{red,green}/src:refs/remotes/branches/*

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-01-23 03:23:04 -08:00
Jay Soffian
3e18ce1ac3 git-svn: allow UUID to be manually remapped via rewriteUUID
In certain situations it may be necessary to manually remap an svn
repostitory UUID. For example:

                  o--- [git-svn clone]
                 /
[origin svn repo]
                 \
                  o--- [svnsync clone]

Imagine that only "git-svn clone" and "svnsync clone" are made available
to external users. Furthur, "git-svn clone" contains only trunk, and for
reasons unknown, "svnsync clone" is missing the revision properties that
normally provide the origin svn repo's UUID.

A git user who has cloned the "git-svn clone" repo now wishes to use
git-svn to pull in the missing branches from the "synsync clone" repo.
In order for git-svn to get the history correct for those branches,
it needs to know the origin svn repo's UUID. Hence rewriteUUID.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-01-23 03:23:04 -08:00
Igor Mironov
6594f0b793 git-svn: add --username/commit-url options for branch/tag
Add ability to specify on the command line the username to perform the
operation as and the writable URL of the repository to perform it on.

[ew: shortened subject]

Signed-off-by: Igor Mironov <igor.a.mironov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-01-23 03:23:04 -08:00
Igor Mironov
99bacd6c25 git-svn: respect commiturl option for branch/tag
When constructing a destination URL, use the property 'commiturl' if it
is specified in the configuration file; otherwise take 'url' as usual.
This accommodates the scenario where a user only wants to involve the
writable repository in operations performing a commit and defaults
everything else to a read-only URL.

[ew: shortened subject]

Signed-off-by: Igor Mironov <igor.a.mironov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-01-23 03:23:03 -08:00
Igor Mironov
a83b91e724 git-svn: fix mismatched src/dst errors for branch/tag
This fixes the following issue:

$ git svn branch -t --username=svnuser \
  --commit-url=https://myproj.domain.com/svn mytag
Copying http://myproj.domain.com/svn/trunk at r26 to
https://myproj.domain.com/svn/tags/mytag...

Trying to use an unsupported feature: Source and dest appear not to be
in the same repository (src: 'http://myproj.domain.com/svn/trunk';
dst: 'https://myproj.domain.com/svn/tags/mytag')

[ew: shortened subject]

Signed-off-by: Igor Mironov <igor.a.mironov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-01-23 03:23:03 -08:00
Andrew Myrick
41c01693ac git-svn: handle merge-base failures
Change git-svn to warn and continue when merge-base fails while processing svn
merge tickets.

merge-base can fail when a partial branch is created and merged back to trunk
in svn, because it cannot find a common ancestor between the partial branch and
trunk.

Signed-off-by: Andrew Myrick <amyrick@apple.com>
Acked-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-01-23 03:23:03 -08:00
Andrew Myrick
1cef6500a9 git-svn: ignore changeless commits when checking for a cherry-pick
Update git-svn to ignore commits that do not change the tree when it is
deciding if an svn merge ticket represents a real branch merge or just a
cherry-pick.

Consider the following integration model in the svn repository:

   F---G  branch1
  /     \
 D  tag1 \   E  tag2
/         \ /
A---B      C  trunk

branch1 is merged to trunk in commit C.

With this patch, git-svn will correctly identify branch1 as a proper merge
parent, instead of incorrectly ignoring it as a cherry-pick.

Signed-off-by: Andrew Myrick <amyrick@apple.com>
Acked-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-01-23 03:23:03 -08:00
Eric Wong
150d38c4f3 git svn: branch/tag commands detect username in URLs
svn+ssh:// repositories often have userinfo embedded in the URL
which were stripped out of the "git-svn-id:" trailers.  Since
the SVN::Client::copy function takes userinfo into account when
matching URLs for SVN repositories, we need to retrieve the full
URL with embedded userinfo in it to avoid mismatched URLs.

Tested-by: Florian Köberle <florian@fkoeberle.de>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-12-23 11:58:05 -08:00
Eric Wong
0fe19753f2 git svn: lookup new parents correctly from svn:mergeinfo
This appears to be a trivial case where array indices were being
passed to git rev-list, instead of the contents stored in the
array itself.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-12-22 12:15:40 -08:00
Andrew Myrick
063681d72e git-svn: Remove obsolete MAXPARENT check
Change git-svn not to impose a limit of 16 parents on a merge.

This limit in git-svn artificially prevents cloning svn repositories
that contain commits with more than 16 merge parents.

The limit was removed from builtin-commit-tree.c for git v1.6.0 in commit
ef98c5cafb, so there is no need to check for it
it in git-svn.

Signed-off-by: Andrew Myrick <amyrick@apple.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-12-21 14:33:50 -08:00
Sam Vilain
7a955a5365 git-svn: detect cherry-picks correctly.
The old function was incorrect; in some instances it marks a cherry picked
range as a merged branch (because of an incorrect assumption that
'rev-list COMMIT --not RANGE' would work).  This is replaced with a
function which should detect them correctly, memoized to limit the expense
of dealing with branches with many cherry picks to one 'merge-base' call
per merge, per branch which used cherry picking.

Signed-off-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-12-21 02:32:53 -08:00
Sam Vilain
ea020cbd6a git-svn: exclude already merged tips using one rev-list call
The old function would have to check all mentioned merge tips, every time
that the mergeinfo ticket changed.  This involved 1-2 rev-list operation
for each listed mergeinfo line.  If there are a lot of feature branches
being merged into a trunk, this makes for a very expensive operation for
detecting the new parents on every merge.

This new version first uses a single 'rev-list' to figure out which commit
ranges are already reachable from the parents.  This is used to eliminate
the already merged branches from the list.

Signed-off-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-12-21 02:32:52 -08:00
Sam Vilain
33973a5b17 git-svn: fix some mistakes with interpreting SVN mergeinfo commit ranges
SVN's list of commit ranges in mergeinfo tickets is inclusive, whereas
git commit ranges are exclusive on the left hand side.  Also, the end
points of the commit ranges may not exist; they simply delineate
ranges of commits which may or may not exist.  Fix these two mistakes.

Signed-off-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-12-21 02:32:50 -08:00
Sam Vilain
7d944c3399 git-svn: memoize conversion of SVN merge ticket info to git commit ranges
Each time the svn mergeinfo ticket changes, we look it up in the rev_map;
when there are a lot of merged branches, this will result in many repeated
lookups of the same information for subsequent commits.  Arrange the slow
part of the function so that it may be memoized, and memoize it.  The more
expensive revision walking operation can be memoized separately.

[ew: changed "next" to "return" for function exit]

Signed-off-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-12-21 02:32:48 -08:00
Eric Wong
577e9fcad2 git svn: fix --revision when fetching deleted paths
When using the -r/--revision argument to fetch deleted history,
calling SVN::Ra::get_log() from an SVN::Ra object initialized
to track the deleted URL will fail.

This regression was introduced in:
  commit 4aacaeb3dc
  "fix shallow clone when upstream revision is too new"

We now ignore errors from SVN::Ra::get_log() here because using
--revision will always override the value of $head here if
(and only if) we're tracking deleted directories.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-12-21 02:32:39 -08:00
Eric Wong
a5b80d9263 git svn: make empty directory creation gc-aware
The "git svn gc" command creates and appends to unhandled.log.gz
files which should be parsed before the uncompressed
unhandled.log files.

Reported-by: Robert Zeh
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-12-19 14:07:24 -08:00
Alex Vandiver
f584150966 git-svn: set svn.authorsfile earlier when cloning
If a clone errors out because of a missing author, or user interrupt,
this allows `git svn fetch` to resume seamlessly, rather than forcing
the user to re-provide the path to the authors file.

[ew: shortened subject]
Signed-off-by: Alex Vandiver <alex@chmrr.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-12-08 20:39:58 -08:00
Alex Vandiver
2bc35dcbf7 git-svn: Set svn.authorsfile to an absolute path when cloning
If --authors-file is passed a relative path, cloning will work, but
future `git svn fetch`es will fail to locate the authors file
correctly.  Thus, use File::Spec->rel2abs to determine an absolute
path for the authors file before setting it.

Signed-off-by: Alex Vandiver <alex@chmrr.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-12-08 20:38:39 -08:00
Eric Wong
f9ad77a739 git svn: log removals of empty directories
This also adds a test case for:
  "git svn: Don't create empty directories whose parents were deleted"
which was the reason we found this bug in the first place.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-12-07 20:49:44 -08:00
Greg Price
33f2a3108e git svn: Don't create empty directories whose parents were deleted
Commit 6111b93 "git svn: attempt to create empty dirs on clone+rebase"
will create empty directories 'a/b' and 'a/c' if they were previously
created in SVN, even if their parent directory 'a' was deleted.

For example, unhandled.log may contain lines like this:

r32
  +empty_dir: packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/acl
  +empty_dir: packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/machine.d
  +empty_dir: packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/moira-acl
[...]
r314
  -empty_dir: packages/sipb-xen-remctl-auto

[ew: rewrote to be line-wrapped at <= 80-columns]

Reported-by: Evan Broder <broder@mit.edu>
Signed-off-by: Greg Price <price@ksplice.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-12-07 20:47:08 -08:00
Alex Vandiver
e9e4c8b747 git-svn: sort svk merge tickets to account for minimal parents
When merging branches based on svk:merge properties, a single merge
can have updated or added multiple svk:merge lines.  Attempt to
include the minimal set of parents by sorting the merge properties in
order of revision, highest to lowest.

Signed-off-by: Alex Vandiver <alex@chmrr.net>
Acked-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-12-07 20:25:40 -08:00
Eric Wong
9be30eed61 git svn: strip leading path when making empty dirs
Since unhandled.log stores paths relative to the repository
root, we need to strip out leading path components if the
directories we're tracking are not the repository root.

Reported-by: Björn Steinbrink
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-11-22 18:15:42 -08:00
Eric Wong
4d0157d699 git svn: always reuse existing remotes on fetch
The internal no_reuse_existing flag is set to allow initializing
multiple remotes with the same URL, common with SVM users.

Unfortunately, this flag caused misbehavior when used
with the -R command-line flag for fetching.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-11-22 12:54:59 -08:00
Junio C Hamano
376f39fbea Merge branch 'jn/editor-pager'
* jn/editor-pager:
  Provide a build time default-pager setting
  Provide a build time default-editor setting
  am -i, git-svn: use "git var GIT_PAGER"
  add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR"
  Teach git var about GIT_PAGER
  Teach git var about GIT_EDITOR
  Suppress warnings from "git var -l"
  Do not use VISUAL editor on dumb terminals
  Handle more shell metacharacters in editor names
2009-11-20 23:48:52 -08:00
Eric Wong
6111b93499 git svn: attempt to create empty dirs on clone+rebase
We parse unhandled.log files for empty_dir statements and make a
best effort attempt to recreate empty directories on fresh
clones and rebase.  This should cover the majority of cases
where users work off a single branch or for projects where
branches do not differ in empty directories.

Since this cannot affect "normal" git commands like "checkout"
or "reset", so users switching between branches in a single
working directory should use the new "git svn mkdirs" command
after switching branches.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-11-15 19:30:06 -08:00
Eric Wong
1a30582b43 git svn: read global+system config for clone+init
Since $GIT_DIR does not exist when initializing new repositories,
we can follow back to the global and system config files for
git.

The logic for this was originally introduced when
$GIT_DIR/config was the only config file git could read (back
when "git config" was "git repo-config"), so the function is
renamed to "read_git_config" instead of "read_repo_config".

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-11-14 14:34:13 -08:00
Toby Allsopp
753dc384dc git svn: handle SVN merges from revisions past the tip of the branch
When recording the revisions that it has merged, SVN sets the top
revision to be the latest revision in the repository, which is not
necessarily a revision on the branch that is being merged from.  When
it is not on the branch, git-svn fails to add the extra parent to
represent the merge because it relies on finding the commit on the
branch that corresponds to the top of the SVN merge range.

In order to correctly handle this case, we look for the maximum
revision less than or equal to the top of the SVN merge range that is
actually on the branch being merged from.

[ew: This includes the following (squashed) commit to prevent
     errors during bisect:]

  Author: Toby Allsopp <toby.allsopp@navman.co.nz>
  Date:   Fri Nov 13 09:48:39 2009 +1300

    git-svn: add (failing) test for SVN 1.5+ merge with intervening commit

    This test exposes a bug in git-svn's handling of SVN 1.5+ mergeinfo
    properties.  The problematic case is when there is some commit on an
    unrelated branch after the last commit on the merged-from branch.
    When SVN records the mergeinfo property, it records the latest
    revision in the whole repository, which, in the problematic case, is
    not on the branch it is merging from.

    To trigger the git-svn bug, we modify t9151 to include two SVN merges,
    the second of which has an intervening commit.  The SVN dump was
    generated using SVN 1.6.6 (on Debian squeeze amd64).

Signed-off-by: Toby Allsopp <toby.allsopp@navman.co.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-11-14 13:37:59 -08:00
Jonathan Nieder
dec543e62d am -i, git-svn: use "git var GIT_PAGER"
Use the new "git var GIT_PAGER" command to ask what pager to use.

Without this change, the core.pager configuration is ignored by
these commands.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-13 12:20:52 -08:00
Jonathan Nieder
b4479f0747 add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR"
Use the new "git var GIT_EDITOR" feature to decide what editor to
use, instead of duplicating its logic elsewhere.  This should make
the behavior of commands in edge cases (e.g., editor names with
spaces) a little more consistent.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-13 12:20:50 -08:00
Sam Vilain
dff589ef94 git-svn: convert SVN 1.5+ / svnmerge.py svn:mergeinfo props to parents
This feature is long overdue; convert SVN's merge representation to git's
as revisions are imported.  This works by converting the list of revisions
in each line of the svn:mergeinfo into git revision ranges, and then
checking the latest of each of these revision ranges for A) being new and
B) now being completely merged.

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-10-26 23:54:24 -07:00
Sam Vilain
f1264bd654 git-svn: convert SVK merge tickets to extra parents
SVK is a simple case to start with, as its idea of merge parents
matches git's one.  When a svk:merge ticket is encountered, check each
of the listed merged revisions to see if they are in the history of
this commit; if not, then we have encountered a merge - record it.

[ew: minor formatting cleanups]

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-10-26 23:51:31 -07:00
Eric Wong
ffd5c8e457 git svn: fix fetch where glob is on the top-level URL
In cases where the top-level URL we're tracking is the path we
glob against, we can once again track odd repositories that keep
branches/tags at the top level.  This regression was introduced
in commit 6f5748e14c.

Thanks to Daniel Cordero for the original bug report and
bisection.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-10-26 23:43:23 -07:00
Simon Arlott
85886162f1 git-svn: hide find_parent_branch output in double quiet mode
Hide find_parent_branch logging when -qq is specified.
This eliminates more unnecessary output when run from cron, e.g.:

Found possible branch point:
http://undernet-ircu.svn.sourceforge.net/svnroot/undernet-ircu/ircu2/trunk =>
http://undernet-ircu.svn.sourceforge.net/svnroot/undernet-ircu/ircu2/branches/authz,
1919
Found branch parent: (authz) ea061d76aea985dc0208d36fa5e0b2249b698557
Following parent with do_switch
Successfully followed parent

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-10 00:00:40 -07:00
Alexander Gavrilov
c03c1f798d git-svn: Avoid spurious errors when rewriteRoot is used.
After doing a rebase, git-svn checks that the SVN URL
is what it expects. However, it does not account for
rewriteRoot, which is a legitimate way for the URL
to change. This produces a lot of spurious errors.

[ew: fixed line wrapping]

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-10-09 01:31:05 -07:00
Junio C Hamano
5b590d783a Merge branch 'maint'
* maint:
  GIT 1.6.4.3
  svn: properly escape arguments for authors-prog
  http.c: remove verification of remote packs
  grep: accept relative paths outside current working directory
  grep: fix exit status if external_grep() punts

Conflicts:
	GIT-VERSION-GEN
	RelNotes
2009-09-13 01:30:53 -07:00
Mark Lodato
d3d7d47e6e svn: properly escape arguments for authors-prog
Previously, the call to authors-prog was not properly escaped, so any
special characters in the Subversion username, such as spaces and
semi-colons, would be interpreted by the shell rather than being passed
in as the first argument.  Now all unsafe characters are escaped using
"git rev-parse --sq-quote"

[ew: switched from "\Q..\E" to "rev-parse --sq-quote"]

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 01:28:07 -07:00
Karthik R
f3a87d922a git-svn: Use GIT_SSH setting if SVN_SSH is not set
If SVN_SSH is defined, it will be used. Else value in
GIT_SSH is copied to SVN_SSH & then, only on Windows,
the \s are escaped.

On Windows, the shell-variables must be set as follows
    GIT_SSH="C:\Program Files\PuTTY\plink.exe"
    SVN_SSH="C:\\Program Files\\PuTTY\\plink.exe"

See http://code.google.com/p/msysgit/issues/detail?id=305

[ew: fixed indentation to use tabs]

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Karthik Rajagopalan <karthikr@fastmail.fm>
2009-08-18 20:51:32 -07:00
Eric Wong
5268f9edc3 svn: assume URLs from the command-line are URI-encoded
And then unescape them when writing to $GIT_CONFIG.

SVN has different rules for repository URLs (usually the root)
and for paths within that repository (below the HTTP layer).
Thus, for the request URI path at the HTTP level, the URI needs
to be encoded.  However, in the body of the HTTP request (the
with underlying SVN XML protocol), those paths should not be
URI-encoded[1].  For non-HTTP(S) requests, SVN appears to be
more flexible and will except weird characters in the URL as
well as URI-encoded ones.

Since users are used to using URLs being entirely URI-encoded,
git svn will now attempt to unescape the path portion of URLs
while leaving the actual repository URL untouched.

This change will be reflected in newly-created $GIT_CONFIG files
only.  This allows users to switch between svn(+ssh)://, file://
and http(s):// urls without changing the fetch/branches/tags
config keys.  This won't affect existing imports at all (since
things didn't work before this commit anyways), and will allow
users to force escaping into repository paths that look like
they're escaped (but are not).

Thanks to Mike Smullin for the original bug report and Björn
Steinbrink for summarizing it into testable cases for me.

[1] Except when committing copies/renames, see
    commit 29633bb91c

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-08-18 20:47:37 -07:00
Eric Wong
c83f4e6864 svn: (cleanup) use predefined constant for rev_map_fmt
This makes life easier in case we ever need to change the
internal format of the rev_maps.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-08-12 22:22:45 -07:00