diff mbox series

[v5] Doc: Bundle file usage

Message ID 20191020110306.1714-1-philipoakley@iee.email (mailing list archive)
State New, archived
Headers show
Series [v5] Doc: Bundle file usage | expand

Commit Message

Philip Oakley Oct. 20, 2019, 11:03 a.m. UTC
Improve the command description, including paragraph spacing.

Git URLs can accept bundle files for fetch, pull and clone, include
in that section. Include git clone in the bundle usage description.
Correct the quoting of <git-rev-list-args>.

Detail the <git-rev-list-args> options for cloning a complete repo.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
---
The new paragraph uses the more modern back-ticks while elsewhere
the quote style is matched locally.

I finally chose the `would include your refs ..` to clarify the
--mirror option.

---
 Documentation/git-bundle.txt | 23 +++++++++++++++++------
 Documentation/urls.txt       |  3 +++
 2 files changed, 20 insertions(+), 6 deletions(-)

Comments

Junio C Hamano Oct. 21, 2019, 2:48 a.m. UTC | #1
Philip Oakley <philipoakley@iee.email> writes:

> @@ -20,11 +20,14 @@ DESCRIPTION
>  Some workflows require that one or more branches of development on one
>  machine be replicated on another machine, but the two machines cannot
>  be directly connected, and therefore the interactive Git protocols (git,
> +ssh, http) cannot be used.
> +
> +The 'git bundle' command packages objects and references in an archive
> +at the originating machine, which can then be imported into another
> +repository using 'git fetch', 'git pull', or 'git clone',
> +after moving the archive by some means (e.g., by sneakernet).
> +
> +As no
>  direct connection between the repositories exists, the user must specify a
>  basis for the bundle that is held by the destination repository: the
>  bundle assumes that all objects in the basis are already in the

Notice that we use the term `basis` here.  It is referring to the
bottom end(s) of the commit graph.

> +`git clone` can use any bundle created without negative refspecs
> +(e.g., `new`, but not `old..new`).

To be consistent with the phrasing of this particular document we
saw earlier, you would have said "without basis", but I think the
use of `basis` did not spread beyond "git bundle" documentation.  

If we were writing "git bundle" and its documentation from scratch
using more modern lingo, we probably would say "negative revisions"
here.  Note that the word `refspec` has no place in the context of
this sentence; they are to specify the mapping of refs between the
repository in which transferred objects originate and the repository
that accept the objects.  Also note that `basis` discussed in 'git
bundle' is a bit wider concept than `negative revisions`, so mere
mechanical replacements would not be sufficient as a preliminary
modernization/prepation step for this patch.

> +If you want to match `git clone --mirror`, which would include your
> +refs such as `refs/remotes/*`, use `--all`.
> +If you want to provide the same set of refs that a clone directly
> +from the source repository would get, use `--branches --tags` for
> +the `<git-rev-list-args>`.

This is not wrong per-se, but may lead to confusion.  The readers
must be able to learn:

 - "git clone --mirror full.bndl dst/" from a full bundle created
   with "git bundle create full.bndl --all" can mimic creation of a
   full mirror of the original.

 - "git clone full.bndl dst/" from such a bundle does *not* result
   in creation of a mirror.

 - "git clone slim.bndl dst/" from a minimum bundle created wth "git
   bundle create slim.bndl --branches --tags" would be sufficient to
   obtain the same result as the above.

 - "git clone --mirror slim.bndl dst/" from such a minimum bundle
   cannot mimic creation of a full mirror of the original.

I am not sure the second point is conveyed well with the new
paragraph.  That is, "--all" must be used if the resulting bundle is
meant to be usable to "--mirror" clone from, but it can still be
used to clone normally.  If you do not intend to mirror-clone from,
there is not much point in using "--all" to record extra refs.

Not having the new paragraph does not convey anything at all, so it
definitely is an improvement, though ;-)

Thanks.
Jeff King Oct. 21, 2019, 3:16 a.m. UTC | #2
On Mon, Oct 21, 2019 at 11:48:40AM +0900, Junio C Hamano wrote:

> > +`git clone` can use any bundle created without negative refspecs
> > +(e.g., `new`, but not `old..new`).
> 
> To be consistent with the phrasing of this particular document we
> saw earlier, you would have said "without basis", but I think the
> use of `basis` did not spread beyond "git bundle" documentation.  
> 
> If we were writing "git bundle" and its documentation from scratch
> using more modern lingo, we probably would say "negative revisions"
> here.  Note that the word `refspec` has no place in the context of
> this sentence; they are to specify the mapping of refs between the
> repository in which transferred objects originate and the repository
> that accept the objects.  Also note that `basis` discussed in 'git
> bundle' is a bit wider concept than `negative revisions`, so mere
> mechanical replacements would not be sufficient as a preliminary
> modernization/prepation step for this patch.

Sorry, this one is my fault. I said "negative revisions" in my earlier
mail[1], but somehow while writing example text my brain turned into
"refspecs", which is obviously nonsense. It should be "revisions".

