Commit Graph

308 Commits

Author SHA1 Message Date
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
Eric Wong
060610c572 git-svn: replace .rev_db with a more space-efficient .rev_map format
Migrations are done automatically on an as-needed basis when new
revisions are to be fetched.  Stale remote branches do not get
migrated, yet.

However, unless you set noMetadata or useSvkProps it's safe to
just do:

  find $GIT_DIR/svn -name '.rev_db*' -print0 | xargs rm -f

to purge all the old .rev_db files.

The new format is a one-way migration and is NOT compatible with
old versions of git-svn.

This is the replacement for the rev_db format, which was too big
and inefficient for large repositories with a lot of sparse history
(mainly tags).

The format is this:

  - 24 bytes for every record,
    * 4 bytes for the integer representing an SVN revision number
    * 20 bytes representing the sha1 of a git commit

  - No empty padding records like the old format

  - new records are written append-only since SVN revision numbers
    increase monotonically

  - lookups on SVN revision number are done via a binary search

  - Piping the file to xxd(1) -c24 is a good way of dumping it for
    viewing or editing, should the need ever arise.

As with .rev_db, these files are disposable unless noMetadata or
useSvmProps is set.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-10 21:28:25 -08:00
Steven Grimm
cec0d5a3bb git-svn: Don't create a "master" branch every time rebase is run
If you run "git-svn rebase" while sitting on a topic branch, there is
no need to create a "master" branch if one didn't exist already. The
branch was created implicitly by the automatic checkout after fetching,
which in the case of rebase isn't actually necessary anyway.

Signed-off-by: Steven Grimm <koreth@midwinter.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-30 23:32:51 -08:00
Vineet Kumar
2d87979215 git-svn: add a show-externals command.
show-externals can be used by scripts to provide svn:externals-like
functionality.  For example, a script can list all of the externals and then
use check out the listed URLs at the appropriate paths, similar to what the svn
client does.  Said script (or perhaps git-svn itself, in the future) could
simply invoke svn export on the paths, or it could go one further, using
git-svn clone and even git-submodule together to better integrate externals
checkouts.

The implementation is shamelessly copied from show-ignores.  A more general
command to list user-specified properties is probably a better idea.

Signed-off-by: Vineet Kumar <vineet@doorstop.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-30 23:32:51 -08:00
David D. Kilzer
8d7c4fad3f git-svn: Remove unnecessary Git::SVN::Util package
Digest::MD5 is loaded regardless of the package in which it's
declared, so move its 'use' statement and the md5sum() function
into the main package.

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-30 23:32:51 -08:00
Andy Whitcroft
70ae04e4e8 git-svn: add support for pulling author from From: and Signed-off-by:
Add support for pulling the real author of a commit from the From:
and first Signed-off-by: fields of the SVN commit message.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-30 23:32:51 -08:00