Refactor: inline methods
This commit is contained in:
parent
8f044e6b77
commit
91d0f5817d
2 changed files with 4 additions and 32 deletions
|
@ -56,17 +56,6 @@ class GitDBRepo {
|
|||
headWriter = new HeadWriter(repository);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a blob into the store, returning its unique id.
|
||||
*
|
||||
* @param blob content of the blob
|
||||
* @return the id of the blob
|
||||
* @throws IOException the blob could not be stored
|
||||
*/
|
||||
ObjectId insertBlob(final byte[] blob) throws IOException {
|
||||
return valueWriter.write(blob);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a new, empty tree into the store, returning its unique id.
|
||||
*
|
||||
|
@ -82,23 +71,6 @@ class GitDBRepo {
|
|||
return keyWriter.writeFirst(key, valueId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a tree into the store, copying the exiting tree from the branch, returning its new unique id.
|
||||
*
|
||||
* @param branchRef the branch to copy the tree from
|
||||
* @param key the key to insert
|
||||
* @param valueId id of the value
|
||||
* @return the id of the inserted tree
|
||||
* @throws IOException the tree could not be stored
|
||||
*/
|
||||
ObjectId insertTree(
|
||||
final Ref branchRef,
|
||||
final String key,
|
||||
final ObjectId valueId
|
||||
) throws IOException {
|
||||
return keyWriter.write(key, valueId, branchRef);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a commit into the store, returning its unique id.
|
||||
*
|
||||
|
@ -154,8 +126,8 @@ class GitDBRepo {
|
|||
* @throws IOException if there was an error writing the value
|
||||
*/
|
||||
ObjectId writeValue(final Ref branchRef, final String key, final String value) throws IOException {
|
||||
final ObjectId blob = insertBlob(value.getBytes(StandardCharsets.UTF_8));
|
||||
return insertTree(branchRef, key, blob);
|
||||
final ObjectId blob = valueWriter.write(value.getBytes(StandardCharsets.UTF_8));
|
||||
return keyWriter.write(key, blob, branchRef);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -66,8 +66,8 @@ class InitGitDBRepo {
|
|||
|
||||
private void createInitialBranchOnMaster(final Repository repository) throws IOException {
|
||||
final GitDBRepo repo = new GitDBRepo(repository);
|
||||
final ObjectId objectId =
|
||||
repo.insertBlob(GitDB.VERSION.toString().getBytes(StandardCharsets.UTF_8));
|
||||
final ValueWriter valueWriter = new ValueWriter(repository);
|
||||
final ObjectId objectId = valueWriter.write(GitDB.VERSION.toString().getBytes(StandardCharsets.UTF_8));
|
||||
final ObjectId treeId = repo.insertNewTree(GIT_DB_VERSION, objectId);
|
||||
final ObjectId commitId = repo.initialCommit(treeId, INIT_MESSAGE, INIT_USER, INIT_EMAIL);
|
||||
createBranch(repository, commitId, MASTER);
|
||||
|
|
Loading…
Reference in a new issue