From 7d9fd459f1f5064b421837e46fe87118a07f6d6c Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Thu, 19 Feb 2009 13:08:04 -0500 Subject: git-svn: Create leading directories in create-ignore 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 Acked-by: Eric Wong diff --git a/git-svn.perl b/git-svn.perl index cbc5211..ef01fb9 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -670,7 +670,11 @@ sub cmd_create_ignore { $gs->prop_walk($gs->{path}, $r, sub { my ($gs, $path, $props) = @_; # $path is of the form /path/to/dir/ - my $ignore = '.' . $path . '.gitignore'; + $path = '.' . $path; + # SVN can have attributes on empty directories, + # which git won't track + mkpath([$path]) unless -d $path; + my $ignore = $path . '.gitignore'; my $s = $props->{'svn:ignore'} or return; open(GITIGNORE, '>', $ignore) or fatal("Failed to open `$ignore' for writing: $!"); -- cgit v0.10.2-6-g49f6 From 83c2fcff214fe89649fcd88e095d9961a36b53dd Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 22 Feb 2009 20:25:00 -0800 Subject: git-svn: fix delete+add branch tracking with empty files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original bug report and test case by Björn Steinbrink. Björn Steinbrink 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 diff --git a/git-svn.perl b/git-svn.perl index ef01fb9..bce24a8 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -2421,6 +2421,7 @@ sub find_parent_branch { # do_switch works with svn/trunk >= r22312, but that # is not included with SVN 1.4.3 (the latest version # at the moment), so we can't rely on it + $self->{last_rev} = $r0; $self->{last_commit} = $parent; $ed = SVN::Git::Fetcher->new($self, $gs->{path}); $gs->ra->gs_do_switch($r0, $rev, $gs, diff --git a/t/t9136-git-svn-recreated-branch-empty-file.sh b/t/t9136-git-svn-recreated-branch-empty-file.sh new file mode 100755 index 0000000..733d16e --- /dev/null +++ b/t/t9136-git-svn-recreated-branch-empty-file.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +test_description='test recreated svn branch with empty files' + +. ./lib-git-svn.sh +test_expect_success 'load svn dumpfile' ' + svnadmin load "$rawsvnrepo" < "${TEST_DIRECTORY}/t9136/svn.dump" + ' + +test_expect_success 'clone using git svn' 'git svn clone -s "$svnrepo" x' + +test_done diff --git a/t/t9136/svn.dump b/t/t9136/svn.dump new file mode 100644 index 0000000..6b1ce0b --- /dev/null +++ b/t/t9136/svn.dump @@ -0,0 +1,192 @@ +SVN-fs-dump-format-version: 2 + +UUID: eecae021-8f16-48da-969d-79beb8ae6ea5 + +Revision-number: 0 +Prop-content-length: 56 +Content-length: 56 + +K 8 +svn:date +V 27 +2009-02-22T00:50:56.292890Z +PROPS-END + +Revision-number: 1 +Prop-content-length: 106 +Content-length: 106 + +K 7 +svn:log +V 4 +init +K 10 +svn:author +V 8 +john.doe +K 8 +svn:date +V 27 +2009-02-22T00:50:57.192384Z +PROPS-END + +Node-path: branches +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: tags +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: trunk +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: trunk/file +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 0 +Text-content-md5: d41d8cd98f00b204e9800998ecf8427e +Content-length: 10 + +PROPS-END + + +Revision-number: 2 +Prop-content-length: 105 +Content-length: 105 + +K 7 +svn:log +V 3 +1.0 +K 10 +svn:author +V 8 +john.doe +K 8 +svn:date +V 27 +2009-02-22T00:50:58.124724Z +PROPS-END + +Node-path: tags/1.0 +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 1 +Node-copyfrom-path: trunk + + +Revision-number: 3 +Prop-content-length: 111 +Content-length: 111 + +K 7 +svn:log +V 9 +1.0.1-bad +K 10 +svn:author +V 8 +john.doe +K 8 +svn:date +V 27 +2009-02-22T00:50:58.151727Z +PROPS-END + +Node-path: tags/1.0.1 +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 2 +Node-copyfrom-path: tags/1.0 + + +Revision-number: 4 +Prop-content-length: 111 +Content-length: 111 + +K 7 +svn:log +V 9 +Wrong tag +K 10 +svn:author +V 8 +john.doe +K 8 +svn:date +V 27 +2009-02-22T00:50:58.167427Z +PROPS-END + +Node-path: tags/1.0.1 +Node-action: delete + + +Revision-number: 5 +Prop-content-length: 113 +Content-length: 113 + +K 7 +svn:log +V 10 +1.0-branch +K 10 +svn:author +V 8 +john.doe +K 8 +svn:date +V 27 +2009-02-22T00:50:58.184498Z +PROPS-END + +Node-path: branches/1.0 +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 4 +Node-copyfrom-path: tags/1.0 + + +Revision-number: 6 +Prop-content-length: 113 +Content-length: 113 + +K 7 +svn:log +V 10 +1.0.1-good +K 10 +svn:author +V 8 +john.doe +K 8 +svn:date +V 27 +2009-02-22T00:50:58.200695Z +PROPS-END + +Node-path: tags/1.0.1 +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 5 +Node-copyfrom-path: branches/1.0 + + -- cgit v0.10.2-6-g49f6 From 0df84059d4127ed06e040998ec0e6ce6f61d3d1f Mon Sep 17 00:00:00 2001 From: Peter Oberndorfer Date: Mon, 23 Feb 2009 12:02:53 +0100 Subject: git-svn: read the dcommit url from the config file on a per remote basis The commit url for dcommit is determined in the following order: commandline option --commit-url svn.commiturl svn-remote..commiturl svn-remote..url Signed-off-by: Peter Oberndorfer Acked-by: Eric Wong diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt index 3d45654..cda3389 100644 --- a/Documentation/git-svn.txt +++ b/Documentation/git-svn.txt @@ -169,6 +169,10 @@ and have no uncommitted changes. reused if a user is later given access to an alternate transport method (e.g. `svn+ssh://` or `https://`) for commit. +config key: svn-remote..commiturl + +config key: svn.commiturl (overwrites all svn-remote..commiturl options) + Using this option for any other purpose (don't ask) is very strongly discouraged. -- diff --git a/git-svn.perl b/git-svn.perl index bce24a8..d8476c8 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -438,7 +438,17 @@ sub cmd_dcommit { die "Unable to determine upstream SVN information from ", "$head history.\nPerhaps the repository is empty."; } - $url = defined $_commit_url ? $_commit_url : $gs->full_url; + + if (defined $_commit_url) { + $url = $_commit_url; + } else { + $url = eval { command_oneline('config', '--get', + "svn-remote.$gs->{repo_id}.commiturl") }; + if (!$url) { + $url = $gs->full_url + } + } + my $last_rev = $_revision if defined $_revision; if ($url) { print "Committing to $url ...\n"; -- cgit v0.10.2-6-g49f6