From: Junio C Hamano <gitster@pobox.com>
To: kristofferhaugsbakk@fastmail.com
Cc: git@vger.kernel.org, Kristoffer Haugsbakk <code@khaugsbakk.name>,
avarab@gmail.com, me@ttaylorr.com
Subject: Re: [PATCH v2 3/3] Documentation/git-bundle.txt: discuss naïve backups
Date: Fri, 01 Nov 2024 18:39:10 -0700 [thread overview]
Message-ID: <xmqqzfmiza69.fsf@gitster.g> (raw)
In-Reply-To: <c50f9d405f9043a03cb5ca1855fbf27f9423c759.1730234365.git.code@khaugsbakk.name> (kristofferhaugsbakk@fastmail.com's message of "Tue, 29 Oct 2024 21:41:46 +0100")
kristofferhaugsbakk@fastmail.com writes:
> +A naive way to make a full backup of a repository is to use something to
> +the effect of `cp -a <repo> <destination>`. This is discouraged since
> +the repository could be written to during the copy operation. In turn
> +some files at `<destination>` could be corrupted.
There is nothing wrong in the above, but ...
> +This is why it is recommended to use Git tooling for making repository
> +backups, either with this command or with e.g. linkgit:git-clone[1].
... "git bundle create - --all" in (or "git clone --mirror" from) a
repository cannot be an equivalent to "cp -a" in a quiescent
repository. You'd lose what is staged, you'd lose per repository
configuration, you'd lose hooks, you may be losing other things I am
not remembering.
IOW, those who uses what you call "a naive way" may be doing so with
a valid reason.
So the patch is not quite correct as-is, even though it is going in
the right direction. It discourages apples and recommends oranges.
Let me think aloud to see if I can come up with an improvement.
It is tempting to do "cp -a <repository> <elsewhere>" or "tar cf
- <repository>" to take a snapshot of a repository, but unless
the repository is quiescent, you will get an incomplete snapshot
with inconsiistent state. If all you care about is the state of
the objects and the refs that point to objects, you can instead
use "git clone --mirror <repo> <elsewhere>" or "git bundle
create <bndl> --all" to take a consistent snapshot.
Note that you will lose other local states of the repository,
such as the contents of the index, working tree, per-repository
configuration, hooks, etc.
or something like that, perhaps?
next prev parent reply other threads:[~2024-11-02 1:39 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-20 19:14 [PATCH 0/4] Documentation/git-bundle.txt: promote --all for full backup kristofferhaugsbakk
2024-10-20 19:14 ` [PATCH 1/4] Documentation/git-bundle.txt: mention --all in Synopsis kristofferhaugsbakk
2024-10-20 19:33 ` Kristoffer Haugsbakk
2024-10-21 21:30 ` Taylor Blau
2024-10-20 19:15 ` [PATCH 2/4] Documentation/git-bundle.txt: mention full backup example kristofferhaugsbakk
2024-10-21 21:32 ` Taylor Blau
2024-10-22 21:18 ` Kristoffer Haugsbakk
2024-10-20 19:15 ` [PATCH 3/4] Documentation/git-bundle.txt: mention --all in spec. refs kristofferhaugsbakk
2024-10-21 21:33 ` Taylor Blau
2024-10-20 19:15 ` [PATCH 4/4] Documentation/git-bundle.txt: discuss naïve backups kristofferhaugsbakk
2024-10-21 21:36 ` [PATCH 0/4] Documentation/git-bundle.txt: promote --all for full backup Taylor Blau
2024-10-22 17:29 ` Taylor Blau
2024-10-22 21:22 ` Kristoffer Haugsbakk
2024-10-29 20:41 ` [PATCH v2 0/3] " kristofferhaugsbakk
2024-10-29 20:41 ` [PATCH v2 1/3] Documentation/git-bundle.txt: mention full backup example kristofferhaugsbakk
2024-11-02 1:27 ` Junio C Hamano
2024-11-06 19:31 ` Kristoffer Haugsbakk
2024-10-29 20:41 ` [PATCH v2 2/3] Documentation/git-bundle.txt: mention --all in spec. refs kristofferhaugsbakk
2024-10-29 20:41 ` [PATCH v2 3/3] Documentation/git-bundle.txt: discuss naïve backups kristofferhaugsbakk
2024-11-02 1:39 ` Junio C Hamano [this message]
2024-10-29 22:19 ` [PATCH v2 0/3] Documentation/git-bundle.txt: promote --all for full backup Taylor Blau
2024-11-07 11:57 ` [PATCH v3 0/4] " kristofferhaugsbakk
2024-11-07 11:57 ` [PATCH v3 1/4] Documentation/git-bundle.txt: mention full backup example kristofferhaugsbakk
2024-11-08 2:01 ` Junio C Hamano
2024-11-10 19:38 ` Kristoffer Haugsbakk
2024-11-12 17:31 ` Kristoffer Haugsbakk
2024-11-12 22:58 ` Junio C Hamano
2024-11-16 14:28 ` Kristoffer Haugsbakk
2024-11-07 11:57 ` [PATCH v3 2/4] Documentation/git-bundle.txt: remove old `--all` example kristofferhaugsbakk
2024-11-07 11:57 ` [PATCH v3 3/4] Documentation/git-bundle.txt: mention --all in spec. refs kristofferhaugsbakk
2024-11-07 11:57 ` [PATCH v3 4/4] Documentation/git-bundle.txt: discuss naïve backups kristofferhaugsbakk
2024-11-07 16:36 ` [PATCH v3 0/4] Documentation/git-bundle.txt: promote --all for full backup Junio C Hamano
2024-11-16 14:54 ` [PATCH v4 " kristofferhaugsbakk
2024-11-16 14:54 ` [PATCH v4 1/4] Documentation/git-bundle.txt: mention full backup example kristofferhaugsbakk
2024-11-16 14:54 ` [PATCH v4 2/4] Documentation/git-bundle.txt: remove old `--all` example kristofferhaugsbakk
2024-11-16 14:54 ` [PATCH v4 3/4] Documentation/git-bundle.txt: mention --all in spec. refs kristofferhaugsbakk
2024-11-16 14:54 ` [PATCH v4 4/4] Documentation/git-bundle.txt: discuss naïve backups kristofferhaugsbakk
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqzfmiza69.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=code@khaugsbakk.name \
--cc=git@vger.kernel.org \
--cc=kristofferhaugsbakk@fastmail.com \
--cc=me@ttaylorr.com \
/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.
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 NNTP newsgroup(s).