Skip to content

Commit 061884f

Browse files
committed
SourceGithub::url_diff() is alias for url_changeset()
The output of both methods is identical so we remove duplicated code and simply call url_changeset() from url_diff().
1 parent b666c7d commit 061884f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

SourceGithub/SourceGithub.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,16 @@ public function url_file( $p_repo, $p_changeset, $p_file ) {
253253
return "https://github.com/$t_username/$t_reponame/blob/$t_ref/$t_filename";
254254
}
255255

256+
/**
257+
* Get a URL to a diff view of the given file at the given changeset.
258+
*
259+
* GitHub's commit file-diff URLs are based on hashes, the calculation of
260+
* which is undocumented, so instead of reverse-engineering them we just
261+
* return the Changeset's diff and let the user manually pick the file to
262+
* view from there.
263+
*/
256264
public function url_diff( $p_repo, $p_changeset, $p_file ) {
257-
$t_username = $p_repo->info['hub_username'];
258-
$t_reponame = $p_repo->info['hub_reponame'];
259-
$t_ref = $p_changeset->revision;
260-
261-
return "https://github.com/$t_username/$t_reponame/commit/$t_ref";
265+
return $this->url_changeset( $p_repo, $p_changeset );
262266
}
263267

264268
public function update_repo_form( $p_repo ) {

0 commit comments

Comments
 (0)