简体   繁体   中英

Git-svn branch hoses dcommit when using an odd branch structure

I had a boss, past-tense, who decided to put svn branches in the same folder as trunk. Normally, this wouldn't affect me that much but since I'm using git-svn things are going so well. After I did a fetch it created a folder for each branch in my root folder so I have three folders, drupal, trunk, and client. The drupal folder is git's master branch, client and trunk are the svn branches.

Merging and committing works great, in fact everything git related is working superb. However dcommit is totally hosed, it's trying to commit a folder called client and one called trunk. I can't even imagine what havoc this would cause for svn later on.

So my question is, what have I done wrong in my .git/config and is there anything I can do to fix this or am I going to have to suffer and go back to using svn?

Please don't make me go back. I don't think I can take it anymore. Bastard boss knows how to leave a legacy.

[svn-remote "svn"]
        url = https://svn.mydomain.com/svn/project_name
        fetch = trunk:refs/remotes/trunk
        branches = *:refs/remotes/*
        tags = tags/*:refs/remotes/tags/*

Normally the branches line would look like this (when using --stdlayout):

branches = branches/*:refs/remotes/branches/*

ls output is thus:

$ ls
client/ docs/ drupal/ sql/ trunk/

git -a output:

* master
  trunk
  remotes/git-svn
  remotes/trunk

I think you broke your .git/config when you changed:

branches = branches/*:refs/remotes/*

To

branches = *:refs/remotes/*

Change your .git/config back to what you had normally. Then add a new remote (which I discovered from this page, http://www.dmo.ca/blog/20070608113513/ ) similar to this format, but replaced with the info for your server:

[svn-remote "svn34"]
    url = svn+ssh://your-server/home/svn/project-name/branches/3.4.x
    fetch = :refs/remotes/git-svn-3.4

Please notice the difference of adding a new "remote" to track a new branch. Your current remote cannot be used to track a different branch (as it would seem from the git-svn docs).

If you don't mind editing .git/config every time a branch is added, you can use glob set syntax (http://www.kernel.org/pub/software/scm/git/docs/git-svn.html#_configuration):

fetch = trunk:refs/remotes/trunk
branches = {client,drupal}:refs/remotes/*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM