Skip to content

Commit bd4e434

Browse files
author
Michelle Tilley
committed
Support tilde refspecs
1 parent f8e9e99 commit bd4e434

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

js/historyview.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,14 @@ define(['d3'], function () {
335335
while(modifier) {
336336
var nextToken = modifier[0]
337337
modifier = modifier.substr(1)
338+
var amountMatch = modifier.match(/^(\d+)(.*)$/),
339+
amount = 1;
338340

339-
if (nextToken === '^') {
340-
var amountMatch = modifier.match(/^(\d+)(.*)$/),
341-
amount = 1;
342-
343-
if (amountMatch) {
344-
var amount = ~~amountMatch[1]
345-
}
341+
if (amountMatch) {
342+
var amount = ~~amountMatch[1]
343+
}
346344

345+
if (nextToken === '^') {
347346
if (amount === 0) {
348347
/* do nothing, refers to this commit */
349348
} else if (amount === 1) {
@@ -353,6 +352,12 @@ define(['d3'], function () {
353352
} else {
354353
matchedCommit = null
355354
}
355+
} else if (nextToken === '~') {
356+
for (var i = 0; i < amount; i++) {
357+
if (matchedCommit && matchedCommit.parent) {
358+
matchedCommit = this.getCommit(matchedCommit.parent)
359+
}
360+
}
356361
}
357362
}
358363
}

0 commit comments

Comments
 (0)