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>
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>
It may be convenient for some users to store svn remote tracking
branches outside of the refs/remotes/ heirarchy.
To accomplish this feat, this patch includes the entire path to
the ref in $r->{'refname'} in &read_all_remotes and tries to change
references to this entry so the new value makes sense.
[ew: fixed backwards compatibility, long lines]
Signed-off-by: Adam Brewster <adambrewster@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Since "trunk" is a convention for the main development branch in
the SVN world, try to make that the master branch upon initial
checkout if it exists. This is probably less surprising based
on user requests.
t9135 was the only test which relied on the previous behavior
and thus needed to be modified.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Subversion ignores all blank lines in svn:ignore properties. The old
git-svn code ignored blank lines everywhere except for the first line
of the svn:ignore property. This patch makes the "git svn
show-ignore" and "git svn create-ignore" commands ignore leading blank
lines, too.
Also include leading blank lines in the test suite.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
Most users who type
git svn init file:///tmp/repo --prefix=my-svn/
would expect the root of the svn repository to be tracked by
refs/remotes/my-svn/git-svn.
Acked-by: Eric Wong <normalperson@yhbt.net>
In addition to path-based restrictions, Subversion servers over
http(s) may have access controls implemented via the LimitExcept
directive in Apache. In some cases, LimitExcept may be
(arguably) misconfigured to not allow REPORT requests while
allowing OPTIONS and PROPFIND.
This caused problems with our existing minimize_url logic that
only issued OPTIONS and PROPFIND requests when connecting and
using SVN::Ra::get_latest_revnum. We now call SVN::Ra::get_log
if get_latest_revnum succeeds, resulting in a REPORT request
being sent. This will increase our chances of tripping access
controls before we start attempting to fetch history.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Timothy Schaeffer reported the following:
> Git-svn has been giving me the following error for some time
> when calling "git svn dcommit":
>
> RA layer request failed: PROPFIND request failed on
> '/svn/stf/branches/dev/sw%2Fdpemu%2Finclude%2FNetCnxn.h': PROPFIND of
> '/svn/stf/branches/dev/sw%2Fdpemu%2Finclude%2FNetCnxn.h': 302 Found
> (https://oursvnrepo.net) at /usr/local/libexec/git-core/git-svn line 508
>
> This only occurred when git detected a rename or copy.
>
> Following the lead into git-svn.perl,
> and noticing that some of the '/'s in the path were hex-encoded
> and some were not,
> I changed the regex used to find chars
> to hex-encode in the relative part of the path
> to exclude '/'.
> It works, so far.
> I have included a patch.
While this has previous not been a problem in my experience,
newer versions of SVN may be stricter and this does not
introduce regressions in t9115.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
This was introduced in 0b2af457a4
("Fix branch detection when repository root is inaccessible")
but reintroduced in the previous commit.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
This reverts the --minimize-url behavior change that
appeared recently in commit 0b2af457a4
("Fix branch detection when repository root is inaccessible").
However, we now allow the option to be turned off by allowing
"--no-minimize-url" so people with limited-access setups can
still take advantage of the fix in
0b2af457a4.
Also document the behavior and default settings of minimize-url
in the manpage for the first time.
This introduces a temporary UI regression to allow t9141 to pass
that will be reverted (fixed) in the next commit.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Add a git svn gc command that gzips all unhandled.log files, and
removes all index files under .git/svn.
Signed-off-by: Robert Allan Zeh <robert.a.zeh@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Thanks to Ka-Hing Cheung for the initial bug report and patch:
> git-svn uses $ra->get_latest_revnum to find out the latest
> revision, but that can be problematic, because get_latest_revnum
> returns the latest revnum in the entire repository, not
> restricted by whatever URL you used to construct $ra. So if you
> do git svn clone -r HEAD svn://blah/blah/trunk, it won't work if
> the latest checkin is in one of the branches (it will try to
> fetch a rev that doesn't exist in trunk, making the clone
> useless).
Relying on SVN::Core::INVALID_REVNUM (-1) as the "start"
argument to SVN::Ra::get_log() proved unreliable with http(s)
URLs so the result of SVN::Ra::get_latest_revnum() is used as
the "start" argument instead.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Mishandling of http(s) in need of escaping was causing
t9118-git-svn-funky-branch-names to fail when SVN_HTTPD_PORT
was defined.
This bug was exposed in (but not caused by)
commit 0b2af457a4
(Fix branch detection when repository root is inaccessible)
Signed-off-by: Eric Wong <normalperson@yhbt.net>
SVN allows uppercase A-F characters in repositories. Although
`svnadmin' does not create UUIDs with uppercase by default, it
is possible to change the UUID of a SVN repository and SVN
itself will make no attempt to normalize them.
Thanks to Esben Skovenborg for discovering this issue.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
For the case of multiple projects sharing a single SVN repository, it is
common practice to create the standard SVN directory layout within a
subdirectory for each project. In such setups, access control is often
used to limit what projects a given user may access. git-svn failed to
detect branches (e.g. when passing --stdlayout to clone) because it
relied on having access to the root directory in the repository. This
patch solves this problem by making git-svn use paths relative to the
given repository URL instead of the repository root.
Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
This makes get_log more safe to use because callers cannot run into path
clobbering any more. The additional overhead will not affect performance
since the critical calls from the fetch loop need the path duplication
anyway and the rest of the call sites is not performance critical.
Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
Cloning/initializing svn repositories with an uncanonicalize url
does not work as libsvn throws an assertion. This patch
canonicalize svn uris for the clone and init command from
git-svn.
[ew: fixed trailing whitespace]
Signed-off-by: Ulrich Dangel <uli@spamt.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Marc Branchaud wrote:
> I'm fairly happy with this, except for the way the branch
> subcommand matches refspecs. The patch does a simple string
> comparison, but it'd be better to do an actual glob. I just
> couldn't track down the right function for that, so I left it as
> a strcmp and hope that a gitizen can tell me how to glob here.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
This enables git-svn.perl to read multiple 'branches' and 'tags' entries in
svn-remote config sections. The init and clone subcommands also support
multiple --branches and --tags arguments.
The branch (and tag) subcommand gets a new argument: --destination (or -d).
This argument is required if there are multiple branches (or tags) entries
configured for the remote Subversion repository. The argument's value
specifies which branch (or tag) path to use to create the branch (or tag).
The specified value must match the left side (without wildcards) of one of
the branches (or tags) refspecs in the svn-remote's config.
[ew: avoided explicit loop when combining globs with "push"]
Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Add a command to unwind the effects of fetch by moving the rev_map
and refs/remotes/git-svn back to an old SVN revision. This allows
revisions to be re-fetched. Ideally SVN revs would be immutable,
but permissions changes in the SVN repository or indiscriminate use
of '--ignore-paths' can create situations where fetch cannot make
progress.
Signed-off-by: Ben Jackson <ben@ben.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
By limiting start revision of find_rev_before to max existing
revision. This avoids a long wait if you do
'git svn reset -r 9999999'. The linear search within the
contiguous revisions doesn't seem to be a problem.
[ew: expanded commit message]
Signed-off-by: Ben Jackson <ben@ben.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Previously there was no explicit 'help' command, but 'git svn help'
still printed the usage message (as an invalid command), provided you
got past the initialization steps that required a valid repo.
Signed-off-by: Ben Jackson <ben@ben.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
'git svn dcommit' takes an optional revision argument, but the meaning
of it was rather scary. It completely ignored the current state of
the HEAD, only looking at the revisions between SVN and $rev. If HEAD
was attached to $branch, the branch lost all commits $rev..$branch in
the process.
Considering that 'git svn dcommit HEAD^' has the intuitive meaning
"dcommit all changes on my branch except the last one", we change the
meaning of the revision argument. git-svn temporarily checks out $rev
for its work, meaning that
* if a branch is specified, that branch (_not_ the HEAD) is rebased as
part of the dcommit,
* if some other revision is specified, as in the example, all work
happens on a detached HEAD and no branch is affected.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Eric Wong <normalperson@yhbt.net>
...without i18n.commitencoding set in the config.
SVN tries to store all commit messages in UTF-8, however it is
up to the job of the clients to enforce this rule. SVN servers
themselves do not always enforce this; allowing clients to
commit malformed UTF-8 messages and break repositories.
So git-svn will enforce this and tell the user to set
i18n.commitencoding when a git commit is is not in UTF-8.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Add a new option, --authors-prog, to git-svn that allows a more flexible
alternative (or supplement) to --authors-file. This allows more
advanced username operations than the authors file will allow. For
example, one may look up Subversion users via LDAP, or may generate the
name and email address from the Subversion username.
Notes:
* If both --authors-name and --authors-prog are given, the former is
tried first, falling back to the later.
* The program is called once per unique SVN username, and the result is
cached.
* The command-line argument must be the path to a program, not a generic
shell command line. The absolute path to this program is taken at
startup since the git-svn script changes directory during operation.
* The option is not enabled for `git svn log'.
[ew: fixed case where neither --authors-(name|prog) were defined]
Signed-off-by: Mark Lodato <lodatom@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Report the maximum found revision in the range, instead of the minimum
changed revision.
Signed-off-by: Alex Vandiver <alexmv@mit.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
Instead of trying to find the end of the commit history only in the
last window, track if we have seen commits yet, and use that to judge
if we need to backtrack and look for a tail. Otherwise, conversion
can silently lose up to 100 revisions of a branch if it was deleted
>100 revisions ago.
Signed-off-by: Alex Vandiver <alexmv@mit.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
* maint:
improve error message in config.c
t4018-diff-funcname: add cpp xfuncname pattern to syntax test
Work around BSD whose typeof(tv.tv_sec) != time_t
git-am.txt: reword extra headers in message body
git-am.txt: Use date or value instead of time or timestamp
git-am.txt: add an 'a', say what 'it' is, simplify a sentence
dir.c: Fix two minor grammatical errors in comments
git-svn: fix a sloppy Getopt::Long usage
Getopt-Long v2.38 is much stricter about sloppy getopt usage. The
trailing pipe causes git-svn testcases to fail for all of the --stdin
argument calls.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
It has been reported time and time again in relation to msysGit that
git-svn does not work well when core.autocrlf has any value other than
'false'. So let's make it so by default.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The --ignored-paths argument is now stored as
"svn-remote.$REMOTE_NAME.ignore-paths" in the config file.
[ew: edited subject and message]
Signed-off-by: Ben Jackson <ben@ben.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
The --ignore-paths option to fetch is very useful for working on a subset
of a SVN repository. For proper operation, every command that causes a
fetch (explicit or implied) must include a matching --ignore-paths option.
This patch adds a persistent svn-remote.$repo_id.ignore-paths config by
promoting Fetcher::is_path_ignored to a member function and initializing
$self->{ignore_regex} in Fetcher::new. Command line --ignore-paths is
still recognized and acts in addition to the config value.
Signed-off-by: Ben Jackson <ben@ben.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
'git svn blame' now uses the 'git cat-file --batch' command to
speed up resolving SVN revision number out of commit SHA by
removing fork+exec overhead.
[ew: enforced 80-column line wrap]
Signed-off-by: Boris Byk <boris.byk@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
People may expect/prefer -q to still show git commits,
so this change allows a second -q to hide them.
Signed-off-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Acked-by: Eric Wong <normalperson@yhbt.net>
To find the blob object name given a tree and pathname, we were
incorrectly calling "git ls-tree" with a "--" argument followed
by the pathname of the file we wanted to get.
git ls-tree <TREE> -- --dashed/path/name.c
Unlike many command-line interfaces, the "--" alone does not
symbolize the end of non-option arguments on the command-line.
ls-tree interprets the "--" as a prefix to match against, thus
the entire contents of the --dashed/* hierarchy would be
returned because the "--" matches "--dashed" and every path
under it.
Thanks to Anton Gyllenberg for pointing me toward the
Twisted repository as a real-world example of this case.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ideally only errors should be output in this mode so fetch
can be run from cron and normally produce no output. Without
this change it would output a single line on each git commit,
e.g.
r1909 = 32ef87860662526d4a62f903949ed21e0341079e (u2_10_12_branch)
Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Acked-by: Eric Wong <normalperson@yhbt.net>
To find the blob object name given a tree and pathname, we were
incorrectly calling "git ls-tree" with a "--" argument followed
by the pathname of the file we wanted to get.
git ls-tree <TREE> -- --dashed/path/name.c
Unlike many command-line interfaces, the "--" alone does not
symbolize the end of non-option arguments on the command-line.
ls-tree interprets the "--" as a prefix to match against, thus
the entire contents of the --dashed/* hierarchy would be
returned because the "--" matches "--dashed" and every path
under it.
Thanks to Anton Gyllenberg for pointing me toward the
Twisted repository as a real-world example of this case.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
For repositories laid out like the following:
[svn-remote "svn"]
url = http://foo.com/svn/repos/bar
fetch = myproject/trunk:refs/remotes/trunk
branches = bar/myproject/branches/*:refs/remotes/*
tags = bar/myproject/tags/*:refs/remotes/tags/*
The "bar" component above is considered the intermediate path
and was not handled correctly.
Signed-off-by: Michael Lai <myllai@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
When %z was removed from the strftime call and subsituted with a
local gmt offset calculation, time() was no longer the default for
all time functions as it was with the previous localtime(shift).
This is now corrected so that format_svn_time behaves as it used to.
Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Even though this will break things for some extremely rare repositories
used by broken Windows clients, it's probably not worth enabling this by
default as it has negatively affected many more users than it has helped
from what we've seen so far.
The extremely rare repositories that have broken symlinks in them will be
silently corrupted in import; but users can still reenable this option and
restart the import.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
%z isn't available on all platforms in the date formatting
routines. Provide a workalike capability that should be
more portable.
Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Acked-by: Eric Wong <normalperson@yhbt.net>
The commit url for dcommit is determined in the following order:
commandline option --commit-url
svn.commiturl
svn-remote.<name>.commiturl
svn-remote.<name>.url
Signed-off-by: Peter Oberndorfer <kumbayo84@arcor.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
Original bug report and test case by Björn Steinbrink.
Björn Steinbrink <B.Steinbrink@gmx.de> wrote:
> Hi Eric,
>
> seems that the empty symlink stuff gets confused about which revision to
> use when looking for the parent's file.
>
> r3 = f1a6fcf6b0a1c4a373d0b2b65a3d70700084f361 (tags/1.0.1)
> Found possible branch point: file:///home/doener/h/svn/tags/1.0 => file:///home/doener/h/svn/branches/1.0, 4
> Found branch parent: (1.0) 63ae640ba01014ecbb3df590999ed1fa5914545b
> Following parent with do_switch
> Successfully followed parent
> r5 = 26fcfef5bcced97ab74faf1af7341a2ae0d272aa (1.0)
> Found possible branch point: file:///home/doener/h/svn/branches/1.0 => file:///home/doener/h/svn/tags/1.0.1, 5
> Found branch parent: (tags/1.0.1) 26fcfef5bcced97ab74faf1af7341a2ae0d272aa
> Following parent with do_switch
> Scanning for empty symlinks, this may take a while if you have many empty files
> You may disable this with `git config svn.brokenSymlinkWorkaround false'.
> This may be done in a different terminal without restarting git svn
> Filesystem has no item: File not found: revision 3, path '/branches/1.0/file' at /usr/local/libexec/git-core/git-svn line 3318
>
> Note how it tries to look at revision 3 instead of revision 5 (which it
> correctly detected as the parent). The import succeeds when
> svn.brokenSymlinkWorkaround is set to false. Testcase below.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Since SVN tracks empty directories and git does not, we can not assume
that the directory exists when creating .gitignore files.
Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Ward Wouts reports that git-svn barfed like this:
Unable to parse date: 2004-03-09T09:44:33.Z at /usr/bin/git-svn line 3995
The parse_svn_date sub expects there always are one or more digits after
the decimal point to record fractional seconds, but this example does not
and results in a failure like this.
The fix is based on the original fix by the reporter, further cleaned up.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
If the new svn root URL given with the svn-remote.<repo>.rewriteRoot config option
(or by the --rewrite-root option to 'git svn init') contains a username
(such as 'svn+ssh://username@example.com/repo'), find_by_url() cannot find
the repository URL, because the URL contained in the commit message does have
the username removed.
Signed-off-by: Dévai Tamás <devait@mailbox.sk>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thanks to Anton Gyllenberg <anton@iki.fi> for the bug report
(and testcase in the following commit):
> Commit dbc6c74d08 "git-svn:
> handle empty files marked as symlinks in SVN" caused a
> regression in an unusual case where a branch has been created
> in SVN, later deleted and then created again from another
> branch point and the original branch point had empty files not
> in the new branch. In some cases git svn fetch will then fail
> while trying to fetch the empty file from the wrong SVN
> revision.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
When initializing a git-svn repository from a Subversion repoository,
it is common to be interested in a path which did not exist in the
initial commit to Subversion. In a large repository, the initial fetch
may take some looking for the earliest existence of the path time while
the user receives no additional feedback. Print the highest revision
number scanned thus far to let the user know something is still
happening.
Signed-off-by: Deskin Miller <deskinm@umich.edu>
We will be adding a more places that need to find git revisions
corresponding to new parents, so abstract out this section into a new
method.
Signed-off-by: Yuval Kogman <nothingmuch@woobling.org>
Signed-off-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
[ew: minor formatting changes]
Since dbc6c74d08, git-svn has had
an expensive check for broken symlinks that exist in some
repositories. This leads to a heavy performance hit on
repositories with many empty blobs that are not supposed to be
symlinks.
The workaround is enabled by default; and may be disabled via:
git config svn.brokenSymlinkWorkaround false
Reported by Markus Heidelberg.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
This will be useful when somebody want to checkout something partially from
repository with some non-standart layout or exclude some files from it.
Example: repository has structure /module-{a,b,c}/{trunk,branches,tags}/...
Modules are interdependent, and you want it to be single repostory (to commit
to all modules simultaneously and view complete history), but do not want
branches and tags be checked out into working copy.
Other use case is excluding some large blobs.
The quirk for now is that user must specify this option every fetch/rebase;
in other case he may get extra files or "file not found" errors. It may be
will be resolved by adding regular expression to .git/config into
[svn-remote ...] to make it persistent.
Signed-off-by: Vitaly "_Vi" Shukela <public_vi@tut.by>
Acked-by: Eric Wong <normalperson@yhbt.net>
[ew: replaced 4-space indent with tabs]
[ew: prefixed $ignore_regex with an underscore to be consistent
with other globals in git-svn]
[ew: rearranged functions to minimize diff and removed prototype
usage to be consistent with the rest of git-svn (and other
Perl code in git (and they're ugly to me)]
By enforcing SVN::Pool usage when calling get_file once again.
This regression was introduced with the reintroduction of
SVN::Ra::get_file() usage in
dbc6c74d08
Signed-off-by: Eric Wong <normalperson@yhbt.net>
In svn 1.5.5 the output of "svn info" for added directories was changed
and now shows the repository UUID. This patch implements the same
behavior for "git svn info" and makes t9119-git-svn-info.17 pass if
svn 1.5.5 is used.
Signed-off-by: Marcel Koeppen <git-dev@marzelpan.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
Some SVN repositories contain git repositories within them
(hopefully accidentally checked in). Since git refuses to track
nested ".git" repositories, this can be a problem when fetching
updates from SVN.
Thanks to Morgan Christiansson for the report and testing.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
The get_log() function in the Perl SVN API introduced the limit
parameter in 1.2.0. However, this got discarded in our SVN::Ra
compatibility layer when used with SVN 1.1.x. We now emulate
the limit functionality in older SVN versions by preventing the
original callback from being called if the given limit has been
reached. This emulation is less bandwidth efficient, but SVN
1.1.x is becoming rarer now.
Additionally, the --limit parameter in svn(1) uses the
aforementioned get_log() functionality change in SVN 1.2.x.
t9129 no longer depends on --limit to work and instead uses
Perl to parse out the commit message.
Thanks to Tom G. Christensen for the bug report.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
By default git-svn stores timestamps of fetched commits in
Subversion's UTC format. Passing --localtime to fetch will convert
them to the timezone of the server on which git-svn is run.
This makes the timestamps of a resulting "git log" agree with what
"svn log" shows for the same repository.
Signed-off-by: Pete Harlan <pgit@pcharlan.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
This is a followup to 7fc35e0e94,
(workaround a for broken symlinks in SVN).
Since broken SVN clients can commit svn:special files without
the magic "link " prefix, this can affect delta application
when we update the broken svn:special file. So now we fall
back and retry the delta application on symlinks if having
a "link " prefix fails.
Our behavior differs from svn(1) (v1.5.1) slightly:
When a svn:special file is created w/o a "link " prefix, svn
will create a regular file (mode 100644 to git) with the
contents of the blob as-is.
Our behavior is to continue creating the symlink (mode 120000
to git) with the contents of the blob as-is. While this
differs from current svn(1) behavior, this is easier and more
efficient to implement (and the correctness of the svn(1) is
debatable, since it's a workaround for a bug in the first
place).
More information on this SVN bug is described here:
http://subversion.tigris.org/issues/show_bug.cgi?id=2692
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Broken SVN clients generate empty files with the svn:special set
to '*'. This attempts to denote a symlink pointing to a file
with an empty path (""), which cannot be generated on a POSIX
system.
Thus, we mimic the behavior of svn(1) and create a zero-byte
file in our tree.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
In dc871831(Only use GIT_CONFIG in "git config", not other programs),
GIT_CONFIG_LOCAL was rested in peace, in favor of not reading
/etc/gitconfig and $HOME/.gitconfig at all when GIT_CONFIG is set.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
find_parent_branch generates branch@rev type branches when one has to
look back through SVN history to properly get the history for a branch
copied from somewhere not already being tracked by git-svn. If in the
process of fetching this history, git-svn is interrupted, then when one
fetches again, it will use whatever was last fetched as the parent
commit and fail to fetch any more history which it didn't get to before
being terminated. This is especially troubling in that different
git-svn copies of the same SVN repository can end up with different
commit sha1s, incorrectly showing the history as divergent and
precluding easy collaboration using git push and fetch.
To fix this, when we initialise the Git::SVN object $gs to search for
and perhaps fetch history, we check if there are any commits in SVN in
the range between the current revision $gs is at, and the top revision
for which we were asked to fill history. If there are commits we're
missing in that range, we continue the fetch from the current revision
to the top, properly getting all history before using it as the parent
for the branch we're trying to create.
Signed-off-by: Deskin Miller <deskinm@umich.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The 'branch' subcommand incorrectly had the svn-remote to use hardcoded
as 'svn', the default remote name. This meant that branches derived
from other svn-remotes would try to use the branch and tag configuration
for the 'svn' remote, potentially copying would-be branches to the wrong
place in SVN, into the branch namespace for another project.
Fix this by using the remote name extracted from the svn info for the
specified git ref. Add a testcase for this behaviour.
[jc: squashed in a fix to test from Michael J Gruber for older svn (1.4)]
Signed-off-by: Deskin Miller <deskinm@umich.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This fixes git-svn within msys where Perl will provide temporary files with path
such as /tmp while the git suit expects native Windows paths.
Signed-off-by: Marten Svanfeldt <developer@svanfeldt.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
When in a bare repository (or .git, for that matter), git-svn would fail
to initialise properly, since git rev-parse --show-cdup would not output
anything. However, git rev-parse --show-cdup actually returns an error
code if it's really not in a git directory.
Fix the issue by checking for an explicit error from git rev-parse, and
setting $git_dir appropriately if instead it just does not output.
Signed-off-by: Deskin Miller <deskinm@umich.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
SVN itself always stores log messages in the repository as
UTF-8. git always stores/retrieves everything as raw binary
data with no transformations whatsoever.
To interact with SVN, we need to encode log messages as UTF-8
before sending them to SVN, as SVN cannot do it for us. When
retrieving log messages from SVN, we also need to (attempt to)
reencode the UTF-8 log message back to the user-specified commit
encoding.
Note, handling i18n.logoutputencoding for "git svn log" also
needs to be done in a future change.
Also, this change only deals with the encoding of commit
messages and nothing else (path names, blob content, ...).
In-Reply-To: <8b168cfb0810282014r789ac01dnec51824de1078f0@mail.gmail.com>
James North <tocapicha@gmail.com> wrote:
> Hi,
>
> I'm using git-svn on a system with ISO-8859-1 encoding. The problem is
> when I try to use "git svn dcommit" to send changes to a remote svn
> (also ISO-8859-1).
>
> Seems like git-svn is sending commit messages with utf-8 (just a
> guessing...) and they look bad on the remote svn log. E.g. "Ca?\241a
> de cami?\243n"
>
> I have tried using i18n.commitencoding=ISO-8859-1 as suggested by the
> warning when doing "git svn dcommit" but messages still are sent with
> wrong encoding.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Thanks to Jose Carlos Garcia Sogo and Björn Steinbrink for the
bug report.
On 2008.10.18 23:39:19 +0200, Björn Steinbrink wrote:
> Hi,
>
> Jose Carlos Garcia Sogo reported on #git that a git-svn clone of this
> svn repo fails for him:
> https://sucs.org/~welshbyte/svn/backuptool/trunk
>
> I can reproduce that here with:
> git-svn version 1.6.0.2.541.g46dc1.dirty (svn 1.5.1)
>
> The error message I get is:
> Apache got a malformed URI: Unusable URI: it does not refer to this
> repository at /usr/local/libexec/git-core/git-svn line 4057
>
> strace revealed that git-svn url-encodes ~ while svn does not do that.
>
> For svn we have:
> write(5, "<S:update-report send-all=\"true\" xmlns:S=\"svn:\">
> <S:src-path>https://sucs.org/~welshbyte/svn/backuptool/trunk</S:src-path>...
>
> While git-svn shows:
> write(7, "<S:update-report send-all=\"true\" xmlns:S=\"svn:\">
> <S:src-path>https://sucs.org/%7Ewelshbyte/svn/backuptool/trunk</S:src-path>...
Signed-off-by: Eric Wong <normalperson@yhbt.net>
* maint:
git-svn: change dashed git-commit-tree to git commit-tree
Documentation: clarify information about 'ident' attribute
bash completion: add doubledash to "git show"
Use test-chmtime -v instead of perl in t5000 to get mtime of a file
Add --verbose|-v to test-chmtime
asciidoc: add minor workaround to add an empty line after code blocks
Plug a memleak in builtin-revert
Add file delete/create info when we overflow rename_limit
Install git-cvsserver in $(bindir)
Install git-shell in bindir, too
[ew: fixed a warning to stderr causing t9108 to fail]
Signed-off-by: Florian Ragwitz <rafl@debian.org>
Signed-off-by: Deskin Miller <deskinm@umich.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
When doing a set-tree and there is no revision to commit to, the following unrelated error message is displayed: "Undefined subroutine &Git::SVN::fatal called at /opt/local/libexec/git-core/git-svn line 2575." The following patch fixes the problem and allows the real error message to be shown.
Signed-off-by: Luc Heinrich <luc@honk-honk.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Suppose you're using git-svn to work with a certain SVN repository.
Since you don't like 'git-svn fetch' to take forever, and you don't want
to accidentally interrupt it and end up corrupting your repository, you
set up a remote Git repository to mirror the SVN repository, which does
its own 'git-svn fetch' on a cronjob; now you can 'git-fetch' from the
Git mirror into your local repository, and still dcommit to SVN when you
have changes to push.
After you do this, though, git-svn will get very confused if you ever
try to do 'git-svn fetch' in your local repository again, since its
rev_map will differ from the branch's head, and it will be unable to
fetch new commits from SVN because of the metadata conflict. But all
the necessary metadata are there in the Git commit message; git-svn
already knows how to rebuild rev_map files that get blown away, by
using the metadata.
This patch teaches git-svn do a partial rebuild of the rev_map to
match the true state of the branch, if it ever is used to fetch again.
This will only work for projects not using either noMetadata or
useSvmProps configuration options; if you are using these options,
git-svn will fall back to the previous behaviour.
Signed-off-by: Deskin Miller <deskinm@umich.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
sha1_file: link() returns -1 on failure, not errno
Make git archive respect core.autocrlf when creating zip format archives
Add new test to demonstrate git archive core.autocrlf inconsistency
gitweb: avoid warnings for commits without body
Clarified gitattributes documentation regarding custom hunk header.
git-svn: fix handling of even funkier branch names
git-svn: Always create a new RA when calling do_switch for svn://
git-svn: factor out svnserve test code for later use
diff/diff-files: do not use --cc too aggressively
Apparently do_switch() tolerates the lack of escaping in less
funky branch names. For the really strange and scary ones, we
need to escape them properly. It strangely maintains compatible
with the existing handling of branch names with spaces and
exclamation marks.
Reported-by: m.skoric@web.de ($gmane/94677)
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Not doing so caused the "Malformed network data" error when a directoy
was deleted and replaced with a copy from an older version.
Signed-off-by: Alec Berryman <alec@thened.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
Update draft release notes for 1.6.0.2
Use compatibility regex library for OSX/Darwin
git-svn: Fixes my() parameter list syntax error in pre-5.8 Perl
Git.pm: Use File::Temp->tempfile instead of ->new
t7501: always use test_cmp instead of diff
Conflicts:
Makefile
Perl 5.8.0 ships with File::Temp 0.13, which does not have the new()
interface introduced in 0.14, as pointed out by Tom G. Christensen.
This modifies Git.pm to use the more established tempfile() interface
and updates 'git svn' to match.
Signed-off-by: Marcus Griep <marcus@griep.us>
Acked-by: Eric Wong <normalperson@yhbt.net>
Tested-by: Tom G. Christensen <tgc@statsbiblioteket.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Apparently do_switch() tolerates the lack of escaping in less
funky branch names. For the really strange and scary ones, we
need to escape them properly. It strangely maintains compatible
with the existing handling of branch names with spaces and
exclamation marks.
Reported-by: m.skoric@web.de ($gmane/94677)
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Patch-by: Paul Talacko <gnuruandstuff@yahoo.co.uk>:
<http://article.gmane.org/gmane.comp.version-control.git/95006>
> Hello,
>
> There's an issue in git-svn as autoprops are not applied to
> renamed files, only to added files.
>
> This patch fixes the bug.
[ew: added test case]
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Previously 'git svn info unknown-file' only announced its failure (in
the SVN 1.4 style, "not a versioned resource"), and exited
successfully.
It is desirable to actually exit with failure, so change the code to
exit(1) under this condition. Since that is already halfway SVN 1.5
compatibility, also change the error output to match 1.5.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Eric Wong <normalperson@yhbt.net>
Changes 'git svn info' to always URL-escape the 'URL' and 'Repository'
fields and --url output, like SVN (at least 1.5) does.
Note that reusing the escape_url() further down in Git::SVN::Ra is not
possible because it only triggers for http(s) URLs. I did not know
whether extending it to all schemes would break SVN access anywhere,
so I made a new one that quotes in all schemes.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Eric Wong <normalperson@yhbt.net>
Previously 'git svn info <path>' would always treat the <path> as
relative to the working directory root, with a default of ".". This
does not match the behaviour of 'svn info'. Prepend $(git rev-parse
--show-prefix) to the path used inside cmd_info to make it relative to
the current working directory.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Eric Wong <normalperson@yhbt.net>
Since 711521e 'git svn dcommit' attempts to use the upstream
information to determine the SVN URL, before it verifies that it even
found an upstream. Move up the corresponding check.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Eric Wong <normalperson@yhbt.net>
Not checking the error code of a function used to transform and
send data makes me nervous. It currently returns "undef" on
success; so die if we get any result other than "undef" because
it's likely something went wrong somewhere. I really wish this
function returned an MD5 like send_stream (or better yet, SHA1)
for verification.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
We need the base blob to compute a delta to be sent to the server.
Signed-off-by: Florian Weimer <fw@deneb.enyo.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
Don't rely on the extracted URL from working_head_info since that has the
username removed. Instead use the $gs->full_url method (as before with
ba24e74 (git-svn: add ability to specify --commit-url for dcommit,
2008-08-07)) to give us the URL to commit to if --commit-url is not
specified.
Aditionally, since we clean usernames from URLs, checking the URL after
rebase can fail because it doesn't match the URL we used to commit; so
unconditionally provide a username-free URL for checking the result of the
refetch.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Currently, in sub 'close_file', git-svn creates a temporary file and
copies the contents of the blob to be written into it. This is useful
for symlinks because svn stores symlinks in the form:
link $FILE_PATH
Git creates a blob only out of '$FILE_PATH' and uses file mode to
indicate that the blob should be interpreted as a symlink.
As git-hash-object is invoked with --stdin-paths, a duplicate of the
link from svn must be created that leaves off the first five bytes,
i.e. 'link '. However, this is wholly unnecessary for normal blobs,
though, as we already have a temp file with their contents. Copying
the entire file gains nothing, and effectively requires a file to be
written twice before making it into the object db.
This patch corrects that issue, holding onto the substr-like
duplication for symlinks, but skipping it altogether for normal blobs
by reusing the existing temp file.
Signed-off-by: Marcus Griep <marcus@griep.us>
Acked-by: Eric Wong <normalperson@yhbt.net>
Currently, git-svn would create a temp file on four occasions:
1. Reading a blob out of the object db
2. Creating a delta from svn
3. Hashing and writing a blob into the object db
4. Reading a blob out of the object db (in another place in code)
Any time git-svn did the above, it would dutifully create and then
delete said temp file. Unfortunately, this means that between 2-4
temporary files are created/deleted per file 'add/modify'-ed in
svn (O(n)). This causes significant overhead and helps the inode
counter to spin beautifully.
By its nature, git-svn is a serial beast. Thus, reusing a temp file
does not pose significant problems. "truncate and seek" takes much
less time than "unlink and create". This patch centralizes the
tempfile creation and holds onto the tempfile until they are deleted
on exit. This significantly reduces file overhead, now requiring
at most three (3) temp files per run (O(1)).
Signed-off-by: Marcus Griep <marcus@griep.us>
Acked-by: Eric Wong <normalperson@yhbt.net>
Oops, I let a few patches slip by with long lines in them.
Extracted from an unrelated patch by: Marcus Griep <marcus@griep.us>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Some repositories use a deep branching strategy, such as:
branches/1.0/1.0.rc1
branches/1.0/1.0.rc2
branches/1.0/1.0.rtm
branches/1.0/1.0.gold
Only allowing a single glob stiffles this.
This change allows for a single glob 'set' to accept this deep
branching strategy.
The ref glob depth must match the branch glob depth. When using
the -b or -t options for init or clone, this is automatically
done.
For example, using the above branches:
svn-remote.svn.branches = branches/*/*:refs/remote/*/*
gives the following branch names:
1.0/1.0.rc1
1.0/1.0.rc2
1.0/1.0.rtm
1.0/1.0.gold
[ew:
* removed unrelated line-wrapping changes
* fixed line-wrapping in a few more places
* removed trailing whitespace
* fixed bashism in test
* removed unnecessary httpd startup in test
* changed copyright on tests to 2008 Marcus Griep
* added executable permissions to new tests
]
Signed-off-by: Marcus Griep <marcus@griep.us>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Fixes bad regex match check for multiple globs (would always return
one glob regardless of actual number).
[ew: fixed a bashism in the test and some minor line-wrapping]
Signed-off-by: Marcus Griep <marcus@griep.us>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This allows one to use public svn:// URLs for fetch and
svn+ssh:// URLs for committing (without using the complicated
rewriteRoot option, reimporting or git-filter-branch).
Using this can also help avoid unnecessary server
authentication/encryption overhead on busy SVN servers.
Along with the new --revision option, this can also be allowed
to override the branch detection in dcommit, too. This is
potentially dangerous and not recommended! (And also purposely
undocumented, but the loaded gun is there in case somebody
wants to make it safe).
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
canonicalize_path() was previously changed to better
fit SVN 1.5, but it makes the "info" command not match
svn(1) in two places:
1) URL ended up with a trailing slash when run without an
argument.
2) "Path: " was displayed instead of "Path: ." when run
without an argument.
We will also handle odd cases where a user wants to
get information on a file or directory named "0", too.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Previously, if a config entry looked like this:
svn-remote.svn.fetch=:refs/heads/whatever
git-svn would silently do nothing if you asked it to "git svn fetch", and
give a strange error if asked to "git svn dcommit". What it really wants is
a line that looks like this:
svn-remote.svn.fetch=:refs/remotes/whatever
So we should simply abort if we get the wrong thing.
On the other hand, there's actually no good reason for git-svn to enforce
using the refs/remotes namespace, but the code seems to have hardcoded this
in several places and I'm not brave enough to try to fix it all right now.
Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Subversion repositories often require files to have properties such as
svn:mime-type and svn:eol-style set when they are added. Users
typically set these properties automatically using the SVN auto-props
feature with 'svn add'. This commit teaches dcommit to look at the user
SVN configuration and apply matching auto-props entries for files added
by a diff as it is applied to the SVN remote.
Signed-off-by: Brad King <brad.king@kitware.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* sb/dashless:
Make usage strings dash-less
t/: Use "test_must_fail git" instead of "! git"
t/test-lib.sh: exit with small negagive int is ok with test_must_fail
Conflicts:
builtin-blame.c
builtin-mailinfo.c
builtin-mailsplit.c
builtin-shortlog.c
git-am.sh
t/t4150-am.sh
t/t4200-rerere.sh
find-rev and rebase error out on svm because git-svn doesn't trace the
original svn revision numbers back to git commits. The updated test
case, included in the patch, shows the issue and passes with the rest of
the patch applied.
This fixes Git::SVN::find_by_url to find branches based on the
svm:source URL, where useSvmProps is set. Also makes sure cmd_find_rev
and working_head_info use the information they have to correctly track
the source repository. This is enough to get find-rev and rebase
working.
Signed-off-by: João Abecasis <joao@abecasis.name>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When you misuse a git command, you are shown the usage string.
But this is currently shown in the dashed form. So if you just
copy what you see, it will not work, when the dashed form
is no longer supported.
This patch makes git commands show the dash-less version.
For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh
generates a dash-less usage string now.
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
With subversion 1.5.0 (C and perl libraries) the git-svn selftest
t9101-git-svn-props.sh fails at test 25 and 26. The following commands
cause assertions in the svn library
$ cd deeply
$ git-svn propget svn:ignore .
perl: /build/buildd/subversion-1.5.0dfsg1/subversion/libsvn_ra/ra_loader.c:674: svn_ra_get_dir: Assertion `*path != '/'' failed.
Aborted
$ git-svn propget svn:ignore ..
perl: /build/buildd/subversion-1.5.0dfsg1/subversion/libsvn_subr/path.c:120: svn_path_join: Assertion `is_canonical(component, clen)' failed.
With this commit, git-svn makes sure the path doesn't start with a
slash, and is not a dot, working around these assertions.
The breakage was reported by Lucas Nussbaum through
http://bugs.debian.org/489108
Signed-off-by: Gerrit Pape <pape@smarden.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The original sanitization code was just taken from the
remotes2config.sh shell script in contrib.
Credit to Avery Pennarun for noticing this mistake, and Junio
for clarifying the rules for config section names:
Junio C Hamano wrote in <7vfxr23s6m.fsf@gitster.siamese.dyndns.org>:
> In
>
> [foo "bar"] baz = value
>
> foo and baz must be config.c::iskeychar() (and baz must be isalpha()), but
> "bar" can be almost anything.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commit ffe256f9ba ("git-svn: Speed up fetch")
introduced changes that create a temporary file for each object fetched by
svn. These files should be deleted automatically, but perl apparently
doesn't do this until the process exits (or perhaps when its garbage
collector runs).
This means that on a large fetch, especially with lots of branches, we
sometimes fill up /tmp completely, which prevents the next temp file from
being written completely. This is aggravated by the fact that a new temp
file is created for each updated file, even if that update produces a file
identical to one already in git. Thus, it can happen even if there's lots
of disk space to store the finished repository.
We weren't adequately checking for write errors, so this would result in an
invalid file getting committed, which caused git-svn to fail later with an
invalid checksum.
This patch adds a check to syswrite() so similar problems don't lead to
corruption in the future. It also unlink()'s each temp file explicitly
when we're done with it, so the disk doesn't need to fill up.
Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Tested-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Suppose someone fetches git-svn-ified commits from another repo and then
attempts to use 'git-svn init --rewrite-root=foo bar'. Using git svn rebase
after that will fail badly:
* For each commit tried by working_head_info, rebuild is called indirectly.
* rebuild will iterate over all commits and skip all of them because the
URL does not match. Because of that no rev_map file is generated at all.
* Thus, rebuild will run once for every commit. This takes ages.
* In the end there still isn't any rev_map file and thus working_head_info
fails.
Addressing this behaviour fixes an apparently not too uncommon problem with
providing git-svn mirrors of Subversion repositories. Some repositories are
accessed using different URLs depending on whether the user has push
privileges or not. In the latter case, an anonymous URL is often used that
differs from the push URL. Providing a mirror that is usable in both cases
becomes a lot more possible with this change.
Signed-off-by: Jan Krüger <jk@jk.gs>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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>
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>
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>
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>
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>
* 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
* 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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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
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>
* 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
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>
* 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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Previously, git-svn first read the .git/config file for settings as if
current working directory was the repository top-directory, and after
that made sure to cd into top-directory. The result was a silent
failur to read configuration settings. This patch changes the order
these two things are done.
Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
Acked-by: Eric Wong <normalperson@yhbt.net>
Cache the repository root whenever we connect to the repository.
This will allow us to notice URL changes if the user changes the
URL in .git/config, too.
If the repository is no longer accessible, or if `git svn info'
is the first and only command run; then '(offline)' will be
displayed for "Repository Root:" in the output.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Return the svn URL for the given path, or return the svn
repository URL if no path is given.
Added 18 tests to t/t9119-git-svn-info.sh.
Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Implement "git-svn info" for files and directories based on the
"svn info" command. Note that the -r/--revision argument is not
supported yet.
Added 18 tests in t/t9119-git-svn-info.sh.
[ew: small fix to work without arguments on all working directories]
Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Extacted canonicalize_path() in the main package.
Created new Git::SVN::Util package with an md5sum() function. A
new package was created so that Digest::MD5 did not have to be
loaded in the main package. Replaced code in the SVN::Git::Editor
and SVN::Git::Fetcher packages with calls to md5sum().
Extracted the format_svn_date(), parse_git_date() and
set_local_timezone() functions within the Git::SVN::Log package.
Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
When unreachable revisions are given to "svn log", it displays all commit
logs in the given range that exist in the current tree. (If no commit
logs are found in the current tree, it simply prints a single commit log
separator.) This patch makes "git-svn log" behave the same way.
Ten tests added to t/t9116-git-svn-log.sh.
Signed-off-by: David D Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
The "svn log -rM:N" command shows commit logs inclusive in the range [M,N].
Previously "git-svn log" always excluded the commit log for the smallest
revision in a range, whether the range was ascending or descending. With
this patch, the smallest revision in a range is always shown.
Updated tests for ascending and descending revision ranges.
Signed-off-by: David D Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Fixed typo in Git::SVN::Log::git_svn_log_cmd(). Previously a command like
"git-svn log -r1:4" would only show a commit log separator.
Added tests for ascending and descending revision ranges.
Signed-off-by: David D Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
When doing dcommit git-svn must use subversion's config or newly created
files will not include svn's properties
(defined in [auto-props] with 'enable-auto-props = yes').
Signed-off-by: Konstantin V. Arkhipov <voxus@onphp.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
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>
* maint:
for-each-ref: fix off by one read.
git-branch: remove mention of non-existent '-b' option
git-svn: prevent dcommitting if the index is dirty.
Fix memory leak in traverse_commit_list
dcommit uses rebase to sync the history with what has just been pushed to
SVN. Trying to dcommit with a dirty index is troublesome for rebase, so now
the user will get an error message if he attempts to dcommit with a dirty
index.
Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
Remove a couple of duplicated include
grep with unmerged index
git-daemon: fix remote port number in log entry
git-svn: t9114: verify merge commit message in test
git-svn: fix dcommit clobbering when committing a series of diffs
Our revision number sent to SVN is set to the last revision we
committed if we've made any previous commits in a dcommit
invocation.
Although our SVN Editor code uses the delta of two (old) trees
to generate information to send upstream, it'll still send
complete resultant files upstream; even if the tree they're
based against is out-of-date.
The combination of sending a file that does not include the
latest changes, but set with a revision number of a commit we
just made will cause SVN to accept the resultant file even if it
was generated against an old tree.
More trouble was caused when fixing this because we were
rebasing uncessarily at times. We used git-diff-tree to check
the imported SVN revision against our HEAD, not the last tree we
committed to SVN. The unnecessary rebasing caused merge commits
upstream to SVN to fail.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
"git svn <cmd> --help" gave options in the order they were found in a
Perl hash, which meant "randomly" to humans.
Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-svn.perl (&fatal): Append the newline at the end of the error
message.
Adjust all callers.
Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This allows one to easily retrieve a list of svn properties from within
git-svn without requiring svn or knowing the URL of a repository.
* git-svn.perl (%cmd): Add the command `proplist'.
(&cmd_proplist): New.
* t/t9101-git-svn-props.sh: Test git svn proplist.
Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This allows one to easily retrieve a single SVN property from within
git-svn without requiring svn or remembering the URL of a repository
* git-svn.perl (%cmd): Add the new command `propget'.
($cmd_dir_prefix): New global.
(&get_svnprops): New helper.
(&cmd_propget): New. Use &get_svnprops.
* t/t9101-git-svn-props.sh: Add a test case for propget.
[ew: make sure the rev-parse --show-prefix call doesn't break
the `git-svn clone' command]
Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git svn create-ignore (to create one .gitignore per directory
from the svn:ignore properties. This has the disadvantage of
committing the .gitignore during the next dcommit, but when you
import a repo with tons of ignores (>1000), using git svn show-ignore
to build .git/info/exclude is *not* a good idea, because things like
git-status will end up doing >1000 fnmatch *per file* in the repo,
which leads to git-status taking more than 4s on my Core2Duo 2Ghz 2G
RAM)
* git-svn.perl (%cmd): Add the new command `create-ignore'.
(&cmd_create_ignore): New.
* t/t9101-git-svn-props.sh: Adjust the test-case for show-ignore and
add a test case for create-ignore.
[ew: added commit message from
<05CAB148-56ED-4FF1-8AAB-4BA2A0B70C2C@lrde.epita.fr> ]
Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* git-svn.perl (&traverse_ignore): Remove.
(&prop_walk): New.
(&cmd_show_ignore): Use prop_walk.
[ew: This will ease the implementation of the `create-ignore',
`propget', and `proplist' commands]
Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Some variables coming from the Subversion's Perl bindings are used
in our code only once, so the interpreter warns us about it. These
warnings are false-positives, because the variables themselves are
initialized in the binding's guts, that are made by SWIG.
Credits to Sam Vilain for his note about "no warnings 'once'".
[ew: minor formatting change]
Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Parameters 'store-passwords' and 'store-auth-creds' from Subversion's
configuration (~/.subversion/config) were not respected. This was
fixed: the default values for these parameters are set to 'yes' to
follow Subversion behaviour.
Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
In most cases of branching, the tree is copied unmodified from the trunk
to the branch. When that is done, we can simply start with the parent's
index and apply the changes on the branch as usual.
[ew: rewritten from Steven's original to use SVN::Client instead
of the command-line svn client.
Since SVN::Client connects separately, we'll share our
authentication providers array between our usages of
SVN::Client and SVN::Ra, too. Bypassing the high-level
SVN::Client library can avoid this, but the code will be
much more complex. Regardless, any implementation of this
seems to require restarting a connection to the remote
server.
Also of note is that SVN 1.4 and later allows a more
efficient diff_summary to be done instead of a full diff,
but since this code is only to support SVN < 1.4.4, we'll
ignore it for now.]
Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
git-svn: don't attempt to spawn pager if we don't want one
Supplant the "while case ... break ;; esac" idiom
User Manual: add a chapter for submodules
user-manual: don't assume refs are stored under .git/refs
Detect exec bit in more cases.
Conjugate "search" correctly in the git-prune-packed man page.
Move the paragraph specifying where the .idx and .pack files should be
Documentation/git-lost-found.txt: drop unnecessarily duplicated name.
Even though config_pager() unset the $pager variable, we were
blindly calling exec() on it through run_pager().
Noticed-by: Chris Moore <christopher.ian.moore@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Use the rev-list --parents functionality to read the parents
of the commit. cat-file only shows the raw object with the
original parents and doesn't take into account grafts; so
we'll rely on rev-list machinery for the smarts here.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
We have a workaround for the reparent function not working
correctly on the SVN native protocol servers. This workaround
opens a new connection (SVN::Ra object) to the new
URL/directory.
Since libsvn appears limited to only supporting one connection
at a time, this workaround invalidates the Git::SVN::Ra object
that is $self inside gs_fetch_loop_common(). So we need to
restart that connection once all the fetching is done for each
loop iteration to be able to run get_log() successfully.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This makes git-svn unconditionally invoke git-log with --first-parent when
it is trying to discover its upstream subversion branch and collecting the
commit ids which should be pushed to it with dcommit. The reason for always
using --first-parent is to make git-svn behave in a predictable way when the
ancestry chain contains merges with other git-svn branches.
Since git-svn now always uses 'git-log --first-parent' there is no longer
any need for the --first-parent option to git-svn, so this is removed.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When git-svn uses git-log to find embedded 'git-svn-id'-lines in commit
messages, it can get confused when local history contains merges with
other git-svn branches. But if --first-parent is supplied to git-log,
working_head_info() will only see 'branch-local' commits and thus the
first commit containing a 'git-svn-id' line should refer to the correct
subversion branch.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Although dcommit could detect if the first commit in the series
would conflict with the HEAD revision in SVN, it could not
detect conflicts in further commits it made.
Now we rebase each uncommitted change after each revision is
committed to SVN to ensure that we are up-to-date. git-rebase
will bail out on conflict errors if our next change cannot be
applied and committed to SVN cleanly, preventing accidental
clobbering of changes on the SVN-side.
--no-rebase users will have trouble with this, and are thus
warned if they are committing more than one commit. Fixing this
for (hopefully uncommon) --no-rebase users would be more complex
and will probably happen at a later date.
Thanks to David Watson for finding this and the original test.
Signed-off-by: Junio C Hamano <gitster@pobox.com>