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

Re: [PATCH v2 3/3] gitfaq: add entry about syncing working trees

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 9, 2021, 00:10 UTC
Message-ID
<xmqqtugm42aq.fsf@gitster.g>
In-Reply-To
<xmqqmtmes3ix.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
> 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.

Previous: Junio C HamanoNext: brian m. carlson
Message 10 of 19 in “Additional FAQ entries”
  1. 0/3 Additional FAQ entriesbrian m. carlson, Nov 7, 2021
  2. 1/3 gitfaq: add documentation on proxiesbrian m. carlson, Nov 7, 2021
  3. Eric SunshineNov 7, 2021
  4. brian m. carlsonNov 8, 2021
  5. Junio C HamanoNov 8, 2021
  6. Johannes SchindelinJan 4, 2022
  7. 3/3 gitfaq: add entry about syncing working treesbrian m. carlson, Nov 7, 2021
  8. Eric SunshineNov 8, 2021
  9. Junio C HamanoNov 8, 2021
  10. Junio C HamanoNov 9, 2021
  11. brian m. carlsonNov 14, 2021
  12. 2/3 gitfaq: give advice on using eol attribute in gitattributesbrian m. carlson, Nov 7, 2021
  13. Eric SunshineNov 7, 2021
  14. brian m. carlsonNov 8, 2021
  15. Eric SunshineNov 8, 2021
  16. Johannes SchindelinJan 4, 2022
  17. Johannes SchindelinJan 4, 2022
  18. brian m. carlsonJan 6, 2022
  19. Eric SunshineNov 9, 2021

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.