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

[PATCH 1/3] fast-import: clarify handling of cat-blob feature

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 3, 2011, 08:22 UTC
Message-ID
<20110103082246.GB8842@burratino>
In-Reply-To
<20110103080130.GA8842@burratino>
Date: Thu Dec 9 14:45:21 2010 -0600

Remove the undocumented --cat-blob command line option. It used to be a no-op.

While at it, move parsing of --cat-blob-fd to parse_one_feature; this makes the parse_argv loop a little easier to read and puts the code implementing 'feature cat-blob' and --cat-blob-fd closer to each other.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Forgot to mention: these are based against v1.7.4-rc0~24 (t9300: use
perl "head -c" clone in place of "dd bs=1 count=16000" kluge,
2010-12-13) but I wouldn't be surprised if they apply cleanly to other
commits, too. ;-)
 fast-import.c          |    9 +++------
 t/t9300-fast-import.sh |    9 +++++++++
 2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index 7857760..a5cea45 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2977,8 +2977,10 @@ static int parse_one_feature(const char *feature, int from_stream)
 		option_import_marks(feature + 13, from_stream);
 	} else if (!prefixcmp(feature, "export-marks=")) {
 		option_export_marks(feature + 13);
-	} else if (!strcmp(feature, "cat-blob")) {
+	} else if (from_stream && !strcmp(feature, "cat-blob")) {
 		; /* Don't die - this feature is supported */
+	} else if (!from_stream && !prefixcmp(feature, "cat-blob-fd=")) {
+		option_cat_blob_fd(feature + strlen("cat-blob-fd="));
 	} else if (!prefixcmp(feature, "relative-marks")) {
 		relative_marks_paths = 1;
 	} else if (!prefixcmp(feature, "no-relative-marks")) {
@@ -3073,11 +3075,6 @@ static void parse_argv(void)
 		if (parse_one_feature(a + 2, 0))
 			continue;
 
-		if (!prefixcmp(a + 2, "cat-blob-fd=")) {
-			option_cat_blob_fd(a + 2 + strlen("cat-blob-fd="));
-			continue;
-		}
-
 		die("unknown option %s", a);
 	}
 	if (i != global_argc)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 222d105..53aad51 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -1769,10 +1769,19 @@ test_expect_success 'R: feature cat-blob supported' '
 	git fast-import
 '
 
+test_expect_success 'R: no command line option for cat-blob feature' '
+	test_must_fail git fast-import --cat-blob <empty
+'
+
 test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '
 	test_must_fail git fast-import --cat-blob-fd=-1 </dev/null
 '
 
+test_expect_success 'R: cat-blob-fd cannot be specified in stream' '
+	echo "feature cat-blob-fd=1" |
+	test_must_fail git fast-import
+'
+
 test_expect_success 'R: print old blob' '
 	blob=$(echo "yes it can" | git hash-object -w --stdin) &&
 	cat >expect <<-EOF &&
-- 
1.7.4.rc0.580.g89dc.dirty
Previous: Jonathan NiederNext: Jonathan Nieder
Message 9 of 24 in “fast-import: add 'ls' command”
  1. fast-import: add 'ls' commandDavid Barr, Dec 2, 2010
  2. fast-import: add 'ls' commandDavid Barr, Dec 2, 2010
  3. Sverre RabbelierDec 2, 2010
  4. David Michael BarrDec 2, 2010
  5. Jonathan NiederDec 2, 2010
  6. Junio C HamanoDec 2, 2010
  7. David BarrDec 2, 2010
  8. 0/3 fast-import: add 'ls' commandJonathan Nieder, Jan 3, 2011
  9. 1/3 fast-import: clarify handling of cat-blob featureJonathan Nieder, Jan 3, 2011
  10. 2/3 fast-import: treat filemodify with empty tree as deleteJonathan Nieder, Jan 3, 2011
  11. fast-import: treat filemodify with empty tree as deleteJonathan Nieder, Jan 26, 2011
  12. Sverre RabbelierJan 26, 2011
  13. fast-import: treat filemodify with empty tree as deleteJonathan Nieder, Jan 26, 2011
  14. Junio C HamanoJan 27, 2011
  15. Jonathan NiederJan 27, 2011
  16. fast-import: treat filemodify with empty tree as deleteJonathan Nieder, Jan 27, 2011
  17. Peter BaumannJan 27, 2011
  18. Jonathan NiederJan 27, 2011
  19. Peter BaumannJan 27, 2011
  20. Peter BaumannJan 27, 2011
  21. Jonathan NiederJan 28, 2011
  22. 3/3 fast-import: add 'ls' commandJonathan Nieder, Jan 3, 2011
  23. [RFC] fast-import: 'cat-blob' and 'ls' commandsJonathan Nieder, Jan 26, 2011
  24. Sam VilainJan 26, 2011

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.