git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: David Barr <david.barr@cordelta.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Ramkumar Ramachandra <artagnon@gmail.com>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	"Shawn O. Pearce" <spearce@spearce.org>
Subject: [PATCH 1/3] fast-import: clarify handling of cat-blob feature
Date: Mon, 3 Jan 2011 02:22:46 -0600	[thread overview]
Message-ID: <20110103082246.GB8842@burratino> (raw)
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

  reply	other threads:[~2011-01-03  8:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02 10:40 [PATCH/RFC] fast-import: add 'ls' command David Barr
2010-12-02 10:40 ` [PATCH] " David Barr
2010-12-02 12:37   ` Sverre Rabbelier
2010-12-02 12:57     ` David Michael Barr
2010-12-02 17:37     ` Jonathan Nieder
2010-12-02 19:20       ` Junio C Hamano
2010-12-02 22:51         ` David Barr
2011-01-03  8:01 ` [PATCH/RFC v2 0/3] " Jonathan Nieder
2011-01-03  8:22   ` Jonathan Nieder [this message]
2011-01-03  8:24   ` [PATCH 2/3] fast-import: treat filemodify with empty tree as delete Jonathan Nieder
2011-01-26 22:41     ` [PATCH v2] " Jonathan Nieder
2011-01-26 22:45       ` Sverre Rabbelier
2011-01-26 23:06         ` [PATCH jn/fast-import-fix v3] " Jonathan Nieder
2011-01-27  0:04           ` Junio C Hamano
2011-01-27  0:26             ` Jonathan Nieder
2011-01-27  6:07             ` [PATCH v4] " Jonathan Nieder
2011-01-27 19:33               ` Peter Baumann
2011-01-27 19:48                 ` Jonathan Nieder
2011-01-27 20:46                   ` Peter Baumann
2011-01-27 20:48                     ` Peter Baumann
2011-01-28 17:13                     ` Jonathan Nieder
2011-01-03  8:37   ` [PATCH 3/3] fast-import: add 'ls' command Jonathan Nieder
2011-01-26 21:39   ` [RFC] fast-import: 'cat-blob' and 'ls' commands Jonathan Nieder
2011-01-26 23:46     ` Sam Vilain

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=20110103082246.GB8842@burratino \
    --to=jrnieder@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=david.barr@cordelta.com \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    --cc=srabbelier@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).