From: Junio C Hamano Date: Thu, 25 Aug 2011 23:00:32 +0000 (-0700) Subject: Merge branch 'di/fast-import-doc' X-Git-Tag: v1.7.7-rc0~5 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/1d21112a946b338feaa4df4183ea26ac5d1353d0?ds=inline;hp=-c Merge branch 'di/fast-import-doc' * di/fast-import-doc: doc/fast-import: document feature import-marks-if-exists --- 1d21112a946b338feaa4df4183ea26ac5d1353d0 diff --combined Documentation/git-fast-import.txt index 2969388880,605ab9eea5..db0d75fdbc --- a/Documentation/git-fast-import.txt +++ b/Documentation/git-fast-import.txt @@@ -8,7 -8,6 +8,7 @@@ git-fast-import - Backend for fast Git SYNOPSIS -------- +[verse] frontend | 'git fast-import' [options] DESCRIPTION @@@ -102,12 -101,6 +102,12 @@@ OPTION when the `cat-blob` command is encountered in the stream. The default behaviour is to write to `stdout`. +--done:: + Require a `done` command at the end of the stream. + This option might be useful for detecting errors that + cause the frontend to terminate before it has started to + write a stream. + --export-pack-edges=:: After creating a packfile, print a line of data to listing the filename of the packfile and the last @@@ -337,11 -330,6 +337,11 @@@ and control the current import process standard output. This command is optional and is not needed to perform an import. +`done`:: + Marks the end of the stream. This command is optional + unless the `done` feature was requested using the + `--done` command line option or `feature done` command. + `cat-blob`:: Causes fast-import to print a blob in 'cat-file --batch' format to the file descriptor set with `--cat-blob-fd` or @@@ -660,14 -648,9 +660,14 @@@ paths for a commit are encouraged to d `notemodify` ^^^^^^^^^^^^ -Included in a `commit` command to add a new note (annotating a given -commit) or change the content of an existing note. This command has -two different means of specifying the content of the note. +Included in a `commit` `` command to add a new note +annotating a `` or change this annotation contents. +Internally it is similar to filemodify 100644 on `` +path (maybe split into subdirectories). It's not advised to +use any other commands to write to the `` tree except +`filedeleteall` to delete all existing notes in this tree. +This command has two different means of specifying the content +of the note. External data format:: The data content for the note was already supplied by a prior @@@ -1012,10 -995,14 +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:: @@@ -1032,11 -1019,6 +1036,11 @@@ notes: 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. `option` ~~~~~~~~ @@@ -1066,15 -1048,6 +1070,15 @@@ not be passed as option * cat-blob-fd * force +`done` +~~~~~~ +If the `done` feature is not in use, treated as if EOF was read. +This can be used to tell fast-import to finish early. + +If the `--done` command line option or `feature done` command is +in use, the `done` command is mandatory and marks the end of the +stream. + Crash Reports ------------- If fast-import is supplied invalid input it will terminate with a diff --combined t/t9300-fast-import.sh index f256475020,7588dcc809..2cb4494262 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@@ -1882,6 -1882,53 +1882,53 @@@ test_expect_success 'R: --import-marks- test_cmp expect io.marks ' + test_expect_success 'R: feature import-marks-if-exists' ' + rm -f io.marks && + >expect && + + git fast-import --export-marks=io.marks <<-\EOF && + feature import-marks-if-exists=not_io.marks + EOF + test_cmp expect io.marks && + + blob=$(echo hi | git hash-object --stdin) && + + echo ":1 $blob" >io.marks && + echo ":1 $blob" >expect && + echo ":2 $blob" >>expect && + + git fast-import --export-marks=io.marks <<-\EOF && + feature import-marks-if-exists=io.marks + blob + mark :2 + data 3 + hi + + EOF + test_cmp expect io.marks && + + echo ":3 $blob" >>expect && + + git fast-import --import-marks=io.marks \ + --export-marks=io.marks <<-\EOF && + feature import-marks-if-exists=not_io.marks + blob + mark :3 + data 3 + hi + + EOF + test_cmp expect io.marks && + + >expect && + + git fast-import --import-marks-if-exists=not_io.marks \ + --export-marks=io.marks <<-\EOF + feature import-marks-if-exists=io.marks + EOF + test_cmp expect io.marks + ' + cat >input << EOF feature import-marks=marks.out feature export-marks=marks.new @@@ -2197,48 -2244,6 +2244,48 @@@ test_expect_success 'R: quiet option re test_cmp empty output ' +test_expect_success 'R: feature done means terminating "done" is mandatory' ' + echo feature done | test_must_fail git fast-import && + test_must_fail git fast-import --done expect <<-\EOF && + OBJID + :000000 100644 OBJID OBJID A hello.c + :000000 100644 OBJID OBJID A hello2.c + EOF + git fast-import <<-EOF && + commit refs/heads/done-ends + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data <actual && + test_cmp expect actual +' + cat >input <