This project is read-only.

Parsing rules for checkin message

Sep 30, 2012 at 1:02 PM

Our team has built some tools that run git-tf checkin and specify an arbitrary (ultimately user-specified) --message. And I've found that I don't understand git-tf's command-line parsing at all.

I want to be able to specify any arbitrary string for the --message. Obviously I need to wrap the string in quotes, since it might contain spaces. Then there's the problem of quotes inside the string. By playing around with --preview, I found that I could escape quotes by either doubling them, <"">, or escaping a quote with a backslash, <\">.

So I assumed I also needed to escape backslashes -- but obviously I was wrong, because I started to find \\ showing up in commit comments. (So if backslashes aren't escaped, what would <\""> mean? Escaped quote plus end-of-string, or literal backslash followed by a quote character?)

I also haven't figured out any way to embed line breaks in a commit comment. If my .NET front-end does a Process.Launch on "cmd.exe" with the arguments </c git-tf commit --associate 12345 --message "messageGoesHere">, and I have line-break characters inside messageGoesHere, then git-tf (or cmd.exe?) only parses up to the first line break, and ignores everything after it. I tried embedding the classic backslash-r and backslash-n sequences in the message, but they just come through as backslash-r and backslash-n. I also tried classic C/UNIX-style line continuations (putting a backslash before the line break), but that just puts a backslash in the checkin comment.

Basically I want a predictable way to give an arbitrary string for git-tf's checkin message. Could you guys publish the rules for how it parses strings on its command line? Or better yet, provide a --message-file parameter, so I can put the message in a temp file and not have to escape strings at all?

Oct 4, 2012 at 8:32 PM

Hello sorry for the delayed reply here. I will put together the rules and post them shortly.

Oct 4, 2012 at 8:48 PM

Please find the replies to your questions below:

1) Regarding quotes : we delegate the quote parsing rules to the shell so whatever the shell does we work with. To escape quotes in the shell all you need to either double them or escape using a backslash.

2) You do not need to escape backslashes for the shell to handle them correctly

3) Regarding multiline, I do not of a simple way to do that beside programmatically sending the arguments (I will look into this)

I like the --message-file parameter suggestion I created a feature request here http://gittf.codeplex.com/workitem/38 to track the work needed to add this feature.

Thanks for your suggestions. Please let us know if you have any other suggestions or hit any other issues.

Thanks,

Youhana

Dec 22, 2014 at 4:44 PM
Youhana,

Can you please update us on multiline comment part.

Thank you
Mukesh
Jan 8, 2015 at 6:16 AM
Hi Mukesh,

Youhana is now busy with a different task. I'm trying to substitute him.

As of your questions, I would say that the only option to satisfy all your requirements would be providing the command line parameter "--message-file parameter". Unfortunately, we do not have enough resources assigned to the project, to implement this improvement.

On the other hand, Git-TF is an Open Source Project (one of the very first at Microsoft, BTW). So, if you have time and mood, we'll be glad and appreciated to receive you pull request with the improvement.

Please note, all the above does not mean that we do not respect your opinion. Vice versa, we really believe, that you've found am very important point of improvement. Unfortunately, that's not the only point. Our interventions in this Open Source project are minimal nowadays. We relay on the community. Currently, we add new items to our backlog based on the "Votes" criteria on "Issues" page of this site. I mean, issues with the Git-TF core engine.

Alex
Jan 10, 2015 at 12:46 PM
Hello Alex,

Thanks for your reply. I want to contribute this project as a developer. I cloned the repo and started compiling but I am not able to compile. Attached are the build logs. Can you please help me getting started.

Thank you
Mukesh
Jan 12, 2015 at 1:42 PM
Hi Mukesh,

Unfortunately, I don't see any attachments. Feel free to use my personal e-mail (arukhlin@microsoft.com) to send the logs.

BTW, don't forget: Prior to submitting any pull requests, you will need to submit a Contribution License Agreement form. This form only needs to be submitted once for this project. Once you have downloaded and completed the Contribution License Agreement, please send it to gittf-cla@microsoft.com.

Alex
Jan 12, 2015 at 8:14 PM
Hi Mukesh,

According the logs provided the compilation was successful. What makes you think that you cannot compile?

Alex
Jan 12, 2015 at 9:07 PM
Hello Alex,

Projects com.microsoft.gittf.core, com.microsoft.gittf.client.clc are skipped. Should not they be compile???

Thank you
Mukesh

Jan 13, 2015 at 3:36 PM
Hi Mukesh,

I believe the info messages you mean are generated by Maven on the third build step, when it creates the whole GIt-TF package. By that time com.microsoft.gittf.core and com.microsoft.gittf.client.clc are already built (on the first two build steps), so their building is skipped on that step. Pretty confusing, I agree. :-)

Do you see the corresponfing JAR and ZIP files in the "target" folders? I.e. in
...Git-TF\com.microsoft.gittf.core\target 
...Git-TF\com.microsoft.gittf.client.clc\target
...Git-TF\target  
Alex
Jan 13, 2015 at 3:48 PM
Hello Alex,

Unfortunately no, I do not see those directories.

Thank you
Mukesh

Jan 13, 2015 at 9:23 PM
Hi Mukesh,

Could please send your cloned Git repository? BTW, I looked at Forks in the Git-TF project here, and haven't noticed any fork created under your name. Did I miss it? could send me a link?

Alex
Jan 13, 2015 at 10:45 PM
Hello Alex,

Yes I did not fork. Can you please let me know how to clone the fork. Is it same as clonning master?

Thank you
Mukesh

Mar 4, 2015 at 6:47 PM
Hi Mukesh,

After you create a fork, go to SOURCES:Forks tab. You'll see a list of existing forks with corresponding URL to clone them. A fork is not a branch, it's full copy of the original repository with all branches that existed by the time you forked. You can use your for as a personal repository and do with it whatever you wish, e.g. you can push your changes to it.

Alex