Search code examples
gitgit-svn

git svn keeps downloading deleted branch


I have a git clone of a svn repository that does not include all of the svn commits. I have created a branch on the main SVN repository. I then did a git svn fetch to get the data of the remote branch. I did this often before. But for some reason git started getting info for this branch from commit 1. I didn't know what to do, so I deleted the branch via SVN. I then deleted the remote branch from git (using git branch -d -r accounts@5075). However, after doing git svn fetch, git keeps downloading the now deleted branch.

Does anyone have any idea what is going on and how I can fix it?

Note: I am on windows and I use Tortoise git :)

Edit [git config file]:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[svn-remote "svn"]
    url = url/svnroot/
    fetch = firmware/trunk/mainUnit/trunk:refs/remotes/trunk
    branches = firmware/trunk/mainUnit/branches/*:refs/remotes/*
    tags = firmware/trunk/mainUnit/tags/*:refs/remotes/tags/*
[svn]
    rmdir = true

Solution

  • You might want to change the $GIT_DIR/config file content :

    branches = firmware/trunk/mainUnit/branches/*:refs/remotes/* 
    

    to

    branches = firmware/trunk/mainUnit/branches/*:refs/remotes/<subversionbranch>/*
    

    Quoting the source :

    Note that git-svn keeps track of the highest revision in which a branch or tag has appeared. If the subset of branches or tags is changed after fetching, then $GIT_DIR/svn/.metadata must be manually edited to remove (or reset) branches-maxRev and/or tags-maxRev as appropriate.