It is sometimes useful for importers to be able to read the SHA-1
corresponding to a mark that they have created via fast-import. For
example, they might want to embed the SHA-1 into the commit message of
a later commit. Or it might be useful for internal bookkeeping uses,
or for logging.
Add a "get-mark" command to "git fast-import" that allows the importer
to ask for the value of a mark that has been created earlier.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Michael Haggerty10 years agocommitted byJunio C Hamano
@ -54,7 +54,7 @@ Options for Frontends
@@ -54,7 +54,7 @@ Options for Frontends
~~~~~~~~~~~~~~~~~~~~~
--cat-blob-fd=<fd>::
Write responses to `cat-blob` and `ls` queries to the
Write responses to `get-mark`, `cat-blob`, and `ls` queries to the
file descriptor <fd> instead of `stdout`. Allows `progress`
output intended for the end-user to be separated from other
output.
@ -350,6 +350,11 @@ and control the current import process. More detailed discussion
@@ -350,6 +350,11 @@ and control the current import process. More detailed discussion
unless the `done` feature was requested using the
`--done` command-line option or `feature done` command.
`get-mark`::
Causes fast-import to print the SHA-1 corresponding to a mark
to the file descriptor set with `--cat-blob-fd`, or `stdout` if
unspecified.
`cat-blob`::
Causes fast-import to print a blob in 'cat-file --batch'
format to the file descriptor set with `--cat-blob-fd` or
@ -930,6 +935,25 @@ Placing a `progress` command immediately after a `checkpoint` will
@@ -930,6 +935,25 @@ Placing a `progress` command immediately after a `checkpoint` will
inform the reader when the `checkpoint` has been completed and it
can safely access the refs that fast-import updated.
`get-mark`
~~~~~~~~~~
Causes fast-import to print the SHA-1 corresponding to a mark to
stdout or to the file descriptor previously arranged with the
`--cat-blob-fd` argument. The command otherwise has no impact on the
current import; its purpose is to retrieve SHA-1s that later commits
might want to refer to in their commit messages.
....
'get-mark' SP ':' <idnum> LF
....
This command can be used anywhere in the stream that comments are
accepted. In particular, the `get-mark` command can be used in the
middle of a commit but not in the middle of a `data` command.
See ``Responses To Commands'' below for details about how to read
this output safely.
`cat-blob`
~~~~~~~~~~
Causes fast-import to print a blob to a file descriptor previously
@ -1000,7 +1024,8 @@ Output uses the same format as `git ls-tree <tree> -- <path>`:
@@ -1000,7 +1024,8 @@ Output uses the same format as `git ls-tree <tree> -- <path>`:
====
The <dataref> represents the blob, tree, or commit object at <path>
and can be used in later 'cat-blob', 'filemodify', or 'ls' commands.
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