From: Jonathan Nieder <jrnieder@gmail.com>
To: git@vger.kernel.org
Cc: Johan Herland <johan@herland.net>,
Sverre Rabbelier <srabbelier@gmail.com>,
Ramkumar Ramachandra <artagnon@gmail.com>,
"Shawn O. Pearce" <spearce@spearce.org>,
Sam Vilain <sam@vilain.net>
Subject: [PATCH 2/2] fast-import: introduce "feature notes" command
Date: Tue, 1 Feb 2011 23:07:35 -0600 [thread overview]
Message-ID: <20110202050735.GE15285@elie> (raw)
In-Reply-To: <20110202045826.GC15285@elie>
Here is a "feature" command for streams to use to require support for
the notemodify (N) command.
Support for importing notes was added to git fast-import quite a while
ago (v1.6.6-rc0~21^2~8, 2009-10-09), before the 'feature' facility was
introduced (v1.7.0-rc0~95^2~4, fast-import: add feature command,
2009-12-04) so for compatibility with older git versions, authors
of existing frontends should not start using the "feature notes"
command. Most git versions in wide use support notemodify already.
The purpose of the "feature notes" declaration is instead to
distinguish between git and fast-import backends that do not support
notemodify. In git "feature notes" will be a no-op while in other
current fast-import backends it will error out with a clear error
message.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Still to do: the documentation does not hint at the point mentioned
in paragraphs 2 and 3 above. Ideas for wording?
Aside from that, I think this is ready. Thanks for reading.
Documentation/git-fast-import.txt | 12 +++++++-----
fast-import.c | 6 ++++--
t/t9301-fast-import-notes.sh | 1 +
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
index 086b14f..2393252 100644
--- a/Documentation/git-fast-import.txt
+++ b/Documentation/git-fast-import.txt
@@ -942,11 +942,13 @@ import-marks::
any "feature import-marks" command in the stream.
cat-blob::
- Ignored. Versions of fast-import not supporting the
- "cat-blob" command will exit with a message indicating so.
- This lets the import error out early with a clear message,
- rather than wasting time on the early part of an import
- before the unsupported command is detected.
+ Require that the backend support the 'cat-blob' command.
+ Versions of fast-import not supporting the 'cat-blob'
+ command will exit with a message indicating so.
+
+notes::
+ Require that the backend support the 'notemodify' (N)
+ subcommand to the 'commit' command.
`option`
~~~~~~~~
diff --git a/fast-import.c b/fast-import.c
index 60f26fe..bf2f9f8 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2983,14 +2983,16 @@ 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")) {
- ; /* Don't die - this feature is supported */
} else if (!prefixcmp(feature, "relative-marks")) {
relative_marks_paths = 1;
} else if (!prefixcmp(feature, "no-relative-marks")) {
relative_marks_paths = 0;
} else if (!prefixcmp(feature, "force")) {
force_update = 1;
+ }
+ /* These features are present; don't error out for them. */
+ else if (!strcmp(feature, "cat-blob")) {
+ } else if (!strcmp(feature, "notes")) {
} else {
return 0;
}
diff --git a/t/t9301-fast-import-notes.sh b/t/t9301-fast-import-notes.sh
index 7cf8cd8..463254c 100755
--- a/t/t9301-fast-import-notes.sh
+++ b/t/t9301-fast-import-notes.sh
@@ -120,6 +120,7 @@ test_expect_success 'add notes with simple M command' '
test_tick
cat >input <<INPUT_END
+feature notes
commit refs/notes/test
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
--
1.7.2.3
next prev parent reply other threads:[~2011-02-02 5:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-02 4:58 [PATCH/RFC 0/2] fast-import: introduce "feature notes" command Jonathan Nieder
2011-02-02 5:00 ` [PATCH 1/2] Documentation/fast-import: explain how to remove a note Jonathan Nieder
2011-02-02 5:07 ` Jonathan Nieder [this message]
2011-02-02 19:47 ` [PATCH 2/2] fast-import: introduce "feature notes" command Thomas Rast
2011-02-02 19:57 ` Sverre Rabbelier
2011-02-02 20:22 ` Jonathan Nieder
2011-02-09 21:46 ` [PATCH maint-1.7.0 v2 0/2] " Jonathan Nieder
2011-02-09 22:43 ` [PATCH 1/2] fast-import: clarify documentation of "feature" command Jonathan Nieder
2011-02-09 22:43 ` [PATCH 2/2] fast-import: introduce "feature notes" command Jonathan Nieder
2011-02-09 23:06 ` Sverre Rabbelier
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=20110202050735.GE15285@elie \
--to=jrnieder@gmail.com \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=johan@herland.net \
--cc=sam@vilain.net \
--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).