4

According to this question, you can edit your .gitconfig and tell git-svn where to go about to push your latest code change.

In my case, I have a special case where nor the Tags and nor the Branches can be used. So, if you look at the SVN repo, you see something like this:

trunk
branches
tags
xtra

I am new to git-svn and up to know I was fine with working directly with the trunk. Things changed and I need to work with xtra folder and create subfolders in there e.g. xtra/Job1234/ and push into it. How can I do such change ?

If I type git svn info, I get:

URL: https://some.net/repositories/myproject/base/trunk

Clearly, any git svn dcommit pushes things to the trunk. Any leads ?

Community
  • 1
  • 1
user643605
  • 173
  • 2
  • 3
  • 11

2 Answers2

1

Try this:

$ git config --add svn-remote.svn.branches "xtra/*:refs/remotes/xtra/*"       ①
$ git svn branch -d xtra Job1234                                              ②
$ git checkout --track remotes/xtra/Job1234                                   ③

... and you should be ready to commit!


Yes, you can also do the equivalent of ① by directly editing .git/config.

ulidtko
  • 14,740
  • 10
  • 56
  • 88
  • Progress but not there yet. – user643605 Oct 09 '13 at 15:16
  • When I type: $git svn branch -d base/xtra Job1234 ...I get an error saying that the destination does not exist... When you look at it you wind up with the destination looking like: https://.net/repo/base/base/xtra/Job1234... For some reason base is there twice – user643605 Oct 09 '13 at 15:30
  • @user643605, that means that my guess about your Subversion repo root was wrong. (You should've specified it in your question). See edit. – ulidtko Oct 09 '13 at 15:32
  • So I changed the first command line from "base/xtra/*:refs/remotes/xtra/* to "/xtra/*:refs/remotes/xtra/*" ... Then I type the second command line and I get an error: " ...searching aggressively for old history"... For some reason something is not found and it starts iterating to fix it. – user643605 Oct 09 '13 at 15:40
  • "searching aggressively for old history" is not an error. Read carefully that line from begginning to end, and the previous one. `git-svn` is working as expected, you can verify that with `git branch -av` when it completes. – ulidtko Oct 09 '13 at 15:46
  • 1
    this is what I did and it worked for me. 1) Added a line in .git/config under [svn-remote "svn"] branches = xtra/my_repo/*:refs/remotes/my_repo/* 2) git svn branch -d xtra/my_repo Job1234 3) git checkout --track refs/remotes/my_repo/Job1234... thanks to ulidtko! – user643605 Oct 09 '13 at 20:16
0

Note that git svn branch can segfault before Git 2.17 (Q2 2018) will provide a workaround for segfault with more recent versions of SVN.

See commit 7f6f75e (29 Jan 2018) by Eric Wong (ele828).
(Merged by Junio C Hamano -- gitster -- in commit 9cd5320, 13 Feb 2018)

git-svn: control destruction order to avoid segfault

It seems necessary to control destruction ordering to avoid a segfault with SVN 1.9.5 when using "git svn branch".
I've also reported the problem against libsvn-perl to Debian Bug #888791, but releasing the SVN::Client instance can be beneficial anyways to save memory.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250