summaryrefslogtreecommitdiffstats
path: root/git-archive.html
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-06-07 14:53:15 -0700
committerJunio C Hamano <gitster@pobox.com>2022-06-07 14:53:15 -0700
commit80b2839fef1883be53377559ec365cc6fb471ee8 (patch)
tree65ca835f5ec69da51b45572637287f7986671531 /git-archive.html
parentc926f62d061511274a5bfe2b3653a1f729b97a04 (diff)
downloadgit-htmldocs-80b2839fef1883be53377559ec365cc6fb471ee8.tar.gz
Autogenerated HTML docs for v2.36.1-363-g9c897e
Diffstat (limited to 'git-archive.html')
-rw-r--r--git-archive.html40
1 files changed, 36 insertions, 4 deletions
diff --git a/git-archive.html b/git-archive.html
index b8b0adad8..15e99f70e 100644
--- a/git-archive.html
+++ b/git-archive.html
@@ -817,7 +817,9 @@ comment.</p></div>
</dt>
<dd>
<p>
- Prepend &lt;prefix&gt;/ to each filename in the archive.
+ Prepend &lt;prefix&gt;/ to paths in the archive. Can be repeated; its
+ rightmost value is used for all tracked files. See below which
+ value gets used by <code>--add-file</code> and <code>--add-virtual-file</code>.
</p>
</dd>
<dt class="hdlist1">
@@ -837,10 +839,30 @@ comment.</p></div>
<dd>
<p>
Add a non-tracked file 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 <code>--prefix</code> option (if any)
+ before this <code>--add-file</code> and the basename of &lt;file&gt;.
+</p>
+</dd>
+<dt class="hdlist1">
+--add-virtual-file=&lt;path&gt;:&lt;content&gt;
+</dt>
+<dd>
+<p>
+ 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 for <code>--prefix</code> (if any) and the
- basename of &lt;file&gt;.
+ by concatenating the value of the last <code>--prefix</code> option (if any)
+ before this <code>--add-virtual-file</code> and <code>&lt;path&gt;</code>.
</p>
+<div class="paragraph"><p>The <code>&lt;path&gt;</code> argument can start and end with a literal double-quote
+character; the contained file name is interpreted as a C-style string,
+i.e. the backslash is interpreted as escape character. The path must
+be quoted if it contains a colon, to avoid the colon from being
+misinterpreted as the separator between the path and the contents, or
+if the path begins or ends with a double-quote character.</p></div>
+<div class="paragraph"><p>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 <code>--add-file</code> instead.</p></div>
</dd>
<dt class="hdlist1">
--worktree-attributes
@@ -1087,6 +1109,16 @@ while archiving any tree in your <code>$GIT_DIR/info/attributes</code> file.</p>
</p>
</dd>
<dt class="hdlist1">
+<code>git archive -o latest.tar --prefix=build/ --add-file=configure --prefix= HEAD</code>
+</dt>
+<dd>
+<p>
+ Creates a tar archive that contains the contents of the latest
+ commit on the current branch with no prefix and the untracked
+ file <em>configure</em> with the prefix <em>build/</em>.
+</p>
+</dd>
+<dt class="hdlist1">
<code>git config tar.tar.xz.command "xz -c"</code>
</dt>
<dd>
@@ -1116,7 +1148,7 @@ while archiving any tree in your <code>$GIT_DIR/info/attributes</code> file.</p>
<div id="footer">
<div id="footer-text">
Last updated
- 2021-10-29 16:18:45 PDT
+ 2022-06-07 14:51:19 PDT
</div>
</div>
</body>