@@ -5,6 +5,11 @@ var promisify = require("thenify-all");
55var fse = promisify ( require ( "fs-extra" ) , [ "writeFile" ] ) ;
66var local = path . join . bind ( path , __dirname ) ;
77
8+ // Have to wrap exec, since it has a weird callback signature.
9+ var exec = promisify ( function ( command , opts , callback ) {
10+ return require ( "child_process" ) . exec ( command , opts , callback ) ;
11+ } ) ;
12+
813describe ( "Commit" , function ( ) {
914 var NodeGit = require ( "../../" ) ;
1015 var Repository = NodeGit . Repository ;
@@ -24,6 +29,10 @@ describe("Commit", function() {
2429 } ) ;
2530 }
2631
32+ function undoCommit ( ) {
33+ return exec ( "git reset --hard HEAD~1" , { cwd : reposPath } ) ;
34+ }
35+
2736 beforeEach ( function ( ) {
2837 return reinitialize ( this ) ;
2938 } ) ;
@@ -127,7 +136,10 @@ describe("Commit", function() {
127136 } )
128137 . then ( function ( commitId ) {
129138 assert . equal ( expectedCommitId , commitId ) ;
130- return reinitialize ( test ) ;
139+ return undoCommit ( )
140+ . then ( function ( ) {
141+ return reinitialize ( test ) ;
142+ } ) ;
131143 } , function ( reason ) {
132144 return reinitialize ( test )
133145 . then ( function ( ) {
0 commit comments