byte[] data = "">
ObjectId fileId = inserter.insert(Constants.OBJ_BLOB, data, 0, data.length);
TreeFormatter formatter = new TreeFormatter();
formatter.append("README", FileMode.REGULAR_FILE, fileId);
ObjectId treeId = inserter.insert(formatter);
AnyObjectId headID = repository.resolve(Constants.HEAD);
System.out.println(headID);
CommitBuilder commit = new CommitBuilder();
commit.setTreeId(treeId);
commit.setAuthor(person);
commit.setCommitter(person);
commit.setMessage("Commit");
commit.setParentId(headID.toObjectId());
ObjectId commitId = inserter.insert(commit);
RefUpdate ru = repository.updateRef(Constants.HEAD);
ru.setForceUpdate(false);
ru.setRefLogIdent(person);
ru.setNewObjectId(commitId);
ru.setExpectedOldObjectId(headID);
System.out.println(ru.update());
Everything is looking good. Git log command at bare repo returned proper tree.
But the problem is when i make git pull at working copy - all files except one with changes (README) has been deleted.
Can anyone tell me what i'm doing wrong??
--
Kind Regards
Darek Sztwiorok