Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the git-svn-id?

Tags:

git

git-svn

Here is an example git-svn-id from a local test repo.

git-svn-id: file:///tmp/svnrepo/branches/foobar@6 0f7bc949-3f51-4b04-a2a6-16f580a5904d

What is the last part? The "@6" means that it is svn revision number 6, but after that looks to be some hash. It seems to be the same on every single commit.

How is that last part generated? I am assuming it is a hash algorithm applied to the first commit of the git repo. That way the git-svn-id can also guarantee that the total ancestry of that commit is the same or different given another git-svn-id.

like image 748
Alexander Bird Avatar asked Feb 23 '15 22:02

Alexander Bird


People also ask

What is SVN ID?

It's a subversion construct. In subversion, every repo is given a UUID. You can find a svn repo's UUID via svn info. In the example below, the "Repository UUID" line is the repo's UUID. $ svn info Path: .

What is SVN in git?

What is Git-SVN? The git-svn tool is an interface between a local Git repository and a remote SVN repository. Git-svn lets developers write code and create commits locally with Git, then push them up to a central SVN repository with svn commit-style behavior.

Does git use SVN?

git svn is a simple conduit for changesets between Subversion and Git. It provides a bidirectional flow of changes between a Subversion and a Git repository.

Is SVN and GitHub same?

SVN is configured to assume that the history of a project never changes. Git allows you to modify previous commits and changes using tools like git rebase . GitHub supports Subversion clients, which may produce some unexpected results if you're using both Git and SVN on the same project.


1 Answers

It's a subversion construct. In subversion, every repo is given a UUID. You can find a svn repo's UUID via svn info. In the example below, the "Repository UUID" line is the repo's UUID.

$ svn info
Path: .
Working Copy Root Path: /tmp/svnco
URL: file:///tmp/svnrepo
Relative URL: ^/
Repository Root: file:///tmp/svnrepo
Repository UUID: 0f7bc949-3f51-4b04-a2a6-16f580a5904d
Revision: 6
Node Kind: directory
Schedule: normal
Last Changed Author: ABird
Last Changed Rev: 6
Last Changed Date: 2015-02-23 16:54:45 -0500 (Mon, 23 Feb 2015)

Here is the git-svn code which seems to read svn info output and saves the UUID: https://github.com/git/git/blob/master/vcs-svn/svndump.c#L356


To address some of my assumptions in the question: the UUID does not incorporate any information about the git repo's ancestry. From my understanding, someone can git svn clone the same repo, but not include the entire history of the repo. If that is the case between two git-svn repos, then the same point in the svn repo will become different sha1 hashes in the two repos.

like image 140
Alexander Bird Avatar answered Sep 23 '22 13:09

Alexander Bird