git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: Git List <git@vger.kernel.org>, Jeff King <peff@peff.net>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Derrick Stolee <dstolee@microsoft.com>
Subject: Re: [PATCH 4/4] gitfaq: add entry about syncing working trees
Date: Tue, 19 Oct 2021 21:38:47 -0400	[thread overview]
Message-ID: <CAPig+cR=wQYthORMfyf4ShBCTXyWkQJqH6YHuW4Uv-Ys3wef5g@mail.gmail.com> (raw)
In-Reply-To: <20211020010624.675562-6-sandals@crustytoothpaste.net>

On Tue, Oct 19, 2021 at 9:06 PM brian m. carlson
<sandals@crustytoothpaste.net> wrote:
> gitfaq: add entry about syncing working trees

You sent two [4/4] patches. I'm guessing the one prefixed by "gitfaq:"
is the correct one.

> Users very commonly want to sync their working tree across machines,
> often to carry across in-progress work or stashes.  Despite this not
> being a recommended approach, users want to do it and are not dissuaded
> by suggestions not to, so let's recommend a sensible technique.
> [...]
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---
> diff --git a/Documentation/gitfaq.txt b/Documentation/gitfaq.txt
> @@ -185,6 +185,45 @@ Then, you can adjust your push URL to use `git@example_author` or
> +[[sync-working-tree]]
> +How do I sync a working tree across systems?::
> +       First, decide whether you want to do this at all.  Git usually works better
> +       when you push or pull your work using the typical `git push` and `git fetch`
> +       commands and isn't designed to share a working tree across systems.  Doing so
> +       can cause `git status` to need to re-read every file in the working tree.
> +       Additionally, Git's security model does not permit sharing a working tree
> +       across untrusted users, so it is only safe to sync a working tree if it will
> +       only be used by a single user across all machines.
> ++
> +Therefore, it's better to push your work to either the other system or a central
> +server using the normal push and pull mechanism.  However, this doesn't always
> +preserve important data, like stashes, so some people prefer to share a working
> +tree across systems.
> ++
> +It is important not to use a cloud syncing service to sync any portion of a Git
> +repository, since this can cause corruption, such as missing objects, changed
> +or added files, broken refs, and a wide variety of other corruption.  These
> +services tend to sync file by file and don't understand the structure of a Git
> +repository.  This is especially bad if they sync the repository in the middle of
> +it being updated, since that is very likely to cause incomplete or partial
> +updates and therefore data loss.
> ++
> +The recommended approach is to use `rsync -a --delete-after` (ideally with an
> +encrypted connection such as with `ssh`) on the root of repository.  You should
> +ensure several things when you do this:
> [...]
> +Be aware that even with these recommendations, syncing in this way is
> +potentially risky since it bypasses Git's normal integrity checking for
> +repositories, so having backups is advised.

Considering the potential damage which can result from this sort of
synching, this entire section seems too gentle. My knee-jerk reaction
is that it would be better to strongly dissuade upfront rather than
saying that it's okay to do this if you really want to. As such, I'm
wondering if organizing the section like this would be better:

(1) Make a strong statement against doing this: "<strong>Don't do it.</strong>"

(2) Explain why users shouldn't do it; in particular, the final
paragraph above which talks about integrity checks and whatnot should
be right up near the top along with discussion of corruption.

(3) Say that cloud-synching services must _not_ be used and explain why.

(4) Relent a tiny bit and explain that the only slightly acceptable
mechanism is `rsync` when used in a very strict fashion (quiescent
repository, etc.)

  reply	other threads:[~2021-10-20  1:39 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20  1:06 [PATCH 0/4] Additional FAQ entries brian m. carlson
2021-10-20  1:06 ` [PATCH 1/4] gitfaq: add advice on monorepos brian m. carlson
2021-10-20  4:45   ` Bagas Sanjaya
2021-10-20 10:54   ` Ævar Arnfjörð Bjarmason
2021-10-20 21:19     ` brian m. carlson
2021-10-20 11:55   ` Johannes Schindelin
2021-10-20 14:11   ` Philip Oakley
2021-10-20 22:22     ` brian m. carlson
2021-10-25 10:44       ` Philip Oakley
2021-10-20  1:06 ` [PATCH 2/4] gitfaq: add documentation on proxies brian m. carlson
2021-10-20 11:57   ` Johannes Schindelin
2021-10-20 22:17     ` brian m. carlson
2021-10-20 14:48   ` Junio C Hamano
2021-10-20 22:19     ` brian m. carlson
2021-10-20  1:06 ` [PATCH 3/4] gitfaq: give advice on using eol attribute in gitattributes brian m. carlson
2021-10-20  1:21   ` Eric Sunshine
2021-10-20  1:27     ` brian m. carlson
2021-10-20 12:02       ` Johannes Schindelin
2021-10-20 22:25         ` brian m. carlson
2021-10-21 12:02           ` Johannes Schindelin
2021-10-20  1:06 ` [PATCH 4/4] doc: add a FAQ entry about syncing working trees brian m. carlson
2021-10-20  4:58   ` Bagas Sanjaya
2021-10-20 14:05     ` Philip Oakley
2021-10-20 23:35   ` Ævar Arnfjörð Bjarmason
2021-10-21  0:03     ` brian m. carlson
2021-10-21  0:33       ` Ævar Arnfjörð Bjarmason
2021-10-20  1:06 ` [PATCH 4/4] gitfaq: add " brian m. carlson
2021-10-20  1:38   ` Eric Sunshine [this message]
2021-10-20 21:36     ` brian m. carlson
2021-10-20 12:09   ` Johannes Schindelin

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='CAPig+cR=wQYthORMfyf4ShBCTXyWkQJqH6YHuW4Uv-Ys3wef5g@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.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).