File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,16 @@ var Commit = Class.create({
3
3
initialize : function ( obj ) {
4
4
this . raw = obj . details ;
5
5
6
- var messageStart = this . raw . indexOf ( "\n\n" ) + 2 ;
7
6
var diffStart = this . raw . indexOf ( "\ndiff " ) ;
7
+ var messageStart = this . raw . indexOf ( "\n\n" ) + 2 ;
8
+
9
+ if ( diffStart > 0 ) {
10
+ this . message = this . raw . substring ( messageStart , diffStart ) ;
11
+ this . diff = this . raw . substring ( diffStart )
12
+ } else {
13
+ this . message = this . raw . substring ( messageStart )
14
+ this . diff = ""
15
+ }
8
16
this . header = this . raw . substring ( 0 , messageStart ) ;
9
17
10
18
this . sha = this . header . match ( / ^ c o m m i t ( [ 0 - 9 a - f ] { 40 , 40 } ) / ) [ 1 ] ;
@@ -23,8 +31,6 @@ var Commit = Class.create({
23
31
return x . replace ( "\nparent " , "" ) ;
24
32
} ) ;
25
33
26
- this . message = this . raw . substring ( messageStart , diffStart ) ;
27
- this . diff = this . raw . substring ( diffStart ) ;
28
34
} ,
29
35
} ) ;
30
36
@@ -59,6 +65,7 @@ var doeHet = function() {
59
65
} ) ;
60
66
61
67
$ ( "message" ) . innerHTML = commit . message . replace ( / \n / g, "<br>" ) ;
68
+
62
69
if ( commit . diff . length < 10000 ) {
63
70
showDiffs ( ) ;
64
71
} else {
You can’t perform that action at this time.
0 commit comments