git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Is this an acceptable workflow in git-svn, or a user error?
@ 2007-06-09 19:10 Junio C Hamano
  2007-06-09 19:38 ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2007-06-09 19:10 UTC (permalink / raw)
  To: Eric Wong; +Cc: git

Suppose you are interacting with svn://some.where/ and you want
to have a public git://my.svn/mirror.git maintained with your
effort for others to consume.  I am wondering if the following
workflow, especially the push part, is kosher.

----------------------------------------------------------------
0. Priming the process

$ (mkdir mirror.git && cd mirror.git && git init)

$ mkdir private.git && cd private.git && git init
$ git svn init svn://some.where/
$ git push ../mirror.git/ refs/heads/master:refs/heads/master

After this step, mirror.git would be in-sync with the SVN; we
haven't done any of our own development yet.

1. Hack away

$ edit/git-add/etc.
$ git commit

2. Publish the result

git push ../mirror.git/

3. Re-sync with SVN

$ git svn dcommit
----------------------------------------------------------------

I suspect that the above sequence is a user error, in that
re-syncing with SVN using git-svn (either dcommit or rebase)
would need to redo the commits to embed SVN metadata, but the
public mirror now has commits made with git without such
rewriting.  In other words, I suspect that "git push" should
never be done if you made changes on the git side since you
sync'ed with the SVN.

The reason I am asking is that somebody on #git got in a very
confusing situation.  After the Re-sync, "git push" to the
mirror would refuse because it is not a fast forward.  "git
fetch" from the mirror reveals that what after 3. is done, we
see two identically-looking commits, one that was pushed (before
re-sync with SVN) and the other (replaced because of re-sync)
are different.

If that is the case, then I presume that the correct workflow
would be:

1. Hack away
2. Re-sync with SVN
3. Publish the result; do not do anything between 2. and 3.

Is my understanding correct?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is this an acceptable workflow in git-svn, or a user error?
  2007-06-09 19:10 Is this an acceptable workflow in git-svn, or a user error? Junio C Hamano
@ 2007-06-09 19:38 ` Eric Wong
  2007-06-10  7:44   ` Sam Vilain
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Wong @ 2007-06-09 19:38 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano <gitster@pobox.com> wrote:
> Suppose you are interacting with svn://some.where/ and you want
> to have a public git://my.svn/mirror.git maintained with your
> effort for others to consume.  I am wondering if the following
> workflow, especially the push part, is kosher.
> 
> ----------------------------------------------------------------
> 0. Priming the process
> 
> $ (mkdir mirror.git && cd mirror.git && git init)
> 
> $ mkdir private.git && cd private.git && git init
> $ git svn init svn://some.where/
> $ git push ../mirror.git/ refs/heads/master:refs/heads/master
> 
> After this step, mirror.git would be in-sync with the SVN; we
> haven't done any of our own development yet.
> 
> 1. Hack away
> 
> $ edit/git-add/etc.
> $ git commit
> 
> 2. Publish the result
> 
> git push ../mirror.git/
> 
> 3. Re-sync with SVN
> 
> $ git svn dcommit
> ----------------------------------------------------------------
> 
> I suspect that the above sequence is a user error, in that
> re-syncing with SVN using git-svn (either dcommit or rebase)
> would need to redo the commits to embed SVN metadata, but the
> public mirror now has commits made with git without such
> rewriting.  In other words, I suspect that "git push" should
> never be done if you made changes on the git side since you
> sync'ed with the SVN.

Yes.  This is an unfortunate sore point for git-svn users unfamiliar
with what rebase does (inside dcommit).  Users using the the old
'set-tree' workflow are immune to this, but they have their own set of
complications...

Using "git push --force" would work after dcommit, however that
makes extra work for people tracking the git mirror

> The reason I am asking is that somebody on #git got in a very
> confusing situation.  After the Re-sync, "git push" to the
> mirror would refuse because it is not a fast forward.  "git
> fetch" from the mirror reveals that what after 3. is done, we
> see two identically-looking commits, one that was pushed (before
> re-sync with SVN) and the other (replaced because of re-sync)
> are different.
> 
> If that is the case, then I presume that the correct workflow
> would be:
> 
> 1. Hack away
> 2. Re-sync with SVN
> 3. Publish the result; do not do anything between 2. and 3.
> 
> Is my understanding correct?

Yes.  Since dcommit uses rebase, it'll rewrite history.

The "git svn dcommit" workflow is analogous to me making commits and
mailing patches to you to apply to the mainline git.git.  When you apply
them to git.git, they'll be different than the commits I've made even
though they're only metadata changes.

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is this an acceptable workflow in git-svn, or a user error?
  2007-06-09 19:38 ` Eric Wong
@ 2007-06-10  7:44   ` Sam Vilain
  2007-06-10  7:49     ` Sam Vilain
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Vilain @ 2007-06-10  7:44 UTC (permalink / raw)
  To: Eric Wong; +Cc: Junio C Hamano, git

Eric Wong wrote:
>> Is my understanding correct?
>>     
>
> Yes.  Since dcommit uses rebase, it'll rewrite history.
>   

Maybe these new lightweight annotations could be a way around that?

Sam.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is this an acceptable workflow in git-svn, or a user error?
  2007-06-10  7:44   ` Sam Vilain
@ 2007-06-10  7:49     ` Sam Vilain
  0 siblings, 0 replies; 4+ messages in thread
From: Sam Vilain @ 2007-06-10  7:49 UTC (permalink / raw)
  To: Eric Wong; +Cc: Junio C Hamano, git

Sam Vilain wrote:
> Eric Wong wrote:
>   
>>> Is my understanding correct?
>>>       
>> Yes.  Since dcommit uses rebase, it'll rewrite history.  
>>     
> Maybe these new lightweight annotations could be a way around that?
>   

Actually I don't think that will work either unless you start
encapsulating extra git information (author/committer email/timestamps)
in the svn commit somewhere, so that someone else fetching the commits
from svn directly will end up with the same git commitid. And then
there's still the issue of merges.

Sam.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-06-10  7:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-09 19:10 Is this an acceptable workflow in git-svn, or a user error? Junio C Hamano
2007-06-09 19:38 ` Eric Wong
2007-06-10  7:44   ` Sam Vilain
2007-06-10  7:49     ` Sam Vilain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).