I don't mind using "basis" either; it's not commonly used outside of
this page, but I think it does succinctly represent what we're trying to
say here.

[1] https://public-inbox.org/git/20191016210957.GA28981@sigill.intra.peff.net/

> > +If you want to match `git clone --mirror`, which would include your
> > +refs such as `refs/remotes/*`, use `--all`.
> > +If you want to provide the same set of refs that a clone directly
> > +from the source repository would get, use `--branches --tags` for
> > +the `<git-rev-list-args>`.
> 
> This is not wrong per-se, but may lead to confusion.  The readers
> must be able to learn:
> 
>  - "git clone --mirror full.bndl dst/" from a full bundle created
>    with "git bundle create full.bndl --all" can mimic creation of a
>    full mirror of the original.
> 
>  - "git clone full.bndl dst/" from such a bundle does *not* result
>    in creation of a mirror.
> 
>  - "git clone slim.bndl dst/" from a minimum bundle created wth "git
>    bundle create slim.bndl --branches --tags" would be sufficient to
>    obtain the same result as the above.
> 
>  - "git clone --mirror slim.bndl dst/" from such a minimum bundle
>    cannot mimic creation of a full mirror of the original.
> 
> I am not sure the second point is conveyed well with the new
> paragraph.  That is, "--all" must be used if the resulting bundle is
> meant to be usable to "--mirror" clone from, but it can still be
> used to clone normally.  If you do not intend to mirror-clone from,
> there is not much point in using "--all" to record extra refs.

I hoped maybe it would be obvious how the second and fourth cases would
behave, but maybe it is better to spell it out. Maybe it would be better
to talk about what the sender does, and then what the receiver can do
with the result. Something like:

  If you create a bundle using `--all` for `<git-rev-list-args>`, a
  recipient can clone the result using `git clone` or `git clone
  --mirror` and get the same result they would by cloning directly from
  the source repository. If you instead create it with `--branches
  --tags`, the resulting bundle may be smaller, and a non-mirror clone
  will behave the same (but a `clone --mirror` will obviously not
  receive any refs outside of the branches and tags).

That could probably be tightened up a bit.

-Peff
diff mbox series

Patch

diff --git a/Documentation/git-bundle.txt b/Documentation/git-bundle.txt
index 7d6c9dcd17..545940022b 100644
--- a/Documentation/git-bundle.txt
+++ b/Documentation/git-bundle.txt
@@ -20,11 +20,14 @@  DESCRIPTION
 Some workflows require that one or more branches of development on one
 machine be replicated on another machine, but the two machines cannot
 be directly connected, and therefore the interactive Git protocols (git,
-ssh, http) cannot be used.  This command provides support for
-'git fetch' and 'git pull' to operate by packaging objects and references
-in an archive at the originating machine, then importing those into
-another repository using 'git fetch' and 'git pull'
-after moving the archive by some means (e.g., by sneakernet).  As no
+ssh, http) cannot be used.
+
+The 'git bundle' command packages objects and references in an archive
+at the originating machine, which can then be imported into another
+repository using 'git fetch', 'git pull', or 'git clone',
+after moving the archive by some means (e.g., by sneakernet).
+
+As no
 direct connection between the repositories exists, the user must specify a
 basis for the bundle that is held by the destination repository: the
 bundle assumes that all objects in the basis are already in the
@@ -35,7 +38,7 @@  OPTIONS
 
 create <file>::
 	Used to create a bundle named 'file'.  This requires the
-	'git-rev-list-args' arguments to define the bundle contents.
+	'<git-rev-list-args>' arguments to define the bundle contents.
 
 verify <file>::
 	Used to check that a bundle file is valid and will apply
@@ -92,6 +95,14 @@  It is okay to err on the side of caution, causing the bundle file
 to contain objects already in the destination, as these are ignored
 when unpacking at the destination.
 
+`git clone` can use any bundle created without negative refspecs
+(e.g., `new`, but not `old..new`).
+If you want to match `git clone --mirror`, which would include your
+refs such as `refs/remotes/*`, use `--all`.
+If you want to provide the same set of refs that a clone directly
+from the source repository would get, use `--branches --tags` for
+the `<git-rev-list-args>`.
+
 EXAMPLES
 --------
 
diff --git a/Documentation/urls.txt b/Documentation/urls.txt
index bc354fe2dc..1c229d7581 100644
--- a/Documentation/urls.txt
+++ b/Documentation/urls.txt
@@ -53,6 +53,9 @@  These two syntaxes are mostly equivalent, except the former implies
 --local option.
 endif::git-clone[]
 
+'git clone', 'git fetch' and 'git pull', but not 'git push', will also
+accept a suitable bundle file. See linkgit:git-bundle[1].
+
 When Git doesn't know how to handle a certain transport protocol, it
 attempts to use the 'remote-<transport>' remote helper, if one
 exists. To explicitly request a remote helper, the following syntax