git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Steven Walter <stevenrwalter@gmail.com>
To: git@vger.kernel.org
Cc: normalperson@yhbt.net
Subject: git-svn and branches
Date: Wed, 26 Sep 2007 22:12:52 -0400	[thread overview]
Message-ID: <20070927021252.GA23777@dervierte> (raw)

I'm using git-svn to track a rather large subversion repository with a
non-standard layout.  In the past, I've only cared about trunk, but now
I need to occasionally use branches, too.  By adding a second git-svn
remote with the branch URL, I can fetch the branch, and git-svn is even
intelligent enough to notice that the branch was copied off of trunk.

However, git-svn also does a complete checkout for the first revision of
the branch.  By this, I mean it goes through shows "A    file" for every
file in the repository.  This takes quite a while, and seems rather
unnecessary given that git-svn already noticed that the branch shares a
history with trunk, which is already fetched.

Knowing just enough of what git-svn is doing to be dangerous, I whipped
up a short little patch.  This patch seems to work for the common case,
and avoids fetching every file from subversion.  It does break
sometimes, however, and I don't understand why.

Maybe someone with a better grasps of the code can see what I did wrong,
or suggest a better means to my end?

diff --git a/git-svn.perl b/git-svn.perl
index 484b057..1bc92b6 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1848,9 +1848,10 @@ sub find_parent_branch {
                                              $self->full_url, $ed)
                          or die "SVN connection failed somewhere...\n";
                } else {
+                       $self->assert_index_clean($parent);
                        print STDERR "Following parent with do_update\n";
                        $ed = SVN::Git::Fetcher->new($self);
-                       $self->ra->gs_do_update($rev, $rev, $self, $ed)
+                       $self->ra->gs_do_update($rev, $r0, $self, $ed)
                          or die "SVN connection failed somewhere...\n";
                }
                print STDERR "Successfully followed parent\n";
-- 
-Steven Walter <stevenrwalter@gmail.com>
"A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet, balance
accounts, build a wall, set a bone, comfort the dying, take orders,
give orders, cooperate, act alone, solve equations, analyze a new
problem, pitch manure, program a computer, cook a tasty meal, fight
efficiently, die gallantly. Specialization is for insects."
   -Robert Heinlein

             reply	other threads:[~2007-09-27  2:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-27  2:12 Steven Walter [this message]
2007-09-27  6:36 ` git-svn and branches Sam Vilain
2007-09-27  7:24 ` Eric Wong
2007-09-28 17:19   ` Steven Walter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070927021252.GA23777@dervierte \
    --to=stevenrwalter@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=normalperson@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).