Commit graph

313 commits

Author SHA1 Message Date
Avery Pennarun 328eb9b32f git-svn: don't append extra newlines at the end of commit messages.
In git, all commits end in exactly one newline character.  In svn, commits
end in zero or more newlines.  Thus, when importing commits from svn into
git, git-svn always appends two extra newlines to ensure that the
git-svn-id: line is separated from the main commit message by at least one
blank line.

Combined with the terminating newline that's always present in svn commits
produced by git, you usually end up with two blank lines instead of one
between the commit message and git-svn-id: line, which is undesirable.

Instead, let's remove all trailing whitespace from the git commit on the way
through to svn.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-14 11:47:55 -07:00
Christian Engwer b7166cce8c git-svn fails in prop_walk if $self->{path} is not empty
If url://repo/trunk is the current Git branch, prop_walk strips trunk
from the path name. That is useful as, for example "git svn show-ignore"
should not return results like

    trunk/foo

but

    foo

if svn:ignore for trunk includes foo.

The problem now is that prop_walk strips trunk from the path and then
calls itself recursively. But now trunk is missing in the path and
get_dir fails, because it is called for a non existing path.

The attached patch fixed the problem, by adding the previously stipped
$self->{path} in the recursive call. I tested it with my current
git-svn repository for the commands show-ignore and show-external.

Patch was submitted through
 http://bugs.debian.org/477393

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-01 14:29:50 -07:00
Seth Falcon 7d45e14683 Add a --dry-run option to git-svn rebase
When working with multiple branches in an svn repository, it can be
useful to verify the svn repository and local tracking branch that will
be used for the rebase operation.

Signed-off-by: Seth Falcon <seth@userprimary.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-01 14:29:50 -07:00
Karl Hasselström d72ab8c892 Fix path duplication in git svn commit-diff
Given an SVN repo file:///tmp/svntest/repo, trying to commit changes
to a file proj/trunk/foo.txt in that repo with this command line

  git svn commit-diff -r2 HEAD^ HEAD file:///tmp/svntest/repo/proj/trunk

gave the error message

  Filesystem has no item: File not found: transaction '2-6', path
  '/proj/trunk/proj/trunk/foo.txt'

This fixes the duplication.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-01 14:29:50 -07:00
Junio C Hamano d683a0e00c Git::cat_blob: allow using an empty blob to fix git-svn breakage
Recent "git-svn optimization" series introduced Git::cat_blob() subroutine
whose interface was broken in that it returned the size of the blob but
signalled an error by returning 0.  You can never use an empty blob with
such an interface.

This fixes the interface to return a negative value to signal an error.

Reported by Björn Steinbrink.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-27 23:35:55 -07:00
Junio C Hamano 29313449f7 Merge branch 'ar/batch-cat'
* ar/batch-cat:
  change quoting in test t1006-cat-file.sh
  builtin-cat-file.c: use parse_options()
  git-svn: Speed up fetch
  Git.pm: Add hash_and_insert_object and cat_blob
  Git.pm: Add command_bidi_pipe and command_close_bidi_pipe
  git-hash-object: Add --stdin-paths option
  Add more tests for git hash-object
  Move git-hash-object tests from t5303 to t1007
  git-cat-file: Add --batch option
  git-cat-file: Add --batch-check option
  git-cat-file: Make option parsing a little more flexible
  git-cat-file: Small refactor of cmd_cat_file
  Add tests for git cat-file
2008-05-25 13:38:06 -07:00
Junio C Hamano 834836bd3f Merge branch 'ap/svn'
* ap/svn:
  git-svn: add test for --add-author-from and --use-log-author
  git-svn: add documentation for --add-author-from option.
  git-svn: Add --add-author-from option.
  git-svn: add documentation for --use-log-author option.
2008-05-25 13:37:25 -07:00
Adam Roben ffe256f9ba git-svn: Speed up fetch
We were spending a lot of time forking/execing git-cat-file and
git-hash-object. We now maintain a global Git repository object in order to use
Git.pm's more efficient hash_and_insert_object and cat_blob methods.

