Page MenuHomePhabricator

Diffusion & Auditing with GIT (Windows style newlines)
Closed, DuplicatePublic

Description

When assigning auditors to a commit, the parser appears to skip any auditors that are not on the first line. I believe this may be due to the fact that it is not parsing new lines correctly (I am using Windows style new lines if that makes any difference).

I performed the following two test commits:

 git log
commit 81b4478c68efcd0f88035fc9040e391206b12848
Author: dansheps <dansheps@me.me>
Date:   Tue Aug 16 09:06:15 2016 -0500

    Auditors: dws, admin

commit 88394d75d6b92684dc248c64b53f7424de8596c1
Author: dansheps <dansheps@me.me>
Date:   Tue Aug 16 09:01:54 2016 -0500

    Simple change to trigger Phabricator
    Auditors: dws, admin

The earlier commit did not trigger a audit, however the later one (with only "Auditors: dws, admin" in the message).

To reproduce:

Edit a file in a git repository (Add a message with "Auditors: xxx" on any line not the first)
Commit to git repository (Push to upstream if not local)
Wait for Diffusion to import
Auditing will not trigger

Current Version (I have tried previous versions as well)

phabricator 435f756414e692ad02204bf6cb8f185042cec344 (Sat, Aug 6)
arcanist c9337c2ade7c76edc98d27c216ab97fc1e40d01c (Sat, Aug 6)
phutil 8f8e02d47569dce5f035383d8bcbf7a08481e839 (Sat, Aug 6)

This only appears to affect git as it doesn't handle newlines it seems (the message when viewing the commit is all on a single line, versus SVN which has proper line breaks). I only observe repositories, so I haven't tested this on a hosted one, however I will be doing that now.

Hope this is enough information.

Event Timeline

DanSheps removed a subscriber: DanSheps.
DanSheps added a subscriber: DanSheps.
DanSheps renamed this task from Diffusion & Auditing with GIT (Windows style newlines) to Diffusion & Auditing with GIT (Windows style newlines) (when observing).Aug 16 2016, 2:34 PM
DanSheps updated the task description. (Show Details)

Can confirm that this affects hosted and other observed repositories as well.

The first line of a commit is always interpreted as a commit title, so the behavior you describe is expected.

I don't think you can reasonably put "Auditors: alincoln" as the entire body of commits at any nontrivial scale, because it will be impossible to understand what commits are intended to do or use tools like git log to examine or understand the repository. I've never seen any serious project -- even a small, casual one -- use this convention. Do you have some particular reason for it?

The Auditors:alincoln for example, isn't meant to be the whole body.

If I do something like this:

My commit to fix stuff
#myproject
Ref T13442
Auditors: alincoln

It won't pick up the Auditors. However if I do this in the commit message:

Auditors: alincoln
My commit to fix stuff
#myproject
Ref T13442

It picks up the auditors no problem. As I mentioned, I believe it has to do with the way Phabricator handles newlines in GIT repositories. (SVN does not have this issue at all).

I should have clarified, git log was to show you what I did in the commit. Hope this explains it better.

DanSheps renamed this task from Diffusion & Auditing with GIT (Windows style newlines) (when observing) to Diffusion & Auditing with GIT (Windows style newlines).Aug 16 2016, 4:18 PM

Can you push a commit to rGITTEST on this server which reproduces the problem? Specify "Auditors: epriestley".

You should have the commits. You will see the first two didn't trigger Auditors (with auditors in the last line), but the last one did (with Auditors in the first line)

You misspelled my username but that's enough for me to go on, thanks.

Sorry about that, I didn't know the test git repository existed otherwise I would have done this right after.

When I run git cat-file -p 69d24cb35c46a4a2fed6a851aa17962d7dc0bd26 | hd, I get only \ns, no \rs at all... same with git log and git log ---format='%B' (git version 2.8.1.210.gb8b4d93 on linux).

AFAIK, cat-file should preserve the original content exactly, but I can't find the docs about this.

The windows style was from netbeans, I did the previous ones from command line (if you want I can run netbeans as well to prove it). The title was from when I was strictly using netbeans.

Yeah, I think this is because of --format=%s. Some discussion in T5028, which is probably most of this.

I just tested the "Replace %s%n%n%b with %B" and it fixed it, Auditors were parsed without any problems.

Thanks for linking T5028, I did a search but I guess I didn't get the right triggers in there to find that, it does appear to fix it.

I'm just going to merge this into T5028 since I think that ultimately is essentially the same issue.