mrt181
mrt181

Reputation: 5316

Why did git svn remote tracking stopped working?

I have the following setup

svn repository

application
 |
 |-branches
 |  |
 |  |-develop-svn
 |
 |-trunk

local git repository

master
 |
 |-develop

master tracks remotes/trunk

develop tracks remotes/develop-svn

For some reason develop stopped tracking develop-svn.

When i checkout develop from master i get the following message.

$ (master) git checkout develop
Switched to branch develop
Your branch is ahead of 'develop-svn' by 59 commits.

When i try to commit to the svn repository, it tries to update the remote trunk.

$ (develop) git svn dcommit -n
Committing to https://servername/svn/application/trunk ...
...

It used to commit to https://servername/svn/application/branches/develop-svn

I already tried this command, which did not help:

$ (master) git branch --set-upstream develop develop-svn
Branch develop set up to track local refs/remotes/develop-svn.
$ (master) git checkout develop
Switched to branch develop
Your branch is ahead of 'develop-svn' by 59 commits.
$ (develop) git svn dcommit -n
Committing to https://servername/svn/application/trunk ...
...

My config looks like this

[svn-remote "svn"]
  url = https://servername/svn/application
  fetch = trunk:refs/remotes/trunk
  branches = branches/*:refs/remotes/*
  tags = tags/*:refs/remotes/tags/*

Upvotes: 3

Views: 1315

Answers (1)

Mark Longair
Mark Longair

Reputation: 468191

According to Pro Git, git svn dcommit decides which Subversion branch to push to based on the most recent svn-id in the history. The git svn documentation explains this is done by going back through the history following the first parent in each instance:

If you do merge, note the following rule: git svn dcommit will attempt to commit on top of the SVN commit named in

       git log --grep=^git-svn-id: --first-parent -1

You must therefore ensure that the most recent commit of the branch you want to dcommit to is the first parent of the merge. Chaos will ensue otherwise, especially if the first parent is an older commit on the same SVN branch.

(As I'm sure you'll have noticed, the svn-ids begin with a URL pointing to trunk or svn-develop, or whatever.)

So, if you try that command on the branch you're on, does it find the commit you expect? Or might you have rebased or merged in some way that might make the most recent git svn commit (in the sense above) one from the trunk in Subversion rather than the develop-svn branch?

Upvotes: 5

Related Questions