@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Survive importing Git commits with no commit message and/or no author

Summary:
Ref T13538. See PHI1739. Synthetic Git commits with no author and/or no commit message currently extract `null` and then fail to parse.

Ideally, we would carefully distinguish between `null` and empty string. In practice, that requires significant schema changes (these columns are non-nullable and have indexing requirements) and these cases are degenerate. These commits are challenging to build and can not normally be constructed with `git commit`.

At least for now, merge the `null` cases into the empty string cases so we can survive import.

Test Plan:
- Constructed a commit with no author and no commit message using the approach described in T13538; pushed and parsed it.
- Before: fatals during identity selection and storing the commit message (both roughly NULL inserts into non-null columns).
- After: clean import.

This produces a less-than-ideal UI in Diffusion, but it doesn't break anything:

{F7492094}

Maniphest Tasks: T13538

Differential Revision: https://secure.phabricator.com/D21266

+13 -1
+13 -1
src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
··· 62 62 final protected function updateCommitData(DiffusionCommitRef $ref) { 63 63 $commit = $this->commit; 64 64 $author = $ref->getAuthor(); 65 - $message = $ref->getMessage(); 66 65 $committer = $ref->getCommitter(); 67 66 $hashes = $ref->getHashes(); 68 67 $has_committer = (bool)strlen($committer); ··· 72 71 $identity_engine = id(new DiffusionRepositoryIdentityEngine()) 73 72 ->setViewer($viewer) 74 73 ->setSourcePHID($commit->getPHID()); 74 + 75 + // See T13538. It is possible to synthetically construct a Git commit with 76 + // no author and arrive here with NULL for the author value. 77 + 78 + // This is distinct from a commit with an empty author. Because both these 79 + // cases are degenerate and we can't resolve NULL into an identity, cast 80 + // NULL to the empty string and merge the flows. 81 + $author = phutil_string_cast($author); 75 82 76 83 $author_identity = $identity_engine->newResolvedIdentity($author); 77 84 ··· 102 109 'authorPHID', 103 110 $author_identity->getCurrentEffectiveUserPHID()); 104 111 112 + // See T13538. It is possible to synthetically construct a Git commit with 113 + // no message. As above, treat this as though it is the same as the empty 114 + // message. 115 + $message = $ref->getMessage(); 116 + $message = phutil_string_cast($message); 105 117 $data->setCommitMessage($message); 106 118 107 119 if ($has_committer) {