Skip to content

Commit 72c2820

Browse files
committed
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 <[email protected]> Acked-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 564d025 commit 72c2820

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Documentation/git-archive.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ OPTIONS
5353
--prefix=<prefix>/::
5454
Prepend <prefix>/ to paths in the archive. Can be repeated; its
5555
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`.
5757

5858
-o <file>::
5959
--output=<file>::
@@ -67,9 +67,7 @@ OPTIONS
6767

6868
--add-virtual-file=<path>:<content>::
6969
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.
7371
+
7472
The `<path>` argument can start and end with a literal double-quote
7573
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.
8179
The file mode is limited to a regular file, and the option may be
8280
subject to platform-dependent command-line limits. For non-trivial
8381
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.
8486

8587
--worktree-attributes::
8688
Look for attributes in .gitattributes files in the working tree

0 commit comments

Comments
 (0)