git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jose Gisbert <jose.gisbert@live.com>
To: Jeff King <peff@peff.net>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: RE: Using git svn rebase at quarantine environment or a feasible alternative to synchronize git and svn repositories
Date: Tue, 2 Oct 2018 10:28:38 +0000	[thread overview]
Message-ID: <VI1PR0902MB2223AB8C9A721478E82449FEE2E80@VI1PR0902MB2223.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <20181001145344.GA26349@sigill.intra.peff.net>

> As you noticed, this used to be allowed. But it's dangerous, because if
> the movement of the objects out of quarantine fails, then you're left
> with a corrupted ref (ditto, anybody looking at the ref after update but
> before quarantine ends will see what appears to be a corrupted
> repository).
> 
> There are two solutions I can think of:
> 
>   1. The unsafe thing is to just unset $GIT_QUARANTINE_PATH before
>      running "git svn rebase". That will skip the safety check
>      completely, enabling the pre-v2.13 behavior. I don't really
>      recommend this, but modulo the race and unlikely file-moving
>      errors, it would probably generally work.
> 
>   2. Store intermediate results from pre-receive not as actual refs, and
>      then install the refs as part of the post-receive. I don't think
>      there's out of the box support for this, since "git svn rebase" is
>      always going to call "git rebase", which is going to try to write
>      refs.
> 
>      The smoothest thing would be for the refs code to see that
>      $GIT_QUARANTINE_PATH is set, write a journal of ref updates into a
>      file in that path, and then have the quarantine code try to apply
>      those ref updates immediately after moving the objects out of
>      quarantine (with the usual lease-locking mechanism).
> 
>      That's likely to be pretty tricky to implement, so I'm not even
>      going to try to sketch out a patch in this email.
> 
>      You might be able to do something similar by hand by using a
>      temporary sub-repository. E.g., "clone -s" to a temp repo, do the
>      rebase there, and then in the post-receive fetch the refs back.
>      That's less efficient, but the boundaries of the operation are very
>      easy to understand.

I read about the dangers of updating refs at the pre-receive hook at
git-receive-pack man pages and, of course, it's something to take into
account. But, given that this setup will be temporary and the technical
complexity of the other solutions you propose (solution #2 seems unfeasible
and I don't know where to find and how to modify refs code or quarantine code)
I'm more predisposed to try solution #1 by now.

Moreover, assuming that solution #1 will generally work and the facts that:

- I think it would be possible to us to recover from a corrupted repository
  somehow easily. Couldn't we, for instance, reset from a failed push and try
  it again?
- the chances of corrupting the svn repository, our reference here, seem small
  because git svn dcommit is the last operation in the chain and is only
  performed when everything else went ok
- we are a small team and git is not our main CVS, so we can stop pushing to
  git while we fix the repository

I'm more inclined to apply this solution. Maybe I'm being too much optimistic
with my assumptions.

Nevertheless I will investigate the "clone -s" alternative. It seems easy to
implement and performance is currently not a limitation for us.

> This is definitely the right place. Sorry I don't have a better answer!

Thank you for your elaborated response Jeff. It has been a pleasure to write
to the git community email group.

Regards,

Jose

  reply	other threads:[~2018-10-02 10:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-01  8:12 Using git svn rebase at quarantine environment or a feasible alternative to synchronize git and svn repositories Jose Gisbert
2018-10-01  8:55 ` Ævar Arnfjörð Bjarmason
2018-10-01 14:17   ` Jose Gisbert
2018-10-01 15:00     ` Ævar Arnfjörð Bjarmason
2018-10-02 10:29       ` Jose Gisbert
2018-10-01 14:53 ` Jeff King
2018-10-02 10:28   ` Jose Gisbert [this message]
2018-10-02 14:27     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=VI1PR0902MB2223AB8C9A721478E82449FEE2E80@VI1PR0902MB2223.eurprd09.prod.outlook.com \
    --to=jose.gisbert@live.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).