archive: document that --add-virtual-file takes full path

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>

Junio C Hamano committed Jun 14, 2024 at 11:40 UTC 72c282098d27ee7252a431fc93dfe0f271242ed8
1 file changed +6 -4
Documentation/git-archive.txt
+6 -4
@@ -53,7 +53,7 @@ OPTIONS
53 --prefix=<prefix>/::
54 Prepend <prefix>/ to paths in the archive. Can be repeated; its
55 rightmost value is used for all tracked files. See below which
56 - value gets used by `--add-file` and `--add-virtual-file`.
56 + value gets used by `--add-file`.
57
58 -o <file>::
59 --output=<file>::
@@ -67,9 +67,7 @@ OPTIONS
67
68 --add-virtual-file=<path>:<content>::
69 Add the specified contents to the archive. Can be repeated to add
70 - multiple files. The path of the file in the archive is built
71 - by concatenating the value of the last `--prefix` option (if any)
72 - before this `--add-virtual-file` and `<path>`.
70 + multiple files.
71 +
72 The `<path>` argument can start and end with a literal double-quote
73 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.
79 The file mode is limited to a regular file, and the option may be
80 subject to platform-dependent command-line limits. For non-trivial
81 cases, write an untracked file and use `--add-file` instead.
82 ++
83 +Note that unlike `--add-file` the path created in the archive is not
84 +affected by the `--prefix` option, as a full `<path>` can be given as
85 +the value of the option.
86
87 --worktree-attributes::
88 Look for attributes in .gitattributes files in the working tree