public GitAddResponse add ( ) throws IOException , JavaGitException { GitAdd gitAdd = new GitAdd ( ) ; // create a list of filenames and add yourself to it List < File > list = new ArrayList < File > ( ) ; File relativeFilePath ; if ( relativePath . isDirectory ( ) ) { for ( File f : relativePath . listFiles ( ) ) { if ( ! f . isHidden ( ) && ! f . getName ( ) . startsWith ( "." ) ) { relativeFilePath = this . getRelativePath ( f , this . getWorkingTree ( ) . getPath ( ) ) ; list . add ( relativeFilePath ) ; } } } else { list . add ( relativePath ) ; } // run git-add command return gitAdd . add ( workingTree . getPath ( ) , null , list ) ; }
Adds the object to the git index