{"thread":{"id":"24246","subject":"[PATCH/RFC] Teach fast-import to import subtrees named by tree id","startedAt":"2010-07-01T03:18:19Z","lastAt":"2010-09-27T09:15:41Z","messageCount":75,"participants":["Jonathan Nieder","Sverre Rabbelier","Ramkumar Ramachandra","Sam Vilain","Raja R Harinath"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"144560","messageId":"20100701031819.GA12524@burratino","threadId":"24246","inReplyTo":null,"subject":"[PATCH/RFC] Teach fast-import to import subtrees named by tree id","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-01T03:18:19Z","receivedAt":"2010-07-01T03:18:19Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"To simulate the svn cp command, it would be very useful to be\nreplace an arbitrary file in the current revision by an\narbitrary directory from a previous one.  Modify the filemodify\ncommand to allow that:\n\n M 040000 <tree id> pathname\n\nThis would be most useful in combination with a facility to\nprint the commit ids for new revisions as they are written.\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nCc: Sverre Rabbelier <srabbelier@gmail.com>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nI actually thought fast-import already did this until David\nmentioned that no, it does not.  Well, live and learn.\n\nThis and Sverre’s --print-marks command would allow svn-fe\nto be simplified a great deal.\n\nI was not sure whether to add a \"feature\" specification for\nthis, so I’ll try that as a separate patch.\n\nThoughts?\nJonathan\n\n Documentation/git-fast-import.txt |    8 ++++-\n fast-import.c                     |   24 ++++++++++------\n t/t9300-fast-import.sh            |   54 +++++++++++++++++++++++++++++++++++++\n 3 files changed, 75 insertions(+), 11 deletions(-)\n\ndiff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt\nindex 19082b0..f4d9aeb 100644\n--- a/Documentation/git-fast-import.txt\n+++ b/Documentation/git-fast-import.txt\n@@ -482,9 +482,11 @@ External data format::\n \t'M' SP <mode> SP <dataref> SP <path> LF\n ....\n +\n-Here `<dataref>` can be either a mark reference (`:<idnum>`)\n+Here usually `<dataref>` must be either a mark reference (`:<idnum>`)\n set by a prior `blob` command, or a full 40-byte SHA-1 of an\n-existing Git blob object.\n+existing Git blob object.  If `<mode>` is `040000`` then\n+`<dataref>` must be the full 40-byte SHA-1 of an existing\n+Git tree object or a mark reference set with `--import-marks`.\n \n Inline data format::\n \tThe data content for the file has not been supplied yet.\n@@ -509,6 +511,8 @@ in octal.  Git only supports the following modes:\n * `160000`: A gitlink, SHA-1 of the object refers to a commit in\n   another repository. Git links can only be specified by SHA or through\n   a commit mark. They are used to implement submodules.\n+* `040000`: A subdirectory.  Subdirectories can only be specified by\n+  SHA or through a tree mark set with `--import-marks`.\n \n In both formats `<path>` is the complete path of the file to be added\n (if not already existing) or modified (if already existing).\ndiff --git a/fast-import.c b/fast-import.c\nindex 1e5d66e..ad6843a 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -2131,6 +2131,7 @@ static void file_change_m(struct branch *b)\n \tcase S_IFREG | 0644:\n \tcase S_IFREG | 0755:\n \tcase S_IFLNK:\n+\tcase S_IFDIR:\n \tcase S_IFGITLINK:\n \t\t/* ok */\n \t\tbreak;\n@@ -2176,23 +2177,28 @@ static void file_change_m(struct branch *b)\n \t\t * another repository.\n \t\t */\n \t} else if (inline_data) {\n+\t\tif (S_ISDIR(mode))\n+\t\t\tdie(\"Directories cannot be specified 'inline': %s\",\n+\t\t\t\tcommand_buf.buf);\n \t\tif (p != uq.buf) {\n \t\t\tstrbuf_addstr(&uq, p);\n \t\t\tp = uq.buf;\n \t\t}\n \t\tread_next_command();\n \t\tparse_and_store_blob(&last_blob, sha1, 0);\n-\t} else if (oe) {\n-\t\tif (oe->type != OBJ_BLOB)\n-\t\t\tdie(\"Not a blob (actually a %s): %s\",\n-\t\t\t\ttypename(oe->type), command_buf.buf);\n \t} else {\n-\t\tenum object_type type = sha1_object_info(sha1, NULL);\n+\t\tenum object_type expected = S_ISDIR(mode) ?\n+\t\t\t\t\t\tOBJ_TREE: OBJ_BLOB;\n+\t\tenum object_type type = oe ? oe->type :\n+\t\t\t\t\tsha1_object_info(sha1, NULL);\n \t\tif (type < 0)\n-\t\t\tdie(\"Blob not found: %s\", command_buf.buf);\n-\t\tif (type != OBJ_BLOB)\n-\t\t\tdie(\"Not a blob (actually a %s): %s\",\n-\t\t\t    typename(type), command_buf.buf);\n+\t\t\tdie(\"%s not found: %s\",\n+\t\t\t\t\tS_ISDIR(mode) ?  \"Tree\" : \"Blob\",\n+\t\t\t\t\tcommand_buf.buf);\n+\t\tif (type != expected)\n+\t\t\tdie(\"Not a %s (actually a %s): %s\",\n+\t\t\t\ttypename(expected), typename(type),\n+\t\t\t\tcommand_buf.buf);\n \t}\n \n \ttree_content_set(&b->branch_tree, p, sha1, mode, NULL);\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 131f032..50d5913 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -796,6 +796,60 @@ test_expect_success \\\n \t'git fast-import <input &&\n \t test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`'\n \n+test_expect_success \\\n+\t'N: copy directory by id' \\\n+\t'cat >expect <<-\\EOF &&\n+\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n+\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n+\tEOF\n+\t subdir=$(git rev-parse refs/heads/branch^0:file2) &&\n+\t cat >input <<-INPUT_END &&\n+\tcommit refs/heads/N4\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcopy by tree hash\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch^0\n+\tM 040000 $subdir file3\n+\tINPUT_END\n+\t git fast-import <input &&\n+\t git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&\n+\t compare_diff_raw expect actual'\n+\n+test_expect_success \\\n+\t'N: modify copied tree' \\\n+\t'cat >expect <<-\\EOF &&\n+\t:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100\tnewdir/interesting\tfile3/file5\n+\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n+\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n+\tEOF\n+\t subdir=$(git rev-parse refs/heads/branch^0:file2) &&\n+\t cat >input <<-INPUT_END &&\n+\tcommit refs/heads/N5\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcopy by tree hash\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch^0\n+\tM 040000 $subdir file3\n+\n+\tcommit refs/heads/N5\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tmodify directory copy\n+\tCOMMIT\n+\n+\tM 644 inline file3/file5\n+\tdata <<EOF\n+\t$file5_data\n+\tEOF\n+\tINPUT_END\n+\t git fast-import <input &&\n+\t git diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&\n+\t compare_diff_raw expect actual'\n+\n ###\n ### series O\n ###\n-- \n1.7.1.1\n"},{"id":"144564","messageId":"20100701054849.GA14972@burratino","threadId":"24246","inReplyTo":"20100701031819.GA12524@burratino","subject":"[WIP/PATCH] Teach fast-import to print the id of each imported commit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-01T05:48:49Z","receivedAt":"2010-07-01T05:48:49Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"For the svn importer, it would be useful to have a map from\nsubversion revision numbers to git commits.  This is particularly\nrelevant because the subversion api sometimes represents as \"copy\nthis directory from this revision\", and the importer needs to be\nable to access the corresponding trees.  So (optionally) print\neach commit id when the corresponding object is written.\n\nUnfortunately when each commit object is written, it is not yet\naccessible to the caller.  The corresponding pack index\nand header are not written until the next checkpoint finishes.\n\nShould fast-import accept lines of the form\n\n M 100644 <commit id>:<path> <path>\n\nand\n\n M 040000 <commit id>:<path> <path>\n\nto allow the caller to use commits before they are accessible\nthrough the git object database?\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\nbut definitely not ready for inclusion\n---\n fast-import.c          |   18 ++++++++++++++++++\n t/t9300-fast-import.sh |   45 +++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 63 insertions(+), 0 deletions(-)\n\ndiff --git a/fast-import.c b/fast-import.c\nindex ad6843a..869da7f 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -361,6 +361,9 @@ static uintmax_t next_mark;\n static struct strbuf new_data = STRBUF_INIT;\n static int seen_data_command;\n \n+/* Where to report commits */\n+static int commits_fd = -1;\n+\n static void parse_argv(void);\n \n static void write_branch_report(FILE *rpt, struct branch *b)\n@@ -2563,6 +2566,11 @@ static void parse_new_commit(void)\n \n \tif (!store_object(OBJ_COMMIT, &new_data, NULL, b->sha1, next_mark))\n \t\tb->pack_id = pack_id;\n+\tif (commits_fd != -1) {\n+\t\tchar *buf = sha1_to_hex(b->sha1);\n+\t\tbuf[40] = '\\n';\n+\t\twrite_or_die(commits_fd, buf, 41);\n+\t}\n \tb->last_commit = object_count_by_type[OBJ_COMMIT];\n }\n \n@@ -2747,6 +2755,14 @@ static void option_export_marks(const char *marks)\n \tsafe_create_leading_directories_const(export_marks_file);\n }\n \n+static void option_print_commits(const char *fd)\n+{\n+\tunsigned long n = strtoul(fd, NULL, 0);\n+\tif (n > (unsigned long) INT_MAX)\n+\t\tdie(\"--print-commits cannot exceed %d\", INT_MAX);\n+\tcommits_fd = (int) n;\n+}\n+\n static void option_export_pack_edges(const char *edges)\n {\n \tif (pack_edges)\n@@ -2800,6 +2816,8 @@ static int parse_one_feature(const char *feature, int from_stream)\n \t\toption_import_marks(feature + 13, from_stream);\n \t} else if (!prefixcmp(feature, \"export-marks=\")) {\n \t\toption_export_marks(feature + 13);\n+\t} else if (!prefixcmp(feature, \"print-commits=\")) {\n+\t\toption_print_commits(feature + strlen(\"print-commits=\"));\n \t} else if (!prefixcmp(feature, \"relative-marks\")) {\n \t\trelative_marks_paths = 1;\n \t} else if (!prefixcmp(feature, \"no-relative-marks\")) {\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 50d5913..5cb949f 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -1555,6 +1555,51 @@ test_expect_success 'R: feature no-relative-marks should be honoured' '\n     test_cmp marks.new non-relative.out\n '\n \n+test_expect_success 'R: print-commits magic' '\n+\tmkfifo commits &&\n+\tcat >caller <<-\\CALLER_END\n+\t\t#!/bin/sh\n+\t\tcat <<EOF &&\n+\t\tfeature print-commits=3\n+\t\tcommit refs/heads/printed\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tto be printed\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/master\n+\t\tD file3\n+\n+\t\tEOF\n+\n+\t\tread cid <&3 &&\n+\t\t! git rev-parse $cid: >/dev/null &&\n+\t\techo checkpoint &&\n+\t\tsleep 1 &&\n+\t\ttree=$(git rev-parse $cid:) &&\n+\t\tcat <<EOF\n+\t\tcommit refs/heads/printed\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tto be printed\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/printed^0\n+\t\tM 040000 $tree old\n+\n+\t\tEOF\n+\t\tsleep 1\n+\tCALLER_END\n+\tchmod +x caller &&\n+\t{\n+\t\tsh caller 3<commits ||\n+\t\techo fail\n+\t} |\n+\tgit fast-import 3>commits &&\n+\tgit rev-parse printed^ printed &&\n+\tgit show printed:\n+'\n+\n cat >input << EOF\n option git quiet\n blob\n-- \n1.7.1.1\n"},{"id":"144656","messageId":"AANLkTim2DnettF2gNTQVaJvrpzwrTP_-HWTp8l6R5TVc@mail.gmail.com","threadId":"24246","inReplyTo":"20100701054849.GA14972@burratino","subject":"Re: [WIP/PATCH] Teach fast-import to print the id of each imported commit","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-07-02T03:16:55Z","receivedAt":"2010-07-02T03:16:55Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Thu, Jul 1, 2010 at 07:48, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Unfortunately when each commit object is written, it is not yet\n> accessible to the caller.\n\nThis I don't understand, as soon as the object is written wouldn't it\nbe available in .git/objects?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"144657","messageId":"AANLkTinSvg6fqu0Y-EHpMoQDZcYBIRP3qRprsHQQwjZE@mail.gmail.com","threadId":"24246","inReplyTo":"20100701031819.GA12524@burratino","subject":"Re: [PATCH/RFC] Teach fast-import to import subtrees named by tree id","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-07-02T03:20:01Z","receivedAt":"2010-07-02T03:20:01Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Thu, Jul 1, 2010 at 05:18, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> I was not sure whether to add a \"feature\" specification for\n> this, so I’ll try that as a separate patch.\n\nYes, that'd be a good idea. That should be as easy as adding an option though?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"144659","messageId":"20100702034125.GA7209@burratino","threadId":"24246","inReplyTo":"AANLkTim2DnettF2gNTQVaJvrpzwrTP_-HWTp8l6R5TVc@mail.gmail.com","subject":"Re: [WIP/PATCH] Teach fast-import to print the id of each imported commit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-02T03:41:25Z","receivedAt":"2010-07-02T03:41:25Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sverre Rabbelier wrote:\n\n> This I don't understand, as soon as the object is written wouldn't it\n> be available in .git/objects?\n\nfast-import writes objects directly to pack --- part of the secret to\nits speed.\n\nSee store_object() in fast-import.c, or you can play around with the\ntest from my WIP patch to try it out (removing the ‘sleep 1’).\n"},{"id":"144660","messageId":"AANLkTiksZygUvp-9jK_qZ9bvjETg-V3-uoZnRZFgYI1n@mail.gmail.com","threadId":"24246","inReplyTo":"20100702034125.GA7209@burratino","subject":"Re: [WIP/PATCH] Teach fast-import to print the id of each imported commit","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-07-02T04:29:36Z","receivedAt":"2010-07-02T04:29:36Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Fri, Jul 2, 2010 at 05:41, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> fast-import writes objects directly to pack --- part of the secret to\n> its speed.\n\nAah, so only after a 'checkpoint', I see.\n\n> See store_object() in fast-import.c, or you can play around with the\n> test from my WIP patch to try it out (removing the ‘sleep 1’).\n\nOkay, in that case I think your other patch is made of even more win :)\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"144661","messageId":"20100702044220.GB7209@burratino","threadId":"24246","inReplyTo":"AANLkTinSvg6fqu0Y-EHpMoQDZcYBIRP3qRprsHQQwjZE@mail.gmail.com","subject":"Re: [PATCH/RFC] Teach fast-import to import subtrees named by tree id","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-02T04:42:20Z","receivedAt":"2010-07-02T04:42:20Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sverre Rabbelier wrote:\n> On Thu, Jul 1, 2010 at 05:18, Jonathan Nieder <jrnieder@gmail.com> wrote:\n\n>> I was not sure whether to add a \"feature\" specification for\n>> this, so I’ll try that as a separate patch.\n[...]\n> That should be as easy as adding an option though?\n\nYes, I think so.\n\n-- 8< --\nSubject: fast-import: And a feature option for importing subtrees\n\nThe \"feature external-trees\" command avoids wasting time\nimporting with old backends only to error out on a later\n\"M 040000 <tree hash> <path>\".\n\nIts use is completely optional.  In particular, if backends\nwithout the external-trees feature become extinct, then there\nwill be no reason to keep using it.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n Documentation/git-fast-import.txt |   17 +++++++++++++----\n fast-import.c                     |    3 +++\n 2 files changed, 16 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt\nindex 5edf059..54a3ea1 100644\n--- a/Documentation/git-fast-import.txt\n+++ b/Documentation/git-fast-import.txt\n@@ -484,9 +484,12 @@ External data format::\n +\n Here usually `<dataref>` must be either a mark reference (`:<idnum>`)\n set by a prior `blob` command, or a full 40-byte SHA-1 of an\n-existing Git blob object.  If `<mode>` is `040000` then\n-`<dataref>` must be the full 40-byte SHA-1 of an existing\n-Git tree object or a mark reference set with `--import-marks`.\n+existing Git blob object.\n++\n+If `<mode>` is `040000` then `<dataref>` must be the full 40-byte\n+SHA-1 of an existing Git tree object or a mark reference set with\n+`--import-marks`.  Frontends can check for a backend supporting\n+this mode with the `feature external-trees` command.\n \n Inline data format::\n \tThe data content for the file has not been supplied yet.\n@@ -889,7 +892,8 @@ The <feature> part of the command may be any string matching\n ^[a-zA-Z][a-zA-Z-]*$ and should be understood by fast-import.\n \n Feature work identical as their option counterparts with the\n-exception of the import-marks feature, see below.\n+exception of the import-marks and external-trees features;\n+see below.\n \n The following features are currently supported:\n \n@@ -898,6 +902,7 @@ The following features are currently supported:\n * export-marks\n * relative-marks\n * no-relative-marks\n+* external-trees\n * force\n \n The import-marks behaves differently from when it is specified as\n@@ -905,6 +910,10 @@ commandline option in that only one \"feature import-marks\" is allowed\n per stream. Also, any --import-marks= specified on the commandline\n will override those from the stream (if any).\n \n+The `feature external-trees` command can be used to abort early\n+if the backend does not support `M 040000 <tree hash> <path>`.\n+It has no effect in recent fast-import verisons.\n+\n `option`\n ~~~~~~~~\n Processes the specified option so that git fast-import behaves in a\ndiff --git a/fast-import.c b/fast-import.c\nindex ad6843a..290d4b1 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -2820,6 +2820,9 @@ static void parse_feature(void)\n \tif (seen_data_command)\n \t\tdie(\"Got feature command '%s' after data command\", feature);\n \n+\tif (!prefixcmp(feature, \"external-trees\"))\n+\t\t/* Yes, we do support the M 040000 command. */\n+\t\treturn;\n \tif (parse_one_feature(feature, 1))\n \t\treturn;\n \n-- \n1.7.1.1\n"},{"id":"144662","messageId":"20100702051201.GC7209@burratino","threadId":"24246","inReplyTo":"20100701054849.GA14972@burratino","subject":"Re: [WIP/PATCH] Teach fast-import to print the id of each imported commit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-02T05:12:01Z","receivedAt":"2010-07-02T05:12:01Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jonathan Nieder wrote:\n\n> Should fast-import accept lines of the form\n> \n>  M 100644 <commit id>:<path> <path>\n> \n> and\n> \n>  M 040000 <commit id>:<path> <path>\n> \n> to allow the caller to use commits before they are accessible\n> through the git object database?\n\nA ‘cat’ command (suggested by David) would also be useful, so the\ncaller can read trees and blobs before they are accessible through\nthe object db.  The svn importer would use this when applying\n(svndiff0-format) deltas to import changes to regular files.\n"},{"id":"144678","messageId":"20100702124431.GB2306@debian","threadId":"24246","inReplyTo":"20100701031819.GA12524@burratino","subject":"Re: [PATCH/RFC] Teach fast-import to import subtrees named by tree id","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-07-02T12:44:31Z","receivedAt":"2010-07-02T12:44:31Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Jonathan,\n\nJonathan Nieder writes:\n> To simulate the svn cp command, it would be very useful to be\n> replace an arbitrary file in the current revision by an\n> arbitrary directory from a previous one.  Modify the filemodify\n> command to allow that:\n> \n>  M 040000 <tree id> pathname\n> \n> This would be most useful in combination with a facility to\n> print the commit ids for new revisions as they are written.\n\nThanks for this patch! I applied and tested it: works as\nexpected. It's ready for inclusion, yes?\n\nReviewed-by: Ramkumar Ramachandra <artagnon@gmail.com>\n\n> ---\n> I actually thought fast-import already did this until David\n> mentioned that no, it does not.  Well, live and learn.\n> \n> This and Sverre’s --print-marks command would allow svn-fe\n> to be simplified a great deal.\n> \n> I was not sure whether to add a \"feature\" specification for\n> this, so I’ll try that as a separate patch.\n> \n> Thoughts?\n> Jonathan\n> \n>  Documentation/git-fast-import.txt |    8 ++++-\n>  fast-import.c                     |   24 ++++++++++------\n>  t/t9300-fast-import.sh            |   54 +++++++++++++++++++++++++++++++++++++\n>  3 files changed, 75 insertions(+), 11 deletions(-)\n> \n> diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt\n> index 19082b0..f4d9aeb 100644\n> --- a/Documentation/git-fast-import.txt\n> +++ b/Documentation/git-fast-import.txt\n> @@ -482,9 +482,11 @@ External data format::\n>  \t'M' SP <mode> SP <dataref> SP <path> LF\n>  ....\n>  +\n> -Here `<dataref>` can be either a mark reference (`:<idnum>`)\n> +Here usually `<dataref>` must be either a mark reference (`:<idnum>`)\n>  set by a prior `blob` command, or a full 40-byte SHA-1 of an\n> -existing Git blob object.\n> +existing Git blob object.  If `<mode>` is `040000`` then\n> +`<dataref>` must be the full 40-byte SHA-1 of an existing\n> +Git tree object or a mark reference set with `--import-marks`.\n>  \n>  Inline data format::\n>  \tThe data content for the file has not been supplied yet.\n> @@ -509,6 +511,8 @@ in octal.  Git only supports the following modes:\n>  * `160000`: A gitlink, SHA-1 of the object refers to a commit in\n>    another repository. Git links can only be specified by SHA or through\n>    a commit mark. They are used to implement submodules.\n> +* `040000`: A subdirectory.  Subdirectories can only be specified by\n> +  SHA or through a tree mark set with `--import-marks`.\n>  \n>  In both formats `<path>` is the complete path of the file to be added\n>  (if not already existing) or modified (if already existing).\n> diff --git a/fast-import.c b/fast-import.c\n> index 1e5d66e..ad6843a 100644\n> --- a/fast-import.c\n> +++ b/fast-import.c\n> @@ -2131,6 +2131,7 @@ static void file_change_m(struct branch *b)\n>  \tcase S_IFREG | 0644:\n>  \tcase S_IFREG | 0755:\n>  \tcase S_IFLNK:\n> +\tcase S_IFDIR:\n>  \tcase S_IFGITLINK:\n>  \t\t/* ok */\n>  \t\tbreak;\n> @@ -2176,23 +2177,28 @@ static void file_change_m(struct branch *b)\n>  \t\t * another repository.\n>  \t\t */\n>  \t} else if (inline_data) {\n> +\t\tif (S_ISDIR(mode))\n> +\t\t\tdie(\"Directories cannot be specified 'inline': %s\",\n> +\t\t\t\tcommand_buf.buf);\n\nOkay. Since you've passed S_IFDIR in the earlier switch-case, you've\nmade sure that directories aren't specified inline here.\n\n>  \t\tif (p != uq.buf) {\n>  \t\t\tstrbuf_addstr(&uq, p);\n>  \t\t\tp = uq.buf;\n>  \t\t}\n>  \t\tread_next_command();\n>  \t\tparse_and_store_blob(&last_blob, sha1, 0);\n> -\t} else if (oe) {\n> -\t\tif (oe->type != OBJ_BLOB)\n> -\t\t\tdie(\"Not a blob (actually a %s): %s\",\n> -\t\t\t\ttypename(oe->type), command_buf.buf);\n>  \t} else {\n> -\t\tenum object_type type = sha1_object_info(sha1, NULL);\n> +\t\tenum object_type expected = S_ISDIR(mode) ?\n> +\t\t\t\t\t\tOBJ_TREE: OBJ_BLOB;\n> +\t\tenum object_type type = oe ? oe->type :\n> +\t\t\t\t\tsha1_object_info(sha1, NULL);\n\nInstead allowing just blobs, you've allowed both blob and tree objects\nto be specified here. I don't see any tree writing code in your\nchange, so I'm assuming blob and tree writing is just handled\ntransparently in Git.\n\n>  \t\tif (type < 0)\n> -\t\t\tdie(\"Blob not found: %s\", command_buf.buf);\n> -\t\tif (type != OBJ_BLOB)\n> -\t\t\tdie(\"Not a blob (actually a %s): %s\",\n> -\t\t\t    typename(type), command_buf.buf);\n> +\t\t\tdie(\"%s not found: %s\",\n> +\t\t\t\t\tS_ISDIR(mode) ?  \"Tree\" : \"Blob\",\n> +\t\t\t\t\tcommand_buf.buf);\n> +\t\tif (type != expected)\n> +\t\t\tdie(\"Not a %s (actually a %s): %s\",\n> +\t\t\t\ttypename(expected), typename(type),\n> +\t\t\t\tcommand_buf.buf);\n>  \t}\n>  \ttree_content_set(&b->branch_tree, p, sha1, mode, NULL);\n\nConditionally printing either \"blob\" or \"tree\" in the error message. Okay.\n\n> diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\n> index 131f032..50d5913 100755\n> --- a/t/t9300-fast-import.sh\n> +++ b/t/t9300-fast-import.sh\n\nOkay. Test passes.\n\n-- Ram\n"},{"id":"144681","messageId":"AANLkTintWyhcx9pURSqxs3e9BBkPx9KSPPYh4UOU7kv6@mail.gmail.com","threadId":"24246","inReplyTo":"20100702051201.GC7209@burratino","subject":"Re: [WIP/PATCH] Teach fast-import to print the id of each imported commit","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-07-02T14:55:01Z","receivedAt":"2010-07-02T14:55:01Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Fri, Jul 2, 2010 at 07:12, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> A ‘cat’ command (suggested by David) would also be useful, so the\n> caller can read trees and blobs before they are accessible through\n> the object db.  The svn importer would use this when applying\n> (svndiff0-format) deltas to import changes to regular files.\n\nHow would the output be delimited? The same way fast-import expects\nits blob input?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"144692","messageId":"20100702154028.GB2287@burratino","threadId":"24246","inReplyTo":"AANLkTintWyhcx9pURSqxs3e9BBkPx9KSPPYh4UOU7kv6@mail.gmail.com","subject":"Re: [WIP/PATCH] Teach fast-import to print the id of each imported commit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-02T15:40:28Z","receivedAt":"2010-07-02T15:40:28Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sverre Rabbelier wrote:\n> On Fri, Jul 2, 2010 at 07:12, Jonathan Nieder <jrnieder@gmail.com> wrote:\n\n>> A ‘cat’ command (suggested by David) would also be useful, so the\n>> caller can read trees and blobs before they are accessible through\n>> the object db.  The svn importer would use this when applying\n>> (svndiff0-format) deltas to import changes to regular files.\n>\n> How would the output be delimited? The same way fast-import expects\n> its blob input?\n\nRight.  I was imagining something like\n\n <blob hash> blob <size>\n ... content ...\n <blank line>\n\nà la cat-file --batch.  Hopefully by the end of this weekend, if no\none else gets to it first.\n"},{"id":"144693","messageId":"AANLkTikDK8XlXPHAAUyn5HIKiqE6Ea_b3c3cFGOYOv4H@mail.gmail.com","threadId":"24246","inReplyTo":"20100702154028.GB2287@burratino","subject":"Re: [WIP/PATCH] Teach fast-import to print the id of each imported commit","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-07-02T15:48:28Z","receivedAt":"2010-07-02T15:48:28Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Fri, Jul 2, 2010 at 17:40, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> à la cat-file --batch.  Hopefully by the end of this weekend, if no\n> one else gets to it first.\n\nOkay, sounds like an excellent plan. Perhaps you can even borrow from\ngit cat-file's code?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"144766","messageId":"1278201760.9701.39.camel@denix","threadId":"24246","inReplyTo":"20100702154028.GB2287@burratino","subject":"Re: [WIP/PATCH] Teach fast-import to print the id of each imported commit","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2010-07-04T00:02:40Z","receivedAt":"2010-07-04T00:02:40Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"On Fri, 2010-07-02 at 10:40 -0500, Jonathan Nieder wrote:\n> Sverre Rabbelier wrote:\n> > On Fri, Jul 2, 2010 at 07:12, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> \n> >> A ‘cat’ command (suggested by David) would also be useful, so the\n> >> caller can read trees and blobs before they are accessible through\n> >> the object db.  The svn importer would use this when applying\n> >> (svndiff0-format) deltas to import changes to regular files.\n> >\n> > How would the output be delimited? The same way fast-import expects\n> > its blob input?\n> \n> Right.  I was imagining something like\n> \n>  <blob hash> blob <size>\n>  ... content ...\n>  <blank line>\n> \n> à la cat-file --batch.  Hopefully by the end of this weekend, if no\n> one else gets to it first.\n\nIt should be very simple to implement --batch-verify as well, which is\nessentially the same thing, just only printing the header and not the\ncontents.\n\nHow hard do you think it would be to implement a 'rev-parse' command?\nPerhaps you can see where this is going... :-)\n\nSam\n"},{"id":"144768","messageId":"20100704003543.GA25858@burratino","threadId":"24246","inReplyTo":"1278201760.9701.39.camel@denix","subject":"Re: [WIP/PATCH] Teach fast-import to print the id of each imported commit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-04T00:35:43Z","receivedAt":"2010-07-04T00:35:43Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sam Vilain wrote:\n\n> It should be very simple to implement --batch-verify as well, which is\n> essentially the same thing, just only printing the header and not the\n> contents.\n> \n> How hard do you think it would be to implement a 'rev-parse' command?\n> Perhaps you can see where this is going... :-)\n\nWell, I think I understand what you are saying, but it’s not quite\nlike that.  fast-import is already doing a lot of work to keep track\nof this collection of objects in a pack that is not yet accessible to\ngit because its index has not been written yet.\n\nsvn-fe needs those objects (well, it at least needs a few blobs when\nit learns to apply a delta to the latest revision).  So what to do?\n\nOne option is to make fast-import into a library, or copy the code we\nneed into svn-fe.  And that would be possible!  But it would make\nsvn-fe much more complicated, and there would be this second\nfast-import interface to maintain.\n\nOr svn-fe could keep the full text of all files from the latest\nrevision in a temporary directory.  To get blobs for an _older_\nrevision, it would still need to ask git, but such copy operations are\nuncommon enough that the time to request a checkpoint and wait for\nthings to settle could be tolerable.  The main downside: in a huge\nrepository like ASF’s, that’s a good amount of wasted space.\n\nOr one can teach fast-import to supply exactly what we need from it,\nwhich is the raw content of some blobs (and perhaps trees) it has\nwritten to pack and not indexed yet.\n\nJonathan\n"},{"id":"144770","messageId":"1278215044.13014.33.camel@denix","threadId":"24246","inReplyTo":"20100704003543.GA25858@burratino","subject":"Re: [WIP/PATCH] Teach fast-import to print the id of each imported commit","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2010-07-04T03:44:04Z","receivedAt":"2010-07-04T03:44:04Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"On Sat, 2010-07-03 at 19:35 -0500, Jonathan Nieder wrote:\n> Sam Vilain wrote:\n> \n> > It should be very simple to implement --batch-verify as well, which is\n> > essentially the same thing, just only printing the header and not the\n> > contents.\n> > \n> > How hard do you think it would be to implement a 'rev-parse' command?\n> > Perhaps you can see where this is going... :-)\n> \n> Well, I think I understand what you are saying, but it’s not quite\n> like that.  fast-import is already doing a lot of work to keep track\n> of this collection of objects in a pack that is not yet accessible to\n> git because its index has not been written yet.\n  [...]\n> Or one can teach fast-import to supply exactly what we need from it,\n> which is the raw content of some blobs (and perhaps trees) it has\n> written to pack and not indexed yet.\n\nLet me explain further.  If in fast-import.c:new_object, if it were to\nmake a struct object (see object.h), and make sure it was put in\nobj_hash (see object.c, particularly create_object()), then you might\nfind a whole load of plumbing would magically start working and be able\nto work with the new objects that you are trying to load.  Of course\nthere may be a couple of other functions which might need to change.\nPrimarily object.c:read_object, which needs to be able to check the\npackfile being spooled by git fast-import.\n\nIf you did this, then to implement this feature you could in principle\njust call read_sha1_file()\n\nSam\n"},{"id":"144771","messageId":"20100704072206.GA758@burratino","threadId":"24246","inReplyTo":"1278215044.13014.33.camel@denix","subject":"Re: [WIP/PATCH] Teach fast-import to print the id of each imported commit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-04T07:22:06Z","receivedAt":"2010-07-04T07:22:06Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sam Vilain wrote:\n\n> Let me explain further.  If in fast-import.c:new_object, if it were to\n> make a struct object (see object.h), and make sure it was put in\n> obj_hash (see object.c, particularly create_object()), then you might\n> find a whole load of plumbing would magically start working and be able\n> to work with the new objects that you are trying to load.  Of course\n> there may be a couple of other functions which might need to change.\n> Primarily object.c:read_object, which needs to be able to check the\n> packfile being spooled by git fast-import.\n> \n> If you did this, then to implement this feature you could in principle\n> just call read_sha1_file()\n\nOh, to implement the ‘cat’ feature, I was planning to call\ngfi_unpack_entry; the hard part is finding a spare moment to do that\n(if others have more spare moments, I would be happy to find that\nstep unnecessary).\n\nWhat you describe sounds more useful as part of a longer-term plan.\nIf fast-import and its caller live in the same process, then being\nable to use the usual object access APIs would be convenient indeed.\nIn other words, it sounds like an incentive to libify fast-import.\n\nWell, everything in due time.\n\nThanks for the comments,\nJonathan\n"},{"id":"148291","messageId":"20100817170216.GA14491@kytes","threadId":"24246","inReplyTo":"20100701054849.GA14972@burratino","subject":"Re: [WIP/PATCH] Teach fast-import to print the id of each imported commit","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-17T17:02:20Z","receivedAt":"2010-08-17T17:02:20Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi,\n\nJonathan Nieder writes:\n> For the svn importer, it would be useful to have a map from\n> subversion revision numbers to git commits.  This is particularly\n> relevant because the subversion api sometimes represents as \"copy\n> this directory from this revision\", and the importer needs to be\n> able to access the corresponding trees.  So (optionally) print\n> each commit id when the corresponding object is written.\n> \n> Unfortunately when each commit object is written, it is not yet\n> accessible to the caller.  The corresponding pack index\n> and header are not written until the next checkpoint finishes.\n> \n> Should fast-import accept lines of the form\n> \n>  M 100644 <commit id>:<path> <path>\n> \n> and\n> \n>  M 040000 <commit id>:<path> <path>\n> \n> to allow the caller to use commits before they are accessible\n> through the git object database?\n> \n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> but definitely not ready for inclusion\n\nI'm resurrecting this thread. We need to finish this feature before we\ncan finish the dumpfilev3 support in svn-dump-fast-export.\n\n-- Ram\n"},{"id":"149930","messageId":"20100905031528.GA2344@burratino","threadId":"24246","inReplyTo":"20100817170216.GA14491@kytes","subject":"[RFC/PATCH 0/3] fast-import: give importers access to the object store","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-05T03:15:28Z","receivedAt":"2010-09-05T03:15:28Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi Ram,\n\nRamkumar Ramachandra wrote:\n\n> I'm resurrecting this thread. We need to finish this feature before we\n> can finish the dumpfilev3 support in svn-dump-fast-export.\n\nOk.\n\nTo recap, because fast-import does not write a pack index until the\ncheckpoint, frontends cannot necessarily read back what they have\nwritten immediately.  The obvious application to allowing that is as a\nsanity check, but more important to us is that it allows the lazy\nfrontend to forget previous revisions even if they are required for\nlater \"file/directory copy\" operations in the import.  The frontend\ncan be secure in the knowledge that the backend remembers everything\nnow.\n\nIt works like this:\n\nfrontend:\n\tfeature report-fd=3\n\tcommit refs/heads/master\n\t... revision 1 ...\n\nimporter:\n\tabc7856cba76bca87a65bca76bca8bca98bca78bca76\n\nfrontend:\n\tcommit refs/heads/master\n\t... revision 2 ...\n\nimporter:\n\tfcdafecfdacba667cd5a4da6dca5fa68ca897dc65178\n\n...\n\nfrontend:\n\tcommit refs/heads/master\n\t... revision 50 ...\n\n\tcat abc7856cba76bca87a65bca76bca8bca98bca78\n\nimporter:\n\tc78a67d9987da089cd89ac879dacd897acd879acd76\n\tcommit abc7856cba76bca87a65bca76bca8bca98bca78bca76 274819\n\ttree <... tree name ...>\n\tauthor <... author name ...>\n\t...\n\nI suspect that these patches are not in their final form.\nIn particular, the interface is kind of klunky: to name a\nblob by path, you have to supply a *tree* which contains that\nblob as well as the pathname.  So retrieving, say,\nv1.7.1:Documentation/git-fast-import.txt, would require\nthree round-trips: one to dereference the tag, one to dereference\nthe commit, and then one to finally retrieve the blob.\n\nAnother possible concern is that this is very much git specific.\nOther fast-import backends are just not going to be able to do\nit with the same format.  Is there a convention for naming\noptions like that?\n\nStill, I hope it is useful to start with.  Thoughts?  Ideas?\nImprovements?\n\nJonathan Nieder (3):\n  t9300 (fast-import): style tweaks\n  Teach fast-import to print the id of each imported commit\n  fast-import: Let importers retrieve the objects being written\n\n Documentation/git-fast-import.txt |   45 +\n fast-import.c                     |  126 ++\n t/t9300-fast-import.sh            | 3371 ++++++++++++++++++++-----------------\n 3 files changed, 1960 insertions(+), 1582 deletions(-)\n\n-- \n1.7.2.3\n"},{"id":"149931","messageId":"20100905032253.GB2344@burratino","threadId":"24246","inReplyTo":"20100905031528.GA2344@burratino","subject":"[PATCH 1/3] t9300 (fast-import): style tweaks","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-05T03:22:53Z","receivedAt":"2010-09-05T03:22:53Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Clarify dependencies between tests to make the fast-import test\nscript more approachable.  In particular:\n\n - guard setup commands with test assertions (for robustness and to\n   make it easier to identify where each test starts and ends);\n\n - mention \"setup\" in the descriptions of tests that are used to\n   prepare for later ones;\n\n - avoid hard-coded object names.  Although compare_diff_raw means\n   most of them do not affect the test result, the reader can\n   benefit more from other object descriptions;\n\n - tweak whitespace style: each test now starts with a test assertion,\n   description, and opening quote on a single line, followed by test\n   code that checks a single claim;\n\nWhile at it:\n\n - introduce a verify_packs() helper, avoiding some repetition;\n\n - use test_cmp instead of test $foo = $bar for nicer output with -v;\n\n - use multiple separate commands instead of pipelines when that\n   helps debugability;\n\n - use $(...) command substitutions in preference to ``; the former\n   are less error-prone with respect to quoting and easier to notice\n   when looking for $variable interpolations.\n\n - do not let tests exit the entire test script when they fail.\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh | 3207 ++++++++++++++++++++++++------------------------\n 1 files changed, 1629 insertions(+), 1578 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 96d07f1..5c274e7 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -7,860 +7,890 @@ test_description='test git fast-import utility'\n . ./test-lib.sh\n . \"$TEST_DIRECTORY\"/diff-lib.sh ;# test-lib chdir's into trash\n \n-file2_data='file2\n-second line of EOF'\n-\n-file3_data='EOF\n-in 3rd file\n- END'\n-\n-file4_data=abcd\n-file4_len=4\n-\n-file5_data='an inline file.\n-  we should see it later.'\n-\n-file6_data='#!/bin/sh\n-echo \"$@\"'\n-\n-###\n-### series A\n-###\n-\n-test_tick\n-cat >input <<INPUT_END\n-blob\n-mark :2\n-data <<EOF\n-$file2_data\n-EOF\n-\n-blob\n-mark :3\n-data <<END\n-$file3_data\n-END\n-\n-blob\n-mark :4\n-data $file4_len\n-$file4_data\n-commit refs/heads/master\n-mark :5\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-initial\n-COMMIT\n-\n-M 644 :2 file2\n-M 644 :3 file3\n-M 755 :4 file4\n-\n-tag series-A\n-from :5\n-data <<EOF\n-An annotated tag without a tagger\n-EOF\n-\n-INPUT_END\n-test_expect_success \\\n-    'A: create pack from stdin' \\\n-    'git fast-import --export-marks=marks.out <input &&\n-\t git whatchanged master'\n-test_expect_success \\\n-\t'A: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n-\n-cat >expect <<EOF\n-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-initial\n-EOF\n-test_expect_success \\\n-\t'A: verify commit' \\\n-\t'git cat-file commit master | sed 1d >actual &&\n-\ttest_cmp expect actual'\n-\n-cat >expect <<EOF\n-100644 blob file2\n-100644 blob file3\n-100755 blob file4\n-EOF\n-test_expect_success \\\n-\t'A: verify tree' \\\n-\t'git cat-file -p master^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t test_cmp expect actual'\n-\n-echo \"$file2_data\" >expect\n-test_expect_success \\\n-\t'A: verify file2' \\\n-\t'git cat-file blob master:file2 >actual && test_cmp expect actual'\n-\n-echo \"$file3_data\" >expect\n-test_expect_success \\\n-\t'A: verify file3' \\\n-\t'git cat-file blob master:file3 >actual && test_cmp expect actual'\n-\n-printf \"$file4_data\" >expect\n-test_expect_success \\\n-\t'A: verify file4' \\\n-\t'git cat-file blob master:file4 >actual && test_cmp expect actual'\n-\n-cat >expect <<EOF\n-object $(git rev-parse refs/heads/master)\n-type commit\n-tag series-A\n-\n-An annotated tag without a tagger\n-EOF\n+test_expect_success 'setup: verify_packs helper' '\n+\tverify_packs () {\n+\t\tfor p in .git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack $p ||\n+\t\t\treturn\n+\t\tdone\n+\t}\n+'\n+\n+test_expect_success 'setup' '\n+\tzeroes=0000000000000000000000000000000000000000 &&\n+\n+\t# Use command substitution to strip off final newlines.\n+\tfile2_data=$(cat <<-\\END_FILE2_DATA\n+\t\tfile2\n+\t\tsecond line of EOF\n+\t\tEND_FILE2_DATA\n+\t) &&\n+\tfile2_id=$(echo \"$file2_data\" | git hash-object --stdin) &&\n+\tfile3_data=$(cat <<-\\END_FILE3_DATA\n+\t\tEOF\n+\t\tin 3rd file\n+\t\t END\n+\t\tEND_FILE3_DATA\n+\t) &&\n+\tfile3_id=$(echo \"$file3_data\" | git hash-object --stdin) &&\n+\tfile4_data=abcd &&\n+\tfile4_len=4 &&\n+\tfile4_id=$(printf \"%s\" \"$file4_data\" | git hash-object --stdin) &&\n+\tfile5_data=$(cat <<-\\END_FILE5_DATA\n+\t\tan inline file.\n+\t\t  we should see it later.\n+\t\tEND_FILE5_DATA\n+\t) &&\n+\tfile5_id=$(echo \"$file5_data\" | git hash-object --stdin) &&\n+\tfile6_data=$(cat <<-\\END_FILE6_DATA\n+\t\t#!/bin/sh\n+\t\techo \"$@\"\n+\t\tEND_FILE6_DATA\n+\t) &&\n+\tfile6_id=$(echo \"$file6_data\" | git hash-object --stdin)\n+'\n+\n+test_expect_success 'setup: series A' '\n+\ttest_tick &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tblob\n+\tmark :2\n+\tdata <<EOF\n+\t$file2_data\n+\tEOF\n+\n+\tblob\n+\tmark :3\n+\tdata <<END\n+\t$file3_data\n+\tEND\n+\n+\tblob\n+\tmark :4\n+\tdata $file4_len\n+\t$file4_data\n+\tcommit refs/heads/master\n+\tmark :5\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tinitial\n+\tCOMMIT\n+\n+\tM 644 :2 file2\n+\tM 644 :3 file3\n+\tM 755 :4 file4\n+\n+\ttag series-A\n+\tfrom :5\n+\tdata <<EOF\n+\tAn annotated tag without a tagger\n+\tEOF\n+\n+\tINPUT_END\n+\n+\tgit fast-import --export-marks=marks.out <input &&\n+\tgit whatchanged master\n+'\n+\n+test_expect_success 'fast-import writes valid packs' '\n+\tverify_packs\n+'\n+\n+test_expect_success 'A: verify commit' '\n+\tcat >expect <<-EOF &&\n+\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\tinitial\n+\tEOF\n+\tgit cat-file commit master >commit &&\n+\tsed 1d <commit >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'A: verify tree' '\n+\tcat >expect <<-\\EOF &&\n+\t100644 blob file2\n+\t100644 blob file3\n+\t100755 blob file4\n+\tEOF\n+\tgit cat-file -p master^{tree} >tree &&\n+\tsed \"s/ [0-9a-f]*\t/ /\" <tree >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'A: verify file2' '\n+\techo \"$file2_data\" >expect &&\n+\tgit cat-file blob master:file2 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'A: verify file3' '\n+\techo \"$file3_data\" >expect &&\n+\tgit cat-file blob master:file3 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'A: verify file4' '\n+\tprintf \"$file4_data\" >expect &&\n+\tgit cat-file blob master:file4 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_expect_success 'A: verify tag/series-A' '\n+\tmaster=$(git rev-parse refs/heads/master) &&\n+\tcat >expect <<-EOF &&\n+\tobject $master\n+\ttype commit\n+\ttag series-A\n+\n+\tAn annotated tag without a tagger\n+\tEOF\n \tgit cat-file tag tags/series-A >actual &&\n \ttest_cmp expect actual\n '\n \n-cat >expect <<EOF\n-:2 `git rev-parse --verify master:file2`\n-:3 `git rev-parse --verify master:file3`\n-:4 `git rev-parse --verify master:file4`\n-:5 `git rev-parse --verify master^0`\n-EOF\n-test_expect_success \\\n-\t'A: verify marks output' \\\n-\t'test_cmp expect marks.out'\n+test_expect_success 'A: verify marks output' '\n+\tcat >expect <<-EOF &&\n+\t:2 $(git rev-parse --verify master:file2)\n+\t:3 $(git rev-parse --verify master:file3)\n+\t:4 $(git rev-parse --verify master:file4)\n+\t:5 $(git rev-parse --verify master^0)\n+\tEOF\n+\ttest_cmp expect marks.out\n+'\n \n-test_expect_success \\\n-\t'A: verify marks import' \\\n-\t'git fast-import \\\n+test_expect_success 'A: import marks' '\n+\tcat >expect <<-EOF &&\n+\t:2 $(git rev-parse --verify master:file2)\n+\t:3 $(git rev-parse --verify master:file3)\n+\t:4 $(git rev-parse --verify master:file4)\n+\t:5 $(git rev-parse --verify master^0)\n+\tEOF\n+\tgit fast-import \\\n \t\t--import-marks=marks.out \\\n \t\t--export-marks=marks.new \\\n \t\t</dev/null &&\n-\ttest_cmp expect marks.new'\n-\n-test_tick\n-cat >input <<INPUT_END\n-commit refs/heads/verify--import-marks\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-recreate from :5\n-COMMIT\n-\n-from :5\n-M 755 :2 copy-of-file2\n-\n-INPUT_END\n-test_expect_success \\\n-\t'A: verify marks import does not crash' \\\n-\t'git fast-import --import-marks=marks.out <input &&\n-\t git whatchanged verify--import-marks'\n-test_expect_success \\\n-\t'A: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n-cat >expect <<EOF\n-:000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A\tcopy-of-file2\n-EOF\n-git diff-tree -M -r master verify--import-marks >actual\n-test_expect_success \\\n-\t'A: verify diff' \\\n-\t'compare_diff_raw expect actual &&\n-\t test `git rev-parse --verify master:file2` \\\n-\t    = `git rev-parse --verify verify--import-marks:copy-of-file2`'\n-\n-test_tick\n-mt=$(git hash-object --stdin < /dev/null)\n-: >input.blob\n-: >marks.exp\n-: >tree.exp\n-\n-cat >input.commit <<EOF\n-commit refs/heads/verify--dump-marks\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-test the sparse array dumping routines with exponentially growing marks\n-COMMIT\n-EOF\n-\n-i=0\n-l=4\n-m=6\n-n=7\n-while test \"$i\" -lt 27; do\n-    cat >>input.blob <<EOF\n-blob\n-mark :$l\n-data 0\n-blob\n-mark :$m\n-data 0\n-blob\n-mark :$n\n-data 0\n-EOF\n-    echo \"M 100644 :$l l$i\" >>input.commit\n-    echo \"M 100644 :$m m$i\" >>input.commit\n-    echo \"M 100644 :$n n$i\" >>input.commit\n-\n-    echo \":$l $mt\" >>marks.exp\n-    echo \":$m $mt\" >>marks.exp\n-    echo \":$n $mt\" >>marks.exp\n-\n-    printf \"100644 blob $mt\\tl$i\\n\" >>tree.exp\n-    printf \"100644 blob $mt\\tm$i\\n\" >>tree.exp\n-    printf \"100644 blob $mt\\tn$i\\n\" >>tree.exp\n-\n-    l=$(($l + $l))\n-    m=$(($m + $m))\n-    n=$(($l + $n))\n-\n-    i=$((1 + $i))\n-done\n-\n-sort tree.exp > tree.exp_s\n+\ttest_cmp expect marks.new\n+'\n+\n+test_expect_success 'setup: A: verify marks import' '\n+\ttest_tick &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/verify--import-marks\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\trecreate from :5\n+\tCOMMIT\n+\n+\tfrom :5\n+\tM 755 :2 copy-of-file2\n+\n+\tINPUT_END\n+\n+\tgit fast-import --import-marks=marks.out <input &&\n+\tverify_packs &&\n+\tgit whatchanged verify--import-marks\n+'\n+\n+test_expect_success 'A: verify diff' '\n+\techo \":000000 100755 $zeroes $file2_id A\tcopy-of-file2\" >expect &&\n+\techo $file2_id >expect.copy &&\n+\tgit diff-tree -M -r master verify--import-marks >actual &&\n+\tgit rev-parse --verify verify--import-marks:copy-of-file2 >actual.copy &&\n+\tcompare_diff_raw expect actual &&\n+\ttest_cmp expect.copy actual.copy\n+'\n \n test_expect_success 'A: export marks with large values' '\n-\tcat input.blob input.commit | git fast-import --export-marks=marks.large &&\n+\ttest_tick &&\n+\tmt=$(git hash-object --stdin </dev/null) &&\n+\t>input.blob &&\n+\t>marks.exp &&\n+\t>tree.exp &&\n+\n+\tcat >input.commit <<-EOF &&\n+\tcommit refs/heads/verify--dump-marks\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\ttest the sparse array dumping routines with exponentially growing marks\n+\tCOMMIT\n+\tEOF\n+\n+\t(\n+\t\ti=0 &&\n+\t\tl=4 &&\n+\t\tm=6 &&\n+\t\tn=7 &&\n+\t\twhile test \"$i\" -lt 27\n+\t\tdo\n+\t\t\tcat >>input.blob <<-EOF &&\n+\t\t\tblob\n+\t\t\tmark :$l\n+\t\t\tdata 0\n+\t\t\tblob\n+\t\t\tmark :$m\n+\t\t\tdata 0\n+\t\t\tblob\n+\t\t\tmark :$n\n+\t\t\tdata 0\n+\t\t\tEOF\n+\t\t\t{\n+\t\t\t\techo \"M 100644 :$l l$i\" &&\n+\t\t\t\techo \"M 100644 :$m m$i\" &&\n+\t\t\t\techo \"M 100644 :$n n$i\"\n+\t\t\t} >>input.commit &&\n+\t\t\t{\n+\t\t\t\techo \":$l $mt\" &&\n+\t\t\t\techo \":$m $mt\" &&\n+\t\t\t\techo \":$n $mt\"\n+\t\t\t} >>marks.exp &&\n+\t\t\t{\n+\t\t\t\tprintf \"100644 blob $mt\\tl$i\\n\" &&\n+\t\t\t\tprintf \"100644 blob $mt\\tm$i\\n\" &&\n+\t\t\t\tprintf \"100644 blob $mt\\tn$i\\n\"\n+\t\t\t} >>tree.exp &&\n+\n+\t\t\tl=$(($l + $l)) &&\n+\t\t\tm=$(($m + $m)) &&\n+\t\t\tn=$(($l + $n)) &&\n+\t\t\ti=$((1 + $i)) ||\n+\t\t\texit\n+\t\tdone\n+\t) &&\n+\tsort tree.exp >tree.exp_s &&\n+\tcat input.blob input.commit |\n+\tgit fast-import --export-marks=marks.large &&\n \tgit ls-tree refs/heads/verify--dump-marks >tree.out &&\n \ttest_cmp tree.exp_s tree.out &&\n-\ttest_cmp marks.exp marks.large'\n+\ttest_cmp marks.exp marks.large\n+'\n \n-###\n-### series B\n-###\n-\n-test_tick\n-cat >input <<INPUT_END\n-commit refs/heads/branch\n-mark :1\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-corrupt\n-COMMIT\n-\n-from refs/heads/master\n-M 755 0000000000000000000000000000000000000001 zero1\n-\n-INPUT_END\n test_expect_success 'B: fail on invalid blob sha1' '\n-    test_must_fail git fast-import <input\n+\ttest_tick &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/branch\n+\tmark :1\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcorrupt\n+\tCOMMIT\n+\n+\tfrom refs/heads/master\n+\tM 755 0000000000000000000000000000000000000001 zero1\n+\n+\tINPUT_END\n+\n+\ttest_must_fail git fast-import <input\n '\n-rm -f .git/objects/pack_* .git/objects/index_*\n \n-cat >input <<INPUT_END\n-commit .badbranchname\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-corrupt\n-COMMIT\n-\n-from refs/heads/master\n-\n-INPUT_END\n test_expect_success 'B: fail on invalid branch name \".badbranchname\"' '\n-    test_must_fail git fast-import <input\n+\trm -f .git/objects/pack_* .git/objects/index_* &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit .badbranchname\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcorrupt\n+\tCOMMIT\n+\n+\tfrom refs/heads/master\n+\n+\tINPUT_END\n+\n+\ttest_must_fail git fast-import <input\n '\n-rm -f .git/objects/pack_* .git/objects/index_*\n \n-cat >input <<INPUT_END\n-commit bad[branch]name\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-corrupt\n-COMMIT\n-\n-from refs/heads/master\n-\n-INPUT_END\n test_expect_success 'B: fail on invalid branch name \"bad[branch]name\"' '\n-    test_must_fail git fast-import <input\n+\trm -f .git/objects/pack_* .git/objects/index_* &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit bad[branch]name\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcorrupt\n+\tCOMMIT\n+\n+\tfrom refs/heads/master\n+\n+\tINPUT_END\n+\n+\ttest_must_fail git fast-import <input\n+'\n+\n+test_expect_success 'B: accept branch name \"TEMP_TAG\"' '\n+\tgit rev-parse master >expect &&\n+\trm -f .git/objects/pack_* .git/objects/index_* &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit TEMP_TAG\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\ttag base\n+\tCOMMIT\n+\n+\tfrom refs/heads/master\n+\n+\tINPUT_END\n+\n+\ttest_when_finished \"rm -f .git/TEMP_TAG\" &&\n+\tgit fast-import <input &&\n+\ttest -f .git/TEMP_TAG &&\n+\tgit rev-parse TEMP_TAG^ >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'setup: series C' '\n+\tnewf=$(echo hi newf | git hash-object -w --stdin) &&\n+\toldf=$(git rev-parse --verify master:file2) &&\n+\techo $newf >expect.new &&\n+\techo $oldf >expect.old &&\n+\ttest_tick &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/branch\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tsecond\n+\tCOMMIT\n+\n+\tfrom refs/heads/master\n+\tM 644 $oldf file2/oldf\n+\tM 755 $newf file2/newf\n+\tD file3\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tverify_packs &&\n+\tgit whatchanged branch\n+'\n+\n+test_expect_success 'C: reuse of existing blob' '\n+\tgit rev-parse --verify branch:file2/newf >actual.new &&\n+\tgit rev-parse --verify branch:file2/oldf >actual.old &&\n+\ttest_cmp expect.new actual.new &&\n+\ttest_cmp expect.old actual.old\n+'\n+\n+test_expect_success 'C: verify commit' '\n+\tcat >expect <<-EOF &&\n+\tparent `git rev-parse --verify master^0`\n+\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\tsecond\n+\tEOF\n+\tgit cat-file commit branch >commit &&\n+\tsed 1d <commit >actual &&\n+\ttest_cmp expect actual\n '\n-rm -f .git/objects/pack_* .git/objects/index_*\n-\n-cat >input <<INPUT_END\n-commit TEMP_TAG\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-tag base\n-COMMIT\n-\n-from refs/heads/master\n-\n-INPUT_END\n-test_expect_success \\\n-    'B: accept branch name \"TEMP_TAG\"' \\\n-    'git fast-import <input &&\n-\t test -f .git/TEMP_TAG &&\n-\t test `git rev-parse master` = `git rev-parse TEMP_TAG^`'\n-rm -f .git/TEMP_TAG\n-\n-###\n-### series C\n-###\n-\n-newf=`echo hi newf | git hash-object -w --stdin`\n-oldf=`git rev-parse --verify master:file2`\n-test_tick\n-cat >input <<INPUT_END\n-commit refs/heads/branch\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-second\n-COMMIT\n-\n-from refs/heads/master\n-M 644 $oldf file2/oldf\n-M 755 $newf file2/newf\n-D file3\n-\n-INPUT_END\n-test_expect_success \\\n-    'C: incremental import create pack from stdin' \\\n-    'git fast-import <input &&\n-\t git whatchanged branch'\n-test_expect_success \\\n-\t'C: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n-test_expect_success \\\n-\t'C: validate reuse existing blob' \\\n-\t'test $newf = `git rev-parse --verify branch:file2/newf`\n-\t test $oldf = `git rev-parse --verify branch:file2/oldf`'\n-\n-cat >expect <<EOF\n-parent `git rev-parse --verify master^0`\n-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-second\n-EOF\n-test_expect_success \\\n-\t'C: verify commit' \\\n-\t'git cat-file commit branch | sed 1d >actual &&\n-\t test_cmp expect actual'\n-\n-cat >expect <<EOF\n-:000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A\tfile2/newf\n-:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100\tfile2\tfile2/oldf\n-:100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D\tfile3\n-EOF\n-git diff-tree -M -r master branch >actual\n-test_expect_success \\\n-\t'C: validate rename result' \\\n-\t'compare_diff_raw expect actual'\n-\n-###\n-### series D\n-###\n-\n-test_tick\n-cat >input <<INPUT_END\n-commit refs/heads/branch\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-third\n-COMMIT\n-\n-from refs/heads/branch^0\n-M 644 inline newdir/interesting\n-data <<EOF\n-$file5_data\n-EOF\n-\n-M 755 inline newdir/exec.sh\n-data <<EOF\n-$file6_data\n-EOF\n-\n-INPUT_END\n-test_expect_success \\\n-    'D: inline data in commit' \\\n-    'git fast-import <input &&\n-\t git whatchanged branch'\n-test_expect_success \\\n-\t'D: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n-\n-cat >expect <<EOF\n-:000000 100755 0000000000000000000000000000000000000000 35a59026a33beac1569b1c7f66f3090ce9c09afc A\tnewdir/exec.sh\n-:000000 100644 0000000000000000000000000000000000000000 046d0371e9220107917db0d0e030628de8a1de9b A\tnewdir/interesting\n-EOF\n-git diff-tree -M -r branch^ branch >actual\n-test_expect_success \\\n-\t'D: validate new files added' \\\n-\t'compare_diff_raw expect actual'\n-\n-echo \"$file5_data\" >expect\n-test_expect_success \\\n-\t'D: verify file5' \\\n-\t'git cat-file blob branch:newdir/interesting >actual &&\n-\t test_cmp expect actual'\n-\n-echo \"$file6_data\" >expect\n-test_expect_success \\\n-\t'D: verify file6' \\\n-\t'git cat-file blob branch:newdir/exec.sh >actual &&\n-\t test_cmp expect actual'\n-\n-###\n-### series E\n-###\n-\n-cat >input <<INPUT_END\n-commit refs/heads/branch\n-author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n-data <<COMMIT\n-RFC 2822 type date\n-COMMIT\n-\n-from refs/heads/branch^0\n-\n-INPUT_END\n+\n+test_expect_success 'C: validate rename result' '\n+\tcat >expect <<-EOF &&\n+\t:000000 100755 $zeroes $newf A\tfile2/newf\n+\t:100644 100644 $file2_id $file2_id R100\tfile2\tfile2/oldf\n+\t:100644 000000 $file3_id 0000000000000000000000000000000000000000 D\tfile3\n+\tEOF\n+\tgit diff-tree -M -r master branch >actual &&\n+\tcompare_diff_raw expect actual\n+'\n+\n+test_expect_success 'setup: D: inline data in commit' '\n+\ttest_tick &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/branch\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tthird\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch^0\n+\tM 644 inline newdir/interesting\n+\tdata <<EOF\n+\t$file5_data\n+\tEOF\n+\n+\tM 755 inline newdir/exec.sh\n+\tdata <<EOF\n+\t$file6_data\n+\tEOF\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tverify_packs &&\n+\tgit whatchanged branch\n+'\n+\n+test_expect_success 'D: validate new files added' '\n+\tcat >expect <<-EOF &&\n+\t:000000 100755 $zeroes $file6_id A\tnewdir/exec.sh\n+\t:000000 100644 $zeroes $file5_id A\tnewdir/interesting\n+\tEOF\n+\tgit diff-tree -M -r branch^ branch >actual &&\n+\tcompare_diff_raw expect actual\n+'\n+\n+test_expect_success 'D: verify file5' '\n+\techo \"$file5_data\" >expect &&\n+\tgit cat-file blob branch:newdir/interesting >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'D: verify file6' '\n+\techo \"$file6_data\" >expect &&\n+\tgit cat-file blob branch:newdir/exec.sh >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_expect_success 'E: rfc2822 date, --date-format=raw' '\n-    test_must_fail git fast-import --date-format=raw <input\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/branch\n+\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n+\tdata <<COMMIT\n+\tRFC 2822 type date\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch^0\n+\n+\tINPUT_END\n+\ttest_must_fail git fast-import --date-format=raw <input\n '\n-test_expect_success \\\n-    'E: rfc2822 date, --date-format=rfc2822' \\\n-    'git fast-import --date-format=rfc2822 <input'\n-test_expect_success \\\n-\t'E: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n-\n-cat >expect <<EOF\n-author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500\n-\n-RFC 2822 type date\n-EOF\n-test_expect_success \\\n-\t'E: verify commit' \\\n-\t'git cat-file commit branch | sed 1,2d >actual &&\n-\ttest_cmp expect actual'\n-\n-###\n-### series F\n-###\n-\n-old_branch=`git rev-parse --verify branch^0`\n-test_tick\n-cat >input <<INPUT_END\n-commit refs/heads/branch\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-losing things already?\n-COMMIT\n-\n-from refs/heads/branch~1\n-\n-reset refs/heads/other\n-from refs/heads/branch\n-\n-INPUT_END\n-test_expect_success \\\n-    'F: non-fast-forward update skips' \\\n-    'if git fast-import <input\n-\t then\n-\t\techo BAD gfi did not fail\n-\t\treturn 1\n-\t else\n-\t\tif test $old_branch = `git rev-parse --verify branch^0`\n-\t\tthen\n-\t\t\t: branch unaffected and failure returned\n-\t\t\treturn 0\n-\t\telse\n-\t\t\techo BAD gfi changed branch $old_branch\n-\t\t\treturn 1\n-\t\tfi\n-\t fi\n-\t'\n-test_expect_success \\\n-\t'F: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n-\n-cat >expect <<EOF\n-tree `git rev-parse branch~1^{tree}`\n-parent `git rev-parse branch~1`\n-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-losing things already?\n-EOF\n-test_expect_success \\\n-\t'F: verify other commit' \\\n-\t'git cat-file commit other >actual &&\n-\ttest_cmp expect actual'\n-\n-###\n-### series G\n-###\n-\n-old_branch=`git rev-parse --verify branch^0`\n-test_tick\n-cat >input <<INPUT_END\n-commit refs/heads/branch\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-losing things already?\n-COMMIT\n-\n-from refs/heads/branch~1\n-\n-INPUT_END\n-test_expect_success \\\n-    'G: non-fast-forward update forced' \\\n-    'git fast-import --force <input'\n-test_expect_success \\\n-\t'G: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n-test_expect_success \\\n-\t'G: branch changed, but logged' \\\n-\t'test $old_branch != `git rev-parse --verify branch^0` &&\n-\t test $old_branch = `git rev-parse --verify branch@{1}`'\n-\n-###\n-### series H\n-###\n-\n-test_tick\n-cat >input <<INPUT_END\n-commit refs/heads/H\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-third\n-COMMIT\n-\n-from refs/heads/branch^0\n-M 644 inline i-will-die\n-data <<EOF\n-this file will never exist.\n-EOF\n-\n-deleteall\n-M 644 inline h/e/l/lo\n-data <<EOF\n-$file5_data\n-EOF\n-\n-INPUT_END\n-test_expect_success \\\n-    'H: deletall, add 1' \\\n-    'git fast-import <input &&\n-\t git whatchanged H'\n-test_expect_success \\\n-\t'H: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n-\n-cat >expect <<EOF\n-:100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D\tfile2/newf\n-:100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D\tfile2/oldf\n-:100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D\tfile4\n-:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100\tnewdir/interesting\th/e/l/lo\n-:100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D\tnewdir/exec.sh\n-EOF\n-git diff-tree -M -r H^ H >actual\n-test_expect_success \\\n-\t'H: validate old files removed, new files added' \\\n-\t'compare_diff_raw expect actual'\n-\n-echo \"$file5_data\" >expect\n-test_expect_success \\\n-\t'H: verify file' \\\n-\t'git cat-file blob H:h/e/l/lo >actual &&\n-\t test_cmp expect actual'\n-\n-###\n-### series I\n-###\n-\n-cat >input <<INPUT_END\n-commit refs/heads/export-boundary\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-we have a border.  its only 40 characters wide.\n-COMMIT\n-\n-from refs/heads/branch\n-\n-INPUT_END\n-test_expect_success \\\n-    'I: export-pack-edges' \\\n-    'git fast-import --export-pack-edges=edges.list <input'\n-\n-cat >expect <<EOF\n-.git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`\n-EOF\n-test_expect_success \\\n-\t'I: verify edge list' \\\n-\t'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n-\t test_cmp expect actual'\n-\n-###\n-### series J\n-###\n-\n-cat >input <<INPUT_END\n-commit refs/heads/J\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-create J\n-COMMIT\n-\n-from refs/heads/branch\n-\n-reset refs/heads/J\n-\n-commit refs/heads/J\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-initialize J\n-COMMIT\n-\n-INPUT_END\n-test_expect_success \\\n-    'J: reset existing branch creates empty commit' \\\n-    'git fast-import <input'\n-test_expect_success \\\n-\t'J: branch has 1 commit, empty tree' \\\n-\t'test 1 = `git rev-list J | wc -l` &&\n-\t test 0 = `git ls-tree J | wc -l`'\n-\n-###\n-### series K\n-###\n-\n-cat >input <<INPUT_END\n-commit refs/heads/K\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-create K\n-COMMIT\n-\n-from refs/heads/branch\n-\n-commit refs/heads/K\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-redo K\n-COMMIT\n-\n-from refs/heads/branch^1\n-\n-INPUT_END\n-test_expect_success \\\n-    'K: reinit branch with from' \\\n-    'git fast-import <input'\n-test_expect_success \\\n-    'K: verify K^1 = branch^1' \\\n-    'test `git rev-parse --verify branch^1` \\\n-\t\t= `git rev-parse --verify K^1`'\n-\n-###\n-### series L\n-###\n-\n-cat >input <<INPUT_END\n-blob\n-mark :1\n-data <<EOF\n-some data\n-EOF\n-\n-blob\n-mark :2\n-data <<EOF\n-other data\n-EOF\n-\n-commit refs/heads/L\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-create L\n-COMMIT\n-\n-M 644 :1 b.\n-M 644 :1 b/other\n-M 644 :1 ba\n-\n-commit refs/heads/L\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-update L\n-COMMIT\n-\n-M 644 :2 b.\n-M 644 :2 b/other\n-M 644 :2 ba\n-INPUT_END\n-\n-cat >expect <<EXPECT_END\n-:100644 100644 4268632... 55d3a52... M\tb.\n-:040000 040000 0ae5cac... 443c768... M\tb\n-:100644 100644 4268632... 55d3a52... M\tba\n-EXPECT_END\n-\n-test_expect_success \\\n-    'L: verify internal tree sorting' \\\n-\t'git fast-import <input &&\n-\t git diff-tree --abbrev --raw L^ L >output &&\n-\t test_cmp expect output'\n-\n-###\n-### series M\n-###\n-\n-test_tick\n-cat >input <<INPUT_END\n-commit refs/heads/M1\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-file rename\n-COMMIT\n-\n-from refs/heads/branch^0\n-R file2/newf file2/n.e.w.f\n-\n-INPUT_END\n-\n-cat >expect <<EOF\n-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100\tfile2/newf\tfile2/n.e.w.f\n-EOF\n-test_expect_success \\\n-\t'M: rename file in same subdirectory' \\\n-\t'git fast-import <input &&\n-\t git diff-tree -M -r M1^ M1 >actual &&\n-\t compare_diff_raw expect actual'\n-\n-cat >input <<INPUT_END\n-commit refs/heads/M2\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-file rename\n-COMMIT\n-\n-from refs/heads/branch^0\n-R file2/newf i/am/new/to/you\n-\n-INPUT_END\n-\n-cat >expect <<EOF\n-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100\tfile2/newf\ti/am/new/to/you\n-EOF\n-test_expect_success \\\n-\t'M: rename file to new subdirectory' \\\n-\t'git fast-import <input &&\n-\t git diff-tree -M -r M2^ M2 >actual &&\n-\t compare_diff_raw expect actual'\n-\n-cat >input <<INPUT_END\n-commit refs/heads/M3\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-file rename\n-COMMIT\n-\n-from refs/heads/M2^0\n-R i other/sub\n-\n-INPUT_END\n-\n-cat >expect <<EOF\n-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100\ti/am/new/to/you\tother/sub/am/new/to/you\n-EOF\n-test_expect_success \\\n-\t'M: rename subdirectory to new subdirectory' \\\n-\t'git fast-import <input &&\n-\t git diff-tree -M -r M3^ M3 >actual &&\n-\t compare_diff_raw expect actual'\n-\n-###\n-### series N\n-###\n-\n-test_tick\n-cat >input <<INPUT_END\n-commit refs/heads/N1\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-file copy\n-COMMIT\n-\n-from refs/heads/branch^0\n-C file2/newf file2/n.e.w.f\n-\n-INPUT_END\n-\n-cat >expect <<EOF\n-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile2/n.e.w.f\n-EOF\n-test_expect_success \\\n-\t'N: copy file in same subdirectory' \\\n-\t'git fast-import <input &&\n-\t git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&\n-\t compare_diff_raw expect actual'\n-\n-cat >input <<INPUT_END\n-commit refs/heads/N2\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-clean directory copy\n-COMMIT\n-\n-from refs/heads/branch^0\n-C file2 file3\n-\n-commit refs/heads/N2\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-modify directory copy\n-COMMIT\n-\n-M 644 inline file3/file5\n-data <<EOF\n-$file5_data\n-EOF\n-\n-INPUT_END\n-\n-cat >expect <<EOF\n-:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100\tnewdir/interesting\tfile3/file5\n-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n-:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n-EOF\n-test_expect_success \\\n-\t'N: copy then modify subdirectory' \\\n-\t'git fast-import <input &&\n-\t git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&\n-\t compare_diff_raw expect actual'\n-\n-cat >input <<INPUT_END\n-commit refs/heads/N3\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-dirty directory copy\n-COMMIT\n-\n-from refs/heads/branch^0\n-M 644 inline file2/file5\n-data <<EOF\n-$file5_data\n-EOF\n-\n-C file2 file3\n-D file2/file5\n-\n-INPUT_END\n-\n-test_expect_success \\\n-\t'N: copy dirty subdirectory' \\\n-\t'git fast-import <input &&\n-\t test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`'\n-\n-test_expect_success \\\n-\t'N: copy directory by id' \\\n-\t'cat >expect <<-\\EOF &&\n-\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n-\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n+\n+test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '\n+\tcat >expect <<-EOF &&\n+\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500\n+\n+\tRFC 2822 type date\n+\tEOF\n+\tgit fast-import --date-format=rfc2822 <input &&\n+\tverify_packs &&\n+\tgit cat-file commit branch >commit &&\n+\tsed 1,2d <commit >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'setup: F: non-fast-forward update' '\n+\ttest_tick &&\n+\n+\tcat >input <<-INPUT_END\n+\tcommit refs/heads/branch\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tlosing things already?\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch~1\n+\n+\treset refs/heads/other\n+\tfrom refs/heads/branch\n+\n+\tINPUT_END\n+\n+\told_branch=$(git rev-parse --verify branch^0) &&\n+\ttest_must_fail git fast-import <input &&\n+\tverify_packs\n+'\n+\n+test_expect_success 'F: non-fast-forward update skips' '\n+\techo $old_branch >expect &&\n+\tgit rev-parse --verify branch^0 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'F: verify other commit' '\n+\tcat >expect <<-EOF &&\n+\ttree $(git rev-parse branch~1^{tree})\n+\tparent $(git rev-parse branch~1)\n+\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\tlosing things already?\n+\tEOF\n+\tgit cat-file commit other >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'setup: G: forced non-fast-forward update' '\n+\ttest_tick &&\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/branch\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tlosing things already?\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch~1\n+\n+\tINPUT_END\n+\n+\tgit rev-parse --verify branch^0 >old_branch &&\n+\tgit fast-import --force <input &&\n+\tverify_packs\n+'\n+\n+test_expect_success 'G: branch changed, but logged' '\n+\tgit rev-parse --verify branch^0 >branch &&\n+\tgit rev-parse --verify branch@{1} >prev &&\n+\t! test_cmp old_branch branch &&\n+\ttest_cmp old_branch prev\n+'\n+\n+test_expect_success 'setup: H: deleteall, add one' '\n+\ttest_tick &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/H\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tthird\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch^0\n+\tM 644 inline i-will-die\n+\tdata <<EOF\n+\tthis file will never exist.\n+\tEOF\n+\n+\tdeleteall\n+\tM 644 inline h/e/l/lo\n+\tdata <<EOF\n+\t$file5_data\n+\tEOF\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tverify_packs &&\n+\tgit whatchanged H\n+'\n+\n+test_expect_success 'H: validate old files removed, new files added' '\n+\tcat >expect <<-EOF &&\n+\t:100755 000000 $newf $zeroes D\tfile2/newf\n+\t:100644 000000 $oldf $zeroes D\tfile2/oldf\n+\t:100755 000000 $file4_id $zeroes D\tfile4\n+\t:100644 100644 $file5_id $file5_id R100\tnewdir/interesting\th/e/l/lo\n+\t:100755 000000 $file6_id $zeroes D\tnewdir/exec.sh\n+\tEOF\n+\tgit diff-tree -M -r H^ H >actual &&\n+\tcompare_diff_raw expect actual\n+'\n+\n+test_expect_success 'H: verify file' '\n+\techo \"$file5_data\" >expect &&\n+\tgit cat-file blob H:h/e/l/lo >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'I: --export-pack-edges' '\n+\techo \".git/objects/pack/pack-.pack: EDGE\" >expect &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/export-boundary\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\twe have a border.  its only 40 characters wide.\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch\n+\n+\tINPUT_END\n+\n+\tgit fast-import --export-pack-edges=edges.list <input &&\n+\ttip=$(git rev-parse --verify export-boundary) &&\n+\tsed -e \"\n+\t\t\ts/pack-.*pack/pack-.pack/\n+\t\t\ts/$tip/EDGE/\n+\t\t\" edges.list >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'J: reset existing branch creates empty commit' '\n+\techo SHA >one &&\n+\t>empty &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/J\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcreate J\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch\n+\n+\treset refs/heads/J\n+\n+\tcommit refs/heads/J\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tinitialize J\n+\tCOMMIT\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tgit rev-list J >commitlist &&\n+\tgit ls-tree J >listing &&\n+\n+\tsed -e \"s/$_x40/SHA/\" commitlist >num-commits &&\n+\ttest_cmp one num-commits &&\n+\ttest_cmp empty listing\n+'\n+\n+test_expect_success 'K: reinit branch with from' '\n+\tgit rev-parse --verify branch^1 >expect &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/K\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcreate K\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch\n+\n+\tcommit refs/heads/K\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tredo K\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch^1\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tgit rev-parse --verify K^1 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'L: trees sort correctly' '\n+\tsome_data=$(echo some data | git hash-object -w --stdin) &&\n+\tother_data=$(echo other data | git hash-object -w --stdin) &&\n+\tsome_tree=$(\n+\t\trm -f tmp_index &&\n+\t\techo \"100644 blob $some_data\tother\" |\n+\t\tGIT_INDEX_FILE=tmp_index git update-index --index-info &&\n+\t\tGIT_INDEX_FILE=tmp_index git write-tree\n+\t) &&\n+\tother_tree=$(\n+\t\trm -f tmp_index &&\n+\t\techo \"100644 blob $other_data\tother\" |\n+\t\tGIT_INDEX_FILE=tmp_index git update-index --index-info &&\n+\t\tGIT_INDEX_FILE=tmp_index git write-tree\n+\t) &&\n+\tcat >expect <<-EXPECT_END &&\n+\t:100644 100644 $some_data $other_data M\tb.\n+\t:040000 040000 $some_tree $other_tree M\tb\n+\t:100644 100644 $some_data $other_data M\tba\n+\tEXPECT_END\n+\n+\tcat >input <<-INPUT_END &&\n+\tblob\n+\tmark :1\n+\tdata <<EOF\n+\tsome data\n+\tEOF\n+\n+\tblob\n+\tmark :2\n+\tdata <<EOF\n+\tother data\n+\tEOF\n+\n+\tcommit refs/heads/L\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcreate L\n+\tCOMMIT\n+\n+\tM 644 :1 b.\n+\tM 644 :1 b/other\n+\tM 644 :1 ba\n+\n+\tcommit refs/heads/L\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tupdate L\n+\tCOMMIT\n+\n+\tM 644 :2 b.\n+\tM 644 :2 b/other\n+\tM 644 :2 ba\n+\tINPUT_END\n+\tgit fast-import <input &&\n+\tgit diff-tree L^ L >output &&\n+\ttest_cmp expect output\n+'\n+\n+test_expect_success 'M: rename file within subdirectory' '\n+\ttest_tick &&\n+\tcat >expect <<-EOF &&\n+\t:100755 100755 $newf $newf R100\tfile2/newf\tfile2/n.e.w.f\n+\tEOF\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/M1\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tfile rename\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch^0\n+\tR file2/newf file2/n.e.w.f\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tgit diff-tree -M -r M1^ M1 >actual &&\n+\tcompare_diff_raw expect actual\n+'\n+\n+test_expect_success 'M: rename file to new subdirectory (and set up M2)' '\n+\tcat >expect <<-EOF &&\n+\t:100755 100755 $newf $newf R100\tfile2/newf\ti/am/new/to/you\n+\tEOF\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/M2\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tfile rename\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch^0\n+\tR file2/newf i/am/new/to/you\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tgit diff-tree -M -r M2^ M2 >actual &&\n+\tcompare_diff_raw expect actual\n+'\n+\n+test_expect_success 'M: rename subdirectory to new subdirectory' '\n+\tcat >expect <<-EOF &&\n+\t:100755 100755 $newf $newf R100\ti/am/new/to/you\tother/sub/am/new/to/you\n+\tEOF\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/M3\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tfile rename\n+\tCOMMIT\n+\n+\tfrom refs/heads/M2^0\n+\tR i other/sub\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tgit diff-tree -M -r M3^ M3 >actual &&\n+\tcompare_diff_raw expect actual\n+'\n+\n+test_expect_success 'N: copy file in same subdirectory' '\n+\ttest_tick &&\n+\tcat >expect <<-EOF &&\n+\t:100755 100755 $newf $newf C100\tfile2/newf\tfile2/n.e.w.f\n+\tEOF\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/N1\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tfile copy\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch^0\n+\tC file2/newf file2/n.e.w.f\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tgit diff-tree -C --find-copies-harder -r N1^ N1 >actual &&\n+\tcompare_diff_raw expect actual\n+'\n+\n+test_expect_success 'N: copy then modify subdirectory (and set up N2)' '\n+\tcat >expect <<-EOF &&\n+\t:100644 100644 $file5_id $file5_id C100\tnewdir/interesting\tfile3/file5\n+\t:100755 100755 $newf $newf C100\tfile2/newf\tfile3/newf\n+\t:100644 100644 $oldf $oldf C100\tfile2/oldf\tfile3/oldf\n+\tEOF\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/N2\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tclean directory copy\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch^0\n+\tC file2 file3\n+\n+\tcommit refs/heads/N2\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tmodify directory copy\n+\tCOMMIT\n+\n+\tM 644 inline file3/file5\n+\tdata <<EOF\n+\t$file5_data\n \tEOF\n-\t subdir=$(git rev-parse refs/heads/branch^0:file2) &&\n-\t cat >input <<-INPUT_END &&\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tgit diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&\n+\tcompare_diff_raw expect actual\n+'\n+\n+test_expect_success 'N: copy dirty subdirectory (and set up N3)' '\n+\tgit rev-parse N2^{tree} >expect &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/N3\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tdirty directory copy\n+\tCOMMIT\n+\n+\tfrom refs/heads/branch^0\n+\tM 644 inline file2/file5\n+\tdata <<EOF\n+\t$file5_data\n+\tEOF\n+\n+\tC file2 file3\n+\tD file2/file5\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tgit rev-parse N3^{tree} >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'N: copy directory by id' '\n+\tsubdir=$(git rev-parse --verify refs/heads/branch^0:file2) &&\n+\tcat >expect <<-EOF &&\n+\t:100755 100755 $newf $newf C100\tfile2/newf\tfile3/newf\n+\t:100644 100644 $oldf $oldf C100\tfile2/oldf\tfile3/oldf\n+\tEOF\n+\n+\tcat >input <<-INPUT_END &&\n \tcommit refs/heads/N4\n \tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \tdata <<COMMIT\n@@ -870,19 +900,21 @@ test_expect_success \\\n \tfrom refs/heads/branch^0\n \tM 040000 $subdir file3\n \tINPUT_END\n-\t git fast-import <input &&\n-\t git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&\n-\t compare_diff_raw expect actual'\n \n-test_expect_success \\\n-\t'N: modify copied tree' \\\n-\t'cat >expect <<-\\EOF &&\n-\t:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100\tnewdir/interesting\tfile3/file5\n-\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n-\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n+\tgit fast-import <input &&\n+\tgit diff-tree -C --find-copies-harder -r N4^ N4 >actual &&\n+\tcompare_diff_raw expect actual\n+'\n+\n+test_expect_success 'N: modify copied tree' '\n+\tsubdir=$(git rev-parse refs/heads/branch^0:file2) &&\n+\tcat >expect <<-EOF &&\n+\t:100644 100644 $file5_id $file5_id C100\tnewdir/interesting\tfile3/file5\n+\t:100755 100755 $newf $newf C100\tfile2/newf\tfile3/newf\n+\t:100644 100644 $oldf $oldf C100\tfile2/oldf\tfile3/oldf\n \tEOF\n-\t subdir=$(git rev-parse refs/heads/branch^0:file2) &&\n-\t cat >input <<-INPUT_END &&\n+\n+\tcat >input <<-INPUT_END &&\n \tcommit refs/heads/N5\n \tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \tdata <<COMMIT\n@@ -903,794 +935,813 @@ test_expect_success \\\n \t$file5_data\n \tEOF\n \tINPUT_END\n-\t git fast-import <input &&\n-\t git diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&\n-\t compare_diff_raw expect actual'\n-\n-###\n-### series O\n-###\n-\n-cat >input <<INPUT_END\n-#we will\n-commit refs/heads/O1\n-# -- ignore all of this text\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-# $GIT_COMMITTER_NAME has inserted here for his benefit.\n-data <<COMMIT\n-dirty directory copy\n-COMMIT\n-\n-# don't forget the import blank line!\n-#\n-# yes, we started from our usual base of branch^0.\n-# i like branch^0.\n-from refs/heads/branch^0\n-# and we need to reuse file2/file5 from N3 above.\n-M 644 inline file2/file5\n-# otherwise the tree will be different\n-data <<EOF\n-$file5_data\n-EOF\n-\n-# don't forget to copy file2 to file3\n-C file2 file3\n-#\n-# or to delete file5 from file2.\n-D file2/file5\n-# are we done yet?\n-\n-INPUT_END\n-\n-test_expect_success \\\n-\t'O: comments are all skipped' \\\n-\t'git fast-import <input &&\n-\t test `git rev-parse N3` = `git rev-parse O1`'\n-\n-cat >input <<INPUT_END\n-commit refs/heads/O2\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-dirty directory copy\n-COMMIT\n-from refs/heads/branch^0\n-M 644 inline file2/file5\n-data <<EOF\n-$file5_data\n-EOF\n-C file2 file3\n-D file2/file5\n-\n-INPUT_END\n-\n-test_expect_success \\\n-\t'O: blank lines not necessary after data commands' \\\n-\t'git fast-import <input &&\n-\t test `git rev-parse N3` = `git rev-parse O2`'\n-\n-test_expect_success \\\n-\t'O: repack before next test' \\\n-\t'git repack -a -d'\n-\n-cat >input <<INPUT_END\n-commit refs/heads/O3\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-zstring\n-COMMIT\n-commit refs/heads/O3\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-zof\n-COMMIT\n-checkpoint\n-commit refs/heads/O3\n-mark :5\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-zempty\n-COMMIT\n-checkpoint\n-commit refs/heads/O3\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-zcommits\n-COMMIT\n-reset refs/tags/O3-2nd\n-from :5\n-reset refs/tags/O3-3rd\n-from :5\n-INPUT_END\n-\n-cat >expect <<INPUT_END\n-string\n-of\n-empty\n-commits\n-INPUT_END\n-test_expect_success \\\n-\t'O: blank lines not necessary after other commands' \\\n-\t'git fast-import <input &&\n-\t test 8 = `find .git/objects/pack -type f | wc -l` &&\n-\t test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&\n-\t git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&\n-\t test_cmp expect actual'\n-\n-cat >input <<INPUT_END\n-commit refs/heads/O4\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-zstring\n-COMMIT\n-commit refs/heads/O4\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-zof\n-COMMIT\n-progress Two commits down, 2 to go!\n-commit refs/heads/O4\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-zempty\n-COMMIT\n-progress Three commits down, 1 to go!\n-commit refs/heads/O4\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-zcommits\n-COMMIT\n-progress I'm done!\n-INPUT_END\n-test_expect_success \\\n-\t'O: progress outputs as requested by input' \\\n-\t'git fast-import <input >actual &&\n-\t grep \"progress \" <input >expect &&\n-\t test_cmp expect actual'\n-\n-###\n-### series P (gitlinks)\n-###\n-\n-cat >input <<INPUT_END\n-blob\n-mark :1\n-data 10\n-test file\n-\n-reset refs/heads/sub\n-commit refs/heads/sub\n-mark :2\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data 12\n-sub_initial\n-M 100644 :1 file\n-\n-blob\n-mark :3\n-data <<DATAEND\n-[submodule \"sub\"]\n-\tpath = sub\n-\turl = \"`pwd`/sub\"\n-DATAEND\n-\n-commit refs/heads/subuse1\n-mark :4\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data 8\n-initial\n-from refs/heads/master\n-M 100644 :3 .gitmodules\n-M 160000 :2 sub\n-\n-blob\n-mark :5\n-data 20\n-test file\n-more data\n-\n-commit refs/heads/sub\n-mark :6\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data 11\n-sub_second\n-from :2\n-M 100644 :5 file\n-\n-commit refs/heads/subuse1\n-mark :7\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data 7\n-second\n-from :4\n-M 160000 :6 sub\n-\n-INPUT_END\n-\n-test_expect_success \\\n-\t'P: supermodule & submodule mix' \\\n-\t'git fast-import <input &&\n-\t git checkout subuse1 &&\n-\t rm -rf sub && mkdir sub && cd sub &&\n-\t git init &&\n-\t git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&\n-\t git checkout master &&\n-\t cd .. &&\n-\t git submodule init &&\n-\t git submodule update'\n-\n-SUBLAST=$(git rev-parse --verify sub)\n-SUBPREV=$(git rev-parse --verify sub^)\n-\n-cat >input <<INPUT_END\n-blob\n-mark :1\n-data <<DATAEND\n-[submodule \"sub\"]\n-\tpath = sub\n-\turl = \"`pwd`/sub\"\n-DATAEND\n-\n-commit refs/heads/subuse2\n-mark :2\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data 8\n-initial\n-from refs/heads/master\n-M 100644 :1 .gitmodules\n-M 160000 $SUBPREV sub\n-\n-commit refs/heads/subuse2\n-mark :3\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data 7\n-second\n-from :2\n-M 160000 $SUBLAST sub\n-\n-INPUT_END\n-\n-test_expect_success \\\n-\t'P: verbatim SHA gitlinks' \\\n-\t'git branch -D sub &&\n-\t git gc && git prune &&\n-\t git fast-import <input &&\n-\t test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)'\n-\n-test_tick\n-cat >input <<INPUT_END\n-commit refs/heads/subuse3\n-mark :1\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-corrupt\n-COMMIT\n-\n-from refs/heads/subuse2\n-M 160000 inline sub\n-data <<DATA\n-$SUBPREV\n-DATA\n-\n-INPUT_END\n+\n+\tgit fast-import <input &&\n+\tgit diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&\n+\tcompare_diff_raw expect actual\n+'\n+\n+test_expect_success 'O: comments are all skipped' '\n+\tgit rev-parse N3 >expect &&\n+\n+\tcat >input <<-INPUT_END &&\n+\t#we will\n+\tcommit refs/heads/O1\n+\t# -- ignore all of this text\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t# $GIT_COMMITTER_NAME has inserted here for his benefit.\n+\tdata <<COMMIT\n+\tdirty directory copy\n+\tCOMMIT\n+\n+\t# don'\\''t forget the import blank line!\n+\t#\n+\t# yes, we started from our usual base of branch^0.\n+\t# i like branch^0.\n+\tfrom refs/heads/branch^0\n+\t# and we need to reuse file2/file5 from N3 above.\n+\tM 644 inline file2/file5\n+\t# otherwise the tree will be different\n+\tdata <<EOF\n+\t$file5_data\n+\tEOF\n+\n+\t# don'\\''t forget to copy file2 to file3\n+\tC file2 file3\n+\t#\n+\t# or to delete file5 from file2.\n+\tD file2/file5\n+\t# are we done yet?\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tgit rev-parse O1 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'O: blank lines not necessary after data commands' '\n+\tgit rev-parse N3 >expect &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/O2\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tdirty directory copy\n+\tCOMMIT\n+\tfrom refs/heads/branch^0\n+\tM 644 inline file2/file5\n+\tdata <<EOF\n+\t$file5_data\n+\tEOF\n+\tC file2 file3\n+\tD file2/file5\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tgit rev-parse O2 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'O: blank lines not necessary after other commands' '\n+\tcat >expect <<-\\INPUT_END &&\n+\tstring\n+\tof\n+\tempty\n+\tcommits\n+\tINPUT_END\n+\n+\tgit repack -a -d &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/O3\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tzstring\n+\tCOMMIT\n+\tcommit refs/heads/O3\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tzof\n+\tCOMMIT\n+\tcheckpoint\n+\tcommit refs/heads/O3\n+\tmark :5\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tzempty\n+\tCOMMIT\n+\tcheckpoint\n+\tcommit refs/heads/O3\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tzcommits\n+\tCOMMIT\n+\treset refs/tags/O3-2nd\n+\tfrom :5\n+\treset refs/tags/O3-3rd\n+\tfrom :5\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tgit log --reverse --pretty=oneline O3 >log &&\n+\tgit rev-parse O3^ >o3-parent &&\n+\tgit rev-parse refs/tags/O3-2nd >o3-2nd &&\n+\n+\tsed s/^.*z// log >actual &&\n+\ttest_cmp expect actual &&\n+\ttest 8 = `find .git/objects/pack -type f | wc -l` &&\n+\ttest_cmp o3-2nd o3-parent\n+'\n+\n+test_expect_success 'O: progress outputs as requested by input' '\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/O4\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tzstring\n+\tCOMMIT\n+\tcommit refs/heads/O4\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tzof\n+\tCOMMIT\n+\tprogress Two commits down, 2 to go!\n+\tcommit refs/heads/O4\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tzempty\n+\tCOMMIT\n+\tprogress Three commits down, 1 to go!\n+\tcommit refs/heads/O4\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tzcommits\n+\tCOMMIT\n+\tprogress I'\\''m done!\n+\tINPUT_END\n+\tgrep \"progress \" <input >expect &&\n+\n+\tgit fast-import <input >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'setup: P: supermodule & submodule mix' '\n+\tcat >input <<-INPUT_END &&\n+\tblob\n+\tmark :1\n+\tdata 10\n+\ttest file\n+\n+\treset refs/heads/sub\n+\tcommit refs/heads/sub\n+\tmark :2\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 12\n+\tsub_initial\n+\tM 100644 :1 file\n+\n+\tblob\n+\tmark :3\n+\tdata <<DATAEND\n+\t[submodule \"sub\"]\n+\t\tpath = sub\n+\t\turl = \"$(pwd)/sub\"\n+\tDATAEND\n+\n+\tcommit refs/heads/subuse1\n+\tmark :4\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 8\n+\tinitial\n+\tfrom refs/heads/master\n+\tM 100644 :3 .gitmodules\n+\tM 160000 :2 sub\n+\n+\tblob\n+\tmark :5\n+\tdata 20\n+\ttest file\n+\tmore data\n+\n+\tcommit refs/heads/sub\n+\tmark :6\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 11\n+\tsub_second\n+\tfrom :2\n+\tM 100644 :5 file\n+\n+\tcommit refs/heads/subuse1\n+\tmark :7\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 7\n+\tsecond\n+\tfrom :4\n+\tM 160000 :6 sub\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tgit checkout subuse1 &&\n+\trm -rf sub &&\n+\tmkdir sub &&\n+\t(\n+\t\tcd sub &&\n+\t\tgit init &&\n+\t\tgit fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&\n+\t\tgit checkout master\n+\t) &&\n+\tgit submodule init &&\n+\tgit submodule update\n+'\n+\n+test_expect_success 'P: verbatim SHA gitlinks (and set up subuse2)' '\n+\tSUBLAST=$(git rev-parse --verify sub) &&\n+\tSUBPREV=$(git rev-parse --verify sub^) &&\n+\tgit rev-parse --verify subuse1 >expect &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tblob\n+\tmark :1\n+\tdata <<DATAEND\n+\t[submodule \"sub\"]\n+\t\tpath = sub\n+\t\turl = \"$(pwd)/sub\"\n+\tDATAEND\n+\n+\tcommit refs/heads/subuse2\n+\tmark :2\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 8\n+\tinitial\n+\tfrom refs/heads/master\n+\tM 100644 :1 .gitmodules\n+\tM 160000 $SUBPREV sub\n+\n+\tcommit refs/heads/subuse2\n+\tmark :3\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata 7\n+\tsecond\n+\tfrom :2\n+\tM 160000 $SUBLAST sub\n+\n+\tINPUT_END\n+\n+\tgit branch -D sub &&\n+\tgit gc && git prune &&\n+\tgit fast-import <input &&\n+\tgit rev-parse --verify subuse2 >actual &&\n+\ttest_cmp expect actual\n+'\n \n test_expect_success 'P: fail on inline gitlink' '\n-    test_must_fail git fast-import <input'\n+\ttest_tick &&\n \n-test_tick\n-cat >input <<INPUT_END\n-blob\n-mark :1\n-data <<DATA\n-$SUBPREV\n-DATA\n+\tcat >input <<-INPUT_END &&\n+\tcommit refs/heads/subuse3\n+\tmark :1\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcorrupt\n+\tCOMMIT\n \n-commit refs/heads/subuse3\n-mark :2\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-corrupt\n-COMMIT\n+\tfrom refs/heads/subuse2\n+\tM 160000 inline sub\n+\tdata <<DATA\n+\t$SUBPREV\n+\tDATA\n \n-from refs/heads/subuse2\n-M 160000 :1 sub\n+\tINPUT_END\n \n-INPUT_END\n+\ttest_must_fail git fast-import <input\n+'\n \n test_expect_success 'P: fail on blob mark in gitlink' '\n-    test_must_fail git fast-import <input'\n-\n-###\n-### series Q (notes)\n-###\n-\n-note1_data=\"The first note for the first commit\"\n-note2_data=\"The first note for the second commit\"\n-note3_data=\"The first note for the third commit\"\n-note1b_data=\"The second note for the first commit\"\n-note1c_data=\"The third note for the first commit\"\n-note2b_data=\"The second note for the second commit\"\n-\n-test_tick\n-cat >input <<INPUT_END\n-blob\n-mark :2\n-data <<EOF\n-$file2_data\n-EOF\n-\n-commit refs/heads/notes-test\n-mark :3\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-first (:3)\n-COMMIT\n-\n-M 644 :2 file2\n-\n-blob\n-mark :4\n-data $file4_len\n-$file4_data\n-commit refs/heads/notes-test\n-mark :5\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-second (:5)\n-COMMIT\n-\n-M 644 :4 file4\n-\n-commit refs/heads/notes-test\n-mark :6\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-third (:6)\n-COMMIT\n-\n-M 644 inline file5\n-data <<EOF\n-$file5_data\n-EOF\n-\n-M 755 inline file6\n-data <<EOF\n-$file6_data\n-EOF\n-\n-blob\n-mark :7\n-data <<EOF\n-$note1_data\n-EOF\n-\n-blob\n-mark :8\n-data <<EOF\n-$note2_data\n-EOF\n-\n-commit refs/notes/foobar\n-mark :9\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-notes (:9)\n-COMMIT\n-\n-N :7 :3\n-N :8 :5\n-N inline :6\n-data <<EOF\n-$note3_data\n-EOF\n-\n-commit refs/notes/foobar\n-mark :10\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-notes (:10)\n-COMMIT\n-\n-N inline :3\n-data <<EOF\n-$note1b_data\n-EOF\n-\n-commit refs/notes/foobar2\n-mark :11\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-notes (:11)\n-COMMIT\n-\n-N inline :3\n-data <<EOF\n-$note1c_data\n-EOF\n-\n-commit refs/notes/foobar\n-mark :12\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-notes (:12)\n-COMMIT\n-\n-deleteall\n-N inline :5\n-data <<EOF\n-$note2b_data\n-EOF\n-\n-INPUT_END\n-\n-test_expect_success \\\n-\t'Q: commit notes' \\\n-\t'git fast-import <input &&\n-\t git whatchanged notes-test'\n-test_expect_success \\\n-\t'Q: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n-\n-commit1=$(git rev-parse notes-test~2)\n-commit2=$(git rev-parse notes-test^)\n-commit3=$(git rev-parse notes-test)\n-\n-cat >expect <<EOF\n-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-first (:3)\n-EOF\n-test_expect_success \\\n-\t'Q: verify first commit' \\\n-\t'git cat-file commit notes-test~2 | sed 1d >actual &&\n-\ttest_cmp expect actual'\n-\n-cat >expect <<EOF\n-parent $commit1\n-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-second (:5)\n-EOF\n-test_expect_success \\\n-\t'Q: verify second commit' \\\n-\t'git cat-file commit notes-test^ | sed 1d >actual &&\n-\ttest_cmp expect actual'\n-\n-cat >expect <<EOF\n-parent $commit2\n-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-third (:6)\n-EOF\n-test_expect_success \\\n-\t'Q: verify third commit' \\\n-\t'git cat-file commit notes-test | sed 1d >actual &&\n-\ttest_cmp expect actual'\n-\n-cat >expect <<EOF\n-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-notes (:9)\n-EOF\n-test_expect_success \\\n-\t'Q: verify first notes commit' \\\n-\t'git cat-file commit refs/notes/foobar~2 | sed 1d >actual &&\n-\ttest_cmp expect actual'\n-\n-cat >expect.unsorted <<EOF\n-100644 blob $commit1\n-100644 blob $commit2\n-100644 blob $commit3\n-EOF\n-cat expect.unsorted | sort >expect\n-test_expect_success \\\n-\t'Q: verify first notes tree' \\\n-\t'git cat-file -p refs/notes/foobar~2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t test_cmp expect actual'\n-\n-echo \"$note1_data\" >expect\n-test_expect_success \\\n-\t'Q: verify first note for first commit' \\\n-\t'git cat-file blob refs/notes/foobar~2:$commit1 >actual && test_cmp expect actual'\n-\n-echo \"$note2_data\" >expect\n-test_expect_success \\\n-\t'Q: verify first note for second commit' \\\n-\t'git cat-file blob refs/notes/foobar~2:$commit2 >actual && test_cmp expect actual'\n-\n-echo \"$note3_data\" >expect\n-test_expect_success \\\n-\t'Q: verify first note for third commit' \\\n-\t'git cat-file blob refs/notes/foobar~2:$commit3 >actual && test_cmp expect actual'\n-\n-cat >expect <<EOF\n-parent `git rev-parse --verify refs/notes/foobar~2`\n-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-notes (:10)\n-EOF\n-test_expect_success \\\n-\t'Q: verify second notes commit' \\\n-\t'git cat-file commit refs/notes/foobar^ | sed 1d >actual &&\n-\ttest_cmp expect actual'\n-\n-cat >expect.unsorted <<EOF\n-100644 blob $commit1\n-100644 blob $commit2\n-100644 blob $commit3\n-EOF\n-cat expect.unsorted | sort >expect\n-test_expect_success \\\n-\t'Q: verify second notes tree' \\\n-\t'git cat-file -p refs/notes/foobar^^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t test_cmp expect actual'\n-\n-echo \"$note1b_data\" >expect\n-test_expect_success \\\n-\t'Q: verify second note for first commit' \\\n-\t'git cat-file blob refs/notes/foobar^:$commit1 >actual && test_cmp expect actual'\n-\n-echo \"$note2_data\" >expect\n-test_expect_success \\\n-\t'Q: verify first note for second commit' \\\n-\t'git cat-file blob refs/notes/foobar^:$commit2 >actual && test_cmp expect actual'\n-\n-echo \"$note3_data\" >expect\n-test_expect_success \\\n-\t'Q: verify first note for third commit' \\\n-\t'git cat-file blob refs/notes/foobar^:$commit3 >actual && test_cmp expect actual'\n-\n-cat >expect <<EOF\n-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-notes (:11)\n-EOF\n-test_expect_success \\\n-\t'Q: verify third notes commit' \\\n-\t'git cat-file commit refs/notes/foobar2 | sed 1d >actual &&\n-\ttest_cmp expect actual'\n-\n-cat >expect.unsorted <<EOF\n-100644 blob $commit1\n-EOF\n-cat expect.unsorted | sort >expect\n-test_expect_success \\\n-\t'Q: verify third notes tree' \\\n-\t'git cat-file -p refs/notes/foobar2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t test_cmp expect actual'\n-\n-echo \"$note1c_data\" >expect\n-test_expect_success \\\n-\t'Q: verify third note for first commit' \\\n-\t'git cat-file blob refs/notes/foobar2:$commit1 >actual && test_cmp expect actual'\n-\n-cat >expect <<EOF\n-parent `git rev-parse --verify refs/notes/foobar^`\n-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\n-notes (:12)\n-EOF\n-test_expect_success \\\n-\t'Q: verify fourth notes commit' \\\n-\t'git cat-file commit refs/notes/foobar | sed 1d >actual &&\n-\ttest_cmp expect actual'\n-\n-cat >expect.unsorted <<EOF\n-100644 blob $commit2\n-EOF\n-cat expect.unsorted | sort >expect\n-test_expect_success \\\n-\t'Q: verify fourth notes tree' \\\n-\t'git cat-file -p refs/notes/foobar^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t test_cmp expect actual'\n-\n-echo \"$note2b_data\" >expect\n-test_expect_success \\\n-\t'Q: verify second note for second commit' \\\n-\t'git cat-file blob refs/notes/foobar:$commit2 >actual && test_cmp expect actual'\n-\n-###\n-### series R (feature and option)\n-###\n-\n-cat >input <<EOF\n-feature no-such-feature-exists\n-EOF\n+\ttest_tick &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tblob\n+\tmark :1\n+\tdata <<DATA\n+\t$SUBPREV\n+\tDATA\n+\n+\tcommit refs/heads/subuse3\n+\tmark :2\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tcorrupt\n+\tCOMMIT\n+\n+\tfrom refs/heads/subuse2\n+\tM 160000 :1 sub\n+\n+\tINPUT_END\n+\n+\ttest_must_fail git fast-import <input\n+'\n+\n+test_expect_success 'setup: series Q (notes)' '\n+\ttest_tick &&\n+\n+\tnote1_data=\"The first note for the first commit\" &&\n+\tnote2_data=\"The first note for the second commit\" &&\n+\tnote3_data=\"The first note for the third commit\" &&\n+\tnote1b_data=\"The second note for the first commit\" &&\n+\tnote1c_data=\"The third note for the first commit\" &&\n+\tnote2b_data=\"The second note for the second commit\" &&\n+\n+\tcat >input <<-INPUT_END &&\n+\tblob\n+\tmark :2\n+\tdata <<EOF\n+\t$file2_data\n+\tEOF\n+\n+\tcommit refs/heads/notes-test\n+\tmark :3\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tfirst (:3)\n+\tCOMMIT\n+\n+\tM 644 :2 file2\n+\n+\tblob\n+\tmark :4\n+\tdata $file4_len\n+\t$file4_data\n+\tcommit refs/heads/notes-test\n+\tmark :5\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tsecond (:5)\n+\tCOMMIT\n+\n+\tM 644 :4 file4\n+\n+\tcommit refs/heads/notes-test\n+\tmark :6\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tthird (:6)\n+\tCOMMIT\n+\n+\tM 644 inline file5\n+\tdata <<EOF\n+\t$file5_data\n+\tEOF\n+\n+\tM 755 inline file6\n+\tdata <<EOF\n+\t$file6_data\n+\tEOF\n+\n+\tblob\n+\tmark :7\n+\tdata <<EOF\n+\t$note1_data\n+\tEOF\n+\n+\tblob\n+\tmark :8\n+\tdata <<EOF\n+\t$note2_data\n+\tEOF\n+\n+\tcommit refs/notes/foobar\n+\tmark :9\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tnotes (:9)\n+\tCOMMIT\n+\n+\tN :7 :3\n+\tN :8 :5\n+\tN inline :6\n+\tdata <<EOF\n+\t$note3_data\n+\tEOF\n+\n+\tcommit refs/notes/foobar\n+\tmark :10\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tnotes (:10)\n+\tCOMMIT\n+\n+\tN inline :3\n+\tdata <<EOF\n+\t$note1b_data\n+\tEOF\n+\n+\tcommit refs/notes/foobar2\n+\tmark :11\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tnotes (:11)\n+\tCOMMIT\n+\n+\tN inline :3\n+\tdata <<EOF\n+\t$note1c_data\n+\tEOF\n+\n+\tcommit refs/notes/foobar\n+\tmark :12\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\tnotes (:12)\n+\tCOMMIT\n+\n+\tdeleteall\n+\tN inline :5\n+\tdata <<EOF\n+\t$note2b_data\n+\tEOF\n+\n+\tINPUT_END\n+\n+\tgit fast-import <input &&\n+\tverify_packs &&\n+\tgit whatchanged notes-test\n+'\n+\n+test_expect_success 'Q: verify first commit' '\n+\tcat >expect <<-EOF &&\n+\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\tfirst (:3)\n+\tEOF\n+\n+\tgit cat-file commit notes-test~2 >commit &&\n+\tsed 1d <commit >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify second commit' '\n+\tcommit1=$(git rev-parse notes-test~2) &&\n+\tcat >expect <<-EOF\n+\tparent $commit1\n+\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\tsecond (:5)\n+\tEOF\n+\tgit cat-file commit notes-test^ >commit &&\n+\tsed 1d <commit >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify third commit' '\n+\tcommit2=$(git rev-parse notes-test^) &&\n+\tcat >expect <<-EOF &&\n+\tparent $commit2\n+\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\tthird (:6)\n+\tEOF\n+\tgit cat-file commit notes-test >commit &&\n+\tsed 1d <commit >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify first notes commit' '\n+\tcat >expect <<-EOF &&\n+\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\tnotes (:9)\n+\tEOF\n+\tgit cat-file commit refs/notes/foobar~2 >commit &&\n+\tsed 1d <commit >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify first notes tree' '\n+\tcommit1=$(git rev-parse notes-test~2) &&\n+\tcommit2=$(git rev-parse notes-test^) &&\n+\tcommit3=$(git rev-parse notes-test) &&\n+\tsort >expect <<-EOF &&\n+\t100644 blob $commit1\n+\t100644 blob $commit2\n+\t100644 blob $commit3\n+\tEOF\n+\n+\tgit cat-file -p refs/notes/foobar~2^{tree} >tree &&\n+\tsed \"s/ [0-9a-f]*\t/ /\" <tree >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify first note for first commit' '\n+\techo \"$note1_data\" >expect &&\n+\tgit cat-file blob refs/notes/foobar~2:$commit1 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify first note for second commit' '\n+\techo \"$note2_data\" >expect &&\n+\tgit cat-file blob refs/notes/foobar~2:$commit2 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify first note for third commit' '\n+\techo \"$note3_data\" >expect &&\n+\tgit cat-file blob refs/notes/foobar~2:$commit3 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify second notes commit' '\n+\tcat >expect <<-EOF &&\n+\tparent `git rev-parse --verify refs/notes/foobar~2`\n+\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\tnotes (:10)\n+\tEOF\n+\tgit cat-file commit refs/notes/foobar^ >commit &&\n+\tsed 1d <commit >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify second notes tree' '\n+\tsort >expect <<-EOF\n+\t100644 blob $commit1\n+\t100644 blob $commit2\n+\t100644 blob $commit3\n+\tEOF\n+\tgit cat-file -p refs/notes/foobar^^{tree} >tree &&\n+\tsed \"s/ [0-9a-f]*\t/ /\" <tree >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify second note for first commit' '\n+\techo \"$note1b_data\" >expect &&\n+\tgit cat-file blob refs/notes/foobar^:$commit1 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify first note for second commit' '\n+\techo \"$note2_data\" >expect &&\n+\tgit cat-file blob refs/notes/foobar^:$commit2 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify first note for third commit' '\n+\techo \"$note3_data\" >expect &&\n+\tgit cat-file blob refs/notes/foobar^:$commit3 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify third notes commit' '\n+\tcat >expect <<-EOF &&\n+\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\tnotes (:11)\n+\tEOF\n+\tgit cat-file commit refs/notes/foobar2 >commit &&\n+\tsed 1d <commit >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify third notes tree' '\n+\techo \"100644 blob $commit1\" >expect &&\n+\tgit cat-file -p refs/notes/foobar2^{tree} >tree &&\n+\tsed \"s/ [0-9a-f]*\t/ /\" <tree >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify third note for first commit' '\n+\techo \"$note1c_data\" >expect\n+\tgit cat-file blob refs/notes/foobar2:$commit1 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify fourth notes commit' '\n+\tparent=$(git rev-parse --verify refs/notes/foobar^) &&\n+\tcat >expect <<-EOF &&\n+\tparent $parent\n+\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\n+\tnotes (:12)\n+\tEOF\n+\tgit cat-file commit refs/notes/foobar >commit &&\n+\tsed 1d <commit >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify fourth notes tree' '\n+\techo \"100644 blob $commit2\" >expect &&\n+\tgit cat-file -p refs/notes/foobar^{tree} >tree &&\n+\tsed \"s/ [0-9a-f]*\t/ /\" <tree >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'Q: verify second note for second commit' '\n+\techo \"$note2b_data\" >expect\n+\tgit cat-file blob refs/notes/foobar:$commit2 >actual &&\n+\ttest_cmp expect actual\n+'\n \n test_expect_success 'R: abort on unsupported feature' '\n+\tcat >input <<-EOF &&\n+\tfeature no-such-feature-exists\n+\tEOF\n+\n \ttest_must_fail git fast-import <input\n '\n \n-cat >input <<EOF\n-feature date-format=now\n-EOF\n-\n test_expect_success 'R: supported feature is accepted' '\n+\tcat >input <<-EOF &&\n+\tfeature date-format=now\n+\tEOF\n+\n \tgit fast-import <input\n '\n \n-cat >input << EOF\n-blob\n-data 3\n-hi\n-feature date-format=now\n-EOF\n-\n test_expect_success 'R: abort on receiving feature after data command' '\n+\tcat >input <<-EOF &&\n+\tblob\n+\tdata 3\n+\thi\n+\tfeature date-format=now\n+\tEOF\n+\n \ttest_must_fail git fast-import <input\n '\n \n-cat >input << EOF\n-feature import-marks=git.marks\n-feature import-marks=git2.marks\n-EOF\n-\n test_expect_success 'R: only one import-marks feature allowed per stream' '\n+\tcat >input <<-\\EOF &&\n+\tfeature import-marks=git.marks\n+\tfeature import-marks=git2.marks\n+\tEOF\n+\n \ttest_must_fail git fast-import <input\n '\n \n-cat >input << EOF\n-feature export-marks=git.marks\n-blob\n-mark :1\n-data 3\n-hi\n-\n-EOF\n-\n-test_expect_success \\\n-    'R: export-marks feature results in a marks file being created' \\\n-    'cat input | git fast-import &&\n-    grep :1 git.marks'\n-\n-test_expect_success \\\n-    'R: export-marks options can be overriden by commandline options' \\\n-    'cat input | git fast-import --export-marks=other.marks &&\n-    grep :1 other.marks'\n-\n-cat >input << EOF\n-feature import-marks=marks.out\n-feature export-marks=marks.new\n-EOF\n-\n-test_expect_success \\\n-    'R: import to output marks works without any content' \\\n-    'cat input | git fast-import &&\n-    test_cmp marks.out marks.new'\n-\n-cat >input <<EOF\n-feature import-marks=nonexistant.marks\n-feature export-marks=marks.new\n-EOF\n+test_expect_success 'setup: R: stream using export-marks feature' '\n+\tcat >input <<-\\EOF\n+\tfeature export-marks=git.marks\n+\tblob\n+\tmark :1\n+\tdata 3\n+\thi\n+\n+\tEOF\n+'\n \n-test_expect_success \\\n-    'R: import marks prefers commandline marks file over the stream' \\\n-    'cat input | git fast-import --import-marks=marks.out &&\n-    test_cmp marks.out marks.new'\n+test_expect_success 'R: export-marks feature results in a marks file being created' '\n+\tgit fast-import <input &&\n+\tgrep :1 git.marks\n+'\n \n+test_expect_success 'R: export-marks options can be overriden by commandline options' '\n+\tgit fast-import --export-marks=other.marks <input &&\n+\tgrep :1 other.marks\n+'\n \n-cat >input <<EOF\n-feature import-marks=nonexistant.marks\n-feature export-marks=combined.marks\n-EOF\n+test_expect_success 'R: import to output marks works without any content' '\n+\tcat >input <<-\\EOF &&\n+\tfeature import-marks=marks.out\n+\tfeature export-marks=marks.new\n+\tEOF\n \n-test_expect_success 'R: multiple --import-marks= should be honoured' '\n-    head -n2 marks.out > one.marks &&\n-    tail -n +3 marks.out > two.marks &&\n-    git fast-import --import-marks=one.marks --import-marks=two.marks <input &&\n-    test_cmp marks.out combined.marks\n+\tgit fast-import <input &&\n+\ttest_cmp marks.out marks.new\n '\n \n-cat >input <<EOF\n-feature relative-marks\n-feature import-marks=relative.in\n-feature export-marks=relative.out\n-EOF\n-\n-test_expect_success 'R: feature relative-marks should be honoured' '\n-    mkdir -p .git/info/fast-import/ &&\n-    cp marks.new .git/info/fast-import/relative.in &&\n-    git fast-import <input &&\n-    test_cmp marks.new .git/info/fast-import/relative.out\n+test_expect_success 'R: import marks prefers commandline marks file over the stream' '\n+\tcat >input <<-EOF &&\n+\tfeature import-marks=nonexistant.marks\n+\tfeature export-marks=marks.new\n+\tEOF\n+\tgit fast-import --import-marks=marks.out <input &&\n+\ttest_cmp marks.out marks.new\n '\n \n-cat >input <<EOF\n-feature relative-marks\n-feature import-marks=relative.in\n-feature no-relative-marks\n-feature export-marks=non-relative.out\n-EOF\n+test_expect_success 'R: multiple --import-marks= are honoured' '\n+\tcat >input <<-EOF &&\n+\tfeature import-marks=nonexistant.marks\n+\tfeature export-marks=combined.marks\n+\tEOF\n \n-test_expect_success 'R: feature no-relative-marks should be honoured' '\n-    git fast-import <input &&\n-    test_cmp marks.new non-relative.out\n+\thead -n2 marks.out >one.marks &&\n+\ttail -n +3 marks.out >two.marks &&\n+\tgit fast-import --import-marks=one.marks --import-marks=two.marks <input &&\n+\ttest_cmp marks.out combined.marks\n '\n \n-cat >input << EOF\n-option git quiet\n-blob\n-data 3\n-hi\n+test_expect_success 'R: feature relative-marks is honoured' '\n+\tcat >input <<-\\EOF &&\n+\tfeature relative-marks\n+\tfeature import-marks=relative.in\n+\tfeature export-marks=relative.out\n+\tEOF\n+\n+\tmkdir -p .git/info/fast-import/ &&\n+\tcp marks.out .git/info/fast-import/relative.in &&\n+\tgit fast-import <input &&\n+\ttest_cmp marks.out .git/info/fast-import/relative.out\n+'\n \n-EOF\n+test_expect_success 'R: feature no-relative-marks is honoured' '\n+\tcat >input <<-\\EOF &&\n+\tfeature relative-marks\n+\tfeature import-marks=relative.in\n+\tfeature no-relative-marks\n+\tfeature export-marks=non-relative.out\n+\tEOF\n \n-touch empty\n+\tgit fast-import <input &&\n+\ttest_cmp marks.out non-relative.out\n+'\n \n test_expect_success 'R: quiet option results in no stats being output' '\n-    cat input | git fast-import 2> output &&\n-    test_cmp empty output\n+\t>empty &&\n+\tcat >input <<-\\EOF &&\n+\toption git quiet\n+\tblob\n+\tdata 3\n+\thi\n+\n+\tEOF\n+\n+\tgit fast-import <input 2>output &&\n+\ttest_cmp empty output\n '\n \n-cat >input <<EOF\n-option git non-existing-option\n-EOF\n-\n test_expect_success 'R: die on unknown option' '\n-    test_must_fail git fast-import <input\n+\tcat >input <<-\\EOF &&\n+\toption git non-existing-option\n+\tEOF\n+\n+\ttest_must_fail git fast-import <input\n '\n \n test_expect_success 'R: unknown commandline options are rejected' '\\\n-    test_must_fail git fast-import --non-existing-option < /dev/null\n+\ttest_must_fail git fast-import --non-existing-option </dev/null\n '\n \n-cat >input <<EOF\n-option non-existing-vcs non-existing-option\n-EOF\n-\n test_expect_success 'R: ignore non-git options' '\n-    git fast-import <input\n+\tcat >input <<-\\EOF &&\n+\toption non-existing-vcs non-existing-option\n+\tEOF\n+\n+\tgit fast-import <input\n '\n \n-##\n-## R: very large blobs\n-##\n-blobsize=$((2*1024*1024 + 53))\n-test-genrandom bar $blobsize >expect\n-cat >input <<INPUT_END\n-commit refs/heads/big-file\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-R - big file\n-COMMIT\n-\n-M 644 inline big1\n-data $blobsize\n-INPUT_END\n-cat expect >>input\n-cat >>input <<INPUT_END\n-M 644 inline big2\n-data $blobsize\n-INPUT_END\n-cat expect >>input\n-echo >>input\n-\n-test_expect_success \\\n-\t'R: blob bigger than threshold' \\\n-\t'test_create_repo R &&\n-\t git --git-dir=R/.git fast-import --big-file-threshold=1 <input'\n-test_expect_success \\\n-\t'R: verify created pack' \\\n-\t': >verify &&\n-\t for p in R/.git/objects/pack/*.pack;\n-\t do\n-\t   git verify-pack -v $p >>verify || exit;\n-\t done'\n-test_expect_success \\\n-\t'R: verify written objects' \\\n-\t'git --git-dir=R/.git cat-file blob big-file:big1 >actual &&\n-\t test_cmp expect actual &&\n-\t a=$(git --git-dir=R/.git rev-parse big-file:big1) &&\n-\t b=$(git --git-dir=R/.git rev-parse big-file:big2) &&\n-\t test $a = $b'\n-test_expect_success \\\n-\t'R: blob appears only once' \\\n-\t'n=$(grep $a verify | wc -l) &&\n-\t test 1 = $n'\n+test_expect_success 'R: blob bigger than threshold' '\n+\tblobsize=$((2*1024*1024 + 53)) &&\n+\ttest-genrandom bar $blobsize >expect &&\n+\techo ONE | wc -l >expect.count &&\n+\n+\t{\n+\t\tcat <<-INPUT_END &&\n+\t\tcommit refs/heads/big-file\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tR - big file\n+\t\tCOMMIT\n+\n+\t\tM 644 inline big1\n+\t\tdata $blobsize\n+\t\tINPUT_END\n+\n+\t\tcat expect &&\n+\t\tcat <<-INPUT_END &&\n+\t\tM 644 inline big2\n+\t\tdata $blobsize\n+\t\tINPUT_END\n+\n+\t\tcat expect &&\n+\t\techo\n+\t} >input &&\n+\n+\ttest_create_repo R &&\n+\tgit --git-dir=R/.git fast-import --big-file-threshold=1 <input &&\n+\t(\n+\t\tfor p in R/.git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack -v $p ||\n+\t\t\texit\n+\t\tdone\n+\t) >verify &&\n+\tgit --git-dir=R/.git cat-file blob big-file:big1 >actual &&\n+\tgit --git-dir=R/.git rev-parse big-file:big1 >a &&\n+\tgit --git-dir=R/.git rev-parse big-file:big2 >b &&\n+\tgrep $(cat a) verify | wc -l >count &&\n+\n+\ttest_cmp expect actual &&\n+\ttest_cmp a b &&\n+\t# blob only appears once\n+\ttest_cmp expect.count count\n+'\n \n test_done\n-- \n1.7.2.3\n"},{"id":"149932","messageId":"20100905032957.GC2344@burratino","threadId":"24246","inReplyTo":"20100905031528.GA2344@burratino","subject":"[PATCH 2/3] Teach fast-import to print the id of each imported commit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-05T03:29:58Z","receivedAt":"2010-09-05T03:29:58Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"For the svn importer, it would be useful to build a map from\nsubversion revision numbers to git commits as the import takes place.\nThis is particularly relevant because the subversion api sometimes\nrepresents as \"copy this directory from this revision\", and the\nimporter needs to be able to access the corresponding trees.  So\n(optionally) print each commit id when the corresponding object is\nwritten.\n\nUnfortunately when each commit object is written, it is not yet\naccessible to the caller until a checkpoint has finished.  A later\npatch will teach fast-import to directly pass on the relevant data on\nrequest, using the same channel.\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nCc: Sverre Rabbelier <srabbelier@gmail.com>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nI am not happy with the interface:\n\n. the name --report-fd is a bit silly.  Maybe next round will\n  have a better one.\n. some frontends may want to use \"cat\" without the commit id noise\n. it is easy to trigger SIGPIPE by ignoring the last couple of\n  commit ids\n. communication needs to be serialized.  What will happen if a commit\n  gets finished while a \"cat\" command is being fulfilled?\n\n Documentation/git-fast-import.txt |   13 +++++++++++\n fast-import.c                     |   18 +++++++++++++++\n t/t9300-fast-import.sh            |   42 +++++++++++++++++++++++++++++++++++++\n 3 files changed, 73 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt\nindex 966ba4f..e217635 100644\n--- a/Documentation/git-fast-import.txt\n+++ b/Documentation/git-fast-import.txt\n@@ -92,6 +92,18 @@ OPTIONS\n \t--(no-)-relative-marks= with the --(import|export)-marks=\n \toptions.\n \n+--report-fd=<fd>::\n+\tPrint the 40-character object name for each commit to\n+\tthe specified file descriptor before writing it to the\n+\tpack.  This information may be useful if the importer\n+\tneeds to maintain a map from revisions in the source\n+\trepository to commit ids in the target repository\n+\tduring the import.\n++\n+The described objects are not necessarily accessible\n+using standard git plumbing tools until a little while\n+after the next checkpoint.\n+\n --export-pack-edges=<file>::\n \tAfter creating a packfile, print a line of data to\n \t<file> listing the filename of the packfile and the last\n@@ -896,6 +908,7 @@ The following features are currently supported:\n * date-format\n * import-marks\n * export-marks\n+* report-fd\n * relative-marks\n * no-relative-marks\n * force\ndiff --git a/fast-import.c b/fast-import.c\nindex 2317b0f..ef0cee7 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -361,6 +361,9 @@ static uintmax_t next_mark;\n static struct strbuf new_data = STRBUF_INIT;\n static int seen_data_command;\n \n+/* Where to report commits */\n+static int report_fd = -1;\n+\n static void parse_argv(void);\n \n static void write_branch_report(FILE *rpt, struct branch *b)\n@@ -2571,6 +2574,11 @@ static void parse_new_commit(void)\n \n \tif (!store_object(OBJ_COMMIT, &new_data, NULL, b->sha1, next_mark))\n \t\tb->pack_id = pack_id;\n+\tif (report_fd != -1) {\n+\t\tchar *buf = sha1_to_hex(b->sha1);\n+\t\tbuf[40] = '\\n';\n+\t\twrite_or_die(report_fd, buf, 41);\n+\t}\n \tb->last_commit = object_count_by_type[OBJ_COMMIT];\n }\n \n@@ -2755,6 +2763,14 @@ static void option_export_marks(const char *marks)\n \tsafe_create_leading_directories_const(export_marks_file);\n }\n \n+static void option_report_fd(const char *fd)\n+{\n+\tunsigned long n = strtoul(fd, NULL, 0);\n+\tif (n > (unsigned long) INT_MAX)\n+\t\tdie(\"--report-fd cannot exceed %d\", INT_MAX);\n+\treport_fd = (int) n;\n+}\n+\n static void option_export_pack_edges(const char *edges)\n {\n \tif (pack_edges)\n@@ -2808,6 +2824,8 @@ static int parse_one_feature(const char *feature, int from_stream)\n \t\toption_import_marks(feature + 13, from_stream);\n \t} else if (!prefixcmp(feature, \"export-marks=\")) {\n \t\toption_export_marks(feature + 13);\n+\t} else if (!prefixcmp(feature, \"report-fd=\")) {\n+\t\toption_report_fd(feature + strlen(\"report-fd=\"));\n \t} else if (!prefixcmp(feature, \"relative-marks\")) {\n \t\trelative_marks_paths = 1;\n \t} else if (!prefixcmp(feature, \"no-relative-marks\")) {\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 5c274e7..610e7a5 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -1663,6 +1663,48 @@ test_expect_success 'R: feature no-relative-marks is honoured' '\n \ttest_cmp marks.out non-relative.out\n '\n \n+test_expect_success 'have pipes?' '\n+\ttest_when_finished \"rm -f frob\" &&\n+\tif mkfifo frob\n+\tthen\n+\t\ttest_set_prereq PIPE\n+\tfi\n+'\n+\n+test_expect_success PIPE 'R: feature report-fd is honoured' '\n+\tmkfifo commits &&\n+\ttest_when_finished \"rm -f commits\" &&\n+\tcat >frontend <<-\\FRONTEND_END &&\n+\t\t#!/bin/sh\n+\t\tcat <<EOF &&\n+\t\tfeature report-fd=3\n+\t\tcommit refs/heads/printed\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tto be printed\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/master\n+\t\tD file3\n+\n+\t\tEOF\n+\n+\t\tread cid <&3 &&\n+\t\techo \"$cid\" >received\n+\t\tEOF\n+\tFRONTEND_END\n+\tchmod +x frontend &&\n+\t(\n+\t\t{\n+\t\t\tsh frontend 3<commits ||\n+\t\t\texit\n+\t\t} |\n+\t\tgit fast-import 3>commits\n+\t) &&\n+\tgit rev-parse --verify printed >real &&\n+\ttest_cmp real received\n+'\n+\n test_expect_success 'R: quiet option results in no stats being output' '\n \t>empty &&\n \tcat >input <<-\\EOF &&\n-- \n1.7.2.3\n"},{"id":"149933","messageId":"20100905034116.GD2344@burratino","threadId":"24246","inReplyTo":"20100905031528.GA2344@burratino","subject":"[PATCH 3/3] fast-import: Let importers retrieve the objects being written","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-05T03:41:17Z","receivedAt":"2010-09-05T03:41:17Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"As the description of the \"progress\" option in git-fast-import.1\nhints, there is no convenient way to immediately access the objects\nwritten to a new repository through fast-import.  Until a checkpoint\nhas been started and finishes writing the pack index, any new blobs,\ntrees, and commits will not be accessible using standard git tools.\n\nSo introduce another way: a \"cat\" command introduced in the command\nstream requests for fast-import to print an object to the same\nreport-fd stream used to report commits being written.\n\nThe output uses the same format as \"git cat-file --batch\".\n\nLike cat-file --batch, this does not provide an option to dereference\nobjects to a type of the requestor's choosing.  Tags are presented\nas tags, commits as commits, and trees as trees.\n\nObjects can be specified by path within a tree as well, using a\n\n cat TREE \"PATH\"\n\nsyntax.  With this syntax, also, the tree can only be specified by\n:n marker or 40-digit tree id.\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nCc: David Barr <david.barr@cordelta.com>\nCc: Ramkumar Ramachandra <artagnon@gmail.com>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nThat's the end of the series.  As with patch 2, I'm not thrilled\nwith the interface, but I hope it can get the job done for now.\n\n Documentation/git-fast-import.txt |   34 +++++++++++-\n fast-import.c                     |  108 +++++++++++++++++++++++++++++++++++\n t/t9300-fast-import.sh            |  114 +++++++++++++++++++++++++++++++++++++\n 3 files changed, 255 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt\nindex e217635..2cf48f5 100644\n--- a/Documentation/git-fast-import.txt\n+++ b/Documentation/git-fast-import.txt\n@@ -102,7 +102,8 @@ OPTIONS\n +\n The described objects are not necessarily accessible\n using standard git plumbing tools until a little while\n-after the next checkpoint.\n+after the next checkpoint.  To request access to the\n+objects before then, use `cat` lines in the command stream.\n \n --export-pack-edges=<file>::\n \tAfter creating a packfile, print a line of data to\n@@ -332,6 +333,10 @@ and control the current import process.  More detailed discussion\n \tstandard output.  This command is optional and is not needed\n \tto perform an import.\n \n+`cat`::\n+\tCauses fast-import to print an object in 'cat-file --batch'\n+\tformat to the file descriptor set with \"feature report-fd\".\n+\n `feature`::\n \tRequire that fast-import supports the specified feature, or\n \tabort if it does not.\n@@ -888,6 +893,33 @@ Placing a `progress` command immediately after a `checkpoint` will\n inform the reader when the `checkpoint` has been completed and it\n can safely access the refs that fast-import updated.\n \n+`cat`\n+~~~~~\n+Causes fast-import to print an object to a file descriptor\n+previously arranged with the `--report-fd` option.  The command\n+otherwise has no impact on the current import; its main purpose is to\n+retrieve objects that may be in fast-import's memory but not\n+accessible from the target repository a little quicker than by the\n+method suggested by the description of the `progress` option.\n+\n+....\n+\t'cat' SP <dataref> LF\n+....\n+\n+The `<dataref>` can be either a mark reference (`:<idnum>`)\n+set previously, or a full 40-byte SHA-1 of any Git object,\n+preexisting or ready to be written.\n+\n+If `<dataref>` refers to a tree object, it may be followed by\n+a path within that tree to retrieve a subtree or blob.\n+\n+....\n+\t'cat' SP <treeref> SP <path> LF\n+....\n+\n+A `<path>` string should be surrounded with quotation marks and\n+use C-style escaping.\n+\n `feature`\n ~~~~~~~~~\n Require that fast-import supports the specified feature, or abort if\ndiff --git a/fast-import.c b/fast-import.c\nindex ef0cee7..b7fa9ae 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -55,6 +55,9 @@ Format of STDIN stream:\n     ('from' sp committish lf)?\n     lf?;\n \n+  cat_request ::= 'cat' sp (hexsha1 | idnum) lf\n+    | 'cat' sp hexsha1 sp path_str lf;\n+\n   checkpoint ::= 'checkpoint' lf\n     lf?;\n \n@@ -2688,6 +2691,109 @@ static void parse_reset_branch(void)\n \t\tunread_command_buf = 1;\n }\n \n+static void quoted_path_sha1(unsigned char sha1[20], struct tree_entry *root,\n+\t\t\t\tconst char *path, const char *line)\n+{\n+\tstruct strbuf uq = STRBUF_INIT;\n+\tstruct tree_entry leaf = {0};\n+\tconst char *x;\n+\n+\tif (unquote_c_style(&uq, path, &x))\n+\t\tdie(\"Invalid path: %s\", line);\n+\tif (*x)\n+\t\tdie(\"Garbage after path: %s\", line);\n+\ttree_content_get(root, uq.buf, &leaf);\n+\tif (!leaf.versions[1].mode)\n+\t\tdie(\"Path %s not in branch\", uq.buf);\n+\thashcpy(sha1, leaf.versions[1].sha1);\n+}\n+\n+static void sendreport(const char *buf, unsigned long size)\n+{\n+\tif (write_in_full(report_fd, buf, size) != size)\n+\t\tdie_errno(\"Write to frontend failed\");\n+}\n+\n+static void cat_object(struct object_entry *oe, unsigned char sha1[20])\n+{\n+\tstruct strbuf line = STRBUF_INIT;\n+\tunsigned long size;\n+\tenum object_type type = 0;\n+\tchar *buf;\n+\n+\tif (report_fd < 0)\n+\t\tdie(\"Internal error: bad report_fd %d\", report_fd);\n+\tif (oe && oe->pack_id != MAX_PACK_ID) {\n+\t\ttype = oe->type;\n+\t\tbuf = gfi_unpack_entry(oe, &size);\n+\t} else {\n+\t\tbuf = read_sha1_file(sha1, &type, &size);\n+\t}\n+\tif (!buf)\n+\t\tdie(\"Can't read object %s\", sha1_to_hex(sha1));\n+\n+\t/*\n+\t * Output based on batch_one_object() from cat-file.c.\n+\t */\n+\tif (type <= 0) {\n+\t\tstrbuf_reset(&line);\n+\t\tstrbuf_addf(&line, \"%s missing\\n\", sha1_to_hex(sha1));\n+\t\tif (write_in_full(report_fd, line.buf, line.len) != line.len)\n+\t\t\tdie_errno(\"Write to frontend failed 1\");\n+\t}\n+\tstrbuf_reset(&line);\n+\tstrbuf_addf(&line, \"%s %s %lu\\n\", sha1_to_hex(sha1),\n+\t\t\t\t\t\ttypename(type), size);\n+\tsendreport(line.buf, line.len);\n+\tsendreport(buf, size);\n+\tsendreport(\"\\n\", 1);\n+\tfree(buf);\n+}\n+\n+\n+static void parse_cat_request(void)\n+{\n+\tconst char *p;\n+\tstruct object_entry *oe = oe;\n+\tunsigned char sha1[20];\n+\tstruct tree_entry root = {0};\n+\n+\t/* cat SP <object> */\n+\tp = command_buf.buf + strlen(\"cat \");\n+\tif (report_fd < 0)\n+\t\tdie(\"The cat command features the report-fd feature.\");\n+\tif (*p == ':') {\n+\t\tchar *x;\n+\t\toe = find_mark(strtoumax(p + 1, &x, 10));\n+\t\tif (x == p + 1)\n+\t\t\tdie(\"Invalid mark: %s\", command_buf.buf);\n+\t\tif (!oe)\n+\t\t\tdie(\"Unknown mark: %s\", command_buf.buf);\n+\t\tp = x;\n+\t\thashcpy(sha1, oe->idx.sha1);\n+\t} else {\n+\t\tif (get_sha1_hex(p, sha1))\n+\t\t\tdie(\"Invalid SHA1: %s\", command_buf.buf);\n+\t\tp += 40;\n+\t\tif (!*p)\n+\t\t\toe = find_object(sha1);\n+\t}\n+\n+\t/* [ SP \"<path>\" ] */\n+\tif (*p) {\n+\t\tif (*p++ != ' ')\n+\t\t\tdie(\"Missing space after SHA1: %s\", command_buf.buf);\n+\n+\t\t/* cat <tree> \"<path>\" form. */\n+\t\thashcpy(root.versions[1].sha1, sha1);\n+\t\tload_tree(&root);\n+\t\tquoted_path_sha1(sha1, &root, p, command_buf.buf);\n+\t\toe = find_object(sha1);\n+\t}\n+\n+\tcat_object(oe, sha1);\n+}\n+\n static void parse_checkpoint(void)\n {\n \tif (object_count) {\n@@ -2971,6 +3077,8 @@ int main(int argc, const char **argv)\n \t\t\tparse_new_tag();\n \t\telse if (!prefixcmp(command_buf.buf, \"reset \"))\n \t\t\tparse_reset_branch();\n+\t\telse if (!prefixcmp(command_buf.buf, \"cat \"))\n+\t\t\tparse_cat_request();\n \t\telse if (!strcmp(\"checkpoint\", command_buf.buf))\n \t\t\tparse_checkpoint();\n \t\telse if (!prefixcmp(command_buf.buf, \"progress \"))\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 610e7a5..82e03e8 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -1705,6 +1705,120 @@ test_expect_success PIPE 'R: feature report-fd is honoured' '\n \ttest_cmp real received\n '\n \n+test_expect_success PIPE 'R: report-fd: can feed back printed tree' '\n+\tcat >frontend <<-\\FRONTEND_END &&\n+\t\t#!/bin/sh\n+\t\tcat <<EOF &&\n+\t\tfeature report-fd=3\n+\t\tcommit refs/heads/printed\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tto be printed\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/master\n+\t\tD file3\n+\n+\t\tEOF\n+\n+\t\tread commit_id <&3 &&\n+\t\techo \"$commit_id\" >printed &&\n+\t\techo \"$commit_id commit\" >expect.response &&\n+\t\techo \"cat $commit_id\" &&\n+\t\tread cid2 type size <&3 &&\n+\t\techo \"$cid2 $type\" >response &&\n+\t\tdd if=/dev/stdin of=commit bs=1 count=$size <&3 &&\n+\t\tread newline <&3 &&\n+\t\tread tree tree_id <commit &&\n+\n+\t\tcat <<EOF &&\n+\t\tcommit refs/heads/printed\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tto be printed\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/printed^0\n+\t\tM 040000 $tree_id old\n+\n+\t\tEOF\n+\t\tread cid <&3\n+\tFRONTEND_END\n+\tchmod +x frontend &&\n+\n+\tmkfifo commits &&\n+\ttest_when_finished \"rm -f commits\" &&\n+\t(\n+\t\t{\n+\t\t\tsh frontend 3<commits ||\n+\t\t\texit\n+\t\t} |\n+\t\tgit fast-import 3>commits\n+\t) &&\n+\tgit rev-parse printed^ >expect.printed &&\n+\tgit cat-file commit printed^ >expect.commit &&\n+\n+\ttest_cmp expect.printed printed &&\n+\ttest_cmp expect.response response &&\n+\ttest_cmp expect.commit commit\n+'\n+\n+test_expect_success PIPE 'R: report-fd: can feed back printed blob' '\n+\tcat >expect <<-EOF &&\n+\t:100755 100644 $file6_id $file6_id C100\tnewdir/exec.sh\tfile6\n+\tEOF\n+\n+\tcat >frontend <<-\\FRONTEND_END &&\n+\t\t#!/bin/sh\n+\n+\t\tbranch=$(git rev-parse --verify refs/heads/branch) &&\n+\t\tcat <<EOF &&\n+\t\tfeature report-fd=3\n+\t\tcat $branch\n+\t\tEOF\n+\n+\t\tread commit_id type size <&3 &&\n+\t\tdd if=/dev/stdin of=commit bs=1 count=$size <&3 &&\n+\t\tread newline <&3 &&\n+\t\tread tree tree_id <commit &&\n+\n+\t\techo \"cat $tree_id \\\"newdir/exec.sh\\\"\" &&\n+\t\tread blob_id type size <&3 &&\n+\t\tdd if=/dev/stdin of=blob bs=1 count=$size <&3 &&\n+\t\tread newline <&3 &&\n+\n+\t\tcat <<EOF &&\n+\t\tcommit refs/heads/copyblob\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcopy file6 to top level\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/branch^0\n+\t\tM 644 inline \"file6\"\n+\t\tdata $size\n+\t\tEOF\n+\t\tcat blob &&\n+\t\techo &&\n+\t\techo &&\n+\n+\t\tread cid <&3\n+\tFRONTEND_END\n+\tchmod +x frontend &&\n+\n+\tmkfifo commits &&\n+\ttest_when_finished \"rm -f commits\" &&\n+\t(\n+\t\t{\n+\t\t\tsh frontend 3<commits ||\n+\t\t\texit\n+\t\t} |\n+\t\tgit fast-import 3>commits\n+\t) &&\n+\tgit diff-tree -C --find-copies-harder -r copyblob^ copyblob >actual &&\n+\tcompare_diff_raw expect actual\n+'\n+\n test_expect_success 'R: quiet option results in no stats being output' '\n \t>empty &&\n \tcat >input <<-\\EOF &&\n-- \n1.7.2.3\n"},{"id":"149937","messageId":"20100905060854.GA15511@kytes","threadId":"24246","inReplyTo":"20100905031528.GA2344@burratino","subject":"Re: [RFC/PATCH 0/3] fast-import: give importers access to the object store","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-09-05T06:08:58Z","receivedAt":"2010-09-05T06:08:58Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Jonathan,\n\nJonathan Nieder writes:\n> To recap, because fast-import does not write a pack index until the\n> checkpoint, frontends cannot necessarily read back what they have\n> written immediately.  The obvious application to allowing that is as a\n> sanity check, but more important to us is that it allows the lazy\n> frontend to forget previous revisions even if they are required for\n> later \"file/directory copy\" operations in the import.  The frontend\n> can be secure in the knowledge that the backend remembers everything\n> now.\n\nExcellent timing! I finished writing tests for the svndiff0 applier\nand started modifying svn-fe to use it. I've applied your patches and\nrebased my work on top of it.\n\n> I suspect that these patches are not in their final form.\n> In particular, the interface is kind of klunky: to name a\n> blob by path, you have to supply a *tree* which contains that\n> blob as well as the pathname.  So retrieving, say,\n> v1.7.1:Documentation/git-fast-import.txt, would require\n> three round-trips: one to dereference the tag, one to dereference\n> the commit, and then one to finally retrieve the blob.\n\nIdeally, we'd like to be able to supply a commit and a pathname. I'll\nlook into the difficulties in implementing this interface.\n\n> Another possible concern is that this is very much git specific.\n> Other fast-import backends are just not going to be able to do\n> it with the same format.  Is there a convention for naming\n> options like that?\n\nWhy is this a concern? We aren't even breaking backward\ncompatibility. This bidi interface should only be used by SVN-like\nfrontends.\n\n> Still, I hope it is useful to start with.  Thoughts?  Ideas?\n> Improvements?\n\nWe'll get ideas to improve this as svn-fe gets built up. On a related\nnote, we should probably extend the git-remote-testgit helper to use\nthis feature in future to facilitate writing unittests.\n\nThanks.\n\n-- Ram\n"},{"id":"149938","messageId":"AANLkTimqMJ1vHaJL65RZ4PuxONtg1evn4vBdPks_odqq@mail.gmail.com","threadId":"24246","inReplyTo":"20100905060854.GA15511@kytes","subject":"Re: [RFC/PATCH 0/3] fast-import: give importers access to the object store","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-09-05T06:28:11Z","receivedAt":"2010-09-05T06:28:11Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sun, Sep 5, 2010 at 01:08, Ramkumar Ramachandra <artagnon@gmail.com> wrote:\n>> Another possible concern is that this is very much git specific.\n>> Other fast-import backends are just not going to be able to do\n>> it with the same format.  Is there a convention for naming\n>> options like that?\n>\n> Why is this a concern? We aren't even breaking backward\n> compatibility. This bidi interface should only be used by SVN-like\n> frontends.\n\nI don't agree, imagine implementing hg-remote-svn (or the conceptual\nequivalent at least), it would require the same functionality, yes?\nYou need to retrieve something from fast-import that you previously\ngave it.\n\n> We'll get ideas to improve this as svn-fe gets built up. On a related\n> note, we should probably extend the git-remote-testgit helper to use\n> this feature in future to facilitate writing unittests.\n\nHmmm, that would be somewhat difficult I suspect, the reason\ngit-remote-testgit was so easy to write is because git-fast-export and\ngit-fast-import do exactly what I wanted to test. You'd have to teach\nmunge the fast-export stream even more to insert this feature somehow,\nI suspect that'll be a non-trivial feat. Of course, you will need to\ntest it somehow, I suspect that Jonathan's current approach (using\nhardcoded streams) might be the easiest.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"149962","messageId":"20100905084731.GB15511@kytes","threadId":"24246","inReplyTo":"AANLkTimqMJ1vHaJL65RZ4PuxONtg1evn4vBdPks_odqq@mail.gmail.com","subject":"Re: [RFC/PATCH 0/3] fast-import: give importers access to the object store","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-09-05T08:47:35Z","receivedAt":"2010-09-05T08:47:35Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Sverre,\n\nSverre Rabbelier writes:\n> On Sun, Sep 5, 2010 at 01:08, Ramkumar Ramachandra <artagnon@gmail.com> wrote:\n> >> Another possible concern is that this is very much git specific.\n> >> Other fast-import backends are just not going to be able to do\n> >> it with the same format.  Is there a convention for naming\n> >> options like that?\n> >\n> > Why is this a concern? We aren't even breaking backward\n> > compatibility. This bidi interface should only be used by SVN-like\n> > frontends.\n> \n> I don't agree, imagine implementing hg-remote-svn (or the conceptual\n> equivalent at least), it would require the same functionality, yes?\n> You need to retrieve something from fast-import that you previously\n> gave it.\n\nAh, yes. I didn't think of that. If fast-import is already mature,\nit's probably a good idea to design a new protocol altogether based on\nthis and not call it fast-import?\n\n> > We'll get ideas to improve this as svn-fe gets built up. On a related\n> > note, we should probably extend the git-remote-testgit helper to use\n> > this feature in future to facilitate writing unittests.\n> \n> Hmmm, that would be somewhat difficult I suspect, the reason\n> git-remote-testgit was so easy to write is because git-fast-export and\n> git-fast-import do exactly what I wanted to test. You'd have to teach\n> munge the fast-export stream even more to insert this feature somehow,\n> I suspect that'll be a non-trivial feat. Of course, you will need to\n> test it somehow, I suspect that Jonathan's current approach (using\n> hardcoded streams) might be the easiest.\n\nHm, ok. Whatever makes testing easier.\n\n-- Ram\n"},{"id":"149971","messageId":"AANLkTinUnpANbwZZtQyp9daijMebKcBFytHPzP24nA=o@mail.gmail.com","threadId":"24246","inReplyTo":"20100905084731.GB15511@kytes","subject":"Re: [RFC/PATCH 0/3] fast-import: give importers access to the object store","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-09-05T16:20:35Z","receivedAt":"2010-09-05T16:20:35Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sun, Sep 5, 2010 at 03:47, Ramkumar Ramachandra <artagnon@gmail.com> wrote:\n> Sverre Rabbelier writes:\n>> I don't agree, imagine implementing hg-remote-svn (or the conceptual\n>> equivalent at least), it would require the same functionality, yes?\n>> You need to retrieve something from fast-import that you previously\n>> gave it.\n>\n> Ah, yes. I didn't think of that. If fast-import is already mature,\n> it's probably a good idea to design a new protocol altogether based on\n> this and not call it fast-import?\n\nThat's not what I meant at all. We should still use fast-import, we\nshould just design this extension to the fast-import protocol in such\na way that it would also be useful when implementing something like\nhg-remote-svn ;).\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"149977","messageId":"20100905173104.GA14020@burratino","threadId":"24246","inReplyTo":"20100905060854.GA15511@kytes","subject":"Re: [RFC/PATCH 0/3] fast-import: give importers access to the object store","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-05T17:31:04Z","receivedAt":"2010-09-05T17:31:04Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ramkumar Ramachandra wrote:\n\n> I finished writing tests for the svndiff0 applier\n> and started modifying svn-fe to use it. I've applied your patches and\n> rebased my work on top of it.\n\nNice.\n\n> Ideally, we'd like to be able to supply a commit and a pathname.\n\nTo expand on this a little, avoiding dwim-ery of this kind was part\nof the spirit I was going for: minimal as possible.  Either the\nfrontend or the backend is going to have to read the first line of\nthe commit:\n\n \"tree ...tree name...\n  parent [etc]\"\n\nand I thought, why not let the frontend do that for now?\n\nHopefully after using something just barely sufficient like this, we\nwill know what primitives are needed to make code clear and\nefficient (ls?  cat --batch-check?  cat byte range?).  And such\nprimitives could be at a higher level of abstraction, which might make\nthe protocol guardians happier.\n\n> On a related\n> note, we should probably extend the git-remote-testgit helper to use\n> this feature in future to facilitate writing unittests.\n\nHopefully t/t9011-svn-helper.sh will exercise it in the future.\n\nThanks for the comments,\nJonathan\n"},{"id":"150269","messageId":"20100908031300.GA23409@capella.cs.uchicago.edu","threadId":"24246","inReplyTo":"20100905031528.GA2344@burratino","subject":"[PATCH 4/3] fast-import: typofix","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-08T03:13:00Z","receivedAt":"2010-09-08T03:13:00Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Noticed-by: Sverre Rabbelier <srabbelier@gmail.com>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nTo be squashed with patch 3 in the next round.  Thanks,\nSverre.\n\n fast-import.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/fast-import.c b/fast-import.c\nindex b7fa9ae..099f63e 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -2761,7 +2761,7 @@ static void parse_cat_request(void)\n \t/* cat SP <object> */\n \tp = command_buf.buf + strlen(\"cat \");\n \tif (report_fd < 0)\n-\t\tdie(\"The cat command features the report-fd feature.\");\n+\t\tdie(\"The cat command requires the report-fd feature.\");\n \tif (*p == ':') {\n \t\tchar *x;\n \t\toe = find_mark(strtoumax(p + 1, &x, 10));\n-- \n1.7.3.rc0.6.g7505a.dirty\n"},{"id":"150270","messageId":"20100908031744.GB23409@capella.cs.uchicago.edu","threadId":"24246","inReplyTo":"20100905031528.GA2344@burratino","subject":"[PATCH 5/3] fast-import: allow cat command with empty path","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-08T03:17:44Z","receivedAt":"2010-09-08T03:17:44Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Rather than erroring out, treat an empty path as the path to\nthe root of a tree so frontends can be simplified a little.\n\nWhile at it, fix a typo in an error message: the cat command is used\nto examine paths within trees, not branches.\n\nCc: David Barr <david.barr@cordelta.com>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nWould this be helpful?  I imagine it would make tree access by\npathname a bit simpler, and I found myself tempted to try it.\n\nThe test from the next patch exercises this.\n\n fast-import.c |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/fast-import.c b/fast-import.c\nindex 099f63e..f3c4123 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -2702,9 +2702,13 @@ static void quoted_path_sha1(unsigned char sha1[20], struct tree_entry *root,\n \t\tdie(\"Invalid path: %s\", line);\n \tif (*x)\n \t\tdie(\"Garbage after path: %s\", line);\n+\tif (uq.len == 0) {\n+\t\thashcpy(sha1, root->versions[1].sha1);\n+\t\treturn;\n+\t}\n \ttree_content_get(root, uq.buf, &leaf);\n \tif (!leaf.versions[1].mode)\n-\t\tdie(\"Path %s not in branch\", uq.buf);\n+\t\tdie(\"Path %s not in tree\", uq.buf);\n \thashcpy(sha1, leaf.versions[1].sha1);\n }\n \n-- \n1.7.3.rc0.6.g7505a.dirty\n"},{"id":"150271","messageId":"20100908032736.GC23409@capella.cs.uchicago.edu","threadId":"24246","inReplyTo":"20100905031528.GA2344@burratino","subject":"[PATCH 6/3] fast-import: Allow cat requests at arbitrary points in stream","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-08T03:27:37Z","receivedAt":"2010-09-08T03:27:37Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Rather than planning in advance and saving up a bunch of objects\nbefore a \"commit\" command, frontends might want to wait until the\nmiddle of a commit and request objects then.\n\nAllow them to.\n\nThe new rule: a \"cat\" request can be inserted wherever a comment\nis allowed, which means at the start of any line except in the\nmiddle of a \"data\" command.\n\nCc: Ramkumar Ramachandra <artagnon@gmail.com>\nCc: David Barr <david.barr@cordelta.com>\nCc: Sverre Rabbelier <srabbelier@gmail.com>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nThat's it for today.  I'll be on vacation for the next couple of weeks\nso I can't promise to be responsive.  Comments are still welcome,\nthough (nothing is really different except that the latency may be\nlonger).\n\n Documentation/git-fast-import.txt |    4 ++\n fast-import.c                     |   27 ++++++++-----\n t/t9300-fast-import.sh            |   74 +++++++++++++++++++++++++++++++++++++\n 3 files changed, 94 insertions(+), 11 deletions(-)\n\ndiff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt\nindex 2cf48f5..b670c7d 100644\n--- a/Documentation/git-fast-import.txt\n+++ b/Documentation/git-fast-import.txt\n@@ -920,6 +920,10 @@ a path within that tree to retrieve a subtree or blob.\n A `<path>` string should be surrounded with quotation marks and\n use C-style escaping.\n \n+The `cat` command can be used anywhere that comments are\n+acceptable.  In particular, the `cat` command can be used in the\n+middle of a commit, but not in the middle of a `data` stream.\n+\n `feature`\n ~~~~~~~~~\n Require that fast-import supports the specified feature, or abort if\ndiff --git a/fast-import.c b/fast-import.c\nindex f3c4123..87246d5 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -55,9 +55,6 @@ Format of STDIN stream:\n     ('from' sp committish lf)?\n     lf?;\n \n-  cat_request ::= 'cat' sp (hexsha1 | idnum) lf\n-    | 'cat' sp hexsha1 sp path_str lf;\n-\n   checkpoint ::= 'checkpoint' lf\n     lf?;\n \n@@ -135,14 +132,18 @@ Format of STDIN stream:\n   ts    ::= # time since the epoch in seconds, ascii base10 notation;\n   tz    ::= # GIT style timezone;\n \n-     # note: comments may appear anywhere in the input, except\n-     # within a data command.  Any form of the data command\n-     # always escapes the related input from comment processing.\n+     # note: comments and cat requests may appear anywhere\n+     # in the input, except within a data command.  Any form\n+     # of the data command always escapes the related input\n+     # from comment processing.\n      #\n      # In case it is not clear, the '#' that starts the comment\n      # must be the first character on that line (an lf\n      # preceded it).\n      #\n+  cat_request ::= 'cat' sp (hexsha1 | idnum) lf\n+    | 'cat' sp hexsha1 sp path_str lf;\n+\n   comment ::= '#' not_lf* lf;\n   not_lf  ::= # Any byte that is not ASCII newline (LF);\n */\n@@ -368,6 +369,7 @@ static int seen_data_command;\n static int report_fd = -1;\n \n static void parse_argv(void);\n+static void parse_cat_request(void);\n \n static void write_branch_report(FILE *rpt, struct branch *b)\n {\n@@ -1777,7 +1779,6 @@ static void read_marks(void)\n \tfclose(f);\n }\n \n-\n static int read_next_command(void)\n {\n \tstatic int stdin_eof = 0;\n@@ -1787,7 +1788,7 @@ static int read_next_command(void)\n \t\treturn EOF;\n \t}\n \n-\tdo {\n+\tfor (;;) {\n \t\tif (unread_command_buf) {\n \t\t\tunread_command_buf = 0;\n \t\t} else {\n@@ -1820,7 +1821,13 @@ static int read_next_command(void)\n \t\t\trc->prev->next = rc;\n \t\t\tcmd_tail = rc;\n \t\t}\n-\t} while (command_buf.buf[0] == '#');\n+\t\tif (!prefixcmp(command_buf.buf, \"cat \")) {\n+\t\t\tparse_cat_request();\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (command_buf.buf[0] != '#')\n+\t\t\treturn 0;\n+\t}\n \n \treturn 0;\n }\n@@ -3081,8 +3088,6 @@ int main(int argc, const char **argv)\n \t\t\tparse_new_tag();\n \t\telse if (!prefixcmp(command_buf.buf, \"reset \"))\n \t\t\tparse_reset_branch();\n-\t\telse if (!prefixcmp(command_buf.buf, \"cat \"))\n-\t\t\tparse_cat_request();\n \t\telse if (!strcmp(\"checkpoint\", command_buf.buf))\n \t\t\tparse_checkpoint();\n \t\telse if (!prefixcmp(command_buf.buf, \"progress \"))\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 82e03e8..dcdfbd4 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -1819,6 +1819,80 @@ test_expect_success PIPE 'R: report-fd: can feed back printed blob' '\n \tcompare_diff_raw expect actual\n '\n \n+test_expect_success PIPE 'R: report-fd: cat commands mid-commit' '\n+\tcat >expect <<-EOF &&\n+\t:100755 100644 $file4_id $file4_id C100 file4\tfile4-copy\n+\tEOF\n+\tgit cat-file commit refs/heads/branch >expect.commit &&\n+\techo tree >expect.type &&\n+\tgit cat-file tree refs/heads/branch >expect.tree &&\n+\n+\tcat >frontend <<-\\FRONTEND_END &&\n+\t\t#!/bin/sh\n+\n+\t\tbranch=$(git rev-parse --verify refs/heads/branch) &&\n+\t\tcat <<EOF &&\n+\t\tfeature report-fd=3\n+\t\tcommit refs/heads/catdemo\n+\t\tcat $branch\n+\t\tEOF\n+\n+\t\tread commit_id type size <&3 &&\n+\t\tdd if=/dev/stdin of=commit bs=1 count=$size <&3 &&\n+\t\tread newline <&3 &&\n+\t\tread tree tree_id <commit &&\n+\n+\t\techo \"cat $tree_id\" &&\n+\n+\t\tread tree_id2 type size <&3 &&\n+\t\tdd if=/dev/stdin of=tree bs=1 count=$size <&3 &&\n+\t\tread newline <&3 &&\n+\t\techo $type >type &&\n+\n+\t\tgrep ^committer commit &&\n+\t\tcat <<EOF &&\n+\t\tdata <<COMMIT\n+\t\tcopy file4 as file4-copy\n+\t\tCOMMIT\n+\n+\t\tfrom refs/heads/branch^0\n+\t\tcat $tree_id \"file4\"\n+\t\tEOF\n+\n+\t\tread blob_id type size <&3 &&\n+\t\tdd if=/dev/stdin of=/dev/null bs=1 count=$size <&3 &&\n+\t\tread newline <&3 &&\n+\n+\t\tcat <<EOF &&\n+\t\tM 644 $blob_id \"file4-copy\"\n+\t\tcat $tree_id \"\"\n+\n+\t\tEOF\n+\n+\t\tread tree_id3 type size <&3 &&\n+\t\tdd if=/dev/stdin of=tree2 bs=1 count=$size <&3 &&\n+\t\tread newline <&3 &&\n+\t\tread cid <&3\n+\tFRONTEND_END\n+\tchmod +x frontend &&\n+\n+\tmkfifo commits &&\n+\ttest_when_finished \"rm -f commits\" &&\n+\t(\n+\t\t{\n+\t\t\tsh frontend 3<commits ||\n+\t\t\texit\n+\t\t} |\n+\t\tgit fast-import 3>commits\n+\t) &&\n+\tgit diff-tree -C catdemo^ catdemo >actual &&\n+\tcompare_diff_raw expect actual\n+\ttest_cmp expect.commit commit &&\n+\ttest_cmp expect.type type &&\n+\ttest_cmp expect.tree tree &&\n+\ttest_cmp expect.tree tree2\n+'\n+\n test_expect_success 'R: quiet option results in no stats being output' '\n \t>empty &&\n \tcat >input <<-\\EOF &&\n-- \n1.7.3.rc0.6.g7505a.dirty\n"},{"id":"150272","messageId":"AANLkTinU6TtFgLuQf54aZNE7-E3fDYLcmp25uiGRFgrV@mail.gmail.com","threadId":"24246","inReplyTo":"20100908032736.GC23409@capella.cs.uchicago.edu","subject":"Re: [PATCH 6/3] fast-import: Allow cat requests at arbitrary points in stream","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-09-08T03:38:33Z","receivedAt":"2010-09-08T03:38:33Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Tue, Sep 7, 2010 at 22:27, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Rather than planning in advance and saving up a bunch of objects\n> before a \"commit\" command, frontends might want to wait until the\n> middle of a commit and request objects then.\n\nI'm not sure I understand the justification of this patch. Is the\npurpose of this patch to save you from having to loop over everything\nyou want to commit in the next commit and cat-ing that in advance?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"150273","messageId":"20100908035732.GA24444@capella.cs.uchicago.edu","threadId":"24246","inReplyTo":"AANLkTinU6TtFgLuQf54aZNE7-E3fDYLcmp25uiGRFgrV@mail.gmail.com","subject":"Re: [PATCH 6/3] fast-import: Allow cat requests at arbitrary points in stream","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-08T03:57:32Z","receivedAt":"2010-09-08T03:57:32Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sverre Rabbelier wrote:\n> On Tue, Sep 7, 2010 at 22:27, Jonathan Nieder <jrnieder@gmail.com> wrote:\n\n>> Rather than planning in advance and saving up a bunch of objects\n>> before a \"commit\" command, frontends might want to wait until the\n>> middle of a commit and request objects then.\n>\n> I'm not sure I understand the justification of this patch. Is the\n> purpose of this patch to save you from having to loop over everything\n> you want to commit in the next commit and cat-ing that in advance?\n\nYes.  In particular, an importer that wants to apply deltas\nto generate the content for\n\n M 100644 inline foo\n\ncommands might use this.\n\nProbably not relevant for svn-fe in its current design, since it uses\nblob commands and remembers the tree as it builds it up.\n"},{"id":"150291","messageId":"20100908101649.GH13171@kytes","threadId":"24246","inReplyTo":"20100908032736.GC23409@capella.cs.uchicago.edu","subject":"Re: [PATCH 6/3] fast-import: Allow cat requests at arbitrary points in stream","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-09-08T10:16:54Z","receivedAt":"2010-09-08T10:16:54Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Jonathan,\n\nJonathan Nieder writes:\n> Rather than planning in advance and saving up a bunch of objects\n> before a \"commit\" command, frontends might want to wait until the\n> middle of a commit and request objects then.\n> \n> Allow them to.\n> \n> The new rule: a \"cat\" request can be inserted wherever a comment\n> is allowed, which means at the start of any line except in the\n> middle of a \"data\" command.\n\nExcellent idea. This will certainly be useful when we start working on\nthe zero-tree refactor.\n\n> That's it for today.  I'll be on vacation for the next couple of weeks\n> so I can't promise to be responsive.  Comments are still welcome,\n> though (nothing is really different except that the latency may be\n> longer).\n\nQuick status update: David has started working on the IO backend\nthat's necessary to get svn-fe to use svn-da. We'll start testing/\nreviewing this series once that's done.\n\nI'm busy studying for exams next week.\n\n-- Ram\n"},{"id":"150779","messageId":"1284596048.3298.3.camel@wilber","threadId":"24246","inReplyTo":"20100905031528.GA2344@burratino","subject":"Re: [RFC/PATCH 0/3] fast-import: give importers access to the object store","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2010-09-16T00:14:08Z","receivedAt":"2010-09-16T00:14:08Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"On Sat, 2010-09-04 at 22:15 -0500, Jonathan Nieder wrote:\n> It works like this:\n> \n> frontend:\n> \tfeature report-fd=3\n> \tcommit refs/heads/master\n> \t... revision 1 ...\n> \n> importer:\n> \tabc7856cba76bca87a65bca76bca8bca98bca78bca76\n\nThis is probably quite a late comment, but I don't think that\n'report-fd=3' is a good idea in a protocol like this.  It should not\ntake an argument and just respond down the appropriate selected file\ndescriptor.  ie, default to standard output.  If standard input is a\nsocket, then use that bidirectionally.  If --report-fd is used on the\ncommand line, use that.\n\nSam\n"},{"id":"150912","messageId":"AANLkTikoQb9R06ppYnPAHujnuXtGD7s14Z7AqhgcPUeN@mail.gmail.com","threadId":"24246","inReplyTo":"1284596048.3298.3.camel@wilber","subject":"Re: [RFC/PATCH 0/3] fast-import: give importers access to the object store","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-09-17T23:24:58Z","receivedAt":"2010-09-17T23:24:58Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Thu, Sep 16, 2010 at 02:14, Sam Vilain <sam@vilain.net> wrote:\n> This is probably quite a late comment, but I don't think that\n> 'report-fd=3' is a good idea in a protocol like this.  It should not\n> take an argument and just respond down the appropriate selected file\n> descriptor.  ie, default to standard output.  If standard input is a\n> socket, then use that bidirectionally.  If --report-fd is used on the\n> command line, use that.\n\nI understand your point, the generated stream is not very reusable if\nthe fd is 'hardcoded'. On the other hand, the primary use for this\nfeature is the case where an exporter feeds directly into an importer.\nWhat use case do you see for re-use of a stream where the report-fd is\nused? Or are your objections based on some other ground?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"151424","messageId":"20100924065900.GA4666@burratino","threadId":"24246","inReplyTo":"20100905032253.GB2344@burratino","subject":"[PATCH/RFC 00/24] Re: [PATCH 1/3] t9300 (fast-import): style tweaks","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T06:59:00Z","receivedAt":"2010-09-24T06:59:00Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nJonathan Nieder wrote:\n\n> Clarify dependencies between tests to make the fast-import test\n> script more approachable.  In particular:\n... many things ...\n> While at it:\n... more things ...\n\nThe patch was a lazy way for me to add new assertions to the\nfast-import test script without going crazy.  But it really was lazy:\nit has almost nothing to do with the \"fast-import protocol\nexperiments\" series that it headed, and worse, that one patch did so\nmany things at once that it was basically guaranteed that (1) no one\nwould like all of it and (2) it bitrotted in a couple of days.\n\nOh well.  Tomorrow I would like to re-roll the fast-import experiment\nso the svn-fe that understands deltas can get more attention, and of\ncourse that series does not require these style fixes at all.\n\nSo why resend them?  I end up mentally making these changes every time\nI add a new test to that script, so I imagine it would be nicer to\nmake the changes once.  Maybe it would help newcomers to dive into the\nwonderful world of fast-import testing.\n\nSo here is a small chunk of that monster patch, ejected from the\noriginal series and split up.\n\nPatch 1 introduces a verify_packs () helper that makes the script much\neasier to read (by including only two copies of an unpleasant loop).\nThe nominal justification is that giving the\n\n\tfor each pack\n\tdo\n\t\tgit verify-pack $pack ||\n\t\texit\n\tdone\n\nloop its own function allows use to write \"return\" instead of \"exit\",\nresulting in better behavior when a test fails.\n\nPatch 2 is the most important one to me.  It gets rid of some\nhardcoded tree and blob names, most of which were not doing any\nharm except to scare me.  At first glance it is not obvious when\na stray test_tick, for example, will ruin later tests (it turns out\nnever but there is at one test that does depend on the choice of\nhash function), and at first glance, it is not obvious what is\nactually the expected diff when a raw diff is presented as expected\noutput.\n\nThe approach adopted is to introduce some symbolic constants, like\n\n\tempty_blob=$(git hash-object --stdin </dev/null)\n\nand use them in the expected output.\n\nPatches 3-6 just pick nits.  The dividends are better output\nwith -v and more robust checking for failure of git commands.\n\nPatch 7 changes some 4-space indents to tabs (since the latter\nis predominant in the file).\n\nPatches 8-24 change from traditional\n\n\ttest_expect_failure \\\n\t\t'description' \\\n\t\t'commands &&\n\t\t more commands'\n\nto modern\n\n\ttest_expect_success 'description' '\n\t\tcommands &&\n\t\tmore commands\n\t'\n\nstyle.  They are meant to be squashed together and are only split\nin tiny pieces for easier review.\n\nLet's take whatever is useful and forget about the rest.\n\nThanks,\nJonathan Nieder (24):\n  t9300 (fast-import): avoid exiting early on failure\n  t9300 (fast-import): avoid hard-coded object names\n  t9300 (fast-import): guard \"export large marks\" test\n  t9300 (fast-import): check exit status from upstream of pipes\n  t9300 (fast-import): check exit status from command substitution\n  t9300 (fast-import): use test_cmp in place of test $(foo) = $(bar)\n  t9300 (fast-import): use tabs to indent\n  t9300 (fast-import), series A: re-indent\n  t9300 (fast-import), series B: re-indent\n  t9300 (fast-import), series C: re-indent\n  t9300 (fast-import), series D: re-indent\n  t9300 (fast-import), series E: re-indent\n  t9300 (fast-import), series F: re-indent\n  t9300 (fast-import), series H: re-indent\n  t9300 (fast-import), series I: re-indent\n  t9300 (fast-import), series J: re-indent\n  t9300 (fast-import), series K: re-indent\n  t9300 (fast-import), series L: re-indent\n  t9300 (fast-import), series M: re-indent\n  t9300 (fast-import), series N: re-indent\n  t9300 (fast-import), series O: re-indent\n  t9300 (fast-import), series P: re-indent\n  t9300 (fast-import), series Q: re-indent\n  t9300 (fast-import), series R: re-indent\n\n t/t9300-fast-import.sh | 1010 ++++++++++++++++++++++++++----------------------\n 1 files changed, 539 insertions(+), 471 deletions(-)\n\n-- \n1.7.2.3\n"},{"id":"151425","messageId":"20100924070418.GB4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 01/24] t9300 (fast-import): avoid exiting early on failure","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:04:19Z","receivedAt":"2010-09-24T07:04:19Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Exiting is not an appropriate way to signal a test failure, since it\nbypasses the usual expect_success/expect_failure logic and prevents\nlater tests that might be able to help diagnose the problem from\nrunning.\n\nStill, exiting is a temptingly easy way to catch errors in shell\nloops.  Alternatives:\n\n 1) Ignore errors in the loop body.  This can leave problems hidden\n    and undiagnosed so it is not really an option.\n\n 2) Enclose the loop in a subshell which can catch the exit on\n    failure.\n\n 3) Enclose the loop in a function and return the exit code on\n    failure.\n\n 4) More ad-hoc methods.\n\nMost instances in t9300 lend themselves well to (3), with the nice\nside effect of avoiding some repetitive code.  Introduce a new\nverify_packs () helper in this spirit.\n\nOne instance uses \"verify-pack -v\", making it slightly different from\nthe others; rather than spending effort on making the helper general\nenough to be usable for it, too, enclose the strange loop in\na subshell (strategy (2)).  While at it, simplify the code a little\nby redirecting stdout of the loop instead of its body.\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   38 ++++++++++++++++++++++++--------------\n 1 files changed, 24 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 7c05920..1eef926 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -23,6 +23,14 @@ file5_data='an inline file.\n file6_data='#!/bin/sh\n echo \"$@\"'\n \n+verify_packs () {\n+\tfor p in .git/objects/pack/*.pack\n+\tdo\n+\t\tgit verify-pack $p ||\n+\t\treturn\n+\tdone\n+}\n+\n ###\n ### series A\n ###\n@@ -69,7 +77,7 @@ test_expect_success \\\n \t git whatchanged master'\n test_expect_success \\\n \t'A: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n+\t'verify_packs'\n \n cat >expect <<EOF\n author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n@@ -155,7 +163,7 @@ test_expect_success \\\n \t git whatchanged verify--import-marks'\n test_expect_success \\\n \t'A: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n+\t'verify_packs'\n cat >expect <<EOF\n :000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A\tcopy-of-file2\n EOF\n@@ -318,7 +326,7 @@ test_expect_success \\\n \t git whatchanged branch'\n test_expect_success \\\n \t'C: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n+\t'verify_packs'\n test_expect_success \\\n \t'C: validate reuse existing blob' \\\n \t'test $newf = `git rev-parse --verify branch:file2/newf`\n@@ -376,7 +384,7 @@ test_expect_success \\\n \t git whatchanged branch'\n test_expect_success \\\n \t'D: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n+\t'verify_packs'\n \n cat >expect <<EOF\n :000000 100755 0000000000000000000000000000000000000000 35a59026a33beac1569b1c7f66f3090ce9c09afc A\tnewdir/exec.sh\n@@ -422,7 +430,7 @@ test_expect_success \\\n     'git fast-import --date-format=rfc2822 <input'\n test_expect_success \\\n \t'E: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n+\t'verify_packs'\n \n cat >expect <<EOF\n author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500\n@@ -473,7 +481,7 @@ test_expect_success \\\n \t'\n test_expect_success \\\n \t'F: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n+\t'verify_packs'\n \n cat >expect <<EOF\n tree `git rev-parse branch~1^{tree}`\n@@ -509,7 +517,7 @@ test_expect_success \\\n     'git fast-import --force <input'\n test_expect_success \\\n \t'G: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n+\t'verify_packs'\n test_expect_success \\\n \t'G: branch changed, but logged' \\\n \t'test $old_branch != `git rev-parse --verify branch^0` &&\n@@ -546,7 +554,7 @@ test_expect_success \\\n \t git whatchanged H'\n test_expect_success \\\n \t'H: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n+\t'verify_packs'\n \n cat >expect <<EOF\n :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D\tfile2/newf\n@@ -1327,7 +1335,7 @@ test_expect_success \\\n \t git whatchanged notes-test'\n test_expect_success \\\n \t'Q: verify pack' \\\n-\t'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done'\n+\t'verify_packs'\n \n commit1=$(git rev-parse notes-test~2)\n commit2=$(git rev-parse notes-test^)\n@@ -1675,11 +1683,13 @@ test_expect_success \\\n \t git --git-dir=R/.git fast-import --big-file-threshold=1 <input'\n test_expect_success \\\n \t'R: verify created pack' \\\n-\t': >verify &&\n-\t for p in R/.git/objects/pack/*.pack;\n-\t do\n-\t   git verify-pack -v $p >>verify || exit;\n-\t done'\n+\t'(\n+\t\tfor p in R/.git/objects/pack/*.pack\n+\t\tdo\n+\t\t\tgit verify-pack -v $p ||\n+\t\t\texit\n+\t\tdone\n+\t ) >verify'\n test_expect_success \\\n \t'R: verify written objects' \\\n \t'git --git-dir=R/.git cat-file blob big-file:big1 >actual &&\n-- \n1.7.2.3\n"},{"id":"151426","messageId":"20100924070510.GC4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 02/24] t9300 (fast-import): avoid hard-coded object names","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:05:10Z","receivedAt":"2010-09-24T07:05:10Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"compare_diff_raw already ensures most (though not all) of the tests\ndo not rely on any particular hash function, but still the attentive\nreader might be comforted by some less opaque object descriptions.\n\nTested with\n\n\tsed -i s/compare_diff_raw/test_cmp/g t9300-fast-import.sh &&\n\tsh t9300-fast-import.sh -v -i\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   91 ++++++++++++++++++++++++++++++++---------------\n 1 files changed, 62 insertions(+), 29 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 1eef926..ed37a4e 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -7,6 +7,8 @@ test_description='test git fast-import utility'\n . ./test-lib.sh\n . \"$TEST_DIRECTORY\"/diff-lib.sh ;# test-lib chdir's into trash\n \n+zeroes=0000000000000000000000000000000000000000\n+\n file2_data='file2\n second line of EOF'\n \n@@ -31,6 +33,14 @@ verify_packs () {\n \tdone\n }\n \n+test_expect_success 'setup' '\n+\tfile2_id=$(echo \"$file2_data\" | git hash-object --stdin) &&\n+\tfile3_id=$(echo \"$file3_data\" | git hash-object --stdin) &&\n+\tfile4_id=$(printf \"%s\" \"$file4_data\" | git hash-object --stdin) &&\n+\tfile5_id=$(echo \"$file5_data\" | git hash-object --stdin) &&\n+\tfile6_id=$(echo \"$file6_data\" | git hash-object --stdin)\n+'\n+\n ###\n ### series A\n ###\n@@ -165,7 +175,7 @@ test_expect_success \\\n \t'A: verify pack' \\\n \t'verify_packs'\n cat >expect <<EOF\n-:000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A\tcopy-of-file2\n+:000000 100755 $zeroes $file2_id A\tcopy-of-file2\n EOF\n git diff-tree -M -r master verify--import-marks >actual\n test_expect_success \\\n@@ -345,9 +355,9 @@ test_expect_success \\\n \t test_cmp expect actual'\n \n cat >expect <<EOF\n-:000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A\tfile2/newf\n-:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100\tfile2\tfile2/oldf\n-:100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D\tfile3\n+:000000 100755 $zeroes $newf A\tfile2/newf\n+:100644 100644 $file2_id $file2_id R100\tfile2\tfile2/oldf\n+:100644 000000 $file3_id $zeroes D\tfile3\n EOF\n git diff-tree -M -r master branch >actual\n test_expect_success \\\n@@ -387,8 +397,8 @@ test_expect_success \\\n \t'verify_packs'\n \n cat >expect <<EOF\n-:000000 100755 0000000000000000000000000000000000000000 35a59026a33beac1569b1c7f66f3090ce9c09afc A\tnewdir/exec.sh\n-:000000 100644 0000000000000000000000000000000000000000 046d0371e9220107917db0d0e030628de8a1de9b A\tnewdir/interesting\n+:000000 100755 $zeroes $file6_id A\tnewdir/exec.sh\n+:000000 100644 $zeroes $file5_id A\tnewdir/interesting\n EOF\n git diff-tree -M -r branch^ branch >actual\n test_expect_success \\\n@@ -557,11 +567,11 @@ test_expect_success \\\n \t'verify_packs'\n \n cat >expect <<EOF\n-:100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D\tfile2/newf\n-:100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D\tfile2/oldf\n-:100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D\tfile4\n-:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100\tnewdir/interesting\th/e/l/lo\n-:100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D\tnewdir/exec.sh\n+:100755 000000 $newf $zeroes D\tfile2/newf\n+:100644 000000 $oldf $zeroes D\tfile2/oldf\n+:100755 000000 $file4_id $zeroes D\tfile4\n+:100644 100644 $file5_id $file5_id R100\tnewdir/interesting\th/e/l/lo\n+:100755 000000 $file6_id $zeroes D\tnewdir/exec.sh\n EOF\n git diff-tree -M -r H^ H >actual\n test_expect_success \\\n@@ -698,16 +708,39 @@ M 644 :2 b/other\n M 644 :2 ba\n INPUT_END\n \n+test_expect_success 'setup: object names for expected diff' '\n+\tsome_data=$(\n+\t\techo some data |\n+\t\tgit hash-object -w --stdin\n+\t) &&\n+\tother_data=$(\n+\t\techo other data |\n+\t\tgit hash-object -w --stdin\n+\t) &&\n+\tsome_tree=$(\n+\t\trm -f tmp_index &&\n+\t\techo \"100644 blob $some_data\tother\" |\n+\t\tGIT_INDEX_FILE=tmp_index git update-index --index-info &&\n+\t\tGIT_INDEX_FILE=tmp_index git write-tree\n+\t) &&\n+\tother_tree=$(\n+\t\trm -f tmp_index &&\n+\t\techo \"100644 blob $other_data\tother\" |\n+\t\tGIT_INDEX_FILE=tmp_index git update-index --index-info &&\n+\t\tGIT_INDEX_FILE=tmp_index git write-tree\n+\t)\n+'\n+\n cat >expect <<EXPECT_END\n-:100644 100644 4268632... 55d3a52... M\tb.\n-:040000 040000 0ae5cac... 443c768... M\tb\n-:100644 100644 4268632... 55d3a52... M\tba\n+:100644 100644 $some_data $other_data M\tb.\n+:040000 040000 $some_tree $other_tree M\tb\n+:100644 100644 $some_data $other_data M\tba\n EXPECT_END\n \n test_expect_success \\\n     'L: verify internal tree sorting' \\\n \t'git fast-import <input &&\n-\t git diff-tree --abbrev --raw L^ L >output &&\n+\t git diff-tree L^ L >output &&\n \t test_cmp expect output'\n \n ###\n@@ -728,7 +761,7 @@ R file2/newf file2/n.e.w.f\n INPUT_END\n \n cat >expect <<EOF\n-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100\tfile2/newf\tfile2/n.e.w.f\n+:100755 100755 $newf $newf R100\tfile2/newf\tfile2/n.e.w.f\n EOF\n test_expect_success \\\n \t'M: rename file in same subdirectory' \\\n@@ -749,7 +782,7 @@ R file2/newf i/am/new/to/you\n INPUT_END\n \n cat >expect <<EOF\n-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100\tfile2/newf\ti/am/new/to/you\n+:100755 100755 $newf $newf R100\tfile2/newf\ti/am/new/to/you\n EOF\n test_expect_success \\\n \t'M: rename file to new subdirectory' \\\n@@ -770,7 +803,7 @@ R i other/sub\n INPUT_END\n \n cat >expect <<EOF\n-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100\ti/am/new/to/you\tother/sub/am/new/to/you\n+:100755 100755 $newf $newf R100\ti/am/new/to/you\tother/sub/am/new/to/you\n EOF\n test_expect_success \\\n \t'M: rename subdirectory to new subdirectory' \\\n@@ -796,7 +829,7 @@ C file2/newf file2/n.e.w.f\n INPUT_END\n \n cat >expect <<EOF\n-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile2/n.e.w.f\n+:100755 100755 $newf $newf C100\tfile2/newf\tfile2/n.e.w.f\n EOF\n test_expect_success \\\n \t'N: copy file in same subdirectory' \\\n@@ -828,9 +861,9 @@ EOF\n INPUT_END\n \n cat >expect <<EOF\n-:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100\tnewdir/interesting\tfile3/file5\n-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n-:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n+:100644 100644 $file5_id $file5_id C100\tnewdir/interesting\tfile3/file5\n+:100755 100755 $newf $newf C100\tfile2/newf\tfile3/newf\n+:100644 100644 $oldf $oldf C100\tfile2/oldf\tfile3/oldf\n EOF\n test_expect_success \\\n \t'N: copy then modify subdirectory' \\\n@@ -863,9 +896,9 @@ test_expect_success \\\n \n test_expect_success \\\n \t'N: copy directory by id' \\\n-\t'cat >expect <<-\\EOF &&\n-\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n-\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n+\t'cat >expect <<-EOF &&\n+\t:100755 100755 $newf $newf C100\tfile2/newf\tfile3/newf\n+\t:100644 100644 $oldf $oldf C100\tfile2/oldf\tfile3/oldf\n \tEOF\n \t subdir=$(git rev-parse refs/heads/branch^0:file2) &&\n \t cat >input <<-INPUT_END &&\n@@ -884,10 +917,10 @@ test_expect_success \\\n \n test_expect_success \\\n \t'N: modify copied tree' \\\n-\t'cat >expect <<-\\EOF &&\n-\t:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100\tnewdir/interesting\tfile3/file5\n-\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n-\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n+\t'cat >expect <<-EOF &&\n+\t:100644 100644 $file5_id $file5_id C100\tnewdir/interesting\tfile3/file5\n+\t:100755 100755 $newf $newf C100\tfile2/newf\tfile3/newf\n+\t:100644 100644 $oldf $oldf C100\tfile2/oldf\tfile3/oldf\n \tEOF\n \t subdir=$(git rev-parse refs/heads/branch^0:file2) &&\n \t cat >input <<-INPUT_END &&\n-- \n1.7.2.3\n"},{"id":"151427","messageId":"20100924070950.GD4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 03/24] t9300 (fast-import): guard \"export large marks\" test setup","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:09:50Z","receivedAt":"2010-09-24T07:09:50Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Since the setup for the large marks test involves more complex code\nthan just a \"cat\", \"echo\", or assignment, make it part of the\ntest_expect_success assertion.  This way, the test script will report\na failure if the setup breaks from a coding mistake, unusual shell, or\nother unforseen circumstance.\n\nWhile at it, make some other small simplifications (grouping commands\nthat write to the same file with { }; using \">file\" instead of \": >file\"\nto empty a file).\n\nCc: Shawn O. Pearce <spearce@spearce.net>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |  106 +++++++++++++++++++++++++-----------------------\n 1 files changed, 55 insertions(+), 51 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex ed37a4e..735ac83 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -184,58 +184,62 @@ test_expect_success \\\n \t test `git rev-parse --verify master:file2` \\\n \t    = `git rev-parse --verify verify--import-marks:copy-of-file2`'\n \n-test_tick\n-mt=$(git hash-object --stdin < /dev/null)\n-: >input.blob\n-: >marks.exp\n-: >tree.exp\n-\n-cat >input.commit <<EOF\n-commit refs/heads/verify--dump-marks\n-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-data <<COMMIT\n-test the sparse array dumping routines with exponentially growing marks\n-COMMIT\n-EOF\n-\n-i=0\n-l=4\n-m=6\n-n=7\n-while test \"$i\" -lt 27; do\n-    cat >>input.blob <<EOF\n-blob\n-mark :$l\n-data 0\n-blob\n-mark :$m\n-data 0\n-blob\n-mark :$n\n-data 0\n-EOF\n-    echo \"M 100644 :$l l$i\" >>input.commit\n-    echo \"M 100644 :$m m$i\" >>input.commit\n-    echo \"M 100644 :$n n$i\" >>input.commit\n-\n-    echo \":$l $mt\" >>marks.exp\n-    echo \":$m $mt\" >>marks.exp\n-    echo \":$n $mt\" >>marks.exp\n-\n-    printf \"100644 blob $mt\\tl$i\\n\" >>tree.exp\n-    printf \"100644 blob $mt\\tm$i\\n\" >>tree.exp\n-    printf \"100644 blob $mt\\tn$i\\n\" >>tree.exp\n-\n-    l=$(($l + $l))\n-    m=$(($m + $m))\n-    n=$(($l + $n))\n-\n-    i=$((1 + $i))\n-done\n-\n-sort tree.exp > tree.exp_s\n-\n test_expect_success 'A: export marks with large values' '\n+\ttest_tick &&\n+\tmt=$(git hash-object --stdin </dev/null) &&\n+\t>input.blob &&\n+\t>marks.exp &&\n+\t>tree.exp &&\n+\n+\tcat >input.commit <<-EOF &&\n+\tcommit refs/heads/verify--dump-marks\n+\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\tdata <<COMMIT\n+\ttest the sparse array dumping routines with exponentially growing marks\n+\tCOMMIT\n+\tEOF\n+\n+\t(\n+\t\ti=0 &&\n+\t\tl=4 &&\n+\t\tm=6 &&\n+\t\tn=7 &&\n+\t\twhile test \"$i\" -lt 27\n+\t\tdo\n+\t\t\tcat >>input.blob <<-EOF &&\n+\t\t\tblob\n+\t\t\tmark :$l\n+\t\t\tdata 0\n+\t\t\tblob\n+\t\t\tmark :$m\n+\t\t\tdata 0\n+\t\t\tblob\n+\t\t\tmark :$n\n+\t\t\tdata 0\n+\t\t\tEOF\n+\t\t\t{\n+\t\t\t\techo \"M 100644 :$l l$i\" &&\n+\t\t\t\techo \"M 100644 :$m m$i\" &&\n+\t\t\t\techo \"M 100644 :$n n$i\"\n+\t\t\t} >>input.commit &&\n+\t\t\t{\n+\t\t\t\techo \":$l $mt\" &&\n+\t\t\t\techo \":$m $mt\" &&\n+\t\t\t\techo \":$n $mt\"\n+\t\t\t} >>marks.exp &&\n+\t\t\t{\n+\t\t\t\tprintf \"100644 blob $mt\\tl$i\\n\" &&\n+\t\t\t\tprintf \"100644 blob $mt\\tm$i\\n\" &&\n+\t\t\t\tprintf \"100644 blob $mt\\tn$i\\n\"\n+\t\t\t} >>tree.exp &&\n+\t\t\tl=$(($l + $l)) &&\n+\t\t\tm=$(($m + $m)) &&\n+\t\t\tn=$(($l + $n)) &&\n+\t\t\ti=$((1 + $i)) ||\n+\t\t\texit\n+\t\tdone\n+\t) &&\n+\tsort tree.exp >tree.exp_s &&\n \tcat input.blob input.commit | git fast-import --export-marks=marks.large &&\n \tgit ls-tree refs/heads/verify--dump-marks >tree.out &&\n \ttest_cmp tree.exp_s tree.out &&\n-- \n1.7.2.3\n"},{"id":"151428","messageId":"20100924071102.GE4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 04/24] t9300 (fast-import): check exit status from upstream of pipes","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:11:02Z","receivedAt":"2010-09-24T07:11:02Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |    6 ++++--\n 1 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 735ac83..47339a3 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -97,7 +97,8 @@ initial\n EOF\n test_expect_success \\\n \t'A: verify commit' \\\n-\t'git cat-file commit master | sed 1d >actual &&\n+\t'git cat-file commit master >commit &&\n+\tsed 1d <commit >actual &&\n \ttest_cmp expect actual'\n \n cat >expect <<EOF\n@@ -107,7 +108,8 @@ cat >expect <<EOF\n EOF\n test_expect_success \\\n \t'A: verify tree' \\\n-\t'git cat-file -p master^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\t'git cat-file -p master^{tree} >tree &&\n+\t sed \"s/ [0-9a-f]*\t/ /\" <tree >actual &&\n \t test_cmp expect actual'\n \n echo \"$file2_data\" >expect\n-- \n1.7.2.3\n"},{"id":"151429","messageId":"20100924071156.GF4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 05/24] t9300 (fast-import): check exit status from command substitutions","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:11:56Z","receivedAt":"2010-09-24T07:11:56Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"If \"git rev-parse\" starts to crash or misbehave, we want to\nnotice.\n\nCc: Shawn O. Pearce <spearce@spearce.net>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   34 +++++++++++++++++++++-------------\n 1 files changed, 21 insertions(+), 13 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 47339a3..c113ddf 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -127,24 +127,32 @@ test_expect_success \\\n \t'A: verify file4' \\\n \t'git cat-file blob master:file4 >actual && test_cmp expect actual'\n \n-cat >expect <<EOF\n-object $(git rev-parse refs/heads/master)\n-type commit\n-tag series-A\n-\n-An annotated tag without a tagger\n-EOF\n test_expect_success 'A: verify tag/series-A' '\n+\tmaster=$(git rev-parse --verify refs/heads/master) &&\n+\tcat >expect <<-EOF &&\n+\tobject $master\n+\ttype commit\n+\ttag series-A\n+\n+\tAn annotated tag without a tagger\n+\tEOF\n \tgit cat-file tag tags/series-A >actual &&\n \ttest_cmp expect actual\n '\n \n-cat >expect <<EOF\n-:2 `git rev-parse --verify master:file2`\n-:3 `git rev-parse --verify master:file3`\n-:4 `git rev-parse --verify master:file4`\n-:5 `git rev-parse --verify master^0`\n-EOF\n+test_expect_success 'setup: compute expected marks' '\n+\t{\n+\t\tprintf \":2 \" &&\n+\t\tgit rev-parse --verify master:file2 &&\n+\t\tprintf \":3 \" &&\n+\t\tgit rev-parse --verify master:file3 &&\n+\t\tprintf \":4 \" &&\n+\t\tgit rev-parse --verify master:file4 &&\n+\t\tprintf \":5 \" &&\n+\t\tgit rev-parse --verify master^0\n+\t} >expect\n+'\n+\n test_expect_success \\\n \t'A: verify marks output' \\\n \t'test_cmp expect marks.out'\n-- \n1.7.2.3\n"},{"id":"151430","messageId":"20100924071237.GG4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 06/24] t9300 (fast-import): use test_cmp in place of test $(foo) = $(bar)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:12:37Z","receivedAt":"2010-09-24T07:12:37Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"This has two benefits: it ensures that the exit status from the\noutput-producing commands is checked and it produces more helpful\noutput when the output does not match and tests are being run with -v.\n\nCc: Shawn O. Pearce <spearce@spearce.net>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   13 ++++++-------\n 1 files changed, 6 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex c113ddf..8d418e4 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -184,15 +184,14 @@ test_expect_success \\\n test_expect_success \\\n \t'A: verify pack' \\\n \t'verify_packs'\n-cat >expect <<EOF\n-:000000 100755 $zeroes $file2_id A\tcopy-of-file2\n-EOF\n-git diff-tree -M -r master verify--import-marks >actual\n test_expect_success \\\n \t'A: verify diff' \\\n-\t'compare_diff_raw expect actual &&\n-\t test `git rev-parse --verify master:file2` \\\n-\t    = `git rev-parse --verify verify--import-marks:copy-of-file2`'\n+\t'echo \":000000 100755 $zeroes $file2_id A\tcopy-of-file2\" >expect &&\n+\t echo $file2_id >expect.copy &&\n+\t git diff-tree -M -r master verify--import-marks >actual &&\n+\t git rev-parse --verify verify--import-marks:copy-of-file2 >actual.copy &&\n+\t compare_diff_raw expect actual &&\n+\t test_cmp expect.copy actual.copy'\n \n test_expect_success 'A: export marks with large values' '\n \ttest_tick &&\n-- \n1.7.2.3\n"},{"id":"151431","messageId":"20100924071350.GH4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 07/24] t9300 (fast-import): use tabs to indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:13:50Z","receivedAt":"2010-09-24T07:13:50Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"The test script mostly uses tabs to indent, but some 4-space indents\nsnuck in.\n\nCc: Shawn O. Pearce <spearce@spearce.net>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |  118 ++++++++++++++++++++++++------------------------\n 1 files changed, 59 insertions(+), 59 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 8d418e4..0059298 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -82,8 +82,8 @@ EOF\n \n INPUT_END\n test_expect_success \\\n-    'A: create pack from stdin' \\\n-    'git fast-import --export-marks=marks.out <input &&\n+\t'A: create pack from stdin' \\\n+\t'git fast-import --export-marks=marks.out <input &&\n \t git whatchanged master'\n test_expect_success \\\n \t'A: verify pack' \\\n@@ -272,7 +272,7 @@ M 755 0000000000000000000000000000000000000001 zero1\n \n INPUT_END\n test_expect_success 'B: fail on invalid blob sha1' '\n-    test_must_fail git fast-import <input\n+\ttest_must_fail git fast-import <input\n '\n rm -f .git/objects/pack_* .git/objects/index_*\n \n@@ -287,7 +287,7 @@ from refs/heads/master\n \n INPUT_END\n test_expect_success 'B: fail on invalid branch name \".badbranchname\"' '\n-    test_must_fail git fast-import <input\n+\ttest_must_fail git fast-import <input\n '\n rm -f .git/objects/pack_* .git/objects/index_*\n \n@@ -302,7 +302,7 @@ from refs/heads/master\n \n INPUT_END\n test_expect_success 'B: fail on invalid branch name \"bad[branch]name\"' '\n-    test_must_fail git fast-import <input\n+\ttest_must_fail git fast-import <input\n '\n rm -f .git/objects/pack_* .git/objects/index_*\n \n@@ -317,8 +317,8 @@ from refs/heads/master\n \n INPUT_END\n test_expect_success \\\n-    'B: accept branch name \"TEMP_TAG\"' \\\n-    'git fast-import <input &&\n+\t'B: accept branch name \"TEMP_TAG\"' \\\n+\t'git fast-import <input &&\n \t test -f .git/TEMP_TAG &&\n \t test `git rev-parse master` = `git rev-parse TEMP_TAG^`'\n rm -f .git/TEMP_TAG\n@@ -344,8 +344,8 @@ D file3\n \n INPUT_END\n test_expect_success \\\n-    'C: incremental import create pack from stdin' \\\n-    'git fast-import <input &&\n+\t'C: incremental import create pack from stdin' \\\n+\t'git fast-import <input &&\n \t git whatchanged branch'\n test_expect_success \\\n \t'C: verify pack' \\\n@@ -402,8 +402,8 @@ EOF\n \n INPUT_END\n test_expect_success \\\n-    'D: inline data in commit' \\\n-    'git fast-import <input &&\n+\t'D: inline data in commit' \\\n+\t'git fast-import <input &&\n \t git whatchanged branch'\n test_expect_success \\\n \t'D: verify pack' \\\n@@ -446,11 +446,11 @@ from refs/heads/branch^0\n \n INPUT_END\n test_expect_success 'E: rfc2822 date, --date-format=raw' '\n-    test_must_fail git fast-import --date-format=raw <input\n+\ttest_must_fail git fast-import --date-format=raw <input\n '\n test_expect_success \\\n-    'E: rfc2822 date, --date-format=rfc2822' \\\n-    'git fast-import --date-format=rfc2822 <input'\n+\t'E: rfc2822 date, --date-format=rfc2822' \\\n+\t'git fast-import --date-format=rfc2822 <input'\n test_expect_success \\\n \t'E: verify pack' \\\n \t'verify_packs'\n@@ -486,8 +486,8 @@ from refs/heads/branch\n \n INPUT_END\n test_expect_success \\\n-    'F: non-fast-forward update skips' \\\n-    'if git fast-import <input\n+\t'F: non-fast-forward update skips' \\\n+\t'if git fast-import <input\n \t then\n \t\techo BAD gfi did not fail\n \t\treturn 1\n@@ -536,8 +536,8 @@ from refs/heads/branch~1\n \n INPUT_END\n test_expect_success \\\n-    'G: non-fast-forward update forced' \\\n-    'git fast-import --force <input'\n+\t'G: non-fast-forward update forced' \\\n+\t'git fast-import --force <input'\n test_expect_success \\\n \t'G: verify pack' \\\n \t'verify_packs'\n@@ -572,8 +572,8 @@ EOF\n \n INPUT_END\n test_expect_success \\\n-    'H: deletall, add 1' \\\n-    'git fast-import <input &&\n+\t'H: deletall, add 1' \\\n+\t'git fast-import <input &&\n \t git whatchanged H'\n test_expect_success \\\n \t'H: verify pack' \\\n@@ -612,8 +612,8 @@ from refs/heads/branch\n \n INPUT_END\n test_expect_success \\\n-    'I: export-pack-edges' \\\n-    'git fast-import --export-pack-edges=edges.list <input'\n+\t'I: export-pack-edges' \\\n+\t'git fast-import --export-pack-edges=edges.list <input'\n \n cat >expect <<EOF\n .git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`\n@@ -646,8 +646,8 @@ COMMIT\n \n INPUT_END\n test_expect_success \\\n-    'J: reset existing branch creates empty commit' \\\n-    'git fast-import <input'\n+\t'J: reset existing branch creates empty commit' \\\n+\t'git fast-import <input'\n test_expect_success \\\n \t'J: branch has 1 commit, empty tree' \\\n \t'test 1 = `git rev-list J | wc -l` &&\n@@ -676,12 +676,12 @@ from refs/heads/branch^1\n \n INPUT_END\n test_expect_success \\\n-    'K: reinit branch with from' \\\n-    'git fast-import <input'\n+\t'K: reinit branch with from' \\\n+\t'git fast-import <input'\n test_expect_success \\\n-    'K: verify K^1 = branch^1' \\\n-    'test `git rev-parse --verify branch^1` \\\n-\t\t= `git rev-parse --verify K^1`'\n+\t'K: verify K^1 = branch^1' \\\n+\t'test `git rev-parse --verify branch^1` \\\n+\t    = `git rev-parse --verify K^1`'\n \n ###\n ### series L\n@@ -751,7 +751,7 @@ cat >expect <<EXPECT_END\n EXPECT_END\n \n test_expect_success \\\n-    'L: verify internal tree sorting' \\\n+\t'L: verify internal tree sorting' \\\n \t'git fast-import <input &&\n \t git diff-tree L^ L >output &&\n \t test_cmp expect output'\n@@ -1227,7 +1227,7 @@ DATA\n INPUT_END\n \n test_expect_success 'P: fail on inline gitlink' '\n-    test_must_fail git fast-import <input'\n+\ttest_must_fail git fast-import <input'\n \n test_tick\n cat >input <<INPUT_END\n@@ -1250,7 +1250,7 @@ M 160000 :1 sub\n INPUT_END\n \n test_expect_success 'P: fail on blob mark in gitlink' '\n-    test_must_fail git fast-import <input'\n+\ttest_must_fail git fast-import <input'\n \n ###\n ### series Q (notes)\n@@ -1598,14 +1598,14 @@ hi\n EOF\n \n test_expect_success \\\n-    'R: export-marks feature results in a marks file being created' \\\n-    'cat input | git fast-import &&\n-    grep :1 git.marks'\n+\t'R: export-marks feature results in a marks file being created' \\\n+\t'cat input | git fast-import &&\n+\tgrep :1 git.marks'\n \n test_expect_success \\\n-    'R: export-marks options can be overriden by commandline options' \\\n-    'cat input | git fast-import --export-marks=other.marks &&\n-    grep :1 other.marks'\n+\t'R: export-marks options can be overriden by commandline options' \\\n+\t'cat input | git fast-import --export-marks=other.marks &&\n+\tgrep :1 other.marks'\n \n cat >input << EOF\n feature import-marks=marks.out\n@@ -1613,9 +1613,9 @@ feature export-marks=marks.new\n EOF\n \n test_expect_success \\\n-    'R: import to output marks works without any content' \\\n-    'cat input | git fast-import &&\n-    test_cmp marks.out marks.new'\n+\t'R: import to output marks works without any content' \\\n+\t'cat input | git fast-import &&\n+\ttest_cmp marks.out marks.new'\n \n cat >input <<EOF\n feature import-marks=nonexistant.marks\n@@ -1623,9 +1623,9 @@ feature export-marks=marks.new\n EOF\n \n test_expect_success \\\n-    'R: import marks prefers commandline marks file over the stream' \\\n-    'cat input | git fast-import --import-marks=marks.out &&\n-    test_cmp marks.out marks.new'\n+\t'R: import marks prefers commandline marks file over the stream' \\\n+\t'cat input | git fast-import --import-marks=marks.out &&\n+\ttest_cmp marks.out marks.new'\n \n \n cat >input <<EOF\n@@ -1634,10 +1634,10 @@ feature export-marks=combined.marks\n EOF\n \n test_expect_success 'R: multiple --import-marks= should be honoured' '\n-    head -n2 marks.out > one.marks &&\n-    tail -n +3 marks.out > two.marks &&\n-    git fast-import --import-marks=one.marks --import-marks=two.marks <input &&\n-    test_cmp marks.out combined.marks\n+\thead -n2 marks.out > one.marks &&\n+\ttail -n +3 marks.out > two.marks &&\n+\tgit fast-import --import-marks=one.marks --import-marks=two.marks <input &&\n+\ttest_cmp marks.out combined.marks\n '\n \n cat >input <<EOF\n@@ -1647,10 +1647,10 @@ feature export-marks=relative.out\n EOF\n \n test_expect_success 'R: feature relative-marks should be honoured' '\n-    mkdir -p .git/info/fast-import/ &&\n-    cp marks.new .git/info/fast-import/relative.in &&\n-    git fast-import <input &&\n-    test_cmp marks.new .git/info/fast-import/relative.out\n+\tmkdir -p .git/info/fast-import/ &&\n+\tcp marks.new .git/info/fast-import/relative.in &&\n+\tgit fast-import <input &&\n+\ttest_cmp marks.new .git/info/fast-import/relative.out\n '\n \n cat >input <<EOF\n@@ -1661,8 +1661,8 @@ feature export-marks=non-relative.out\n EOF\n \n test_expect_success 'R: feature no-relative-marks should be honoured' '\n-    git fast-import <input &&\n-    test_cmp marks.new non-relative.out\n+\tgit fast-import <input &&\n+\ttest_cmp marks.new non-relative.out\n '\n \n cat >input << EOF\n@@ -1676,8 +1676,8 @@ EOF\n touch empty\n \n test_expect_success 'R: quiet option results in no stats being output' '\n-    cat input | git fast-import 2> output &&\n-    test_cmp empty output\n+\tcat input | git fast-import 2> output &&\n+\ttest_cmp empty output\n '\n \n cat >input <<EOF\n@@ -1685,11 +1685,11 @@ option git non-existing-option\n EOF\n \n test_expect_success 'R: die on unknown option' '\n-    test_must_fail git fast-import <input\n+\ttest_must_fail git fast-import <input\n '\n \n test_expect_success 'R: unknown commandline options are rejected' '\\\n-    test_must_fail git fast-import --non-existing-option < /dev/null\n+\ttest_must_fail git fast-import --non-existing-option < /dev/null\n '\n \n cat >input <<EOF\n@@ -1697,7 +1697,7 @@ option non-existing-vcs non-existing-option\n EOF\n \n test_expect_success 'R: ignore non-git options' '\n-    git fast-import <input\n+\tgit fast-import <input\n '\n \n ##\n-- \n1.7.2.3\n"},{"id":"151432","messageId":"20100924071631.GI4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 08/24] t9300 (fast-import), series A: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:16:31Z","receivedAt":"2010-09-24T07:16:31Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"This was originally an old-fashioned test script, with formatting\nthat might now look unfamiliar:\n\n\ttest_expect_success \\\n\t\t'series A: foo bar baz' \\\n\t\t'test commands &&\n\t\t more test commands'\n\nThe apostrophes after tab make indenting more trouble than it ought to\nbe and the alignment cannot be preserved with the <<- operator\nworking.  The initial and final apostrophes on command lines makes\npatches that add new lines to a test harder to read.  The title\naligned with the test code makes the test description harder to\ntake in at a glance.\n\nSo switch to the usual modern style:\n\n\ttest_expect_success 'series A: foo bar baz' '\n\t\ttest commands &&\n\t\tmore test commands\n\t'\n\nNo other change intended.\n\nCc: Shawn O. Pearce <spearce@spearce.net>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   99 ++++++++++++++++++++++++-----------------------\n 1 files changed, 51 insertions(+), 48 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 0059298..10dc720 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -81,13 +81,12 @@ An annotated tag without a tagger\n EOF\n \n INPUT_END\n-test_expect_success \\\n-\t'A: create pack from stdin' \\\n-\t'git fast-import --export-marks=marks.out <input &&\n-\t git whatchanged master'\n-test_expect_success \\\n-\t'A: verify pack' \\\n-\t'verify_packs'\n+test_expect_success 'A: create pack from stdin' '\n+\tgit fast-import --export-marks=marks.out <input &&\n+\tgit whatchanged master'\n+test_expect_success 'A: verify pack' '\n+\tverify_packs\n+'\n \n cat >expect <<EOF\n author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n@@ -95,37 +94,40 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n initial\n EOF\n-test_expect_success \\\n-\t'A: verify commit' \\\n-\t'git cat-file commit master >commit &&\n+test_expect_success 'A: verify commit' '\n+\tgit cat-file commit master >commit &&\n \tsed 1d <commit >actual &&\n-\ttest_cmp expect actual'\n+\ttest_cmp expect actual\n+'\n \n cat >expect <<EOF\n 100644 blob file2\n 100644 blob file3\n 100755 blob file4\n EOF\n-test_expect_success \\\n-\t'A: verify tree' \\\n-\t'git cat-file -p master^{tree} >tree &&\n-\t sed \"s/ [0-9a-f]*\t/ /\" <tree >actual &&\n-\t test_cmp expect actual'\n+test_expect_success 'A: verify tree' '\n+\tgit cat-file -p master^{tree} >tree &&\n+\tsed \"s/ [0-9a-f]*\t/ /\" <tree >actual &&\n+\ttest_cmp expect actual\n+'\n \n echo \"$file2_data\" >expect\n-test_expect_success \\\n-\t'A: verify file2' \\\n-\t'git cat-file blob master:file2 >actual && test_cmp expect actual'\n+test_expect_success 'A: verify file2' '\n+\tgit cat-file blob master:file2 >actual &&\n+\ttest_cmp expect actual\n+'\n \n echo \"$file3_data\" >expect\n-test_expect_success \\\n-\t'A: verify file3' \\\n-\t'git cat-file blob master:file3 >actual && test_cmp expect actual'\n+test_expect_success 'A: verify file3' '\n+\tgit cat-file blob master:file3 >actual &&\n+\ttest_cmp expect actual\n+'\n \n printf \"$file4_data\" >expect\n-test_expect_success \\\n-\t'A: verify file4' \\\n-\t'git cat-file blob master:file4 >actual && test_cmp expect actual'\n+test_expect_success 'A: verify file4' '\n+\tgit cat-file blob master:file4 >actual &&\n+\ttest_cmp expect actual\n+'\n \n test_expect_success 'A: verify tag/series-A' '\n \tmaster=$(git rev-parse --verify refs/heads/master) &&\n@@ -153,17 +155,17 @@ test_expect_success 'setup: compute expected marks' '\n \t} >expect\n '\n \n-test_expect_success \\\n-\t'A: verify marks output' \\\n-\t'test_cmp expect marks.out'\n+test_expect_success 'A: verify marks output' '\n+\ttest_cmp expect marks.out\n+'\n \n-test_expect_success \\\n-\t'A: verify marks import' \\\n-\t'git fast-import \\\n+test_expect_success 'A: verify marks import' '\n+\tgit fast-import \\\n \t\t--import-marks=marks.out \\\n \t\t--export-marks=marks.new \\\n \t\t</dev/null &&\n-\ttest_cmp expect marks.new'\n+\ttest_cmp expect marks.new\n+'\n \n test_tick\n cat >input <<INPUT_END\n@@ -177,21 +179,21 @@ from :5\n M 755 :2 copy-of-file2\n \n INPUT_END\n-test_expect_success \\\n-\t'A: verify marks import does not crash' \\\n-\t'git fast-import --import-marks=marks.out <input &&\n-\t git whatchanged verify--import-marks'\n-test_expect_success \\\n-\t'A: verify pack' \\\n-\t'verify_packs'\n-test_expect_success \\\n-\t'A: verify diff' \\\n-\t'echo \":000000 100755 $zeroes $file2_id A\tcopy-of-file2\" >expect &&\n-\t echo $file2_id >expect.copy &&\n-\t git diff-tree -M -r master verify--import-marks >actual &&\n-\t git rev-parse --verify verify--import-marks:copy-of-file2 >actual.copy &&\n-\t compare_diff_raw expect actual &&\n-\t test_cmp expect.copy actual.copy'\n+test_expect_success 'A: verify marks import does not crash' '\n+\tgit fast-import --import-marks=marks.out <input &&\n+\tgit whatchanged verify--import-marks\n+'\n+test_expect_success 'A: verify pack' '\n+\tverify_packs\n+'\n+test_expect_success 'A: verify diff' '\n+\techo \":000000 100755 $zeroes $file2_id A\tcopy-of-file2\" >expect &&\n+\techo $file2_id >expect.copy &&\n+\tgit diff-tree -M -r master verify--import-marks >actual &&\n+\tgit rev-parse --verify verify--import-marks:copy-of-file2 >actual.copy &&\n+\tcompare_diff_raw expect actual &&\n+\ttest_cmp expect.copy actual.copy\n+'\n \n test_expect_success 'A: export marks with large values' '\n \ttest_tick &&\n@@ -252,7 +254,8 @@ test_expect_success 'A: export marks with large values' '\n \tcat input.blob input.commit | git fast-import --export-marks=marks.large &&\n \tgit ls-tree refs/heads/verify--dump-marks >tree.out &&\n \ttest_cmp tree.exp_s tree.out &&\n-\ttest_cmp marks.exp marks.large'\n+\ttest_cmp marks.exp marks.large\n+'\n \n ###\n ### series B\n-- \n1.7.2.3\n"},{"id":"151433","messageId":"20100924071814.GJ4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 09/24] t9300 (fast-import), series B: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:18:14Z","receivedAt":"2010-09-24T07:18:14Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.net>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   10 +++++-----\n 1 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 10dc720..a2b8950 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -319,11 +319,11 @@ COMMIT\n from refs/heads/master\n \n INPUT_END\n-test_expect_success \\\n-\t'B: accept branch name \"TEMP_TAG\"' \\\n-\t'git fast-import <input &&\n-\t test -f .git/TEMP_TAG &&\n-\t test `git rev-parse master` = `git rev-parse TEMP_TAG^`'\n+test_expect_success 'B: accept branch name \"TEMP_TAG\"' '\n+\tgit fast-import <input &&\n+\ttest -f .git/TEMP_TAG &&\n+\ttest `git rev-parse master` = `git rev-parse TEMP_TAG^`\n+'\n rm -f .git/TEMP_TAG\n \n ###\n-- \n1.7.2.3\n"},{"id":"151434","messageId":"20100924071909.GK4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 10/24] t9300 (fast-import), series C: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:19:09Z","receivedAt":"2010-09-24T07:19:09Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.net>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   36 ++++++++++++++++++------------------\n 1 files changed, 18 insertions(+), 18 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex a2b8950..f8856b4 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -346,17 +346,17 @@ M 755 $newf file2/newf\n D file3\n \n INPUT_END\n-test_expect_success \\\n-\t'C: incremental import create pack from stdin' \\\n-\t'git fast-import <input &&\n-\t git whatchanged branch'\n-test_expect_success \\\n-\t'C: verify pack' \\\n-\t'verify_packs'\n-test_expect_success \\\n-\t'C: validate reuse existing blob' \\\n-\t'test $newf = `git rev-parse --verify branch:file2/newf`\n-\t test $oldf = `git rev-parse --verify branch:file2/oldf`'\n+test_expect_success 'C: incremental import create pack from stdin' '\n+\tgit fast-import <input &&\n+\tgit whatchanged branch\n+'\n+test_expect_success 'C: verify pack' '\n+\tverify_packs\n+'\n+test_expect_success 'C: validate reuse existing blob' '\n+\ttest $newf = `git rev-parse --verify branch:file2/newf`\n+\ttest $oldf = `git rev-parse --verify branch:file2/oldf`\n+'\n \n cat >expect <<EOF\n parent `git rev-parse --verify master^0`\n@@ -365,10 +365,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n second\n EOF\n-test_expect_success \\\n-\t'C: verify commit' \\\n-\t'git cat-file commit branch | sed 1d >actual &&\n-\t test_cmp expect actual'\n+test_expect_success 'C: verify commit' '\n+\tgit cat-file commit branch | sed 1d >actual &&\n+\ttest_cmp expect actual\n+'\n \n cat >expect <<EOF\n :000000 100755 $zeroes $newf A\tfile2/newf\n@@ -376,9 +376,9 @@ cat >expect <<EOF\n :100644 000000 $file3_id $zeroes D\tfile3\n EOF\n git diff-tree -M -r master branch >actual\n-test_expect_success \\\n-\t'C: validate rename result' \\\n-\t'compare_diff_raw expect actual'\n+test_expect_success 'C: validate rename result' '\n+\tcompare_diff_raw expect actual\n+'\n \n ###\n ### series D\n-- \n1.7.2.3\n"},{"id":"151435","messageId":"20100924071959.GL4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 11/24] t9300 (fast-import), series D: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:19:59Z","receivedAt":"2010-09-24T07:19:59Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.net>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   36 ++++++++++++++++++------------------\n 1 files changed, 18 insertions(+), 18 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex f8856b4..78ea775 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -404,34 +404,34 @@ $file6_data\n EOF\n \n INPUT_END\n-test_expect_success \\\n-\t'D: inline data in commit' \\\n-\t'git fast-import <input &&\n-\t git whatchanged branch'\n-test_expect_success \\\n-\t'D: verify pack' \\\n-\t'verify_packs'\n+test_expect_success 'D: inline data in commit' '\n+\tgit fast-import <input &&\n+\tgit whatchanged branch\n+'\n+test_expect_success 'D: verify pack' '\n+\tverify_packs\n+'\n \n cat >expect <<EOF\n :000000 100755 $zeroes $file6_id A\tnewdir/exec.sh\n :000000 100644 $zeroes $file5_id A\tnewdir/interesting\n EOF\n git diff-tree -M -r branch^ branch >actual\n-test_expect_success \\\n-\t'D: validate new files added' \\\n-\t'compare_diff_raw expect actual'\n+test_expect_success 'D: validate new files added' '\n+\tcompare_diff_raw expect actual\n+'\n \n echo \"$file5_data\" >expect\n-test_expect_success \\\n-\t'D: verify file5' \\\n-\t'git cat-file blob branch:newdir/interesting >actual &&\n-\t test_cmp expect actual'\n+test_expect_success 'D: verify file5' '\n+\tgit cat-file blob branch:newdir/interesting >actual &&\n+\ttest_cmp expect actual\n+'\n \n echo \"$file6_data\" >expect\n-test_expect_success \\\n-\t'D: verify file6' \\\n-\t'git cat-file blob branch:newdir/exec.sh >actual &&\n-\t test_cmp expect actual'\n+test_expect_success 'D: verify file6' '\n+\tgit cat-file blob branch:newdir/exec.sh >actual &&\n+\ttest_cmp expect actual\n+'\n \n ###\n ### series E\n-- \n1.7.2.3\n"},{"id":"151437","messageId":"20100924072115.GM4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 12/24] t9300 (fast-import), series E: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:21:15Z","receivedAt":"2010-09-24T07:21:15Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   20 ++++++++++----------\n 1 files changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 78ea775..1324157 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -451,12 +451,12 @@ INPUT_END\n test_expect_success 'E: rfc2822 date, --date-format=raw' '\n \ttest_must_fail git fast-import --date-format=raw <input\n '\n-test_expect_success \\\n-\t'E: rfc2822 date, --date-format=rfc2822' \\\n-\t'git fast-import --date-format=rfc2822 <input'\n-test_expect_success \\\n-\t'E: verify pack' \\\n-\t'verify_packs'\n+test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '\n+\tgit fast-import --date-format=rfc2822 <input\n+'\n+test_expect_success 'E: verify pack' '\n+\tverify_packs\n+'\n \n cat >expect <<EOF\n author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500\n@@ -464,10 +464,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500\n \n RFC 2822 type date\n EOF\n-test_expect_success \\\n-\t'E: verify commit' \\\n-\t'git cat-file commit branch | sed 1,2d >actual &&\n-\ttest_cmp expect actual'\n+test_expect_success 'E: verify commit' '\n+\tgit cat-file commit branch | sed 1,2d >actual &&\n+\ttest_cmp expect actual\n+'\n \n ###\n ### series F\n-- \n1.7.2.3\n"},{"id":"151438","messageId":"20100924072215.GN4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 13/24] t9300 (fast-import), series F: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:22:15Z","receivedAt":"2010-09-24T07:22:15Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   47 +++++++++++++++++++++++------------------------\n 1 files changed, 23 insertions(+), 24 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 1324157..ab317d6 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -488,13 +488,12 @@ reset refs/heads/other\n from refs/heads/branch\n \n INPUT_END\n-test_expect_success \\\n-\t'F: non-fast-forward update skips' \\\n-\t'if git fast-import <input\n-\t then\n+test_expect_success 'F: non-fast-forward update skips' '\n+\tif git fast-import <input\n+\tthen\n \t\techo BAD gfi did not fail\n \t\treturn 1\n-\t else\n+\telse\n \t\tif test $old_branch = `git rev-parse --verify branch^0`\n \t\tthen\n \t\t\t: branch unaffected and failure returned\n@@ -503,11 +502,11 @@ test_expect_success \\\n \t\t\techo BAD gfi changed branch $old_branch\n \t\t\treturn 1\n \t\tfi\n-\t fi\n-\t'\n-test_expect_success \\\n-\t'F: verify pack' \\\n-\t'verify_packs'\n+\tfi\n+'\n+test_expect_success 'F: verify pack' '\n+\tverify_packs\n+'\n \n cat >expect <<EOF\n tree `git rev-parse branch~1^{tree}`\n@@ -517,10 +516,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n losing things already?\n EOF\n-test_expect_success \\\n-\t'F: verify other commit' \\\n-\t'git cat-file commit other >actual &&\n-\ttest_cmp expect actual'\n+test_expect_success 'F: verify other commit' '\n+\tgit cat-file commit other >actual &&\n+\ttest_cmp expect actual\n+'\n \n ###\n ### series G\n@@ -538,16 +537,16 @@ COMMIT\n from refs/heads/branch~1\n \n INPUT_END\n-test_expect_success \\\n-\t'G: non-fast-forward update forced' \\\n-\t'git fast-import --force <input'\n-test_expect_success \\\n-\t'G: verify pack' \\\n-\t'verify_packs'\n-test_expect_success \\\n-\t'G: branch changed, but logged' \\\n-\t'test $old_branch != `git rev-parse --verify branch^0` &&\n-\t test $old_branch = `git rev-parse --verify branch@{1}`'\n+test_expect_success 'G: non-fast-forward update forced' '\n+\tgit fast-import --force <input\n+'\n+test_expect_success 'G: verify pack' '\n+\tverify_packs\n+'\n+test_expect_success 'G: branch changed, but logged' '\n+\ttest $old_branch != `git rev-parse --verify branch^0` &&\n+\ttest $old_branch = `git rev-parse --verify branch@{1}`\n+'\n \n ###\n ### series H\n-- \n1.7.2.3\n"},{"id":"151436","messageId":"AANLkTimjD6LqMgQSez=t9N_KPsXaFXm3sMcrZc=qQug+@mail.gmail.com","threadId":"24246","inReplyTo":"20100924071631.GI4666@burratino","subject":"Re: [PATCH 08/24] t9300 (fast-import), series A: re-indent","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-09-24T07:22:44Z","receivedAt":"2010-09-24T07:22:44Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Fri, Sep 24, 2010 at 09:16, Jonathan Nieder <jrnieder@gmail.com> wrote:\n>        test_expect_success \\\n>                'series A: foo bar baz' \\\n\nSometimes this style is used if the test description is otherwise too long.\n\n>        test_expect_success 'series A: foo bar baz' '\n\nSo what do you do in the case that the line becomes too long?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"151439","messageId":"20100924072251.GO4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 14/24] t9300 (fast-import), series H: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:22:51Z","receivedAt":"2010-09-24T07:22:51Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   28 ++++++++++++++--------------\n 1 files changed, 14 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex ab317d6..875a951 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -573,13 +573,13 @@ $file5_data\n EOF\n \n INPUT_END\n-test_expect_success \\\n-\t'H: deletall, add 1' \\\n-\t'git fast-import <input &&\n-\t git whatchanged H'\n-test_expect_success \\\n-\t'H: verify pack' \\\n-\t'verify_packs'\n+test_expect_success 'H: deletall, add 1' '\n+\tgit fast-import <input &&\n+\tgit whatchanged H\n+'\n+test_expect_success 'H: verify pack' '\n+\tverify_packs\n+'\n \n cat >expect <<EOF\n :100755 000000 $newf $zeroes D\tfile2/newf\n@@ -589,15 +589,15 @@ cat >expect <<EOF\n :100755 000000 $file6_id $zeroes D\tnewdir/exec.sh\n EOF\n git diff-tree -M -r H^ H >actual\n-test_expect_success \\\n-\t'H: validate old files removed, new files added' \\\n-\t'compare_diff_raw expect actual'\n+test_expect_success 'H: validate old files removed, new files added' '\n+\tcompare_diff_raw expect actual\n+'\n \n echo \"$file5_data\" >expect\n-test_expect_success \\\n-\t'H: verify file' \\\n-\t'git cat-file blob H:h/e/l/lo >actual &&\n-\t test_cmp expect actual'\n+test_expect_success 'H: verify file' '\n+\tgit cat-file blob H:h/e/l/lo >actual &&\n+\ttest_cmp expect actual\n+'\n \n ###\n ### series I\n-- \n1.7.2.3\n"},{"id":"151440","messageId":"20100924072351.GP4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 15/24] t9300 (fast-import), series I: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:23:51Z","receivedAt":"2010-09-24T07:23:51Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   14 +++++++-------\n 1 files changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 875a951..fda1911 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -613,17 +613,17 @@ COMMIT\n from refs/heads/branch\n \n INPUT_END\n-test_expect_success \\\n-\t'I: export-pack-edges' \\\n-\t'git fast-import --export-pack-edges=edges.list <input'\n+test_expect_success 'I: export-pack-edges' '\n+\tgit fast-import --export-pack-edges=edges.list <input\n+'\n \n cat >expect <<EOF\n .git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`\n EOF\n-test_expect_success \\\n-\t'I: verify edge list' \\\n-\t'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n-\t test_cmp expect actual'\n+test_expect_success 'I: verify edge list' '\n+\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n+\ttest_cmp expect actual\n+'\n \n ###\n ### series J\n-- \n1.7.2.3\n"},{"id":"151441","messageId":"20100924072430.GQ4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 16/24] t9300 (fast-import), series J: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:24:30Z","receivedAt":"2010-09-24T07:24:30Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   14 +++++++-------\n 1 files changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex fda1911..2a2f969 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -647,13 +647,13 @@ initialize J\n COMMIT\n \n INPUT_END\n-test_expect_success \\\n-\t'J: reset existing branch creates empty commit' \\\n-\t'git fast-import <input'\n-test_expect_success \\\n-\t'J: branch has 1 commit, empty tree' \\\n-\t'test 1 = `git rev-list J | wc -l` &&\n-\t test 0 = `git ls-tree J | wc -l`'\n+test_expect_success 'J: reset existing branch creates empty commit' '\n+\tgit fast-import <input\n+'\n+test_expect_success 'J: branch has 1 commit, empty tree' '\n+\ttest 1 = `git rev-list J | wc -l` &&\n+\ttest 0 = `git ls-tree J | wc -l`\n+'\n \n ###\n ### series K\n-- \n1.7.2.3\n"},{"id":"151442","messageId":"20100924072503.GR4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 17/24] t9300 (fast-import), series K: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:25:03Z","receivedAt":"2010-09-24T07:25:03Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   14 +++++++-------\n 1 files changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 2a2f969..82647f8 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -677,13 +677,13 @@ COMMIT\n from refs/heads/branch^1\n \n INPUT_END\n-test_expect_success \\\n-\t'K: reinit branch with from' \\\n-\t'git fast-import <input'\n-test_expect_success \\\n-\t'K: verify K^1 = branch^1' \\\n-\t'test `git rev-parse --verify branch^1` \\\n-\t    = `git rev-parse --verify K^1`'\n+test_expect_success 'K: reinit branch with from' '\n+\tgit fast-import <input\n+'\n+test_expect_success 'K: verify K^1 = branch^1' '\n+\ttest `git rev-parse --verify branch^1` \\\n+\t   = `git rev-parse --verify K^1`\n+'\n \n ###\n ### series L\n-- \n1.7.2.3\n"},{"id":"151444","messageId":"20100924072532.GS4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 18/24] t9300 (fast-import), series L: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:25:32Z","receivedAt":"2010-09-24T07:25:32Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   10 +++++-----\n 1 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 82647f8..614c5b5 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -752,11 +752,11 @@ cat >expect <<EXPECT_END\n :100644 100644 $some_data $other_data M\tba\n EXPECT_END\n \n-test_expect_success \\\n-\t'L: verify internal tree sorting' \\\n-\t'git fast-import <input &&\n-\t git diff-tree L^ L >output &&\n-\t test_cmp expect output'\n+test_expect_success 'L: verify internal tree sorting' '\n+\tgit fast-import <input &&\n+\tgit diff-tree L^ L >output &&\n+\ttest_cmp expect output\n+'\n \n ###\n ### series M\n-- \n1.7.2.3\n"},{"id":"151445","messageId":"20100924072604.GT4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 19/24] t9300 (fast-import), series M: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:26:04Z","receivedAt":"2010-09-24T07:26:04Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   30 +++++++++++++++---------------\n 1 files changed, 15 insertions(+), 15 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 614c5b5..5237afc 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -778,11 +778,11 @@ INPUT_END\n cat >expect <<EOF\n :100755 100755 $newf $newf R100\tfile2/newf\tfile2/n.e.w.f\n EOF\n-test_expect_success \\\n-\t'M: rename file in same subdirectory' \\\n-\t'git fast-import <input &&\n-\t git diff-tree -M -r M1^ M1 >actual &&\n-\t compare_diff_raw expect actual'\n+test_expect_success 'M: rename file in same subdirectory' '\n+\tgit fast-import <input &&\n+\tgit diff-tree -M -r M1^ M1 >actual &&\n+\tcompare_diff_raw expect actual\n+'\n \n cat >input <<INPUT_END\n commit refs/heads/M2\n@@ -799,11 +799,11 @@ INPUT_END\n cat >expect <<EOF\n :100755 100755 $newf $newf R100\tfile2/newf\ti/am/new/to/you\n EOF\n-test_expect_success \\\n-\t'M: rename file to new subdirectory' \\\n-\t'git fast-import <input &&\n-\t git diff-tree -M -r M2^ M2 >actual &&\n-\t compare_diff_raw expect actual'\n+test_expect_success 'M: rename file to new subdirectory' '\n+\tgit fast-import <input &&\n+\tgit diff-tree -M -r M2^ M2 >actual &&\n+\tcompare_diff_raw expect actual\n+'\n \n cat >input <<INPUT_END\n commit refs/heads/M3\n@@ -820,11 +820,11 @@ INPUT_END\n cat >expect <<EOF\n :100755 100755 $newf $newf R100\ti/am/new/to/you\tother/sub/am/new/to/you\n EOF\n-test_expect_success \\\n-\t'M: rename subdirectory to new subdirectory' \\\n-\t'git fast-import <input &&\n-\t git diff-tree -M -r M3^ M3 >actual &&\n-\t compare_diff_raw expect actual'\n+test_expect_success 'M: rename subdirectory to new subdirectory' '\n+\tgit fast-import <input &&\n+\tgit diff-tree -M -r M3^ M3 >actual &&\n+\tcompare_diff_raw expect actual\n+'\n \n ###\n ### series N\n-- \n1.7.2.3\n"},{"id":"151446","messageId":"20100924072633.GU4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 20/24] t9300 (fast-import), series N: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:26:33Z","receivedAt":"2010-09-24T07:26:33Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   60 ++++++++++++++++++++++++------------------------\n 1 files changed, 30 insertions(+), 30 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 5237afc..7bd2bd0 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -846,11 +846,11 @@ INPUT_END\n cat >expect <<EOF\n :100755 100755 $newf $newf C100\tfile2/newf\tfile2/n.e.w.f\n EOF\n-test_expect_success \\\n-\t'N: copy file in same subdirectory' \\\n-\t'git fast-import <input &&\n-\t git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&\n-\t compare_diff_raw expect actual'\n+test_expect_success 'N: copy file in same subdirectory' '\n+\tgit fast-import <input &&\n+\tgit diff-tree -C --find-copies-harder -r N1^ N1 >actual &&\n+\tcompare_diff_raw expect actual\n+'\n \n cat >input <<INPUT_END\n commit refs/heads/N2\n@@ -880,11 +880,11 @@ cat >expect <<EOF\n :100755 100755 $newf $newf C100\tfile2/newf\tfile3/newf\n :100644 100644 $oldf $oldf C100\tfile2/oldf\tfile3/oldf\n EOF\n-test_expect_success \\\n-\t'N: copy then modify subdirectory' \\\n-\t'git fast-import <input &&\n-\t git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&\n-\t compare_diff_raw expect actual'\n+test_expect_success 'N: copy then modify subdirectory' '\n+\tgit fast-import <input &&\n+\tgit diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&\n+\tcompare_diff_raw expect actual\n+'\n \n cat >input <<INPUT_END\n commit refs/heads/N3\n@@ -904,19 +904,18 @@ D file2/file5\n \n INPUT_END\n \n-test_expect_success \\\n-\t'N: copy dirty subdirectory' \\\n-\t'git fast-import <input &&\n-\t test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`'\n+test_expect_success 'N: copy dirty subdirectory' '\n+\tgit fast-import <input &&\n+\ttest `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`\n+'\n \n-test_expect_success \\\n-\t'N: copy directory by id' \\\n-\t'cat >expect <<-EOF &&\n+test_expect_success 'N: copy directory by id' '\n+\tcat >expect <<-EOF &&\n \t:100755 100755 $newf $newf C100\tfile2/newf\tfile3/newf\n \t:100644 100644 $oldf $oldf C100\tfile2/oldf\tfile3/oldf\n \tEOF\n-\t subdir=$(git rev-parse refs/heads/branch^0:file2) &&\n-\t cat >input <<-INPUT_END &&\n+\tsubdir=$(git rev-parse refs/heads/branch^0:file2) &&\n+\tcat >input <<-INPUT_END &&\n \tcommit refs/heads/N4\n \tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \tdata <<COMMIT\n@@ -926,19 +925,19 @@ test_expect_success \\\n \tfrom refs/heads/branch^0\n \tM 040000 $subdir file3\n \tINPUT_END\n-\t git fast-import <input &&\n-\t git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&\n-\t compare_diff_raw expect actual'\n+\tgit fast-import <input &&\n+\tgit diff-tree -C --find-copies-harder -r N4^ N4 >actual &&\n+\tcompare_diff_raw expect actual\n+'\n \n-test_expect_success \\\n-\t'N: modify copied tree' \\\n-\t'cat >expect <<-EOF &&\n+test_expect_success 'N: modify copied tree' '\n+\tcat >expect <<-EOF &&\n \t:100644 100644 $file5_id $file5_id C100\tnewdir/interesting\tfile3/file5\n \t:100755 100755 $newf $newf C100\tfile2/newf\tfile3/newf\n \t:100644 100644 $oldf $oldf C100\tfile2/oldf\tfile3/oldf\n \tEOF\n-\t subdir=$(git rev-parse refs/heads/branch^0:file2) &&\n-\t cat >input <<-INPUT_END &&\n+\tsubdir=$(git rev-parse refs/heads/branch^0:file2) &&\n+\tcat >input <<-INPUT_END &&\n \tcommit refs/heads/N5\n \tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \tdata <<COMMIT\n@@ -959,9 +958,10 @@ test_expect_success \\\n \t$file5_data\n \tEOF\n \tINPUT_END\n-\t git fast-import <input &&\n-\t git diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&\n-\t compare_diff_raw expect actual'\n+\tgit fast-import <input &&\n+\tgit diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&\n+\tcompare_diff_raw expect actual\n+'\n \n ###\n ### series O\n-- \n1.7.2.3\n"},{"id":"151447","messageId":"20100924072707.GV4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 21/24] t9300 (fast-import), series O: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:27:07Z","receivedAt":"2010-09-24T07:27:07Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   46 +++++++++++++++++++++++-----------------------\n 1 files changed, 23 insertions(+), 23 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 7bd2bd0..04e4f6d 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -998,10 +998,10 @@ D file2/file5\n \n INPUT_END\n \n-test_expect_success \\\n-\t'O: comments are all skipped' \\\n-\t'git fast-import <input &&\n-\t test `git rev-parse N3` = `git rev-parse O1`'\n+test_expect_success 'O: comments are all skipped' '\n+\tgit fast-import <input &&\n+\ttest `git rev-parse N3` = `git rev-parse O1`\n+'\n \n cat >input <<INPUT_END\n commit refs/heads/O2\n@@ -1019,14 +1019,14 @@ D file2/file5\n \n INPUT_END\n \n-test_expect_success \\\n-\t'O: blank lines not necessary after data commands' \\\n-\t'git fast-import <input &&\n-\t test `git rev-parse N3` = `git rev-parse O2`'\n+test_expect_success 'O: blank lines not necessary after data commands' '\n+\tgit fast-import <input &&\n+\ttest `git rev-parse N3` = `git rev-parse O2`\n+'\n \n-test_expect_success \\\n-\t'O: repack before next test' \\\n-\t'git repack -a -d'\n+test_expect_success 'O: repack before next test' '\n+\tgit repack -a -d\n+'\n \n cat >input <<INPUT_END\n commit refs/heads/O3\n@@ -1064,13 +1064,13 @@ of\n empty\n commits\n INPUT_END\n-test_expect_success \\\n-\t'O: blank lines not necessary after other commands' \\\n-\t'git fast-import <input &&\n-\t test 8 = `find .git/objects/pack -type f | wc -l` &&\n-\t test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&\n-\t git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&\n-\t test_cmp expect actual'\n+test_expect_success 'O: blank lines not necessary after other commands' '\n+\tgit fast-import <input &&\n+\ttest 8 = `find .git/objects/pack -type f | wc -l` &&\n+\ttest `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&\n+\tgit log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&\n+\ttest_cmp expect actual\n+'\n \n cat >input <<INPUT_END\n commit refs/heads/O4\n@@ -1097,11 +1097,11 @@ zcommits\n COMMIT\n progress I'm done!\n INPUT_END\n-test_expect_success \\\n-\t'O: progress outputs as requested by input' \\\n-\t'git fast-import <input >actual &&\n-\t grep \"progress \" <input >expect &&\n-\t test_cmp expect actual'\n+test_expect_success 'O: progress outputs as requested by input' '\n+\tgit fast-import <input >actual &&\n+\tgrep \"progress \" <input >expect &&\n+\ttest_cmp expect actual\n+'\n \n ###\n ### series P (gitlinks)\n-- \n1.7.2.3\n"},{"id":"151448","messageId":"20100924072736.GW4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 22/24] t9300 (fast-import), series P: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:27:36Z","receivedAt":"2010-09-24T07:27:36Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |   38 ++++++++++++++++++++------------------\n 1 files changed, 20 insertions(+), 18 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 04e4f6d..ef432e7 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -1162,16 +1162,16 @@ M 160000 :6 sub\n \n INPUT_END\n \n-test_expect_success \\\n-\t'P: supermodule & submodule mix' \\\n-\t'git fast-import <input &&\n-\t git checkout subuse1 &&\n-\t rm -rf sub && mkdir sub && (cd sub &&\n-\t git init &&\n-\t git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&\n-\t git checkout master) &&\n-\t git submodule init &&\n-\t git submodule update'\n+test_expect_success 'P: supermodule & submodule mix' '\n+\tgit fast-import <input &&\n+\tgit checkout subuse1 &&\n+\trm -rf sub && mkdir sub && (cd sub &&\n+\tgit init &&\n+\tgit fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&\n+\tgit checkout master) &&\n+\tgit submodule init &&\n+\tgit submodule update\n+'\n \n SUBLAST=$(git rev-parse --verify sub)\n SUBPREV=$(git rev-parse --verify sub^)\n@@ -1204,12 +1204,12 @@ M 160000 $SUBLAST sub\n \n INPUT_END\n \n-test_expect_success \\\n-\t'P: verbatim SHA gitlinks' \\\n-\t'git branch -D sub &&\n-\t git gc && git prune &&\n-\t git fast-import <input &&\n-\t test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)'\n+test_expect_success 'P: verbatim SHA gitlinks' '\n+\tgit branch -D sub &&\n+\tgit gc && git prune &&\n+\tgit fast-import <input &&\n+\ttest $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)\n+'\n \n test_tick\n cat >input <<INPUT_END\n@@ -1229,7 +1229,8 @@ DATA\n INPUT_END\n \n test_expect_success 'P: fail on inline gitlink' '\n-\ttest_must_fail git fast-import <input'\n+\ttest_must_fail git fast-import <input\n+'\n \n test_tick\n cat >input <<INPUT_END\n@@ -1252,7 +1253,8 @@ M 160000 :1 sub\n INPUT_END\n \n test_expect_success 'P: fail on blob mark in gitlink' '\n-\ttest_must_fail git fast-import <input'\n+\ttest_must_fail git fast-import <input\n+'\n \n ###\n ### series Q (notes)\n-- \n1.7.2.3\n"},{"id":"151449","messageId":"20100924072805.GX4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 23/24] t9300 (fast-import), series Q: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:28:05Z","receivedAt":"2010-09-24T07:28:05Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |  158 +++++++++++++++++++++++++-----------------------\n 1 files changed, 83 insertions(+), 75 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex ef432e7..970f594 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -1379,13 +1379,13 @@ EOF\n \n INPUT_END\n \n-test_expect_success \\\n-\t'Q: commit notes' \\\n-\t'git fast-import <input &&\n-\t git whatchanged notes-test'\n-test_expect_success \\\n-\t'Q: verify pack' \\\n-\t'verify_packs'\n+test_expect_success 'Q: commit notes' '\n+\tgit fast-import <input &&\n+\tgit whatchanged notes-test\n+'\n+test_expect_success 'Q: verify pack' '\n+\tverify_packs\n+'\n \n commit1=$(git rev-parse notes-test~2)\n commit2=$(git rev-parse notes-test^)\n@@ -1397,10 +1397,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n first (:3)\n EOF\n-test_expect_success \\\n-\t'Q: verify first commit' \\\n-\t'git cat-file commit notes-test~2 | sed 1d >actual &&\n-\ttest_cmp expect actual'\n+test_expect_success 'Q: verify first commit' '\n+\tgit cat-file commit notes-test~2 | sed 1d >actual &&\n+\ttest_cmp expect actual\n+'\n \n cat >expect <<EOF\n parent $commit1\n@@ -1409,10 +1409,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n second (:5)\n EOF\n-test_expect_success \\\n-\t'Q: verify second commit' \\\n-\t'git cat-file commit notes-test^ | sed 1d >actual &&\n-\ttest_cmp expect actual'\n+test_expect_success 'Q: verify second commit' '\n+\tgit cat-file commit notes-test^ | sed 1d >actual &&\n+\ttest_cmp expect actual\n+'\n \n cat >expect <<EOF\n parent $commit2\n@@ -1421,10 +1421,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n third (:6)\n EOF\n-test_expect_success \\\n-\t'Q: verify third commit' \\\n-\t'git cat-file commit notes-test | sed 1d >actual &&\n-\ttest_cmp expect actual'\n+test_expect_success 'Q: verify third commit' '\n+\tgit cat-file commit notes-test | sed 1d >actual &&\n+\ttest_cmp expect actual\n+'\n \n cat >expect <<EOF\n author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n@@ -1432,10 +1432,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n notes (:9)\n EOF\n-test_expect_success \\\n-\t'Q: verify first notes commit' \\\n-\t'git cat-file commit refs/notes/foobar~2 | sed 1d >actual &&\n-\ttest_cmp expect actual'\n+test_expect_success 'Q: verify first notes commit' '\n+\tgit cat-file commit refs/notes/foobar~2 | sed 1d >actual &&\n+\ttest_cmp expect actual\n+'\n \n cat >expect.unsorted <<EOF\n 100644 blob $commit1\n@@ -1443,25 +1443,28 @@ cat >expect.unsorted <<EOF\n 100644 blob $commit3\n EOF\n cat expect.unsorted | sort >expect\n-test_expect_success \\\n-\t'Q: verify first notes tree' \\\n-\t'git cat-file -p refs/notes/foobar~2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t test_cmp expect actual'\n+test_expect_success 'Q: verify first notes tree' '\n+\tgit cat-file -p refs/notes/foobar~2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\ttest_cmp expect actual\n+'\n \n echo \"$note1_data\" >expect\n-test_expect_success \\\n-\t'Q: verify first note for first commit' \\\n-\t'git cat-file blob refs/notes/foobar~2:$commit1 >actual && test_cmp expect actual'\n+test_expect_success 'Q: verify first note for first commit' '\n+\tgit cat-file blob refs/notes/foobar~2:$commit1 >actual &&\n+\ttest_cmp expect actual\n+'\n \n echo \"$note2_data\" >expect\n-test_expect_success \\\n-\t'Q: verify first note for second commit' \\\n-\t'git cat-file blob refs/notes/foobar~2:$commit2 >actual && test_cmp expect actual'\n+test_expect_success 'Q: verify first note for second commit' '\n+\tgit cat-file blob refs/notes/foobar~2:$commit2 >actual &&\n+\ttest_cmp expect actual\n+'\n \n echo \"$note3_data\" >expect\n-test_expect_success \\\n-\t'Q: verify first note for third commit' \\\n-\t'git cat-file blob refs/notes/foobar~2:$commit3 >actual && test_cmp expect actual'\n+test_expect_success 'Q: verify first note for third commit' '\n+\tgit cat-file blob refs/notes/foobar~2:$commit3 >actual &&\n+\ttest_cmp expect actual\n+'\n \n cat >expect <<EOF\n parent `git rev-parse --verify refs/notes/foobar~2`\n@@ -1470,10 +1473,10 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n notes (:10)\n EOF\n-test_expect_success \\\n-\t'Q: verify second notes commit' \\\n-\t'git cat-file commit refs/notes/foobar^ | sed 1d >actual &&\n-\ttest_cmp expect actual'\n+test_expect_success 'Q: verify second notes commit' '\n+\tgit cat-file commit refs/notes/foobar^ | sed 1d >actual &&\n+\ttest_cmp expect actual\n+'\n \n cat >expect.unsorted <<EOF\n 100644 blob $commit1\n@@ -1481,25 +1484,28 @@ cat >expect.unsorted <<EOF\n 100644 blob $commit3\n EOF\n cat expect.unsorted | sort >expect\n-test_expect_success \\\n-\t'Q: verify second notes tree' \\\n-\t'git cat-file -p refs/notes/foobar^^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t test_cmp expect actual'\n+test_expect_success 'Q: verify second notes tree' '\n+\tgit cat-file -p refs/notes/foobar^^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\ttest_cmp expect actual\n+'\n \n echo \"$note1b_data\" >expect\n-test_expect_success \\\n-\t'Q: verify second note for first commit' \\\n-\t'git cat-file blob refs/notes/foobar^:$commit1 >actual && test_cmp expect actual'\n+test_expect_success 'Q: verify second note for first commit' '\n+\tgit cat-file blob refs/notes/foobar^:$commit1 >actual &&\n+\ttest_cmp expect actual\n+'\n \n echo \"$note2_data\" >expect\n-test_expect_success \\\n-\t'Q: verify first note for second commit' \\\n-\t'git cat-file blob refs/notes/foobar^:$commit2 >actual && test_cmp expect actual'\n+test_expect_success 'Q: verify first note for second commit' '\n+\tgit cat-file blob refs/notes/foobar^:$commit2 >actual &&\n+\ttest_cmp expect actual\n+'\n \n echo \"$note3_data\" >expect\n-test_expect_success \\\n-\t'Q: verify first note for third commit' \\\n-\t'git cat-file blob refs/notes/foobar^:$commit3 >actual && test_cmp expect actual'\n+test_expect_success 'Q: verify first note for third commit' '\n+\tgit cat-file blob refs/notes/foobar^:$commit3 >actual &&\n+\ttest_cmp expect actual\n+'\n \n cat >expect <<EOF\n author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n@@ -1507,24 +1513,25 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n notes (:11)\n EOF\n-test_expect_success \\\n-\t'Q: verify third notes commit' \\\n-\t'git cat-file commit refs/notes/foobar2 | sed 1d >actual &&\n-\ttest_cmp expect actual'\n+test_expect_success 'Q: verify third notes commit' '\n+\tgit cat-file commit refs/notes/foobar2 | sed 1d >actual &&\n+\ttest_cmp expect actual\n+'\n \n cat >expect.unsorted <<EOF\n 100644 blob $commit1\n EOF\n cat expect.unsorted | sort >expect\n-test_expect_success \\\n-\t'Q: verify third notes tree' \\\n-\t'git cat-file -p refs/notes/foobar2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t test_cmp expect actual'\n+test_expect_success 'Q: verify third notes tree' '\n+\tgit cat-file -p refs/notes/foobar2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\ttest_cmp expect actual\n+'\n \n echo \"$note1c_data\" >expect\n-test_expect_success \\\n-\t'Q: verify third note for first commit' \\\n-\t'git cat-file blob refs/notes/foobar2:$commit1 >actual && test_cmp expect actual'\n+test_expect_success 'Q: verify third note for first commit' '\n+\tgit cat-file blob refs/notes/foobar2:$commit1 >actual &&\n+\ttest_cmp expect actual\n+'\n \n cat >expect <<EOF\n parent `git rev-parse --verify refs/notes/foobar^`\n@@ -1533,24 +1540,25 @@ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n \n notes (:12)\n EOF\n-test_expect_success \\\n-\t'Q: verify fourth notes commit' \\\n-\t'git cat-file commit refs/notes/foobar | sed 1d >actual &&\n-\ttest_cmp expect actual'\n+test_expect_success 'Q: verify fourth notes commit' '\n+\tgit cat-file commit refs/notes/foobar | sed 1d >actual &&\n+\ttest_cmp expect actual\n+'\n \n cat >expect.unsorted <<EOF\n 100644 blob $commit2\n EOF\n cat expect.unsorted | sort >expect\n-test_expect_success \\\n-\t'Q: verify fourth notes tree' \\\n-\t'git cat-file -p refs/notes/foobar^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n-\t test_cmp expect actual'\n+test_expect_success 'Q: verify fourth notes tree' '\n+\tgit cat-file -p refs/notes/foobar^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n+\ttest_cmp expect actual\n+'\n \n echo \"$note2b_data\" >expect\n-test_expect_success \\\n-\t'Q: verify second note for second commit' \\\n-\t'git cat-file blob refs/notes/foobar:$commit2 >actual && test_cmp expect actual'\n+test_expect_success 'Q: verify second note for second commit' '\n+\tgit cat-file blob refs/notes/foobar:$commit2 >actual &&\n+\ttest_cmp expect actual\n+'\n \n ###\n ### series R (feature and option)\n-- \n1.7.2.3\n"},{"id":"151450","messageId":"20100924073006.GY4666@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"[PATCH 24/24] t9300 (fast-import), series R: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:30:06Z","receivedAt":"2010-09-24T07:30:06Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"See \"t9300 (fast-import), series A: re-indent\".\n\nCc: Shawn O. Pearce <spearce@spearce.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nThat's all for now.  Sorry for the dull read.\n\nBe seeing you,\nJonathan\n\n t/t9300-fast-import.sh |   72 ++++++++++++++++++++++++------------------------\n 1 files changed, 36 insertions(+), 36 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 970f594..6c629b4 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -1609,35 +1609,35 @@ hi\n \n EOF\n \n-test_expect_success \\\n-\t'R: export-marks feature results in a marks file being created' \\\n-\t'cat input | git fast-import &&\n-\tgrep :1 git.marks'\n+test_expect_success 'R: export-marks feature results in a marks file being created' '\n+\tcat input | git fast-import &&\n+\tgrep :1 git.marks\n+'\n \n-test_expect_success \\\n-\t'R: export-marks options can be overriden by commandline options' \\\n-\t'cat input | git fast-import --export-marks=other.marks &&\n-\tgrep :1 other.marks'\n+test_expect_success 'R: export-marks options can be overriden by commandline options' '\n+\tcat input | git fast-import --export-marks=other.marks &&\n+\tgrep :1 other.marks\n+'\n \n cat >input << EOF\n feature import-marks=marks.out\n feature export-marks=marks.new\n EOF\n \n-test_expect_success \\\n-\t'R: import to output marks works without any content' \\\n-\t'cat input | git fast-import &&\n-\ttest_cmp marks.out marks.new'\n+test_expect_success 'R: import to output marks works without any content' '\n+\tcat input | git fast-import &&\n+\ttest_cmp marks.out marks.new\n+'\n \n cat >input <<EOF\n feature import-marks=nonexistant.marks\n feature export-marks=marks.new\n EOF\n \n-test_expect_success \\\n-\t'R: import marks prefers commandline marks file over the stream' \\\n-\t'cat input | git fast-import --import-marks=marks.out &&\n-\ttest_cmp marks.out marks.new'\n+test_expect_success 'R: import marks prefers commandline marks file over the stream' '\n+\tcat input | git fast-import --import-marks=marks.out &&\n+\ttest_cmp marks.out marks.new\n+'\n \n \n cat >input <<EOF\n@@ -1700,7 +1700,7 @@ test_expect_success 'R: die on unknown option' '\n \ttest_must_fail git fast-import <input\n '\n \n-test_expect_success 'R: unknown commandline options are rejected' '\\\n+test_expect_success 'R: unknown commandline options are rejected' '\n \ttest_must_fail git fast-import --non-existing-option < /dev/null\n '\n \n@@ -1735,29 +1735,29 @@ INPUT_END\n cat expect >>input\n echo >>input\n \n-test_expect_success \\\n-\t'R: blob bigger than threshold' \\\n-\t'test_create_repo R &&\n-\t git --git-dir=R/.git fast-import --big-file-threshold=1 <input'\n-test_expect_success \\\n-\t'R: verify created pack' \\\n-\t'(\n+test_expect_success 'R: blob bigger than threshold' '\n+\ttest_create_repo R &&\n+\tgit --git-dir=R/.git fast-import --big-file-threshold=1 <input\n+'\n+test_expect_success 'R: verify created pack' '\n+\t(\n \t\tfor p in R/.git/objects/pack/*.pack\n \t\tdo\n \t\t\tgit verify-pack -v $p ||\n \t\t\texit\n \t\tdone\n+\t) >verify\n+'\n-\t ) >verify'\n-test_expect_success \\\n-\t'R: verify written objects' \\\n-\t'git --git-dir=R/.git cat-file blob big-file:big1 >actual &&\n-\t test_cmp expect actual &&\n-\t a=$(git --git-dir=R/.git rev-parse big-file:big1) &&\n-\t b=$(git --git-dir=R/.git rev-parse big-file:big2) &&\n-\t test $a = $b'\n-test_expect_success \\\n-\t'R: blob appears only once' \\\n-\t'n=$(grep $a verify | wc -l) &&\n-\t test 1 = $n'\n+test_expect_success 'R: verify written objects' '\n+\tgit --git-dir=R/.git cat-file blob big-file:big1 >actual &&\n+\ttest_cmp expect actual &&\n+\ta=$(git --git-dir=R/.git rev-parse big-file:big1) &&\n+\tb=$(git --git-dir=R/.git rev-parse big-file:big2) &&\n+\ttest $a = $b\n+'\n+test_expect_success 'R: blob appears only once' '\n+\tn=$(grep $a verify | wc -l) &&\n+\ttest 1 = $n\n+'\n \n test_done\n-- \n1.7.2.3\n"},{"id":"151451","messageId":"20100924073559.GZ4666@burratino","threadId":"24246","inReplyTo":"AANLkTimjD6LqMgQSez=t9N_KPsXaFXm3sMcrZc=qQug+@mail.gmail.com","subject":"Re: [PATCH 08/24] t9300 (fast-import), series A: re-indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T07:35:59Z","receivedAt":"2010-09-24T07:35:59Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sverre Rabbelier wrote:\n> On Fri, Sep 24, 2010 at 09:16, Jonathan Nieder <jrnieder@gmail.com> wrote:\n\n>>        test_expect_success \\\n>>                'series A: foo bar baz' \\\n>\n> Sometimes this style is used if the test description is otherwise too long.\n>\n>>        test_expect_success 'series A: foo bar baz' '\n>\n> So what do you do in the case that the line becomes too long?\n\nIn this series that never happens.\n\nIn general, either\n\n test_expect_success \\\n\t\t'series A: foo bar baz' '\n\t... commands ...\n '\n\nor\n\n test_expect_success \\\n\t'series A: foo bar baz' '\n\t... commands ...\n '\n\nlooks fine to me for those cases where no shorter test description\ncomes quickly to mind.\n"},{"id":"151453","messageId":"20100924085424.GD22658@kytes","threadId":"24246","inReplyTo":"20100924071350.GH4666@burratino","subject":"Re: [PATCH 07/24] t9300 (fast-import): use tabs to indent","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-09-24T08:54:25Z","receivedAt":"2010-09-24T08:54:25Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Jonathan,\n\nJonathan Nieder writes:\n> The test script mostly uses tabs to indent, but some 4-space indents\n> snuck in.\n\nPatches 7-24 are boring non-functional changes that involve re-styling\nand re-indenting. Maybe put them all in one large commit? It's fairly\ntrivial to review these changes anyway.\n\n-- Ram\n"},{"id":"151454","messageId":"AANLkTi=EBa5EORv84Yf0b4sEB-0t8eMzBXVZcd8HnWEx@mail.gmail.com","threadId":"24246","inReplyTo":"20100924085424.GD22658@kytes","subject":"Re: [PATCH 07/24] t9300 (fast-import): use tabs to indent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T09:21:49Z","receivedAt":"2010-09-24T09:21:49Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ramkumar Ramachandra wrote:\n\n> Patches 7-24 are boring non-functional changes that involve re-styling\n> and re-indenting. Maybe put them all in one large commit? It's fairly\n> trivial to review these changes anyway.\n\nYeah, sorry for the mailbomb.  Whichever changes are wanted are meant\nfor squashing indeed.\n"},{"id":"151456","messageId":"20100924093847.GE22658@kytes","threadId":"24246","inReplyTo":"20100924070950.GD4666@burratino","subject":"Re: [PATCH 03/24] t9300 (fast-import): guard \"export large marks\" test setup","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-09-24T09:38:52Z","receivedAt":"2010-09-24T09:38:52Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi,\n\nJonathan Nieder writes:\n>  test_expect_success 'A: export marks with large values' '\n> +\ttest_tick &&\n> +\tmt=$(git hash-object --stdin </dev/null) &&\n> +\t>input.blob &&\n> +\t>marks.exp &&\n> +\t>tree.exp &&\n> +\n> +\tcat >input.commit <<-EOF &&\n> +\tcommit refs/heads/verify--dump-marks\n> +\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n> +\tdata <<COMMIT\n> +\ttest the sparse array dumping routines with exponentially growing marks\n\nOk, so we want marks to grow exponentially.\n\n> +\tCOMMIT\n> +\tEOF\n> +\n> +\t(\n> +\t\ti=0 &&\n> +\t\tl=4 &&\n> +\t\tm=6 &&\n> +\t\tn=7 &&\n\nMaybe use slightly less cryptic variable names?\n\n> +\t\twhile test \"$i\" -lt 27\n\nSomething like for i in `seq 1 10` will atleast make it clear that i\nis just a loop variable. That's one arbitrary variable less.\n\n> +\t\tdo\n> +\t\t\tcat >>input.blob <<-EOF &&\n> +\t\t\tblob\n> +\t\t\tmark :$l\n> +\t\t\tdata 0\n> +\t\t\tblob\n> +\t\t\tmark :$m\n> +\t\t\tdata 0\n> +\t\t\tblob\n> +\t\t\tmark :$n\n> +\t\t\tdata 0\n> +\t\t\tEOF\n> +\t\t\t{\n> +\t\t\t\techo \"M 100644 :$l l$i\" &&\n> +\t\t\t\techo \"M 100644 :$m m$i\" &&\n> +\t\t\t\techo \"M 100644 :$n n$i\"\n> +\t\t\t} >>input.commit &&\n> +\t\t\t{\n> +\t\t\t\techo \":$l $mt\" &&\n> +\t\t\t\techo \":$m $mt\" &&\n> +\t\t\t\techo \":$n $mt\"\n> +\t\t\t} >>marks.exp &&\n> +\t\t\t{\n> +\t\t\t\tprintf \"100644 blob $mt\\tl$i\\n\" &&\n> +\t\t\t\tprintf \"100644 blob $mt\\tm$i\\n\" &&\n> +\t\t\t\tprintf \"100644 blob $mt\\tn$i\\n\"\n> +\t\t\t} >>tree.exp &&\n> +\t\t\tl=$(($l + $l)) &&\n> +\t\t\tm=$(($m + $m)) &&\n> +\t\t\tn=$(($l + $n)) &&\n\nMaybe l=$(($l * 2)) and similarly for m to emphasize that they're\ndoubling in every loop iteration?\n\n-- Ram\n"},{"id":"151460","messageId":"20100924103452.GI22658@kytes","threadId":"24246","inReplyTo":"20100924070950.GD4666@burratino","subject":"Re: [PATCH 03/24] t9300 (fast-import): guard \"export large marks\" test setup","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-09-24T10:34:55Z","receivedAt":"2010-09-24T10:34:55Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi again,\n\nJonathan Nieder writes:\n>  test_expect_success 'A: export marks with large values' '\n> +\ttest_tick &&\n> +\tmt=$(git hash-object --stdin </dev/null) &&\n> +\t>input.blob &&\n> +\t>marks.exp &&\n> +\t>tree.exp &&\n> +\n> +\tcat >input.commit <<-EOF &&\n> +\tcommit refs/heads/verify--dump-marks\n\nNit: Maybe change this to verify--export-marks corresponding to the\n`--export-marks` feature of fast-import? The ref for testing the\n`--import-marks` feature is already called `verify--import-marks`.\n\n-- Ram\n"},{"id":"151467","messageId":"87aan7e7f5.fsf@hariville.hurrynot.org","threadId":"24246","inReplyTo":"20100924093847.GE22658@kytes","subject":"Re: [PATCH 03/24] t9300 (fast-import): guard \"export large marks\" test setup","fromName":"Raja R Harinath","fromEmail":"harinath@hurrynot.org","sentAt":"2010-09-24T10:56:46Z","receivedAt":"2010-09-24T10:56:46Z","isPatch":true,"sender":{"key":"harinath@hurrynot.org","avatar":"https://avatars.githubusercontent.com/u/4610?v=4"},"body":"Hi,\n\nRamkumar Ramachandra <artagnon@gmail.com> writes:\n\n> Jonathan Nieder writes:\n[snip]\n>> +\tcat >input.commit <<-EOF &&\n>> +\tcommit refs/heads/verify--dump-marks\n>> +\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n>> +\tdata <<COMMIT\n>> +\ttest the sparse array dumping routines with exponentially growing marks\n>\n> Ok, so we want marks to grow exponentially.\n\nJust to clarify, this code is already in the tree.  Jonathan is only\nre-indenting it and moving it inside a test_expect_success.\n\n[snip]\n>> +\t\ti=0 &&\n>> +\t\tl=4 &&\n>> +\t\tm=6 &&\n>> +\t\tn=7 &&\n>\n> Maybe use slightly less cryptic variable names?\n\nI expect these are fairly idiomatic, except maybe for 'n', which could\nbe replaced by 'u', I guess.\n\n[snip]\n>> +\t\t\tl=$(($l + $l)) &&\n>> +\t\t\tm=$(($m + $m)) &&\n>> +\t\t\tn=$(($l + $n)) &&\n>\n> Maybe l=$(($l * 2)) and similarly for m to emphasize that they're\n> doubling in every loop iteration?\n\nHmm, $l appears twice, that's literally doubling, isn't it ;-)\n\n- Hari\n"},{"id":"151468","messageId":"8762xve783.fsf@hariville.hurrynot.org","threadId":"24246","inReplyTo":"20100924103452.GI22658@kytes","subject":"Re: [PATCH 03/24] t9300 (fast-import): guard \"export large marks\" test setup","fromName":"Raja R Harinath","fromEmail":"harinath@hurrynot.org","sentAt":"2010-09-24T11:01:00Z","receivedAt":"2010-09-24T11:01:00Z","isPatch":true,"sender":{"key":"harinath@hurrynot.org","avatar":"https://avatars.githubusercontent.com/u/4610?v=4"},"body":"Hi,\n\nRamkumar Ramachandra <artagnon@gmail.com> writes:\n\n> Jonathan Nieder writes:\n>>  test_expect_success 'A: export marks with large values' '\n>> +\ttest_tick &&\n>> +\tmt=$(git hash-object --stdin </dev/null) &&\n>> +\t>input.blob &&\n>> +\t>marks.exp &&\n>> +\t>tree.exp &&\n>> +\n>> +\tcat >input.commit <<-EOF &&\n>> +\tcommit refs/heads/verify--dump-marks\n>\n> Nit: Maybe change this to verify--export-marks corresponding to the\n> `--export-marks` feature of fast-import? The ref for testing the\n> `--import-marks` feature is already called `verify--import-marks`.\n\nFair enough.  I just went with the name of the routine that had the bug:\ndump_marks_helper.\n\n- Hari\n"},{"id":"151537","messageId":"20100924194313.GA8114@burratino","threadId":"24246","inReplyTo":"1284596048.3298.3.camel@wilber","subject":"Re: [RFC/PATCH 0/3] fast-import: give importers access to the object store","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-24T19:43:13Z","receivedAt":"2010-09-24T19:43:13Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi Sam,\n\nSam Vilain wrote:\n> On Sat, 2010-09-04 at 22:15 -0500, Jonathan Nieder wrote:\n\n>> It works like this:\n>> \n>> frontend:\n>> \tfeature report-fd=3\n>> \tcommit refs/heads/master\n>> \t... revision 1 ...\n>> \n>> importer:\n>> \tabc7856cba76bca87a65bca76bca8bca98bca78bca76\n>\n> This is probably quite a late comment, but I don't think that\n> 'report-fd=3' is a good idea in a protocol like this.\n\nYes, I guess \"feature report-fd=3\" is a protocol layering violation.\nUnfortunately import-marks and export-marks have already set a\nprecedent.\n\nHow about a \"feature report-fd\" (with no argument) that checks if the\nreport-fd was set and errors out if not?\n\nWell-behaved streams could use that and rely on the fd to be set on\nthe command line, while poorly-behaved streams could still use\n\"feature report-fd=whatever\" to get the effect of --report-fd=whatever\nand avoid breaking UI consistency.\n"},{"id":"151593","messageId":"AANLkTinsotbGpg1LAXA+UchBHQrBK12tkX+o4tOFWUOF@mail.gmail.com","threadId":"24246","inReplyTo":"20100924194313.GA8114@burratino","subject":"Re: [RFC/PATCH 0/3] fast-import: give importers access to the object store","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-09-24T23:44:15Z","receivedAt":"2010-09-24T23:44:15Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Fri, Sep 24, 2010 at 21:43, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Yes, I guess \"feature report-fd=3\" is a protocol layering violation.\n> Unfortunately import-marks and export-marks have already set a\n> precedent.\n\nI don't agree, they (can) use a relative path name, allow the stream\nto be re-used at a different location.\n\n> Well-behaved streams could use that and rely on the fd to be set on\n> the command line, while poorly-behaved streams could still use\n> \"feature report-fd=whatever\" to get the effect of --report-fd=whatever\n> and avoid breaking UI consistency.\n\nAdditionally you could have the commandline override whatever the\nstream sets, so that the stream can be re-used as long as the user\nspecifies the appropriate commandline arguments?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"151594","messageId":"20100925000156.GA23735@burratino","threadId":"24246","inReplyTo":"AANLkTinsotbGpg1LAXA+UchBHQrBK12tkX+o4tOFWUOF@mail.gmail.com","subject":"Re: [RFC/PATCH 0/3] fast-import: give importers access to the object store","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-25T00:01:56Z","receivedAt":"2010-09-25T00:01:56Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sverre Rabbelier wrote:\n> On Fri, Sep 24, 2010 at 21:43, Jonathan Nieder <jrnieder@gmail.com> wrote:\n\n>> Yes, I guess \"feature report-fd=3\" is a protocol layering violation.\n>> Unfortunately import-marks and export-marks have already set a\n>> precedent.\n>\n> I don't agree, they (can) use a relative path name, allow the stream\n> to be re-used at a different location.\n\nSorry, I had confused myself.  Especially with relative-marks, using\nrelative paths without worrying about where they point makes a lot\nof sense.  I was thinking of a frontend that reads or writes the marks\nfile itself, but import/export-marks features can also be used to just\nsave/restore marks opaquely.\n\n(So iiuc one could imagine a backend that writes the marks within a\ntable somewhere instead of a text file when relative-marks is\nrequested, and most frontends could cope with that.)\n\nThus I have no precedent to fall back on. :)\n\n>> Well-behaved streams could use that and rely on the fd to be set on\n>> the command line, while poorly-behaved streams could still use\n>> \"feature report-fd=whatever\" to get the effect of --report-fd=whatever\n>> and avoid breaking UI consistency.\n>\n> Additionally you could have the commandline override whatever the\n> stream sets, so that the stream can be re-used as long as the user\n> specifies the appropriate commandline arguments?\n\nYep, that would work.  Still I don't think it makes a lot of sense to\nallow \"feature report-fd=4\" in the fast-import stream.  If I can\nensure that fast-import has file descriptor 4 mapped to the right\nplace, then I am in control of the process that starts fast-import, so\na command-line option would be easy enough to use, no?\n"},{"id":"151595","messageId":"AANLkTin_DvzhXSaT62Lr7D_CxD9V0vcaYE3u9PoQYZ+o@mail.gmail.com","threadId":"24246","inReplyTo":"20100925000156.GA23735@burratino","subject":"Re: [RFC/PATCH 0/3] fast-import: give importers access to the object store","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-09-25T00:17:09Z","receivedAt":"2010-09-25T00:17:09Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sat, Sep 25, 2010 at 02:01, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> I was thinking of a frontend that reads or writes the marks\n> file itself, but import/export-marks features can also be used to just\n> save/restore marks opaquely.\n\nThat's exactly what git-remote-hg does :). The hg exporter and\nimporter doesn't care about where git stores it's marks. As long as\nthey both use the same marks it all works.\n\n> Thus I have no precedent to fall back on. :)\n\nSeems like it.\n\n> Yep, that would work.  Still I don't think it makes a lot of sense to\n> allow \"feature report-fd=4\" in the fast-import stream.  If I can\n> ensure that fast-import has file descriptor 4 mapped to the right\n> place, then I am in control of the process that starts fast-import, so\n> a command-line option would be easy enough to use, no?\n\nTrue. Perhaps some more input from others would help.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"151609","messageId":"20100925051926.GA19804@burratino","threadId":"24246","inReplyTo":"20100924065900.GA4666@burratino","subject":"svn-fe status","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-25T05:19:26Z","receivedAt":"2010-09-25T05:19:26Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jonathan Nieder wrote:\n\n> Tomorrow I would like to re-roll the fast-import experiment\n> so the svn-fe that understands deltas can get more attention\n\nbut I did not get as far as I would like.  Interested parties can find\nsome very rough patches in the git repository at:\n git://repo.or.cz/git/jrn.git tp/svn-fe-wip\n\nThe top two patches are completely bogus.  No doubt some of the\nearlier ones are, too, which is why I do not think they are ready for\nreview yet, except by extra curious people.\n\nNow the features that would be most useful from fast-import become a\nbit clearer.  Since a single svn revision can make multiple changes to\na file, the ability to read back the currently staged content for the\ncurrent revision would be helpful, like this:\n\n  commit refs/remotes/origin/root\n  mark :100\n  committer localuser <localuser@machine.example.com>\n  data <<END_MESSAGE\n  \n  from refs/remotes/origin/root^0\n  M 100644 :72:\"trunk/README\" \"branches/topic/README\"\n  cat \"branches/topic/README\"\n  M 100755 inline branches/topic/README\n  data <<END_FILE\n  ... output from delta application goes here ...\n  END_FILE\n  ... etc ...\n\nIn other words, it would be nice to be able to\n\n 1. use ':<mark>:<path>' references to retrieve data from a\n    previous revision\n 2. use 'cat <path>' references to retrieve data from the\n    current revision.\n\nBy using these two features, I think we could eliminate the repo_tree\nmodule completely.\n\nDavid's and Ram's discussions and patches from the last two weeks (or\nat least the part I have understood) have been very helpful.\n\nDavid Barr (3):\n      svndiff: Give caller responsibility for initializing line_buffer\n      vcs-svn: Reduce memory allocation churn in move_window\n      vcs-svn: extend svndump to parse version 3 format\n\nJonathan Nieder (14):\n      Makefile: declare vcs-svn test dependencies\n      line_buffer: Allow character-oriented input\n      line_buffer: Let caller peek ahead to find stream end\n      line_buffer: Add binary-safe read() function\n      vcs-svn: Add svn delta parser\n      svndiff: Handle truncated data in deltas\n      svndiff: Handle truncated source file\n      svndiff: Cap length of delta read\n      Teach fast-import to print the id of each imported commit\n      fast-import: Let importers retrieve the objects being written\n      fast-import: Allow cat command with empty path\n      fast-import: Allow cat requests at arbitrary points in stream\n      [WIP] svn-fe: Use the --report-fd feature\n      wip\n\nRamkumar Ramachandra (1):\n      Add a sample user for the svndiff library\n\n Documentation/git-fast-import.txt |   49 ++++\n Makefile                          |   10 +-\n contrib/svn-fe/.gitignore         |    1 +\n contrib/svn-fe/Makefile           |   30 ++-\n contrib/svn-fe/svn-da.c           |   26 ++\n contrib/svn-fe/svn-da.txt         |   24 ++\n contrib/svn-fe/svn-fe.txt         |    6 +-\n fast-import.c                     |  147 ++++++++++-\n t/t9010-svn-fe.sh                 |   37 +++-\n t/t9010/newdata.diff0             |  Bin 0 -> 19392 bytes\n t/t9010/newdata.done              |  522 +++++++++++++++++++++++++++++++++++++\n t/t9010/src.diff0                 |  Bin 0 -> 74 bytes\n t/t9010/src.done                  |  522 +++++++++++++++++++++++++++++++++++++\n t/t9300-fast-import.sh            |  210 +++++++++++++++\n test-svn-fe.c                     |   38 +++-\n vcs-svn/LICENSE                   |    2 +\n vcs-svn/fast_export.c             |  158 +++++++++++-\n vcs-svn/fast_export.h             |   11 +-\n vcs-svn/line_buffer.c             |   24 ++\n vcs-svn/line_buffer.h             |    3 +\n vcs-svn/repo_tree.c               |    9 +-\n vcs-svn/svndiff.c                 |  477 +++++++++++++++++++++++++++++++++\n vcs-svn/svndiff.h                 |   11 +\n vcs-svn/svndump.c                 |   69 +++++-\n 24 files changed, 2340 insertions(+), 46 deletions(-)\n create mode 100644 contrib/svn-fe/svn-da.c\n create mode 100644 contrib/svn-fe/svn-da.txt\n create mode 100644 t/t9010/blank.done\n create mode 100644 t/t9010/newdata.diff0\n create mode 100644 t/t9010/newdata.done\n create mode 100644 t/t9010/src.diff0\n create mode 100644 t/t9010/src.done\n create mode 100644 vcs-svn/svndiff.c\n create mode 100644 vcs-svn/svndiff.h\n"},{"id":"151631","messageId":"AANLkTi=sij9TeY+Cv85n61xt3R6nPbkpOyKdoDMzbtaD@mail.gmail.com","threadId":"24246","inReplyTo":"20100925051926.GA19804@burratino","subject":"Re: svn-fe status","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-09-25T10:25:06Z","receivedAt":"2010-09-25T10:25:06Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sat, Sep 25, 2010 at 07:19, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Now the features that would be most useful from fast-import become a\n> bit clearer.  Since a single svn revision can make multiple changes to\n> a file, the ability to read back the currently staged content for the\n> current revision would be helpful, like this:\n\nYes, that makes sense.\n\n>  from refs/remotes/origin/root^0\n>  M 100644 :72:\"trunk/README\" \"branches/topic/README\"\n\nShouldn't that be 'C' for copy? Of course, this should also be guarded\nby a feature.\n\n>  1. use ':<mark>:<path>' references to retrieve data from a\n>    previous revision\n\nI like this a lot better than the previous \"catting the contents of a\ncommit to find the tree to find the file hash to cat the file\ncontents\". I don't think there needs to be a colon after the mark\nthough, I'd prefer reserving the colon character for marks and instead\nintroduce a copy operation.\n\n>  2. use 'cat <path>' references to retrieve data from the\n>    current revision.\n\nYou'll thank yourself later if you add an (optional?) mark to cat, so\nthat you can cat previous versions of a file too? Doesn't svn ever\ngive you a diff against -. ... never mind! You don't need that, since\nyou can just copy the contents you want over first! Ok, great, that\nworks :).\n\n> David's and Ram's discussions and patches from the last two weeks (or\n> at least the part I have understood) have been very helpful.\n\nKeep up the great work!\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"151780","messageId":"20100927025458.GA8921@burratino","threadId":"24246","inReplyTo":"AANLkTi=sij9TeY+Cv85n61xt3R6nPbkpOyKdoDMzbtaD@mail.gmail.com","subject":"Re: svn-fe status","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-09-27T02:54:58Z","receivedAt":"2010-09-27T02:54:58Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sverre Rabbelier wrote:\n\n> Shouldn't that be 'C' for copy?\n\nYep, that is better.\n\n feature copyfromrev\n ...\n C :72 \"trunk/README\" \"branches/topic/README\"\n\nWe can peek ahead to make sure\n\n C :72 branches/topic/README\n\nstill copies a file named \":72\".\n\n> You'll thank yourself later if you add an (optional?) mark to cat, so\n> that you can cat previous versions of a file too? Doesn't svn ever\n> give you a diff against -. ... never mind!\n\nFor completeness it probably does make sense to allow\n\n cat <dataref> <path>\n\ntoo, with <dataref> pointing to a tree (as before) or to a tag or\ncommit.  I just suspect svn-fe would not use it.\n"},{"id":"151810","messageId":"AANLkTinv51AjZ4c7cgqhCzJgWDZOCOXHPsraEPXvLUgR@mail.gmail.com","threadId":"24246","inReplyTo":"20100927025458.GA8921@burratino","subject":"Re: svn-fe status","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-09-27T09:15:41Z","receivedAt":"2010-09-27T09:15:41Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Mon, Sep 27, 2010 at 04:54, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> We can peek ahead to make sure\n>\n>  C :72 branches/topic/README\n>\n> still copies a file named \":72\".\n\nYes, I guess so, we have the entire line available when parsing, so\nthat shouldn't be a problem.\n\n> For completeness it probably does make sense to allow\n>\n>  cat <dataref> <path>\n>\n> too, with <dataref> pointing to a tree (as before) or to a tag or\n> commit.  I just suspect svn-fe would not use it.\n\nI'd prefer to have one way to do it, then again, I don't use perl ;).\n\n-- \nCheers,\n\nSverre Rabbelier\n"}]}