git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fast-import: support the ls command anywhere comments are accepted
@ 2014-11-25 22:25 Mike Hommey
  2014-11-25 23:03 ` Mike Hommey
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Hommey @ 2014-11-25 22:25 UTC (permalink / raw)
  To: git; +Cc: Jonathan Nieder

The git-fast-import manual page says about both cat-blob and ls that they can
be used "anywhere in the stream that comments are accepted", but in practice
it turns out it was only true for cat-blob. This change makes fast-import
behavior match its documentation.

Signed-off-by: Mike Hommey <mh@glandium.org>
---
 fast-import.c | 4 ++++
 1 file changed, 4 insertions(+)

The downside of this change is that if a script relies on the fixed behavior,
it won't work with older versions of git. I'm not sure it is better than
fixing the documentation to match the unfortunate current limitation?


diff --git a/fast-import.c b/fast-import.c
index d0bd285..7fd59ef 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1910,6 +1910,10 @@ static int read_next_command(void)
 			parse_cat_blob(p);
 			continue;
 		}
+		if (skip_prefix(command_buf.buf, "ls ", &p)) {
+			parse_ls(p, NULL);
+			continue;
+		}
 		if (command_buf.buf[0] == '#')
 			continue;
 		return 0;
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fast-import: support the ls command anywhere comments are accepted
  2014-11-25 22:25 [PATCH] fast-import: support the ls command anywhere comments are accepted Mike Hommey
@ 2014-11-25 23:03 ` Mike Hommey
  2014-11-27 22:01   ` Mike Hommey
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Hommey @ 2014-11-25 23:03 UTC (permalink / raw)
  To: git; +Cc: Jonathan Nieder

On Wed, Nov 26, 2014 at 07:25:39AM +0900, Mike Hommey wrote:
> The git-fast-import manual page says about both cat-blob and ls that they can
> be used "anywhere in the stream that comments are accepted", but in practice
> it turns out it was only true for cat-blob. This change makes fast-import
> behavior match its documentation.
> 
> Signed-off-by: Mike Hommey <mh@glandium.org>
> ---
>  fast-import.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> The downside of this change is that if a script relies on the fixed behavior,
> it won't work with older versions of git. I'm not sure it is better than
> fixing the documentation to match the unfortunate current limitation?

Note, if my reading of the code is correct, then cat-blob can't be used
between filemodify | filedelete | filecopy | filerename | filedeleteall
| notemodify either...

Mike

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fast-import: support the ls command anywhere comments are accepted
  2014-11-25 23:03 ` Mike Hommey
@ 2014-11-27 22:01   ` Mike Hommey
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Hommey @ 2014-11-27 22:01 UTC (permalink / raw)
  To: git; +Cc: Jonathan Nieder

On Wed, Nov 26, 2014 at 08:03:33AM +0900, Mike Hommey wrote:
> On Wed, Nov 26, 2014 at 07:25:39AM +0900, Mike Hommey wrote:
> > The git-fast-import manual page says about both cat-blob and ls that they can
> > be used "anywhere in the stream that comments are accepted", but in practice
> > it turns out it was only true for cat-blob. This change makes fast-import
> > behavior match its documentation.
> > 
> > Signed-off-by: Mike Hommey <mh@glandium.org>
> > ---
> >  fast-import.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > The downside of this change is that if a script relies on the fixed behavior,
> > it won't work with older versions of git. I'm not sure it is better than
> > fixing the documentation to match the unfortunate current limitation?
> 
> Note, if my reading of the code is correct, then cat-blob can't be used
> between filemodify | filedelete | filecopy | filerename | filedeleteall
> | notemodify either...

Any thought on whether to fix those or to fix the documentation instead?

Mike

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-27 22:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-25 22:25 [PATCH] fast-import: support the ls command anywhere comments are accepted Mike Hommey
2014-11-25 23:03 ` Mike Hommey
2014-11-27 22:01   ` Mike Hommey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).