@@ -494,7 +494,7 @@ define(['d3'], function () {
494
494
this . _renderMergePointers ( ) ;
495
495
this . _renderIdLabels ( ) ;
496
496
this . _resizeSvg ( ) ;
497
- this . checkout ( this . currentBranch ) ;
497
+ this . currentBranch && this . checkout ( this . currentBranch ) ;
498
498
} ,
499
499
500
500
_renderCircles : function ( ) {
@@ -856,19 +856,23 @@ define(['d3'], function () {
856
856
857
857
commit . message = message ;
858
858
if ( ! commit . parent ) {
859
- if ( ! this . currentBranch ) {
860
- throw new Error ( 'Not a good idea to make commits while in a detached HEAD state.' ) ;
861
- }
862
-
863
- commit . parent = this . getCommit ( this . currentBranch ) . id ;
859
+ commit . parent = this . getCommit ( 'HEAD' ) . id ;
864
860
}
865
861
866
862
this . commitData . push ( commit ) ;
867
- this . moveTag ( this . currentBranch , commit . id ) ;
863
+ if ( this . currentBranch ) {
864
+ this . moveTag ( this . currentBranch , commit . id ) ;
865
+ }
868
866
869
867
this . renderCommits ( ) ;
870
868
871
- this . checkout ( this . currentBranch ) ;
869
+ if ( this . currentBranch ) {
870
+ console . log ( 'branch' , this . currentBranch )
871
+ this . checkout ( this . currentBranch ) ;
872
+ } else {
873
+ console . log ( 'commit' , commit . id )
874
+ this . checkout ( commit . id )
875
+ }
872
876
return this ;
873
877
} ,
874
878
@@ -928,6 +932,7 @@ define(['d3'], function () {
928
932
} ,
929
933
930
934
checkout : function ( ref ) {
935
+ console . log ( "checking out" , ref )
931
936
var commit = this . getCommit ( ref ) ;
932
937
933
938
if ( ! commit ) {
0 commit comments