Introduce a new option 'svn.pathnameencoding' that instructs git svn to
recode pathnames to a given encoding. It can be used by windows users
and by those who work in non-utf8 locales to avoid corrupted file names
with non-ascii characters.
[rp: renamed the option and added manpage documentation]
Signed-off-by: Dmitry Statyvka <dstatyvka@tmsoft-ltd.kiev.ua>
Signed-off-by: Robert Pollak <robert.pollak@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Apparently using the Storable module during global destruction is
unsafe - there is a bug which can cause segmentation faults:
http://rt.cpan.org/Public/Bug/Display.html?id=36087http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482355
The persistent memoization support introduced in commit 8bff7c538
relied on global destruction to write cached data, which was leading
to segfaults in some Perl configurations. Calling Memoize::unmemoize
in the END block forces the cache writeout to be performed earlier,
thus avoiding the bug.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Acked-by: Eric Wong <normalperson@yhbt.net>
svn:// servers are more picky regarding redundant slashes
than file:// and http(s)://-backed respositories. Since
the last commit, we avoid putting unnecessary slashes in
$GIT_CONFIG, but this doesn't help users who are already
set up that way.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
The following command
git svn clone \
-r9500:10006 \
svn://svn.debian.org/svn/pkg-games/packages \
--trunk=/trunk/freedoom \
--branches=/branches/freedoom \
--tags=/tags/freedoom \
freedoom.git.2009091
produces strange results:
With v1.6.3.3 (and perhaps earlier versions), this would fetch up to
and including r9978 (the last revision of the no_iwad_alternatives
branch before it was deleted), check it out, and prematurely declare
success, leaving out some commits to the trunk (r9984, r9985, r10006)
from after the branch was merged.
With v1.6.5-rc0~74 (svn: allow branches outside of refs/remotes,
2009-08-11) and later, this fetches up to and including r9978 and then
attempts a post-fetch checkout and fails.
r9978 = 25f0920175c395f0f22f54ae7a2318147f745274
(refs/remotes/no_iwad_alternatives)
fatal: refs/remotes/trunk: not a valid SHA1
update-ref refs/heads/master refs/remotes/trunk: command returned error: 128
Checking .git/config reveals
fetch = packages//trunk/freedoom:refs/remotes/trunk
And with both 1.6.3.3 and 1.7.1, using --trunk=trunk/freedom without
the leading slash (/) works fine.
Moral: git-svn needs to scrub an initial / from $_trunk and related
arguments it receives. Make it so.
Reported-by: Jon Dowland <jmtd@debian.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Avoid attempts to stat() the contents of '', which could happen
when the root directory is empty. Additionally, remove the
unnecessary '_' stat optimization since it was confusing and
possibly throwing off the non-existent case.
[ew: fixed indentation, rewrote commit message]
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Michael J. Kiwala <mkiwala@genome.wustl.edu>
git-check-ref-format(1) describes names which
cannot be used as refnames for git. Some are
legal branchnames in subversion however.
Mangle the not yet handled cases.
Signed-off-by: Torsten Schmutzler <git-ts@theblacksun.eu>
Acked-by: Eric Wong <normalperson@yhbt.net>
The use line was added in ffe256f9. File::Temp calls were later moved
to Git.pm in 0b19138b, but that commit neglected to remove the
now-redundant import.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
When "git svn reset" is called with an invalid revision, we
bail out and show the user a proper error message instead
of giving them a cryptic one related to git-svn internals.
ref: http://bugs.debian.org/578908
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Reported-by: Jens Seidel <jensseidel@users.sf.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Detecting of merges from svn:mergeinfo or svk merge tickets failed
with rewrite-root option. This fixes it.
Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
by requesting SVN::Core which is needed for the svn version.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
git-svn rebase used to have issues with CRLF conversion. Since these issues
have been fixed, we can safely revert the work-around that disables CRLF
conversion.
This reverts commit d3c9634eac.
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
The delayed loading of SVN missed a place where SVN::Core is used. Make
sure to load the package before trying to use it.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
git-svn reads passwords from an interactive terminal.
This behavior cause GUIs to hang waiting for git-svn to
complete
Fix this problem by allowing a password-retrieving command
to be specified in GIT_ASKPASS. SSH_ASKPASS is supported
as a fallback when GIT_ASKPASS is not provided.
Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* jn/maint-fix-pager:
tests: Fix race condition in t7006-pager
t7006-pager: if stdout is not a terminal, make a new one
tests: Add tests for automatic use of pager
am: Fix launching of pager
git svn: Fix launching of pager
git.1: Clarify the behavior of the --paginate option
Make 'git var GIT_PAGER' always print the configured pager
Fix 'git var' usage synopsis
Importing functions from a .dll into Git for Windows' perl is pretty slow,
so let's avoid importing if it is not necessary.
This seems particularly slow in virtualized enviroments. Before this
change (on my machine):
$ time perl /libexec/git-core/git-svn rebase
Current branch master is up to date.
real 2m56.750s
user 0m3.129s
sys 2m39.232s
Afterwards:
$ time perl /libexec/git-core/git-svn rebase
Current branch master is up to date.
real 0m33.407s
user 0m1.409s
sys 0m23.054s
git svn rebase -n goes from 3m7.046s to 0m10.312s.
Signed-off-by: Josh Robb <josh_robb@fastmail.fm>
Acked-by: Eric Wong <normalperson@yhbt.net>
If parent J is an ancestor of parent I, then parent J should be
discarded, not I.
Note that J is an ancestor of I if and only if rev-list I..J is emtpy,
which is what we are testing here.
Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
In commit dec543e (am -i, git-svn: use "git var GIT_PAGER"), I tried
to teach git svn to defer to git var on what pager to use. In the
process, I introduced two bugs:
- The value set for $pager in config_pager has local scope, so
run_pager never sees it;
- git var cannot tell whether git svn’s output is going to a
terminal, so the value chosen for $pager does not reflect that
information.
Fix them.
Reported-by: Sebastian Celis <sebastian@sebastiancelis.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Make memoization of the svn:mergeinfo processing functions persistent with
Memoize::Storable so that the memoization tables don't need to be regenerated
every time the user runs git-svn fetch.
The Memoize::Storable hashes are stored in ENV{GIT_DIR}/svn/.caches.
[ew: changed caches path to avoid conflicts with old repos]
[ew: File::Path::{make_path => mkpath} for compatibility]
[ew: line-wrapped at 80 chars]
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Andrew Myrick <amyrick@apple.com>
In contrast to GIT_SSH, SVN_SSH requires quotes for paths that contain
spaces. As GIT_SSH will not work if it contains quotes, it is safe to
assume it never contains quotes. Also, adding quotes to SVN_SSH for paths
that do not contain spaces does no harm. So we always add quotes when
deriving SVN_SSH from GIT_SSH on msys.
This fixes msysGit issue 385, see
http://code.google.com/p/msysgit/issues/detail?id=385
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
For very large projects it is useful to be able to clone a subset of the
upstream SVN repo's branches. Allow for this by letting the left-side of
the branches and tags glob specs contain a brace-delineated comma-separated
list of names. e.g.:
branches = branches/{red,green}/src:refs/remotes/branches/*
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
In certain situations it may be necessary to manually remap an svn
repostitory UUID. For example:
o--- [git-svn clone]
/
[origin svn repo]
\
o--- [svnsync clone]
Imagine that only "git-svn clone" and "svnsync clone" are made available
to external users. Furthur, "git-svn clone" contains only trunk, and for
reasons unknown, "svnsync clone" is missing the revision properties that
normally provide the origin svn repo's UUID.
A git user who has cloned the "git-svn clone" repo now wishes to use
git-svn to pull in the missing branches from the "synsync clone" repo.
In order for git-svn to get the history correct for those branches,
it needs to know the origin svn repo's UUID. Hence rewriteUUID.
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Add ability to specify on the command line the username to perform the
operation as and the writable URL of the repository to perform it on.
[ew: shortened subject]
Signed-off-by: Igor Mironov <igor.a.mironov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
When constructing a destination URL, use the property 'commiturl' if it
is specified in the configuration file; otherwise take 'url' as usual.
This accommodates the scenario where a user only wants to involve the
writable repository in operations performing a commit and defaults
everything else to a read-only URL.
[ew: shortened subject]
Signed-off-by: Igor Mironov <igor.a.mironov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Change git-svn to warn and continue when merge-base fails while processing svn
merge tickets.
merge-base can fail when a partial branch is created and merged back to trunk
in svn, because it cannot find a common ancestor between the partial branch and
trunk.
Signed-off-by: Andrew Myrick <amyrick@apple.com>
Acked-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Update git-svn to ignore commits that do not change the tree when it is
deciding if an svn merge ticket represents a real branch merge or just a
cherry-pick.
Consider the following integration model in the svn repository:
F---G branch1
/ \
D tag1 \ E tag2
/ \ /
A---B C trunk
branch1 is merged to trunk in commit C.
With this patch, git-svn will correctly identify branch1 as a proper merge
parent, instead of incorrectly ignoring it as a cherry-pick.
Signed-off-by: Andrew Myrick <amyrick@apple.com>
Acked-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
svn+ssh:// repositories often have userinfo embedded in the URL
which were stripped out of the "git-svn-id:" trailers. Since
the SVN::Client::copy function takes userinfo into account when
matching URLs for SVN repositories, we need to retrieve the full
URL with embedded userinfo in it to avoid mismatched URLs.
Tested-by: Florian Köberle <florian@fkoeberle.de>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
This appears to be a trivial case where array indices were being
passed to git rev-list, instead of the contents stored in the
array itself.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Change git-svn not to impose a limit of 16 parents on a merge.
This limit in git-svn artificially prevents cloning svn repositories
that contain commits with more than 16 merge parents.
The limit was removed from builtin-commit-tree.c for git v1.6.0 in commit
ef98c5cafb, so there is no need to check for it
it in git-svn.
Signed-off-by: Andrew Myrick <amyrick@apple.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
The old function was incorrect; in some instances it marks a cherry picked
range as a merged branch (because of an incorrect assumption that
'rev-list COMMIT --not RANGE' would work). This is replaced with a
function which should detect them correctly, memoized to limit the expense
of dealing with branches with many cherry picks to one 'merge-base' call
per merge, per branch which used cherry picking.
Signed-off-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
The old function would have to check all mentioned merge tips, every time
that the mergeinfo ticket changed. This involved 1-2 rev-list operation
for each listed mergeinfo line. If there are a lot of feature branches
being merged into a trunk, this makes for a very expensive operation for
detecting the new parents on every merge.
This new version first uses a single 'rev-list' to figure out which commit
ranges are already reachable from the parents. This is used to eliminate
the already merged branches from the list.
Signed-off-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
SVN's list of commit ranges in mergeinfo tickets is inclusive, whereas
git commit ranges are exclusive on the left hand side. Also, the end
points of the commit ranges may not exist; they simply delineate
ranges of commits which may or may not exist. Fix these two mistakes.
Signed-off-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Each time the svn mergeinfo ticket changes, we look it up in the rev_map;
when there are a lot of merged branches, this will result in many repeated
lookups of the same information for subsequent commits. Arrange the slow
part of the function so that it may be memoized, and memoize it. The more
expensive revision walking operation can be memoized separately.
[ew: changed "next" to "return" for function exit]
Signed-off-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
When using the -r/--revision argument to fetch deleted history,
calling SVN::Ra::get_log() from an SVN::Ra object initialized
to track the deleted URL will fail.
This regression was introduced in:
commit 4aacaeb3dc
"fix shallow clone when upstream revision is too new"
We now ignore errors from SVN::Ra::get_log() here because using
--revision will always override the value of $head here if
(and only if) we're tracking deleted directories.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
The "git svn gc" command creates and appends to unhandled.log.gz
files which should be parsed before the uncompressed
unhandled.log files.
Reported-by: Robert Zeh
Signed-off-by: Eric Wong <normalperson@yhbt.net>
If a clone errors out because of a missing author, or user interrupt,
this allows `git svn fetch` to resume seamlessly, rather than forcing
the user to re-provide the path to the authors file.
[ew: shortened subject]
Signed-off-by: Alex Vandiver <alex@chmrr.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
If --authors-file is passed a relative path, cloning will work, but
future `git svn fetch`es will fail to locate the authors file
correctly. Thus, use File::Spec->rel2abs to determine an absolute
path for the authors file before setting it.
Signed-off-by: Alex Vandiver <alex@chmrr.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
This also adds a test case for:
"git svn: Don't create empty directories whose parents were deleted"
which was the reason we found this bug in the first place.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Commit 6111b93 "git svn: attempt to create empty dirs on clone+rebase"
will create empty directories 'a/b' and 'a/c' if they were previously
created in SVN, even if their parent directory 'a' was deleted.
For example, unhandled.log may contain lines like this:
r32
+empty_dir: packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/acl
+empty_dir: packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/machine.d
+empty_dir: packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/moira-acl
[...]
r314
-empty_dir: packages/sipb-xen-remctl-auto
[ew: rewrote to be line-wrapped at <= 80-columns]
Reported-by: Evan Broder <broder@mit.edu>
Signed-off-by: Greg Price <price@ksplice.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
When merging branches based on svk:merge properties, a single merge
can have updated or added multiple svk:merge lines. Attempt to
include the minimal set of parents by sorting the merge properties in
order of revision, highest to lowest.
Signed-off-by: Alex Vandiver <alex@chmrr.net>
Acked-by: Sam Vilain <sam@vilain.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Since unhandled.log stores paths relative to the repository
root, we need to strip out leading path components if the
directories we're tracking are not the repository root.
Reported-by: Björn Steinbrink
Signed-off-by: Eric Wong <normalperson@yhbt.net>
The internal no_reuse_existing flag is set to allow initializing
multiple remotes with the same URL, common with SVM users.
Unfortunately, this flag caused misbehavior when used
with the -R command-line flag for fetching.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
* jn/editor-pager:
Provide a build time default-pager setting
Provide a build time default-editor setting
am -i, git-svn: use "git var GIT_PAGER"
add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR"
Teach git var about GIT_PAGER
Teach git var about GIT_EDITOR
Suppress warnings from "git var -l"
Do not use VISUAL editor on dumb terminals
Handle more shell metacharacters in editor names
We parse unhandled.log files for empty_dir statements and make a
best effort attempt to recreate empty directories on fresh
clones and rebase. This should cover the majority of cases
where users work off a single branch or for projects where
branches do not differ in empty directories.
Since this cannot affect "normal" git commands like "checkout"
or "reset", so users switching between branches in a single
working directory should use the new "git svn mkdirs" command
after switching branches.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Since $GIT_DIR does not exist when initializing new repositories,
we can follow back to the global and system config files for
git.
The logic for this was originally introduced when
$GIT_DIR/config was the only config file git could read (back
when "git config" was "git repo-config"), so the function is
renamed to "read_git_config" instead of "read_repo_config".
Signed-off-by: Eric Wong <normalperson@yhbt.net>
When recording the revisions that it has merged, SVN sets the top
revision to be the latest revision in the repository, which is not
necessarily a revision on the branch that is being merged from. When
it is not on the branch, git-svn fails to add the extra parent to
represent the merge because it relies on finding the commit on the
branch that corresponds to the top of the SVN merge range.
In order to correctly handle this case, we look for the maximum
revision less than or equal to the top of the SVN merge range that is
actually on the branch being merged from.
[ew: This includes the following (squashed) commit to prevent
errors during bisect:]
Author: Toby Allsopp <toby.allsopp@navman.co.nz>
Date: Fri Nov 13 09:48:39 2009 +1300
git-svn: add (failing) test for SVN 1.5+ merge with intervening commit
This test exposes a bug in git-svn's handling of SVN 1.5+ mergeinfo
properties. The problematic case is when there is some commit on an
unrelated branch after the last commit on the merged-from branch.
When SVN records the mergeinfo property, it records the latest
revision in the whole repository, which, in the problematic case, is
not on the branch it is merging from.
To trigger the git-svn bug, we modify t9151 to include two SVN merges,
the second of which has an intervening commit. The SVN dump was
generated using SVN 1.6.6 (on Debian squeeze amd64).
Signed-off-by: Toby Allsopp <toby.allsopp@navman.co.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
Use the new "git var GIT_PAGER" command to ask what pager to use.
Without this change, the core.pager configuration is ignored by
these commands.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Use the new "git var GIT_EDITOR" feature to decide what editor to
use, instead of duplicating its logic elsewhere. This should make
the behavior of commands in edge cases (e.g., editor names with
spaces) a little more consistent.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This feature is long overdue; convert SVN's merge representation to git's
as revisions are imported. This works by converting the list of revisions
in each line of the svn:mergeinfo into git revision ranges, and then
checking the latest of each of these revision ranges for A) being new and
B) now being completely merged.
Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
SVK is a simple case to start with, as its idea of merge parents
matches git's one. When a svk:merge ticket is encountered, check each
of the listed merged revisions to see if they are in the history of
this commit; if not, then we have encountered a merge - record it.
[ew: minor formatting cleanups]
Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
In cases where the top-level URL we're tracking is the path we
glob against, we can once again track odd repositories that keep
branches/tags at the top level. This regression was introduced
in commit 6f5748e14c.
Thanks to Daniel Cordero for the original bug report and
bisection.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
After doing a rebase, git-svn checks that the SVN URL
is what it expects. However, it does not account for
rewriteRoot, which is a legitimate way for the URL
to change. This produces a lot of spurious errors.
[ew: fixed line wrapping]
Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Previously, the call to authors-prog was not properly escaped, so any
special characters in the Subversion username, such as spaces and
semi-colons, would be interpreted by the shell rather than being passed
in as the first argument. Now all unsafe characters are escaped using
"git rev-parse --sq-quote"
[ew: switched from "\Q..\E" to "rev-parse --sq-quote"]
Signed-off-by: Mark Lodato <lodatom@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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>