Hello everyone,
I am trying to create a new file (or update an exiting one) with jgit,
so the easiest way is just to first write file contents using standard java IO
File myFile = new File(repository.getDirectory().getParent(), "testfile");
if(!myFile.createNewFile()) {
throw new IOException("Could not create file " + myFile);
}
//... then write bytes to the file
and then and it.
I am just wondering if the same is possible using only JGit API? Maybe through ObjectInserter (can't find on how to properly do a commit with low level api)?
I am looking for something like
Array[byte] content = ???
String filePath = ???
Git git = Git.open(repoPath);
Repository repo = git.getRepository;
repo.addOrUpdateFileContent(filePath, content);
git.commit().call();
Thank you for help!