mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-12-23 00:39:47 +01:00
Cleanup
This commit is contained in:
@@ -114,19 +114,23 @@ public class GitModifyCommand extends AbstractGitCommand implements ModifyComman
|
||||
if (StringUtils.isNotBlank(branch)) {
|
||||
try {
|
||||
getClone().checkout().setName(branch).setCreateBranch(true).call();
|
||||
ConfigurationStore<GitRepositoryConfig> store = gitRepositoryConfigStoreProvider
|
||||
.get(repository);
|
||||
GitRepositoryConfig gitRepositoryConfig = store
|
||||
.getOptional()
|
||||
.orElse(new GitRepositoryConfig());
|
||||
gitRepositoryConfig.setDefaultBranch(branch);
|
||||
store.set(gitRepositoryConfig);
|
||||
setBranchInConfig(branch);
|
||||
} catch (GitAPIException e) {
|
||||
throw new InternalRepositoryException(repository, "could not create default branch for initial commit", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setBranchInConfig(String branch) {
|
||||
ConfigurationStore<GitRepositoryConfig> store = gitRepositoryConfigStoreProvider
|
||||
.get(repository);
|
||||
GitRepositoryConfig gitRepositoryConfig = store
|
||||
.getOptional()
|
||||
.orElse(new GitRepositoryConfig());
|
||||
gitRepositoryConfig.setDefaultBranch(branch);
|
||||
store.set(gitRepositoryConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFileToScm(String name, Path file) {
|
||||
addToGitWithLfsSupport(name, file);
|
||||
|
||||
Reference in New Issue
Block a user