From a75910602a7367281409c4f13b5b87f350a0dc43 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 28 May 2022 08:57:46 +0200 Subject: [PATCH] archive: improve documentation of --prefix MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Document the interaction between --add-file and --prefix by giving an example. Helped-by: Junio C Hamano Signed-off-by: René Scharfe Signed-off-by: Junio C Hamano --- Documentation/git-archive.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt index bc4e76a783..94519aae23 100644 --- a/Documentation/git-archive.txt +++ b/Documentation/git-archive.txt @@ -49,7 +49,9 @@ OPTIONS Report progress to stderr. --prefix=/:: - Prepend / to each filename in the archive. + Prepend / 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`. -o :: --output=:: @@ -57,9 +59,9 @@ OPTIONS --add-file=:: 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 for `--prefix` (if any) and the - basename of . + 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-file` and the basename of . --worktree-attributes:: Look for attributes in .gitattributes files in the working tree @@ -194,6 +196,12 @@ EXAMPLES commit on the current branch. Note that the output format is inferred by the extension of the output file. +`git archive -o latest.tar --prefix=build/ --add-file=configure --prefix= HEAD`:: + + Creates a tar archive that contains the contents of the latest + commit on the current branch with no prefix and the untracked + file 'configure' with the prefix 'build/'. + `git config tar.tar.xz.command "xz -c"`:: Configure a "tar.xz" format for making LZMA-compressed tarfiles. -- 2.39.5