Skip to contentSkip to conversation

doc/fast-import: document feature import-marks-if-exists

PATCH New Dmitry Ivankov 1 participant 1 message Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 doc/fast-import: document feature import-marks-if-exists

fast-import command-line option --import-marks-if-exists was introduced in commit dded4f1 (fast-import: Introduce --import-marks-if-exists, 2011-01-15)

--import-marks option can be set via a "feature" command in a fast-import stream and --import-marks-if-exists had support for such specification from the very beginning too due to some shared codebase. Though the documentation for this feature wasn't written in dded4f1.

Add the documentation for "feature import-marks-if-exists=<file>". Also add a minimalistic test for it.

---
This is a new round for 2/3 from [1]. 1/3 and 3/3 are already in master. The only change from v2 is more tests, now there are:

- feature import-marks-if-exists=nonexisting.marks
- feature import-marks-if-exists=existing.marks
- --import-marks=existing.marks & feature=nonexisting.marks
- --import-marks-if-exists=nonexisting.marks & feature=existing.marks

These seem to cover most cases: feature works and is overriden by command line arguments. Having more than one feature specified isn't tested to fail, imo it'd be better to support specifying multiple marks files via features anyway. It's not yet done because unlike other simple options are easy to override on the fly (we first parse the stream for features and then parse argv. So argv overrides things), while import marks are more tricky:
- overriding rule is more complex, any command line option should discard all feature ones.
- reading them could be expensive (we do lookup objects they refer to).
- if the lookup fails or file is otherwise corrupt/bad, we die. So we shouldn't read marks files given by features if they are to be overriden by command line options.

 Documentation/git-fast-import.txt |   10 +++++--
 t/t9300-fast-import.sh            |   47 +++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 3 deletions(-)
Documentation/git-fast-import.txt +7 -3
index 2969388..db0d75f 100644
@@ -1012,10 +1012,14 @@ force::
 	(see OPTIONS, above).
 
 import-marks::
+import-marks-if-exists::
 	Like --import-marks except in two respects: first, only one
-	"feature import-marks" command is allowed per stream;
-	second, an --import-marks= command-line option overrides
-	any "feature import-marks" command in the stream.
+	"feature import-marks" or "feature import-marks-if-exists"
+	command is allowed per stream; second, an --import-marks=
+	or --import-marks-if-exists command-line option overrides
+	any of these "feature" commands in the stream; third,
+	"feature import-marks-if-exists" like a corresponding
+	command-line option silently skips a nonexistent file.
 
 cat-blob::
 ls::
t/t9300-fast-import.sh +47 -0

53 lines not on this page · raw message

Signature · 1 line
1.7.3.4