threads / discuss / 26275

noob question

Subject: noob question

## tl;dr

3 messages between Jan 13, 2011 and Jan 14, 2011.

replies: 2people: 2as markdown or json

Harry Johnson· Jan 13, 2011, 23:58 UTC · lore

I am completely new to git and have only read the tutorial as well as some git for subversion users documentation. Our company is considering switching from subversion to git and I have been doing some experimenting and have run across a potential problem. Our systems are kubuntu/linux.

I have used git-svn to create a git repo from our subversion repo. I have done this as user foo which is just an account that is used for doing central builds. I have then cloned this as repo as myself, harry. My thought is that the repo owned by foo would be a central repo that all of the developers, including myself, could clone and to which we could then 'git push' our changes. The nightly builds would then simply build whatever was currently in the foo repo. This of course completely ignores the complexity of branches at this point but like I said, I am experimenting. I did a test of this and what I found when checking the git log is that while the changes I made and checked into my repo clearly showed me as the author, the same changes after being pushed to foo's repo showed a different author.

So two things.. First should the author have been preserved? How can I make sure that it is?

Second, and probably the better question. Am I too focused on the subversion methodology? Is there a better way of managing a central build scheme using git?

Thanks! -Harry

Thomas Rast· Jan 14, 2011, 11:10 UTC · re: Harry Johnson · lore

Re: noob question

Harry Johnson wrote:
Show 7 quoted lines
> 
> I have used git-svn to create a git repo from our subversion repo. I
> have done this as user foo which is just an account that is used for
> doing central builds. I have then cloned this as repo as myself,
> harry. My thought is that the repo owned by foo would be a central
> repo that all of the developers, including myself, could clone and to
> which  we could then 'git push' our changes.
[...]
Show 6 quoted lines
> when checking the git log is that while the changes I made and checked
> into my repo clearly showed me as the author, the same changes after
> being pushed to foo's repo showed a different author.
> 
> So two things.. First should the author have been preserved? How can I
> make sure that it is?

Yes, absolutely, and since the author is encoded in the commit objects it's impossible to change it without also changing the commit sha1s.

Can you spell your experiments in actual commands and output snippets so we can see what happened?

Did you ever run 'git svn dcommit', 'git rebase', 'git commit --amend' or similar in foo's repo? All of these rewrite commits. As part of their rewriting they set the *committer* to the identity of the current user. 'git svn dcommit' sets author&committer to the identity coming back from SVN.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Harry Johnson· Jan 14, 2011, 21:32 UTC · re: Thomas Rast · lore

Re: noob question

Show 25 quoted lines
>> I have used git-svn to create a git repo from our subversion repo. I
>> have done this as user foo which is just an account that is used for
>> doing central builds. I have then cloned this as repo as myself,
>> harry. My thought is that the repo owned by foo would be a central
>> repo that all of the developers, including myself, could clone and to
>> which  we could then 'git push' our changes.
> [...]
>> when checking the git log is that while the changes I made and checked
>> into my repo clearly showed me as the author, the same changes after
>> being pushed to foo's repo showed a different author.
>>
>> So two things.. First should the author have been preserved? How can I
>> make sure that it is?
>
> Yes, absolutely, and since the author is encoded in the commit objects
> it's impossible to change it without also changing the commit sha1s.
>
> Can you spell your experiments in actual commands and output snippets
> so we can see what happened?
>
> Did you ever run 'git svn dcommit', 'git rebase', 'git commit --amend'
> or similar in foo's repo?  All of these rewrite commits.  As part of
> their rewriting they set the *committer* to the identity of the
> current user.  'git svn dcommit' sets author&committer to the identity
> coming back from SVN.

Ah that does sound like the issue then. I did in fact do a git svn dcommit to commit the changes from the foo repo to our subversion repo. If dcommit rewrites the commit changing the author then that would explain it.

So I did a new test. I made a change and committed it to my local repo. I then did a git pull to bring my repo in sync with the foo repo, then did a push to the foo repo. Before doing anything else I checked the author of my changes in the foo repo and sure enough I am the author! Yay for that.

Now I try to git svn dcommit and I receive the following error: Merge conflict during commit: File or directory 'bar' is out of date. Try updating ...

So I do a git svn rebase, followed by git svn dcommit which works. Now looking at git log I see that my changes are 'authored' by some else. All that to say that you seem to hit the nail on the head and the git svn rebase and git svn dcommit are rewriting the commits and changing the author.

If we do indeed adopt git as our version control system then we would freeze the subversion repo and not worry about git svn any further so I think this is ultimately a non-issue and just something we will deal with during this hybrid testing period.

Thanks!! -Harry

Show 5 quoted lines
>
> --
> Thomas Rast
> trast@{inf,student}.ethz.ch
>

← back to recent threads