From: Jonathan Nieder <jrnieder@gmail.com>
To: Sverre Rabbelier <srabbelier@gmail.com>
Cc: Thomas Rast <trast@student.ethz.ch>,
git@vger.kernel.org, Johan Herland <johan@herland.net>,
Ramkumar Ramachandra <artagnon@gmail.com>,
"Shawn O. Pearce" <spearce@spearce.org>,
Sam Vilain <sam@vilain.net>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 2/2] fast-import: introduce "feature notes" command
Date: Wed, 9 Feb 2011 16:43:57 -0600 [thread overview]
Message-ID: <20110209224357.GB17128@elie> (raw)
In-Reply-To: <20110209214638.GA16716@elie>
Here is a 'feature' command for streams to use to require support for
the notemodify (N) command.
When the 'feature' facility was introduced (v1.7.0-rc0~95^2~4,
2009-12-04), the notes import feature was old news (v1.6.6-rc0~21^2~8,
2009-10-09) and it was not obvious it deserved to be a named feature.
But now that is clear, since all major non-git fast-import backends
lack support for it.
Details: on git version with this patch applied, any "feature notes"
command in the features/options section at the beginning of a stream
will be treated as a no-op. On fast-import implementations without
the feature (and older git versions), the command instead errors out
with a message like
This version of fast-import does not support feature notes.
So by declaring use of notes at the beginning of a stream, frontends
can avoid wasting time and other resources when the backend does not
support notes. (This would be especially important for backends that
do not support rewinding history after a botched import.)
Improved-by: Thomas Rast <trast@student.ethz.ch>
Improved-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Documentation/git-fast-import.txt | 6 ++++++
fast-import.c | 2 ++
t/t9301-fast-import-notes.sh | 1 +
3 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
index 3bf04e3..becee8b 100644
--- a/Documentation/git-fast-import.txt
+++ b/Documentation/git-fast-import.txt
@@ -898,6 +898,12 @@ import-marks::
second, an --import-marks= command-line option overrides
any "feature import-marks" command in the stream.
+notes::
+ Require that the backend support the 'notemodify' (N)
+ subcommand to the 'commit' command.
+ Versions of fast-import not supporting notes will exit
+ with a message indicating so.
+
`option`
~~~~~~~~
Processes the specified option so that git fast-import behaves in a
diff --git a/fast-import.c b/fast-import.c
index 74f08bd..ff56ea2 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2821,6 +2821,8 @@ static int parse_one_feature(const char *feature, int from_stream)
relative_marks_paths = 0;
} else if (!prefixcmp(feature, "force")) {
force_update = 1;
+ } else if (!strcmp(feature, "notes")) {
+ ; /* do nothing; we have the feature */
} else {
return 0;
}
diff --git a/t/t9301-fast-import-notes.sh b/t/t9301-fast-import-notes.sh
index a5c99d8..164edf0 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.4
next prev parent reply other threads:[~2011-02-09 22:44 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 ` [PATCH 2/2] fast-import: introduce "feature notes" command Jonathan Nieder
2011-02-02 19:47 ` 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 ` Jonathan Nieder [this message]
2011-02-09 23:06 ` [PATCH 2/2] fast-import: introduce "feature notes" command 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=20110209224357.GB17128@elie \
--to=jrnieder@gmail.com \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johan@herland.net \
--cc=sam@vilain.net \
--cc=spearce@spearce.org \
--cc=srabbelier@gmail.com \
--cc=trast@student.ethz.ch \
/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).