All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH v6+ 0/7] js/scalar-diagnose rebased
Date: Sat, 28 May 2022 16:11:11 -0700	[thread overview]
Message-ID: <20220528231118.3504387-1-gitster@pobox.com> (raw)
In-Reply-To: <pull.1128.v6.git.1653145696.gitgitgadget@gmail.com>

Recent document clarification on the "--prefix" option of the "git
archive" command from René serves as a good basis for the
documentation of the "--add-virtual-file" option added by this
series, so here is my attempt to rebase js/scalar-diagnose topic
on it to hopefully help reduce Dscho's workload ;-)

Aside from obvious adjustments needed while rebasing onto the
updated documentation, there are only a couple of changes:

 - The way the <path> in --add-virtual-file=<path>:<contents> is
   used has been corrected.  Earlier, leading directory components
   of the <path> were all discarded and used nowhere, which made no
   sense.  The <path> is used as a whole, but for consistency with
   --add-file=<path>, <prefix> is still applied.

 - Overly loose quoting of variables in test scripts has been
   corrected.

Both changes have been in 'seen' from before the rebase.

1:  510f6b226b ! 1:  61522a0866 archive: optionally add "virtual" files
    @@ Commit message
     
      ## Documentation/git-archive.txt ##
     @@ Documentation/git-archive.txt: OPTIONS
    - 	by concatenating the value for `--prefix` (if any) and the
    - 	basename of <file>.
    + --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`.
    ++	value gets used by `--add-file` and `--add-virtual-file`.
    + 
    + -o <file>::
    + --output=<file>::
    +@@ Documentation/git-archive.txt: OPTIONS
    + 	concatenating the value of the last `--prefix` option (if any)
    + 	before this `--add-file` and the basename of <file>.
      
     +--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 for `--prefix` (if any) and the
    -+	basename of <file>.
    ++	by concatenating the value of the last `--prefix` option (if any)
    ++	before this `--add-virtual-file` and `<path>`.
     ++
     +The `<path>` cannot contain any colon, the file mode is limited to
     +a regular file, and the option may be subject to platform-dependent
    @@ archive.c: static int queue_or_write_archive_entry(const struct object_id *oid,
      
      int write_archive_entries(struct archiver_args *args,
     @@ archive.c: int write_archive_entries(struct archiver_args *args,
    - 		strbuf_addstr(&path_in_archive, basename(path));
      
    - 		strbuf_reset(&content);
    + 		put_be64(fake_oid.hash, i + 1);
    + 
    +-		strbuf_reset(&path_in_archive);
    +-		if (info->base)
    +-			strbuf_addstr(&path_in_archive, info->base);
    +-		strbuf_addstr(&path_in_archive, basename(path));
    +-
    +-		strbuf_reset(&content);
     -		if (strbuf_read_file(&content, path, info->stat.st_size) < 0)
    -+		if (info->content)
    -+			err = write_entry(args, &fake_oid, path_in_archive.buf,
    -+					  path_in_archive.len,
    -+					  canon_mode(info->stat.st_mode),
    +-			err = error_errno(_("cannot read '%s'"), path);
    +-		else
    +-			err = write_entry(args, &fake_oid, path_in_archive.buf,
    +-					  path_in_archive.len,
    ++		if (!info->content) {
    ++			strbuf_reset(&path_in_archive);
    ++			if (info->base)
    ++				strbuf_addstr(&path_in_archive, info->base);
    ++			strbuf_addstr(&path_in_archive, basename(path));
    ++
    ++			strbuf_reset(&content);
    ++			if (strbuf_read_file(&content, path, info->stat.st_size) < 0)
    ++				err = error_errno(_("could not read '%s'"), path);
    ++			else
    ++				err = write_entry(args, &fake_oid, path_in_archive.buf,
    ++						  path_in_archive.len,
    ++						  canon_mode(info->stat.st_mode),
    ++						  content.buf, content.len);
    ++		} else {
    ++			err = write_entry(args, &fake_oid,
    ++					  path, strlen(path),
    + 					  canon_mode(info->stat.st_mode),
    +-					  content.buf, content.len);
     +					  info->content, info->stat.st_size);
    -+		else if (strbuf_read_file(&content, path,
    -+					  info->stat.st_size) < 0)
    - 			err = error_errno(_("cannot read '%s'"), path);
    - 		else
    - 			err = write_entry(args, &fake_oid, path_in_archive.buf,
    ++		}
    ++
    + 		if (err)
    + 			break;
    + 	}
     @@ archive.c: static void extra_file_info_clear(void *util, const char *str)
      {
      	struct extra_file_info *info = util;
2:  208f4aad5f ! 2:  5e9d19a70f archive --add-virtual-file: allow paths containing colons
    @@ Commit message
     
      ## Documentation/git-archive.txt ##
     @@ Documentation/git-archive.txt: OPTIONS
    - 	by concatenating the value for `--prefix` (if any) and the
    - 	basename of <file>.
    + 	by concatenating the value of the last `--prefix` option (if any)
    + 	before this `--add-virtual-file` and `<path>`.
      +
     -The `<path>` cannot contain any colon, 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.
     +The `<path>` argument can start and end with a literal double-quote
    -+character; The contained file name is interpreted as a C-style string,
    ++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
    @@ t/t5003-archive-zip.sh: check_zip with_untracked
      test_expect_success UNZIP 'git archive --format=zip --add-virtual-file' '
     +	if test_have_prereq FUNNYNAMES
     +	then
    -+		PATHNAME=quoted:colon
    ++		PATHNAME="pathname with : colon"
     +	else
    -+		PATHNAME=quoted
    ++		PATHNAME="pathname without colon"
     +	fi &&
      	git archive --format=zip >with_file_with_content.zip \
    -+		--add-virtual-file=\"$PATHNAME\": \
    ++		--add-virtual-file=\""$PATHNAME"\": \
      		--add-virtual-file=hello:world $EMPTY_TREE &&
      	test_when_finished "rm -rf tmp-unpack" &&
      	mkdir tmp-unpack && (
      		cd tmp-unpack &&
      		"$GIT_UNZIP" ../with_file_with_content.zip &&
      		test_path_is_file hello &&
    -+		test_path_is_file $PATHNAME &&
    ++		test_path_is_file "$PATHNAME" &&
      		test world = $(cat hello)
      	)
      '
3:  bc1164404f = 3:  4f5b3aa775 scalar: validate the optional enlistment argument
4:  69daeb7d9d ! 4:  f4f070df8e Implement `scalar diagnose`
    @@ Metadata
     Author: Johannes Schindelin <Johannes.Schindelin@gmx.de>
     
      ## Commit message ##
    -    Implement `scalar diagnose`
    +    scalar: implement `scalar diagnose`
     
         Over the course of Scalar's development, it became obvious that there is
         a need for a command that can gather all kinds of useful information
5:  5c1ef19524 = 5:  0417d8abe4 scalar diagnose: include disk space information
6:  0325b9c3ab = 6:  5531b65ddb scalar: teach `diagnose` to gather packfile info
7:  8fee365b07 = 7:  ce9eba5e32 scalar: teach `diagnose` to gather loose objects information



  parent reply	other threads:[~2022-05-28 23:11 UTC|newest]

Thread overview: 140+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26  8:41 [PATCH 0/5] scalar: implement the subcommand "diagnose" Johannes Schindelin via GitGitGadget
2022-01-26  8:41 ` [PATCH 1/5] Implement `scalar diagnose` Johannes Schindelin via GitGitGadget
2022-01-26  9:34   ` René Scharfe
2022-01-26 22:20     ` Taylor Blau
2022-02-06 21:34       ` Johannes Schindelin
2022-01-27 19:38   ` Elijah Newren
2022-01-26  8:41 ` [PATCH 2/5] scalar diagnose: include disk space information Johannes Schindelin via GitGitGadget
2022-01-26  8:41 ` [PATCH 3/5] scalar: teach `diagnose` to gather packfile info Matthew John Cheetham via GitGitGadget
2022-01-26 22:43   ` Taylor Blau
2022-01-27 15:14     ` Derrick Stolee
2022-02-06 21:38       ` Johannes Schindelin
2022-01-26  8:41 ` [PATCH 4/5] scalar: teach `diagnose` to gather loose objects information Matthew John Cheetham via GitGitGadget
2022-01-26 22:50   ` Taylor Blau
2022-01-27 15:17     ` Derrick Stolee
2022-01-27 18:59   ` Elijah Newren
2022-02-06 21:25     ` Johannes Schindelin
2022-01-26  8:41 ` [PATCH 5/5] scalar diagnose: show a spinner while staging content Johannes Schindelin via GitGitGadget
2022-01-27 15:19 ` [PATCH 0/5] scalar: implement the subcommand "diagnose" Derrick Stolee
2022-02-06 21:13   ` Johannes Schindelin
2022-02-06 22:39 ` [PATCH v2 0/6] " Johannes Schindelin via GitGitGadget
2022-02-06 22:39   ` [PATCH v2 1/6] archive: optionally add "virtual" files Johannes Schindelin via GitGitGadget
2022-02-07 19:55     ` René Scharfe
2022-02-07 23:30       ` Junio C Hamano
2022-02-08 13:12         ` Johannes Schindelin
2022-02-08 17:44           ` Junio C Hamano
2022-02-08 20:58             ` René Scharfe
2022-02-09 22:48               ` Junio C Hamano
2022-02-10 19:10                 ` René Scharfe
2022-02-10 19:23                   ` Junio C Hamano
2022-02-11 19:16                     ` René Scharfe
2022-02-11 21:27                       ` Junio C Hamano
2022-02-12  9:12                         ` René Scharfe
2022-02-13  6:25                           ` Junio C Hamano
2022-02-13  9:02                             ` René Scharfe
2022-02-14 17:22                               ` Junio C Hamano
2022-02-08 12:54       ` Johannes Schindelin
2022-02-06 22:39   ` [PATCH v2 2/6] scalar: validate the optional enlistment argument Johannes Schindelin via GitGitGadget
2022-02-06 22:39   ` [PATCH v2 3/6] Implement `scalar diagnose` Johannes Schindelin via GitGitGadget
2022-02-07 19:55     ` René Scharfe
2022-02-08 12:08       ` Johannes Schindelin
2022-02-06 22:39   ` [PATCH v2 4/6] scalar diagnose: include disk space information Johannes Schindelin via GitGitGadget
2022-02-06 22:39   ` [PATCH v2 5/6] scalar: teach `diagnose` to gather packfile info Matthew John Cheetham via GitGitGadget
2022-02-06 22:39   ` [PATCH v2 6/6] scalar: teach `diagnose` to gather loose objects information Matthew John Cheetham via GitGitGadget
2022-05-04 15:25   ` [PATCH v3 0/7] scalar: implement the subcommand "diagnose" Johannes Schindelin via GitGitGadget
2022-05-04 15:25     ` [PATCH v3 1/7] archive: optionally add "virtual" files Johannes Schindelin via GitGitGadget
2022-05-04 15:25     ` [PATCH v3 2/7] archive --add-file-with-contents: allow paths containing colons Johannes Schindelin via GitGitGadget
2022-05-07  2:06       ` Elijah Newren
2022-05-09 21:04         ` Johannes Schindelin
2022-05-04 15:25     ` [PATCH v3 3/7] scalar: validate the optional enlistment argument Johannes Schindelin via GitGitGadget
2022-05-04 15:25     ` [PATCH v3 4/7] Implement `scalar diagnose` Johannes Schindelin via GitGitGadget
2022-05-04 15:25     ` [PATCH v3 5/7] scalar diagnose: include disk space information Johannes Schindelin via GitGitGadget
2022-05-04 15:25     ` [PATCH v3 6/7] scalar: teach `diagnose` to gather packfile info Matthew John Cheetham via GitGitGadget
2022-05-04 15:25     ` [PATCH v3 7/7] scalar: teach `diagnose` to gather loose objects information Matthew John Cheetham via GitGitGadget
2022-05-07  2:23     ` [PATCH v3 0/7] scalar: implement the subcommand "diagnose" Elijah Newren
2022-05-10 19:26     ` [PATCH v4 " Johannes Schindelin via GitGitGadget
2022-05-10 19:26       ` [PATCH v4 1/7] archive: optionally add "virtual" files Johannes Schindelin via GitGitGadget
2022-05-10 21:48         ` Junio C Hamano
2022-05-10 22:06           ` rsbecker
2022-05-10 23:21             ` Junio C Hamano
2022-05-11 16:14               ` René Scharfe
2022-05-11 19:27                 ` Junio C Hamano
2022-05-12 16:16                   ` René Scharfe
2022-05-12 18:15                     ` Junio C Hamano
2022-05-12 21:31                       ` Junio C Hamano
2022-05-14  7:06                         ` René Scharfe
2022-05-12 22:31           ` [PATCH] fixup! " Junio C Hamano
2022-05-10 19:26       ` [PATCH v4 2/7] archive --add-file-with-contents: allow paths containing colons Johannes Schindelin via GitGitGadget
2022-05-10 21:56         ` Junio C Hamano
2022-05-10 22:23           ` rsbecker
2022-05-19 18:12             ` Johannes Schindelin
2022-05-19 18:09           ` Johannes Schindelin
2022-05-19 18:44             ` Junio C Hamano
2022-05-10 19:27       ` [PATCH v4 3/7] scalar: validate the optional enlistment argument Johannes Schindelin via GitGitGadget
2022-05-17 14:51         ` Ævar Arnfjörð Bjarmason
2022-05-18 17:35           ` Junio C Hamano
2022-05-20  7:30             ` Ævar Arnfjörð Bjarmason
2022-05-20 15:55               ` Johannes Schindelin
2022-05-21  9:54                 ` Ævar Arnfjörð Bjarmason
2022-05-22  5:50                   ` Junio C Hamano
2022-05-24 12:25                     ` Johannes Schindelin
2022-05-24 18:11                       ` Ævar Arnfjörð Bjarmason
2022-05-24 19:29                         ` Junio C Hamano
2022-05-25 10:31                           ` Johannes Schindelin
2022-05-10 19:27       ` [PATCH v4 4/7] Implement `scalar diagnose` Johannes Schindelin via GitGitGadget
2022-05-17 14:53         ` Ævar Arnfjörð Bjarmason
2022-05-10 19:27       ` [PATCH v4 5/7] scalar diagnose: include disk space information Johannes Schindelin via GitGitGadget
2022-05-10 19:27       ` [PATCH v4 6/7] scalar: teach `diagnose` to gather packfile info Matthew John Cheetham via GitGitGadget
2022-05-10 19:27       ` [PATCH v4 7/7] scalar: teach `diagnose` to gather loose objects information Matthew John Cheetham via GitGitGadget
2022-05-17 15:03       ` [PATCH v4 0/7] scalar: implement the subcommand "diagnose" Ævar Arnfjörð Bjarmason
2022-05-17 15:28         ` rsbecker
2022-05-19 18:17           ` Johannes Schindelin
2022-05-19 18:17       ` [PATCH v5 " Johannes Schindelin via GitGitGadget
2022-05-19 18:17         ` [PATCH v5 1/7] archive: optionally add "virtual" files Johannes Schindelin via GitGitGadget
2022-05-20 14:41           ` René Scharfe
2022-05-20 16:21             ` Junio C Hamano
2022-05-19 18:17         ` [PATCH v5 2/7] archive --add-file-with-contents: allow paths containing colons Johannes Schindelin via GitGitGadget
2022-05-19 18:17         ` [PATCH v5 3/7] scalar: validate the optional enlistment argument Johannes Schindelin via GitGitGadget
2022-05-19 18:18         ` [PATCH v5 4/7] Implement `scalar diagnose` Johannes Schindelin via GitGitGadget
2022-05-19 18:18         ` [PATCH v5 5/7] scalar diagnose: include disk space information Johannes Schindelin via GitGitGadget
2022-05-19 18:18         ` [PATCH v5 6/7] scalar: teach `diagnose` to gather packfile info Matthew John Cheetham via GitGitGadget
2022-05-19 18:18         ` [PATCH v5 7/7] scalar: teach `diagnose` to gather loose objects information Matthew John Cheetham via GitGitGadget
2022-05-19 19:23         ` [PATCH v5 0/7] scalar: implement the subcommand "diagnose" Junio C Hamano
2022-05-21 15:08         ` [PATCH v6 " Johannes Schindelin via GitGitGadget
2022-05-21 15:08           ` [PATCH v6 1/7] archive: optionally add "virtual" files Johannes Schindelin via GitGitGadget
2022-05-25 21:11             ` Junio C Hamano
2022-05-26  9:09               ` René Scharfe
2022-05-26 17:10                 ` Junio C Hamano
2022-05-26 18:57                   ` René Scharfe
2022-05-26 20:16                     ` Junio C Hamano
2022-05-27 17:02                       ` René Scharfe
2022-05-27 19:01                         ` Junio C Hamano
2022-05-28  6:57                           ` René Scharfe
2022-05-21 15:08           ` [PATCH v6 2/7] archive --add-virtual-file: allow paths containing colons Johannes Schindelin via GitGitGadget
2022-05-25 20:22             ` Junio C Hamano
2022-05-25 21:42               ` Junio C Hamano
2022-05-25 22:34                 ` Junio C Hamano
2022-05-21 15:08           ` [PATCH v6 3/7] scalar: validate the optional enlistment argument Johannes Schindelin via GitGitGadget
2022-05-21 15:08           ` [PATCH v6 4/7] Implement `scalar diagnose` Johannes Schindelin via GitGitGadget
2022-05-21 15:08           ` [PATCH v6 5/7] scalar diagnose: include disk space information Johannes Schindelin via GitGitGadget
2022-05-21 15:08           ` [PATCH v6 6/7] scalar: teach `diagnose` to gather packfile info Matthew John Cheetham via GitGitGadget
2022-05-21 15:08           ` [PATCH v6 7/7] scalar: teach `diagnose` to gather loose objects information Matthew John Cheetham via GitGitGadget
2022-05-28 23:11           ` Junio C Hamano [this message]
2022-05-28 23:11             ` [PATCH v6+ 1/7] archive: optionally add "virtual" files Junio C Hamano
2022-05-28 23:11             ` [PATCH v6+ 2/7] archive --add-virtual-file: allow paths containing colons Junio C Hamano
2022-06-15 18:16               ` Adam Dinwoodie
2022-06-15 20:00                 ` Junio C Hamano
2022-06-15 21:36                   ` Adam Dinwoodie
2022-06-18 20:19                     ` Johannes Schindelin
2022-06-18 22:05                       ` Junio C Hamano
2022-06-20  9:41                       ` Adam Dinwoodie
2022-05-28 23:11             ` [PATCH v6+ 3/7] scalar: validate the optional enlistment argument Junio C Hamano
2022-05-28 23:11             ` [PATCH v6+ 4/7] scalar: implement `scalar diagnose` Junio C Hamano
2022-06-10  2:08               ` Ævar Arnfjörð Bjarmason
2022-06-10 16:44                 ` Junio C Hamano
2022-06-10 17:35                   ` Ævar Arnfjörð Bjarmason
2022-05-28 23:11             ` [PATCH v6+ 5/7] scalar diagnose: include disk space information Junio C Hamano
2022-05-28 23:11             ` [PATCH v6+ 6/7] scalar: teach `diagnose` to gather packfile info Junio C Hamano
2022-05-28 23:11             ` [PATCH v6+ 7/7] scalar: teach `diagnose` to gather loose objects information Junio C Hamano
2022-05-30 10:12             ` [PATCH v6+ 0/7] js/scalar-diagnose rebased Johannes Schindelin
2022-05-30 17:37               ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220528231118.3504387-1-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.