Commit 547e8b92 authored by Jonathan Nieder's avatar Jonathan Nieder Committed by Junio C Hamano

fast-import: introduce "feature notes" command

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: default avatarThomas Rast <[email protected]>
Improved-by: default avatarSverre Rabbelier <[email protected]>
Signed-off-by: default avatarJonathan Nieder <[email protected]>
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent 68595cd4
......@@ -898,6 +898,12 @@ import-marks::
second, an --import-marks= command-line option overrides
any "feature import-marks" command in the stream.
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.
Processes the specified option so that git fast-import behaves in a
......@@ -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;
......@@ -120,6 +120,7 @@ test_expect_success 'add notes with simple M command' '
cat >input <<INPUT_END
feature notes
commit refs/notes/test
data <<COMMIT
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment