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>