From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS,URIBL_CSS,URIBL_CSS_A shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id D5A041F953 for ; Tue, 9 Nov 2021 00:10:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241034AbhKIAM4 (ORCPT ); Mon, 8 Nov 2021 19:12:56 -0500 Received: from pb-smtp1.pobox.com ([64.147.108.70]:50966 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbhKIAMz (ORCPT ); Mon, 8 Nov 2021 19:12:55 -0500 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 4F2EAF0492; Mon, 8 Nov 2021 19:10:09 -0500 (EST) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=IiRXHIGvStTklDXj5ad7aCkgLaVcwfWqJ+2d8n kpPZo=; b=Z7R6UUMlz1U5I4zXG2fWPIEdXf4zpwT16QxhnJWcuY6plJp5TM0TbW yRiZA2QgHPpbvODSec8aZwTgLveEQs/KY/jG2HZZdPGd6r8R0hUDBTiFyIs0sMOk ZB3LSJPT2Zbx9pk4c9Kj+2ufEp/7+QGO0OLskf80i6iDBuFGd4WaQ= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 14544F0490; Mon, 8 Nov 2021 19:10:09 -0500 (EST) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [104.133.2.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 54CBDF048F; Mon, 8 Nov 2021 19:10:07 -0500 (EST) (envelope-from junio@pobox.com) From: Junio C Hamano To: "brian m. carlson" Cc: Eric Sunshine , Git List , Jeff King , Johannes Schindelin , Bagas Sanjaya , Derrick Stolee Subject: Re: [PATCH v2 3/3] gitfaq: add entry about syncing working trees References: <20211107225525.431138-1-sandals@crustytoothpaste.net> <20211107225525.431138-4-sandals@crustytoothpaste.net> Date: Mon, 08 Nov 2021 16:10:05 -0800 In-Reply-To: (Junio C. Hamano's message of "Mon, 08 Nov 2021 14:09:42 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 657C89B0-40F1-11EC-8BA7-62A2C8D8090B-77302942!pb-smtp1.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Junio C Hamano writes: > Doesn't rsync work the same per-file fashion, and the only reason > why it is a better fit is because it is not continuous, not > attempting to "sync" while the repository is in use, until the user > explicitly says "OK, I am ready to go home, so let's stop working > here and send everything over to home with rsync"? OK, so not "per-file" but "continuous" is the root problem, and "cloud" would be a good word because all the popular ones share that "continuous" trait. This part of the proposed patch text may need rethinking a bit. > +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 That is, "file by file" is not a problem per-se, "don't understand the structure" is a huge problem, and "continuous" may contribute to the problem further. I wonder if you let the "cloud" services to continuously sync your repository, then go quiescent for a while and then start touching the destination, it would be sufficient, though. The refs with funny "2" suffixes and the like are the symptom of two sides simultanously mucking with the same file (e.g ".git/refs/main") and the "cloud sync" could not decide what the right final outcome is, right? I also wonder if we add a way to transfer reflog entries, that imply the object reachability, say "git push --with-reflog", over the wire, it would be sufficient to do everything with Git. Before you go home, you'd do git stash save --untracked && git stash apply git push --mirror --with-reflog --with-stash to save away modified and untracked files to a stash entry [*], and push all the refs with their reflog entries (including refs/stash which normally gets refused because it has only two levels). Side note. If there were a variant of "git stash save" that only saves away without modifying the working tree and the index, I'd use that single command instead of "save and immediately restore by applying" kludge. Then at the destination, you'd figure out what the current branch was (the stash message should record tha name of the branch), check that branch out, and running "git stash pop" will give you pretty much the same environment.