Home Explore Blog CI



git

15th chunk of `Documentation/git-fast-import.adoc`
b60c24aebb6601c53d35544b2c5a9a7c3a4efebfc33459d70000000100000fa1
 either a mark reference (`:<idnum>`)
set previously or a full 40-byte SHA-1 of a Git blob, preexisting or
ready to be written.

Output uses the same format as `git cat-file --batch`:

====
	<sha1> SP 'blob' SP <size> LF
	<contents> LF
====

This command can be used where a `filemodify` directive can appear,
allowing it to be used in the middle of a commit.  For a `filemodify`
using an inline directive, it can also appear right before the `data`
directive.

See ``Responses To Commands'' below for details about how to read
this output safely.

`ls`
~~~~
Prints information about the object at a path to a file descriptor
previously arranged with the `--cat-blob-fd` argument.  This allows
printing a blob from the active commit (with `cat-blob`) or copying a
blob or tree from a previous commit for use in the current one (with
`filemodify`).

The `ls` command can also be used where a `filemodify` directive can
appear, allowing it to be used in the middle of a commit.

Reading from the active commit::
	This form can only be used in the middle of a `commit`.
	The path names a directory entry within fast-import's
	active commit.  The path must be quoted in this case.
+
....
	'ls' SP <path> LF
....

Reading from a named tree::
	The `<dataref>` can be a mark reference (`:<idnum>`) or the
	full 40-byte SHA-1 of a Git tag, commit, or tree object,
	preexisting or waiting to be written.
	The path is relative to the top level of the tree
	named by `<dataref>`.
+
....
	'ls' SP <dataref> SP <path> LF
....

See `filemodify` above for a detailed description of `<path>`.

Output uses the same format as `git ls-tree <tree> -- <path>`:

====
	<mode> SP ('blob' | 'tree' | 'commit') SP <dataref> HT <path> LF
====

The <dataref> represents the blob, tree, or commit object at <path>
and can be used in later 'get-mark', 'cat-blob', 'filemodify', or
'ls' commands.

If there is no file or subtree at that path, 'git fast-import' will
instead report

====
	missing SP <path> LF
====

See ``Responses To Commands'' below for details about how to read
this output safely.

`feature`
~~~~~~~~~
Require that fast-import supports the specified feature, or abort if
it does not.

....
	'feature' SP <feature> ('=' <argument>)? LF
....

The <feature> part of the command may be any one of the following:

date-format::
export-marks::
relative-marks::
no-relative-marks::
force::
	Act as though the corresponding command-line option with
	a leading `--` was passed on the command line
	(see OPTIONS, above).

import-marks::
import-marks-if-exists::
	Like --import-marks except in two respects: first, only one
	"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.

get-mark::
cat-blob::
ls::
	Require that the backend support the 'get-mark', 'cat-blob',
	or 'ls' command respectively.
	Versions of fast-import not supporting the specified 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.

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.

done::
	Error out if the stream ends without a 'done' command.
	Without this feature, errors causing the frontend to end
	abruptly at a convenient point in the stream can go
	undetected.  This may occur, for example, if an import
	front end dies in mid-operation without emitting SIGTERM
	or SIGKILL at its subordinate git fast-import instance.

`option`
~~~~~~~~
Processes the specified option so that git fast-import behaves in a
way that suits the frontend's needs.
Note that

Title: Git Fast Import Commands: Ls, Feature, and Option
Summary
The git-fast-import command provides additional options for interacting with the Git repository, including the `ls` command for printing object information, the `feature` command for requiring support for specific features, and the `option` command for customizing the behavior of fast-import, allowing frontends to specify requirements and options for the import process, such as date format, mark handling, and command support, to ensure compatibility and correct behavior.