Re: [PATCH/RFC] Teach fast-import to import subtrees named by tree id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sverre Rabbelier wrote:
> On Thu, Jul 1, 2010 at 05:18, Jonathan Nieder <jrnieder@xxxxxxxxx> wrote:

>> I was not sure whether to add a "feature" specification for
>> this, so I’ll try that as a separate patch.
[...]
> That should be as easy as adding an option though?

Yes, I think so.

-- 8< --
Subject: fast-import: And a feature option for importing subtrees

The "feature external-trees" command avoids wasting time
importing with old backends only to error out on a later
"M 040000 <tree hash> <path>".

Its use is completely optional.  In particular, if backends
without the external-trees feature become extinct, then there
will be no reason to keep using it.

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 Documentation/git-fast-import.txt |   17 +++++++++++++----
 fast-import.c                     |    3 +++
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
index 5edf059..54a3ea1 100644
--- a/Documentation/git-fast-import.txt
+++ b/Documentation/git-fast-import.txt
@@ -484,9 +484,12 @@ External data format::
 +
 Here usually `<dataref>` must be either a mark reference (`:<idnum>`)
 set by a prior `blob` command, or a full 40-byte SHA-1 of an
-existing Git blob object.  If `<mode>` is `040000` then
-`<dataref>` must be the full 40-byte SHA-1 of an existing
-Git tree object or a mark reference set with `--import-marks`.
+existing Git blob object.
++
+If `<mode>` is `040000` then `<dataref>` must be the full 40-byte
+SHA-1 of an existing Git tree object or a mark reference set with
+`--import-marks`.  Frontends can check for a backend supporting
+this mode with the `feature external-trees` command.
 
 Inline data format::
 	The data content for the file has not been supplied yet.
@@ -889,7 +892,8 @@ The <feature> part of the command may be any string matching
 ^[a-zA-Z][a-zA-Z-]*$ and should be understood by fast-import.
 
 Feature work identical as their option counterparts with the
-exception of the import-marks feature, see below.
+exception of the import-marks and external-trees features;
+see below.
 
 The following features are currently supported:
 
@@ -898,6 +902,7 @@ The following features are currently supported:
 * export-marks
 * relative-marks
 * no-relative-marks
+* external-trees
 * force
 
 The import-marks behaves differently from when it is specified as
@@ -905,6 +910,10 @@ commandline option in that only one "feature import-marks" is allowed
 per stream. Also, any --import-marks= specified on the commandline
 will override those from the stream (if any).
 
+The `feature external-trees` command can be used to abort early
+if the backend does not support `M 040000 <tree hash> <path>`.
+It has no effect in recent fast-import verisons.
+
 `option`
 ~~~~~~~~
 Processes the specified option so that git fast-import behaves in a
diff --git a/fast-import.c b/fast-import.c
index ad6843a..290d4b1 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2820,6 +2820,9 @@ static void parse_feature(void)
 	if (seen_data_command)
 		die("Got feature command '%s' after data command", feature);
 
+	if (!prefixcmp(feature, "external-trees"))
+		/* Yes, we do support the M 040000 command. */
+		return;
 	if (parse_one_feature(feature, 1))
 		return;
 
-- 
1.7.1.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]