Sync broken with --rebuild option

Hello,

We have been using subgit for a while in different branches but unfortunately since we had an authentication issue the sync has stopped since then.
When we run subgit install --recover . we get the following error:

SubGit version 3.2.5 (‘Bobique’) build #3694
INSTALLATION FAILED
error: Unable to update configuration for Git repositories ‘path’.
error: Review SVN repository configuration or use --rebuild option to rebuild Git repository.
error: Actual minimal revision of Git repository doesn’t match minimal revision specified in SVN repository config file.

We are trying to get logs files, but none of the options we have used in TMate SubGit: Configuration options are working for us.

We are trying to avoid rewriting github history too so we would like to avoid the option rebuild.

Have we got any other options?

Thanks in advance,
Alberto

Hello Alberto,

first of all, I’d recommend upgrading SubGit to the latest version as the one you are using – 3.2.5 – is pretty old, current is 3.3.11.

But the issue itself is not connected to the version, however: as far as I understand the situation the svn.minimalRevision setting has been changed in the configuration file, but this setting change requires a rebuild as it strongly affects the history, that’s why the error appears. The best way to avoid the rebuild would be returning the setting to the value it had before.

Hello Ildar,

Thanks very much for your quick response.

One of the things we will be planning for sure is the upgrade, thank you for pointing this.

Secondly, I do not fully understand your recommendation, it is probably lack of context from my end, let me add more information just in case I have already checked this:

We have two branches but the same is applicable to both:

  • The last git revision after running git log refs/svn/root/branches/BRANCH is the same as the last in SVN
  • We had another issue in the past and we solved it using git update-ref refs/svn/root/branches/BRANCH

Is this the same issue you are referring to?

Thanks in advance,
Alberto

Hello,
I have found the option you were referring to Ildar.
So inside the configuration file I can see the parameter minimalRevision

Thanks for the hint, I will have a look and let you know.
Alberti

Hello Ildar,

Just to give you an update on this and it might be help somebody else with the same issue.

I tried to correct specify the minimalRevision as your recommendation but it did not work, it only worked (for one of the branches) when I commented the whole parameter.
Now for some shenanigans I cannot understand, it is not working due to a commit coming from SVN (which we have not got configured it like that), from map branch I have got

  commit f127f3b261fc543dafc7b3
  Author: subgit <support@subgit.com>
  Date: Tue Nov 9 14:49:30 2021 +0000
  Translated-from: SVN
  diff --git a/7a/37a11ee1d9683cc83b6e8db b/7a/37a11ee1d9683cc83b6e8db
  new file mode 100644
  index 0000000..add68da
  --- /dev/null
  +++ b/7a/37a11ee1d9683cc83b6e8db
  @@ -0,0 +1 @@
  +r281274 REPO_NAME/branches/BRANCH_NAME
  \ No newline at end of file

Also, the error messages is
[2021-11-09 15:55:38.002][subgit-install][1] branch 'refs/heads/main' unexpectedly refers to commit 661a39977db5a44509c182 which is not synchronized with SVN repository org.tmatesoft.translator.util.e: branch 'refs/heads/main' unexpectedly refers to commit 661a39977db5a44509c182 which is not synchronized with SVN repository

Is this reference affecting the sync?

Thanks in advance,
Alberto

Hello Alberto,

so the minimal revision must have been set to 1 before it had been changed in the configuration and removing the setting just set it this way. But it’s hardly has anything to do with the unexpectedly refers error you are getting now. I would rather assume that the reason for that error is the git update-ref interventions you mentioned before as manual references change in a mirrored repository can easily lead to errors, especially to this kind; but of course, it’s hard to tell for sure without detailed investigation with all the information what was the repository state and what exactly changed in Git and SVN.
I would say that the rebuild is the most appropriate answer in this case taking into account that the mirror hasn’t been running for a while and the repository has been changed manually. The rebuild may change some of the commit hashes, indeed (especially those that were changed manually in Git), but on the other hand it will allow restoring and running a fully-operation mirror. Besides, it’s possible to rebuild only part of the repository using the rebuild-from-revision feature thus repairing only recent part of history leaving the rest untouched.

Hello Ildar,

I see, thanks for your recommendation on the update-ref interventions, so I will make sure we will not use it again, thanks Ildar.
On the other hand, the option rebuild-from-revision you are describing seems a very good option to me, we could just go back revision by revision trying to fix the issue, thanks for this Ildar.

I have found this link https://issues.tmatesoft.com/issue/SG-262 where you :-) were explaining how to use this rebuild-from-revision option.

I will try the same process and I will let you know, hopefully this will lead us to a solution.

Thanks,
Alberto

Hello Alberto,

that’s funny you found that my old explanation) and sorry for not providing it right away here. Actually, it’s pretty simple, this option only requires the number of revision to rebuild the repository from:

subgit install --rebuild-from-revision REV_NO <repository path>

REV_NO is a number (like 2345) of the revision. With this command, SubGit will reset the target repository state to the revision and then re-import later revisions from SVN. Note, that rebuild from revisions won’t create a backup, so it may worth doing it manually prior to the rebuild.

Hello Ildar,
Yeah, it was quite funny see your name there :-)
Just to let you know, --rebuild-from-revision option helped us to finally solve the issue.
Thanks very much for your support Ildar.
Kind Regards,
Alberto