I read the question and answer for staging files in a non-bare repository. However, I am working with a bare repository and I would like to stage files.
I tried using the test for DirCacheBuilder, but the code Repository.lockDirCache()
or Repository.readDirCache()
fails because this is a bare repository.
org.eclipse.jgit.errors.NoWorkTreeException: Bare Repository has neither a working tree, nor an index at org.eclipse.jgit.lib.Repository.getIndexFile(Repository.java:993) at org.eclipse.jgit.dircache.DirCache.read(DirCache.java:166) at org.eclipse.jgit.lib.Repository.readDirCache(Repository.java:1017)
So, how could I stage files in a bare repository using JGit? is this even possible?