Signed-off-by: Adam Roben <aroben@apple.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-23 12:07:05 -07:00
Steven Grimm 4be4038153 Add svn-compatible "blame" output format to git-svn
git-svn blame produced output in the format of git blame; in environments
where there are scripts that read the output of svn blame, it's useful
to be able to use them with the output of git-svn. The git-compatible
format is still available using the new "--git-format" option.

This also fixes a bug in the initial git-svn blame implementation; it was
bombing out on uncommitted local changes.

Signed-off-by: Steven Grimm <koreth@midwinter.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-11 10:12:19 -07:00
Eric Wong d1a8d0ea5f git-svn: fix cloning of HTTP URLs with '+' in their path
With this, git svn clone -s http://svn.gnome.org/svn/gtk+
is successful.

Also modified the funky rename test for this, which _does_
include escaped '+' signs for HTTP URLs.  SVN seems to accept
either "+" or "%2B" in filenames and directories (just not the
main URL), so I'll leave it alone for now.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-11 09:06:39 -07:00
Gustaf Hendeby c4c66b2669 git-svn: Make create-ignore use git add -f
When having a svn:ignore that ignores the .gitignore file the -f
option to git add must be used to avoid git complaining about adding
an ignored file and hence stop the process of creating .gitignores.

Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 16:54:16 -07:00
Avery Pennarun 6aa9ba14a0 git-svn: Add --add-author-from option.
This option adds a From: line (based on the commit's author information)
at the beginning of the body of the commit log message when sending to
svn, if a From: or Signed-off-by: header does not exist.

This, combined with --use-log-author, can retain the author field of commits
through a round trip from git to svn and back.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-04 17:42:29 -07:00
Stephen R. van den Berg abfa533dea git-svn: Same default as cvsimport when using --use-log-author
When using git-cvsimport, the author is inferred from the cvs commit,
e.g. cvs commit logname is foobaruser, then the author field in git
results in:

Author: foobaruser <foobaruser>

Which is not perfect, but perfectly acceptable given the circumstances.

The default git-svn import however, results in:

Author: foobaruser <foobaruser@acf43c95-373e-0410-b603-e72c3f656dc1>

When using mixes of imports, from CVS and SVN into the same git
repository, you'd like to harmonise the imports to the format cvsimport
uses.
git-svn supports an experimental option --use-log-author which currently
results in the same logentry as without that option when no From: or
Signed-off-by: is found in the logentry ($email currently ends up empty,
and hence is generated again).

This patches harmonises the result with cvsimport, and makes
git-svn --use-log-author produce:

Author: foobaruser <foobaruser>

Signed-off-by: Stephen R. van den Berg <srb@cuci.nl>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-30 23:02:41 -07:00
Matthieu Moy 59b0c24daa git-svn: detect and fail gracefully when dcommitting to a void
The command

  git svn clone (URL of an empty SVN repo here)

works, creates an empty git repository. I can perform the initial
commit there, but then, "git svn dcommit" says :

Use of uninitialized value in concatenation (.) or string at .../git-svn line 414.
Committing to  ...
Unable to determine upstream SVN information from HEAD history

I guess a correct management of the initial commit in git-svn would be
hard to implement, but at least, the error message can be improved.
First step is something like the patch below, and better would be for
"git svn clone" to warn that it won't be able to do much with the
cloned repo.

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-29 23:11:57 -07:00
Junio C Hamano d6958a1a32 Merge branch 'maint-1.5.4' into maint
* maint-1.5.4:
  svn-git: Use binmode for reading/writing binary rev maps
  diff options documentation: refer to --diff-filter in --name-status
  git-svn bug with blank commits and author file
  archive.c: format_subst - fixed bogus argument to memchr
  copy.c: copy_fd - correctly report write errors
  gitattributes: Fix subdirectory attributes specified from root directory
2008-04-22 23:37:06 -07:00
Michael Weber 4f7ec79708 svn-git: Use binmode for reading/writing binary rev maps
Otherwise, there is a possible interaction with UTF-8 locales in
combination with PERL_UNICODE, resulting in "inconsistent size: 40" or
"read:"-type errors.

See also:
    perldoc -f binmode
    <http://perldoc.perl.org/perl581delta.html#UTF-8-no-longer-default-under-UTF-8-locales>

Signed-off-by: Michael Weber <michaelw@foldr.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-22 21:43:58 -07:00
Thomas Guyot-Sionnest 9231f500c3 git-svn bug with blank commits and author file
When trying to import from svn using an author file, git-svn bails out
if it encounters a blank author. The attached patch changes this
behavior and allow using the author file with blanks authors.

I came across this bug while importing from a cvs2svn repo where the
initial revision (1) has a blank author. This doesn't break the behavior
of bailing out when an unknown author is encountered.

Acked-by: Eric Wong <normalperson@yhbt.net>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-22 21:39:10 -07:00
Pedro Melo b6309ac2b8 Force the medium pretty format on calls to git log
If a user has customized format.pretty in config, git-svn rebase fails with:

	Unable to determine upstream SVN information from working tree history

because the command expects to read the commit log in the default format.

This fixes the command to explicitly ask for the format it wants to read
from.

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-11 17:35:35 -07:00
Eric Wong f61cc48d28 git-svn: fix following renamed paths when tracking a single path
When using git-svn to follow only a single (empty) path per
svn-remote (i.e. not using --stdlayout), following the history
of a renamed path was broken in
c586879cdf.

This reverts the regression for the single (emtpy) path per
svn-remote case.

To avoid breaking the tests in a committed revision, this is an
addendum to a patch originally submitted by

  Santhosh Kumar Mani <santhoshmani@gmail.com>:
  > git-svn: add test for renamed directory fetch
  >
  > This test tries to fetch a directory which had renames in the
  > history from a SVN repository.

  [ew: unneccesary dependency on the starting an HTTP server
   removed from Santhosh's original test.]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-07 00:16:08 -07:00
Eric Wong 67dac28b90 git-svn: remove redundant slashes from show-ignore
Jonathan Scott Duff wrote:

> Recently I tried "git svn showignore" on my parrot repository and it
> failed.  I tracked it down to the prop_walk() sub.  When it recurses,
> $path has an extra / on the beginning (i.e., when it recurses, it
> tries to get the props for "//apps" instead of "/apps").   I *think*
> this is because $path is used in the recursive call rather than $p
> (which seems to contain a properly transformed $path).  Anyway, I've
> attached a patch that works for me and I think is generally the right
> thing.

Patch-submitted-by: Jonathan Scott Duff
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-30 22:03:05 -07:00
Kevin Ballard 8114da1616 Don't try and percent-escape existing percent escapes in git-svn URIs
git-svn project names are percent-escaped ever since f5530b8
(git-svn: support for funky branch and project names over HTTP(S),
2007-11-11).

Unfortunately this breaks the scenario where the user hands git-svn an
already-escaped URI.  Fix the regexp to skip over what looks like
existing percent escapes, and test this scenario.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-20 23:59:12 -07:00
Junio C Hamano 2a2ad0c000 Merge branch 'maint'
* maint:
  Make man page building quiet when DOCBOOK_XSL_172 is defined
  git-new-workdir: Share SVN meta data between work dirs and the repository
  rev-parse: fix meaning of rev~ vs rev~0.
  git-svn: don't blindly append '*' to branch/tags config
2008-03-15 00:05:40 -07:00
Eric Wong ed0b9d4309 git-svn: don't blindly append '*' to branch/tags config
Previously, git-svn would blindly append '*' even if it was specified by
the user during initialization (for certain SVN setups, it is
necessary).

Now, the following command will work correctly:

  git svn init -T trunk/docutils \
               -t 'tags/*/docutils' \
               -b 'branches/*/docutils' \
               svn://svn.berlios.de/docutils

Thanks to martin f krafft for the bug report:
> My git-svn target configuration is
>
>   [svn-remote "svn"]
>     url = svn://svn.berlios.de/docutils
>     fetch = trunk/docutils:refs/remotes/trunk
>     branches = branches/*/docutils:refs/remotes/*
>     tags = tags/*/docutils:refs/remotes/tags/*
>
> Unfortunately, when I run
>
>   git-svn init -T trunk/docutils -t 'tags/*/docutils'
>    -b 'branches/*/docutils'
>
> then I get (note the two asterisks on the left hand side):
>
>     branches = branches/*/docutils/*:refs/remotes/*
>     tags = tags/*/docutils/*:refs/remotes/tags/*
>
> I took a brief stab at the code but I can't even figure out where
> the /* is appended, so I defer to you.
>
> It should be trivial to keep git-svn from appending /* if the left
> side already contains an asterisk.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Tested-by: martin f krafft <madduck@madduck.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-14 17:54:28 -07:00
Junio C Hamano b81a7b5887 Merge branch 'maint'
* maint:
  git-svn: fix find-rev error message when missing arg
  t0021: tr portability fix for Solaris
  launch_editor(): allow spaces in the filename
  git rebase --abort: always restore the right commit
2008-03-11 21:40:47 -07:00
Marc-Andre Lureau ea14e6c554 git-svn: fix find-rev error message when missing arg
Just let the user know that a revision argument is missing instead of
a perl error. This error message mimic the "init" error message, but
could be improved.

Signed-off-by: Marc-Andre Lureau <marcandre.lureau@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-11 21:20:50 -07:00
Junio C Hamano ad416ed433 Merge branch 'maint' to sync with 1.5.4.4
* maint:
  GIT 1.5.4.4
  ident.c: reword error message when the user name cannot be determined
  Fix dcommit, rebase when rewriteRoot is in use
  Really make the LF after reset in fast-import optional
2008-03-08 20:07:57 -08:00
John Goerzen 0bb91d9a62 Fix dcommit, rebase when rewriteRoot is in use
When the rewriteRoot setting is used with git-svn, it causes the svn
IDs added to commit messages to bear a different URL than is actually
used to retrieve Subversion data.

It is common for Subversion repositories to be available multiple
ways: for instance, HTTP to the public, and svn+ssh to people with
commit access.  The need to switch URLs for access is fairly common as
well -- perhaps someone was just given commit access.  To switch URLs
without having to rewrite history, one can use the old url as a
rewriteRoot, and use the new one in the svn-remote url setting.

This works well for svn fetching and general git commands.

However, git-svn dcommit, rebase, and perhaps other commands do not
work in this scenario.  They scan the svn ID lines in commit messages
and attempt to match them up with url lines in [svn-remote] sections
in the git config.

This patch allows them to match rewriteRoot options, if such options
are present.

Signed-off-by: John Goerzen <jgoerzen@complete.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
2008-03-08 19:20:06 -08:00
Sebastian Noack 77266e96d3 git-svn: Don't prompt for client cert password everytime.
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-27 13:18:35 -08:00
Sebastian Noack 47e83e3cc0 git-svn: Don't prompt for client cert password everytime.
Acked-by: Eric Wong <normalperson@yhbt.net>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-27 12:01:33 -08:00
Tim Stoakes 6fb5375ede Add `git svn blame' command
This command is identical to `git blame', but it shows SVN revision
numbers instead of git commit hashes.

[ew: support "^initial commit" and minor formatting fixes]

Signed-off-by: Tim Stoakes <tim@stoakes.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11 13:23:14 -08:00
Eric Wong c586879cdf git-svn: improve repository URL matching when following parents
This way we can avoid the spawning of a new SVN::Ra session by
reusing the existing one.

The most problematic issue is that some svn servers disallow
too many connections from a single IP, so this will allow
git-svn to fetch from those repositories with a higher success
rate by using fewer connections.

This sometimes showed up as a new (and redundant)
[svn-remote "$parent_refname"] entry in $GIT_DIR/svn/.metadata.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-06 13:50:21 -08:00
Karl Hasselström 94bc914c5e Let "git svn" run "git gc --auto" occasionally
Let "git svn" run "git gc --auto" every 1000 imported commits to
reduce the number of loose objects.

To handle the common use case of frequent imports, where each
invocation typically fetches much less than 1000 commits, also run gc
unconditionally at the end of the import.

"1000" is the same number that was used by default when we called
git-repack. It isn't necessarily still the best choice.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-03 13:00:09 -08:00
Karl Hasselström af788a6eb5 git-svn: Don't call git-repack anymore
In a moment, we'll start calling git-gc --auto instead, since it is a
better fit to what we're trying to accomplish.

The command line options are still accepted, but don't have any
effect, and we warn the user about that.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-03 12:59:24 -08:00
Eric Wong 3b839fd861 git-svn: default to repacking every 1000 commits
This should reduce disk space usage when doing large imports.
We'll be switching to "gc --auto" post-1.5.4 to handle
repacking for us.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-22 01:45:40 -08:00
Eric Wong 98fa5b6851 git-svn: handle leading/trailing whitespace from svnsync revprops
Repositories generated by svnsync cannot be relied on to have
properly set revprops without newlines in UUIDs and URLs.  There
may be broken versions of svnsync out there that append extra
newlines to UUIDs, or the revprops could've been changed by
repository administrators at any time, too.

At least one repository we've come across has an embedded
newline erroneously set in the svnsync-uuid prop.  This is bad
because the trailing newline is taken as another record by the
Git.pm library, and the wantarray detection causes tmp_config()
to return an array with an empty-but-existing second element.

We will now strip leading and trailing whitespace both before
setting and after reading the uuid and url for svnsync values.
We will also force tmp_config to return a single scalar when
reading existing values.

SVN UUIDs should never have whitespace in them, and SVN
repository URLs should be URI-escaped, so neither of those
values we ever see in git-svn should actually have whitespace
in them.

Thanks to Dennis Schridde for the bug report and Junio for
helping diagnose this.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-12 10:58:06 -08:00
Kevin Ballard 35cda06164 Trim leading / off of paths in git-svn prop_walk
prop_walk adds a leading / to all subdirectory paths. Unfortunately
this causes a problem when the remote repo lives in a subdirectory itself,
as the leading / causes subsequent PROPFIND calls to be executed on
the wrong path. Trimming the / before calling the PROPFIND fixes this problem.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-09 14:56:49 -08:00
Junio C Hamano e708af6e58 Merge in GIT 1.5.3.8
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-08 00:58:33 -08:00
Eric Wong eee8a1742b git-svn: clarify the "Ignoring error from SVN" piece
I've heard of several users puzzled by this, and it sometimes it
appears as if git-svn is doing nothing on slower connections and
larger repositories.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-07 16:25:31 -08:00
Eric Wong f5530b8833 git-svn: support for funky branch and project names over HTTP(S)
SVN requires that paths be URI-escaped for HTTP(S) repositories.
file:// and svn:// repositories do not need these rules.

Additionally, accessing individual paths inside repositories
(check_path() and get_log() do NOT require escapes to function
and in fact it breaks things).

Noticed-by: Michael J. Cohen <mjc@cruiseplanners.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-07 15:18:37 -08:00
Eric Wong 321b1842dc git-svn: unlink index files that were globbed, too
commit 3157dd9e89 (git-svn: unlink
internal index files after operations) introduced unlinking
index files after fetching.  However, this missed indices for
refs that were created by globbing branches and tags.  This will
track all refs we ever touch during a fetch and unlink them at
exit time.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-02 10:44:22 -08:00
Eric Wong 7dfa16b9dc git-svn: allow dcommit --no-rebase to commit multiple, dependent changes
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-02 10:43:54 -08:00
Eric Wong 540424b263 git-svn: avoid warning when run without arguments
While we're in the area, finish writing a halfway-written
comment describing what that block does...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-12-19 00:33:15 -08:00
Eric Wong 7fc35e0e94 git-svn: workaround a for broken symlinks in SVN
It's possible for bad clients to commit symlinks without the
5-character "link " prefix in symlinks.  So guard around this
bug in SVN and make a best effort to create symlinks if the
"link " prefix is missing.

More information on this SVN bug is described here:
  http://subversion.tigris.org/issues/show_bug.cgi?id=2692

To be pedantic, there is still a corner case that neither we nor
SVN can handle:  If somebody made a link using a broken SVN
client where "link " is the first part of its path, e.g.
"link sausage", then we'd end up having a symlink which points
to "sausage" because we incorrectly stripped the "link ".
Hopefully this hasn't happened in practice, but if it has,
it's not our fault SVN is broken :)

Thanks to Benoit Sigoure and Sverre Johansen for reporting
and feedback.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-12-19 00:17:07 -08:00
Eric Wong ad94802a7b git-svn: avoid leaving leftover committer/author info in rebase
We set the 6 environment variables for controlling
committer/author email/name/time for every commit.

We do this in the parent process to be passed to
git-commit-tree, because open3() doesn't afford us the control
of doing it only in the child process.  This means we leave them
hanging around in the main process until the next revision comes
around and all 6 environment variables are overwridden again.

Unfortunately, for the last commit, leaving them hanging around
means the git-rebase invocation will pick it up, rewriting the
rebased commit with incorrect author information.  This should fix
it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-12-19 00:04:21 -08:00
Eric Wong 12a6d752fb git-svn: handle our top-level path being deleted and later re-added
Previously, git-svn would ignore cases where the path we're
tracking is removed from the repository.  This was to prevent
heads with follow-parent from ending up with a tree full of
empty revisions (and thus breaking rename detection).

The previous behavior is fine until the path we're tracking
is re-added later on, leading to the old files being merged
in with the new files in the directory (because the old
files were never marked as deleted)

We will now only remove all the old files locally that were
deleted remotely iff we detect the directory we're in is being
created from scratch.

Thanks for Marcus D. Hanwell for the bug report and
Peter Baumann for the analysis.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 12:06:23 -08:00
Eric Wong 3157dd9e89 git-svn: unlink internal index files after operations
Being git, we can generate these very quickly on the fly as
needed, so there's no point in wasting space for these things
for large projects.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-13 09:54:45 -08:00
Andy Whitcroft 5ff6aae895 git-svn: expand handling of From: and Signed-off-by:
The current parsing for From: and Signed-off-by: lines handles fully
specified names:

	From: Full Name <email@address>

Expand this to include the raw email addresses and straight "names":

	From: email@address       -> email <email@address>
	From: Full Name           -> Full Name <unknown>

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-13 09:47:48 -08:00
Junio C Hamano 3e5f260144 Merge branch 'ew/svn-rev-db'
* ew/svn-rev-db:
  git-svn: reinstate old rev_db optimization in new rev_map
  git-svn: replace .rev_db with a more space-efficient .rev_map format
2007-12-12 16:53:06 -08:00
Jeff King cd459e3ffa git-svn: get color config from --get-colorbool
git-config recently learned a --get-colorbool option. By
using it, we will get the same color=auto behavior that
other git commands have.

Specifically, this fixes the case where "color.diff = true"
meant "always" in git-svn, but "auto" in other programs.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-11 00:42:07 -08:00
Eric Wong 66ab84b99c git-svn: reinstate old rev_db optimization in new rev_map
This reinstates an old optimization in .rev_db which
stored the highest revision number we scanned, allowing
us to avoid scanning the SVN log for those revisions
again in a subsequent invocation.

This means the last 24-byte record in a .rev_map file
can be a 4-byte SVN revision number with 20-bytes of
zeroes representing a non-existent commit.  This record
can and will be overwritten when a new commit iff
the commit is all zeroes.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-10 21:28:27 -08:00