[ 
https://jira.codehaus.org/browse/SCM-772?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=351739#comment-351739
 ] 

Robert Scholte commented on SCM-772:
------------------------------------

>From http://git-scm.com/docs/git-status:
{quote}
h2. Porcelain Format

The porcelain format is similar to the short format, but is guaranteed not to 
change in a backwards-incompatible way between Git versions or based on user 
configuration. This makes it ideal for parsing by scripts. The description of 
the short format above also describes the porcelain format, with a few 
exceptions: 

1.The user's color.status configuration is not respected; color will always be 
off.
2.The user's status.relativePaths configuration is not respected; paths shown 
will always be relative to the repository root.

There is also an alternate \-z format recommended for machine parsing. In that 
format, the status field is the same, but some other things change. First, the 
'->' is omitted from rename entries and the field order is reversed (e.g 'from 
-> to' becomes 'to from'). Second, a NUL (ASCII 0) follows each filename, 
replacing space as a field separator and the terminating newline (but a space 
still separates the status field from the first filename). Third, filenames 
containing special characters are not specially formatted; no quoting or 
backslash-escaping is performed. 
{quote}

So yes, this looks interesting. However, I'm missing when both options were 
introduced. IIRC we now assume at least Git 1.8, although the SCM-API has no 
way to verify this (yet). If the {{\-z}} is supported for quite some time, it 
would probably be better to use it. The {{GitStatusConsumer}} has already quite 
some tests, so you should have good feedback on your changes. Looking forward 
on that patch.

> GitStatusConsumer does not properly handle quoted paths output from 
> GitStatusCommand
> ------------------------------------------------------------------------------------
>
>                 Key: SCM-772
>                 URL: https://jira.codehaus.org/browse/SCM-772
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-git
>    Affects Versions: 1.9, 1.9.1
>         Environment: All
>            Reporter: Gary Peskin
>
> We have several files in our repository with spaces in the file name.  Even 
> with --porcelain specified, the filename appears with quotes around it.  Here 
> is an example:
> {noformat}
>  M src/main/webapp/admin-index.html
>  M src/main/webapp/adminhelp/en_US/css/AboutThisBook.css
>  M "src/main/webapp/adminhelp/en_US/css/Appendix A Role Manager Defs.css"
> {noformat}
> This messes up the regular expression parsing in GitStatusConsumer.
> A better approach would be to modify GitStatusCommand to specify the 
> {{"\-z"}} option instead of the {{"--porcelain"}} option.  This option is 
> specifically designed to generate machine parseable output from the git 
> status command.  This would necessitate changes to GitStatusConsumer but 
> would allow the elimination of all of the regex parsing in GitStatusConsumer 
> making for a more reliable solution.
> If you'd like, please let me know and I can work up a patch for the changes 
> to these two classes and send it on.



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Reply via email to