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
diff --git a/resources/com/google/gitiles/templates/LogDetail.soy b/resources/com/google/gitiles/templates/LogDetail.soy index f231aa2..b82b2a4 100644 --- a/resources/com/google/gitiles/templates/LogDetail.soy +++ b/resources/com/google/gitiles/templates/LogDetail.soy
@@ -147,6 +147,61 @@ {/template} +/** + * Single pretty log entry, similar to --pretty=oneline but with committer time instead of author time. + */ +{template committerOneLineLogEntry visibility="private" modifies="logEntry" variant="'committeroneline'"} + {@param abbrevSha: ?} /** abbreviated SHA-1. */ + {@param sha: ?} /** commit SHA-1. */ + {@param url: ?} /** URL to commit detail page. */ + {@param shortMessage: ?} /** short commit message. */ + {@param message: ?} /** list of commit message parts, where each part contains: + text: raw text of the part. + url: optional URL that should be linked to from the part. + */ + {@param author: ?} /** author information with at least "name" and "relativeTime" keys. */ + {@param committer: ?} /** committer information with at least "time" and "relativeTime" keys. */ + {@param branches: ?} /** list of branches for this entry, with "name" and "url" keys. */ + {@param tags: ?} /** list of tags for this entry, with "name" and "url" keys. */ + {@param diffTree: ?} /** unused in this variant. */ + {@param rename: ?} /** if this entry was a rename or a copy of the path, an object containg: + changeType: the change type, "RENAME" or "COPY". + oldPath: the old path prior to the rename or copy. + newPath: the new path after the rename or copy. + score: the similarity score of the rename or copy. + */ +<a class="u-sha1 u-monospace CommitLog-sha1" href="{$url}">{$abbrevSha}</a> +{sp}<a href="{$url}">{$shortMessage}</a> +{sp}<span class="CommitLog-author" title="{$author.email}">{msg desc="commit author name"}by {$author.name}{/msg}</span> +{sp}<span class="CommitLog-time" title="{$committer.time}">· {$committer.relativeTime}</span> +{if length($branches)} + {for $branch in $branches} + {sp}<a class="CommitLog-branchLabel" href="{$branch.url}">{$branch.name}</a> + {/for} +{/if} +{if length($tags)} + {for $tag in $tags} + {sp}<a class="CommitLog-tagLabel" href="{$tag.url}">{$tag.name}</a> + {/for} +{/if} + +{if $rename} + <span class="CommitLog-rename"> + [ + {switch $rename.changeType} + {case 'RENAME'} + Renamed + {case 'COPY'} + Copied + {/switch} + {if $rename.score != 100} + {sp}({$rename.score}%) + {/if} + {sp}from {$rename.oldPath}] + </span> +{/if} + +{/template} /** * Default single log entry (oneline format).