]> git.ipfire.org Git - thirdparty/git.git/commitdiff
archive: document that --add-virtual-file takes full path
authorJunio C Hamano <gitster@pobox.com>
Fri, 14 Jun 2024 18:40:57 +0000 (11:40 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 26 Jun 2024 19:56:45 +0000 (12:56 -0700)
Tom Scogland noticed that `--add-virtual-file` option uses the path
specified as its value as-is, without prepending any value given to
the `--prefix` option like `--add-file` does.

The behaviour has always been that way since the option was
introduced, but the documentation has always been wrong and said
that it would use the value of `--prefix` just like `--add-file`
does.

We could modify the behaviour to make it literally work like the
documentation said, but it would break existing scripts the users
use.

Noticed-by: Tom Scogland <scogland1@llnl.gov>
Acked-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-archive.txt

index 98526f2bebad16e2814f084005c12c2359378ec2..a0e3fe7996e57b001acef17030a7d47ac59c9ba1 100644 (file)
@@ -53,7 +53,7 @@ OPTIONS
 --prefix=<prefix>/::
        Prepend <prefix>/ to paths in the archive.  Can be repeated; its
        rightmost value is used for all tracked files.  See below which
-       value gets used by `--add-file` and `--add-virtual-file`.
+       value gets used by `--add-file`.
 
 -o <file>::
 --output=<file>::
@@ -67,9 +67,7 @@ OPTIONS
 
 --add-virtual-file=<path>:<content>::
        Add the specified contents to the archive.  Can be repeated to add
-       multiple files.  The path of the file in the archive is built
-       by concatenating the value of the last `--prefix` option (if any)
-       before this `--add-virtual-file` and `<path>`.
+       multiple files.
 +
 The `<path>` argument can start and end with a literal double-quote
 character; the contained file name is interpreted as a C-style string,
@@ -81,6 +79,10 @@ if the path begins or ends with a double-quote character.
 The file mode is limited to a regular file, and the option may be
 subject to platform-dependent command-line limits. For non-trivial
 cases, write an untracked file and use `--add-file` instead.
++
+Note that unlike `--add-file` the path created in the archive is not
+affected by the `--prefix` option, as a full `<path>` can be given as
+the value of the option.
 
 --worktree-attributes::
        Look for attributes in .gitattributes files in the working tree