git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: are hashes calculated from data

From
Avery Pennarun <apenwarr@gmail.com>
Date
Apr 2, 2010, 02:50 UTC
Message-ID
<o2q32541b131004011950u6023ef29ocac1d80f2847ef6f@mail.gmail.com>
In-Reply-To
<g2veaacf13c1004011931w70695d1emdceeb977397aee0d@mail.gmail.com>
On Thu, Apr 1, 2010 at 10:31 PM, Raymond Auge <raymond.auge@liferay.com> wrote:
Show 9 quoted lines
> Given two separate git repositories initialized from the same
> subversion repository, if the hashes are calculated from the data
> alone, then those two repositories could theoretically pull/push
> branches from each other while retaining  the ability to commit back
> to the "origin" subversion repository.
>
> If this is in fact the case, it would make it quite simple for me to
> convince the more ambitious developers on our team to use git locally,
> and grow team usage in a passive, viral way.

This *almost* works. The problem is 'git svn dcommit'. It eats your git-created commits, and generates *new* ones by committing back to svn and then retrieving the newly-created commits. It's essentially the same as rebasing, which makes future git merges not really work.

You can minimize the impact of this problem, however.  The easiest way is:
- have only a single person use git-svn
- when committing stuff to git-svn, first checkout the *existing*
git-svn branch, then use "git merge --no-ff mybranch", then "git svn
dcommit".  The --no-ff is very important; this makes sure that a *new*
commit is created (a merge commit) for the svn dcommit.  svn dcommit
then creates only a single svn commit that includes all the patches
from the whole branch.
- then do 'git checkout mybranch; git merge git-svn' to get the svn commit back.

At work, we have a cronjob that basically does most of these steps for us. Then there's a central git repo that corresponds to the svn repo; people who want to use git can use that repo and not worry about git-svn.

Hope this helps.
Have fun,
Avery
Previous: Raymond AugeNext: Miles Bader
Message 2 of 7 in “are hashes calculated from data”
  1. Raymond AugeApr 2, 2010
  2. Avery PennarunApr 2, 2010
  3. Miles BaderApr 2, 2010
  4. Avery PennarunApr 2, 2010
  5. Peter BaumannApr 2, 2010
  6. Avery PennarunApr 2, 2010
  7. Peter BaumannApr 2, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.