Re: [PATCH v5 2/4] t3427: accelerate this test by using fast-export and fast-import
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 3, 2019, 21:26 UTC
- Message-ID
- <xmqqsgpdrs01.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190903185524.13467-3-newren@gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 5 quoted lines
> +extract_files_subtree () {
> + git fast-export --no-data HEAD -- files_subtree/ |
> + sed -e "s%\([0-9a-f]\{40\} \)files_subtree/%\1%" |
> + git fast-import --force --quiet
> +}Clever, if a bit filthy ;-). We expect to see something like
M 100644 dead...beef files_subtree/bar M 100755 c0f.....fee files_subtree/foo
in the --no-data output, and the assumption here is that 40-hex followed by " files_subtree/" would never appear anywhere in the stream other than these tree dump, so the sed script can rewrite the above to
M 100644 dead...beef bar M 100755 c0f.....fee foo
by getting rid of the leading directory name (plus the slash at the end).
Thanks.