git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH 1/3] filter-branch: optionally dump all mappings at the end

From
Johannes Sixt <j6t@kdbg.org>
Date
Dec 31, 2010, 17:09 UTC
Message-ID
<201012311809.24205.j6t@kdbg.org>
In-Reply-To
<57609f1df897f19becc77d5c43c3c3608725160b.1293809100.git.trast@student.ethz.ch>
On Freitag, 31. Dezember 2010, Thomas Rast wrote:
Show 8 quoted lines
> In some cases, like the sub/super-project filtering attempted in this
> series, it may be necessary to carry over the mappings from one or
> more filter-branch run to another.
>
> As the first part to this, make a --dump-map option that dumps a flat
> text file with lines of the form
>
>   $sha1 $(map $sha1)

Despite the alternative implementation that I suggest below, the commit message (and also the documentation to be written) should state the output format in this way.

Show 7 quoted lines
> @@ -194,6 +195,16 @@ do
>  	--original)
>  		orig_namespace=$(expr "$OPTARG/" : '\(.*[^/]\)/*$')/
>  		;;
> +	--dump-map)
> +		case "$OPTARG" in
> +		/*)
Please use
	if is_absolute_path "$OPTARG"
	then
	...
Show 7 quoted lines
> +# At this point the mappings are stable so we can dump them if
> +# requested
> +
> +if test -n "$dump_map"; then
> +	( cd "$workdir"/../map/; ls ) |
> +	while read sha1; do
> +		echo $sha1 $(map $sha1)

There must be a more efficient way than to spawn an additional process for each mapped SHA1. Since this excercises only one branch in the map() function anyway, how about this:

	( cd "$workdir"/../map/ && ls -1 ) |
	while read sha1; do
		read mapped << $sha1 &&
		echo $sha1 $mapped
	done > "$dump_map"

Though, there is some mechanism that maps one SHA1s to more than one, and my approach might not cover that case.

> +	done > "$dump_map"
-- Hannes
Previous: Thomas RastNext: Thomas Rast
Message 3 of 11 in “Submodule filtering for filter-branch”
  1. 0/3 Submodule filtering for filter-branchThomas Rast, Dec 31, 2010
  2. 1/3 filter-branch: optionally dump all mappings at the endThomas Rast, Dec 31, 2010
  3. Johannes SixtDec 31, 2010
  4. 2/3 filter-branch: optionally load existing mappings prior to filteringThomas Rast, Dec 31, 2010
  5. Johannes SixtDec 31, 2010
  6. 3/3 filter-branch: support --submodule-filterThomas Rast, Dec 31, 2010
  7. Johannes SixtDec 31, 2010
  8. Jeffrey Phillips FreemanJan 3, 2011
  9. Thomas RastJan 4, 2011
  10. Junio C HamanoJan 4, 2011
  11. Johannes SixtDec 31, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.