File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -112,12 +112,23 @@ impl<'a> ToUrl for CommitsUrl<'a> {
112112
113113impl < ' a > ToUrl for SingleCommitUrl < ' a > {
114114 fn url ( & self ) -> String {
115- format ! (
116- "https://api.github.com/repos/{OWNER}/{REPO}/commits/{REF}" ,
117- OWNER = OWNER ,
118- REPO = REPO ,
119- REF = self . sha
120- )
115+ // "origin/master" is set as `sha` when there is no `--end=` definition
116+ // specified on the command line. We define the GitHub master branch
117+ // HEAD commit as the end commit in this case
118+ if & self . sha == & "origin/master" {
119+ format ! (
120+ "https://api.github.com/repos/{OWNER}/{REPO}/commits/HEAD" ,
121+ OWNER = OWNER ,
122+ REPO = REPO ,
123+ )
124+ } else {
125+ format ! (
126+ "https://api.github.com/repos/{OWNER}/{REPO}/commits/{REF}" ,
127+ OWNER = OWNER ,
128+ REPO = REPO ,
129+ REF = self . sha
130+ )
131+ }
121132 }
122133}
123134
You can’t perform that action at this time.
0 commit comments