Skip to content

Commit 5371b1f

Browse files
author
Tim Zhou
committed
Add committeroneline template to gitiles LogDetail.soy
This is a workaround change to help alleviate pain from developers trying to use gitiles custom templates. These templates have been broken due to a soy LSC migrating to go/soy/reference/modifiable-templates. To use this new template, users may have to remove the respective configuration settings for their custom templates in gitiles.config. See b/389770745 for more context. Change-Id: Ice7d23c7902042d70f2e8ef7ac2f0a2377441cc1
1 parent a37b23e commit 5371b1f

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

resources/com/google/gitiles/templates/LogDetail.soy

+55
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,61 @@ import * as objDetail from 'com/google/gitiles/templates/ObjectDetail.soy';
147147

148148
{/template}
149149

150+
/**
151+
* Single pretty log entry, similar to --pretty=oneline but with committer time instead of author time.
152+
*/
153+
{template committerOneLineLogEntry visibility="private" modifies="logEntry" variant="'committeroneline'"}
154+
{@param abbrevSha: ?} /** abbreviated SHA-1. */
155+
{@param sha: ?} /** commit SHA-1. */
156+
{@param url: ?} /** URL to commit detail page. */
157+
{@param shortMessage: ?} /** short commit message. */
158+
{@param message: ?} /** list of commit message parts, where each part contains:
159+
text: raw text of the part.
160+
url: optional URL that should be linked to from the part.
161+
*/
162+
{@param author: ?} /** author information with at least "name" and "relativeTime" keys. */
163+
{@param committer: ?} /** committer information with at least "time" and "relativeTime" keys. */
164+
{@param branches: ?} /** list of branches for this entry, with "name" and "url" keys. */
165+
{@param tags: ?} /** list of tags for this entry, with "name" and "url" keys. */
166+
{@param diffTree: ?} /** unused in this variant. */
167+
{@param rename: ?} /** if this entry was a rename or a copy of the path, an object containg:
168+
changeType: the change type, "RENAME" or "COPY".
169+
oldPath: the old path prior to the rename or copy.
170+
newPath: the new path after the rename or copy.
171+
score: the similarity score of the rename or copy.
172+
*/
173+
<a class="u-sha1 u-monospace CommitLog-sha1" href="{$url}">{$abbrevSha}</a>
174+
{sp}<a href="{$url}">{$shortMessage}</a>
175+
{sp}<span class="CommitLog-author" title="{$author.email}">{msg desc="commit author name"}by {$author.name}{/msg}</span>
176+
{sp}<span class="CommitLog-time" title="{$committer.time}">· {$committer.relativeTime}</span>
177+
{if length($branches)}
178+
{for $branch in $branches}
179+
{sp}<a class="CommitLog-branchLabel" href="{$branch.url}">{$branch.name}</a>
180+
{/for}
181+
{/if}
182+
{if length($tags)}
183+
{for $tag in $tags}
184+
{sp}<a class="CommitLog-tagLabel" href="{$tag.url}">{$tag.name}</a>
185+
{/for}
186+
{/if}
187+
188+
{if $rename}
189+
<span class="CommitLog-rename">
190+
[
191+
{switch $rename.changeType}
192+
{case 'RENAME'}
193+
Renamed
194+
{case 'COPY'}
195+
Copied
196+
{/switch}
197+
{if $rename.score != 100}
198+
{sp}({$rename.score}%)
199+
{/if}
200+
{sp}from {$rename.oldPath}]
201+
</span>
202+
{/if}
203+
204+
{/template}
150205

151206
/**
152207
* Default single log entry (oneline format).

0 commit comments

Comments
 (0)