{"thread":{"id":"38049","subject":"[PATCH] fast-import: support the ls command anywhere comments are accepted","startedAt":"2014-11-25T22:25:39Z","lastAt":"2014-11-27T22:01:43Z","messageCount":3,"participants":["Mike Hommey"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"252544","messageId":"1416954339-9304-1-git-send-email-mh@glandium.org","threadId":"38049","inReplyTo":null,"subject":"[PATCH] fast-import: support the ls command anywhere comments are accepted","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2014-11-25T22:25:39Z","receivedAt":"2014-11-25T22:25:39Z","isPatch":true,"sender":{"key":"mh@glandium.org","avatar":"https://avatars.githubusercontent.com/u/1038527?v=4"},"body":"The git-fast-import manual page says about both cat-blob and ls that they can\nbe used \"anywhere in the stream that comments are accepted\", but in practice\nit turns out it was only true for cat-blob. This change makes fast-import\nbehavior match its documentation.\n\nSigned-off-by: Mike Hommey <mh@glandium.org>\n---\n fast-import.c | 4 ++++\n 1 file changed, 4 insertions(+)\n\nThe downside of this change is that if a script relies on the fixed behavior,\nit won't work with older versions of git. I'm not sure it is better than\nfixing the documentation to match the unfortunate current limitation?\n\n\ndiff --git a/fast-import.c b/fast-import.c\nindex d0bd285..7fd59ef 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -1910,6 +1910,10 @@ static int read_next_command(void)\n \t\t\tparse_cat_blob(p);\n \t\t\tcontinue;\n \t\t}\n+\t\tif (skip_prefix(command_buf.buf, \"ls \", &p)) {\n+\t\t\tparse_ls(p, NULL);\n+\t\t\tcontinue;\n+\t\t}\n \t\tif (command_buf.buf[0] == '#')\n \t\t\tcontinue;\n \t\treturn 0;\n-- \n2.1.1\n"},{"id":"252550","messageId":"20141125230333.GA11114@glandium.org","threadId":"38049","inReplyTo":"1416954339-9304-1-git-send-email-mh@glandium.org","subject":"Re: [PATCH] fast-import: support the ls command anywhere comments are accepted","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2014-11-25T23:03:33Z","receivedAt":"2014-11-25T23:03:33Z","isPatch":true,"sender":{"key":"mh@glandium.org","avatar":"https://avatars.githubusercontent.com/u/1038527?v=4"},"body":"On Wed, Nov 26, 2014 at 07:25:39AM +0900, Mike Hommey wrote:\n> The git-fast-import manual page says about both cat-blob and ls that they can\n> be used \"anywhere in the stream that comments are accepted\", but in practice\n> it turns out it was only true for cat-blob. This change makes fast-import\n> behavior match its documentation.\n> \n> Signed-off-by: Mike Hommey <mh@glandium.org>\n> ---\n>  fast-import.c | 4 ++++\n>  1 file changed, 4 insertions(+)\n> \n> The downside of this change is that if a script relies on the fixed behavior,\n> it won't work with older versions of git. I'm not sure it is better than\n> fixing the documentation to match the unfortunate current limitation?\n\nNote, if my reading of the code is correct, then cat-blob can't be used\nbetween filemodify | filedelete | filecopy | filerename | filedeleteall\n| notemodify either...\n\nMike\n"},{"id":"252650","messageId":"20141127220143.GA2554@glandium.org","threadId":"38049","inReplyTo":"20141125230333.GA11114@glandium.org","subject":"Re: [PATCH] fast-import: support the ls command anywhere comments are accepted","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2014-11-27T22:01:43Z","receivedAt":"2014-11-27T22:01:43Z","isPatch":true,"sender":{"key":"mh@glandium.org","avatar":"https://avatars.githubusercontent.com/u/1038527?v=4"},"body":"On Wed, Nov 26, 2014 at 08:03:33AM +0900, Mike Hommey wrote:\n> On Wed, Nov 26, 2014 at 07:25:39AM +0900, Mike Hommey wrote:\n> > The git-fast-import manual page says about both cat-blob and ls that they can\n> > be used \"anywhere in the stream that comments are accepted\", but in practice\n> > it turns out it was only true for cat-blob. This change makes fast-import\n> > behavior match its documentation.\n> > \n> > Signed-off-by: Mike Hommey <mh@glandium.org>\n> > ---\n> >  fast-import.c | 4 ++++\n> >  1 file changed, 4 insertions(+)\n> > \n> > The downside of this change is that if a script relies on the fixed behavior,\n> > it won't work with older versions of git. I'm not sure it is better than\n> > fixing the documentation to match the unfortunate current limitation?\n> \n> Note, if my reading of the code is correct, then cat-blob can't be used\n> between filemodify | filedelete | filecopy | filerename | filedeleteall\n> | notemodify either...\n\nAny thought on whether to fix those or to fix the documentation instead?\n\nMike\n"}]}