[git] IDEA-104846 Fix pushing new branch without new commits

The bug was introduce in b200615c when we stopped showing last 5
commits for new branches, and began to show only those commits which
will be actually pushed.

To avoid the problem check for "nothing to push" (0 commits) only in
the standard case, when the branch is pushed to its tracked branch.
This commit is contained in:
Kirill Likhodedov
2013-04-11 12:54:54 +04:00
parent 40d696eae3
commit 9dadba3a2a
@@ -239,7 +239,12 @@ public final class GitPusher {
GitCommitsByRepoAndBranch commits = pushInfo.getCommits();
for (GitRepository repository : commits.getRepositories()) {
if (commits.get(repository).getAllCommits().size() == 0) { // don't push repositories where there is nothing to push. Note that when a branch is created, several recent commits are stored in the pushInfo.
GitCommitsByBranch commitsForRepo = commits.get(repository);
GitLocalBranch sourceBranch = pushInfo.getPushSpecs().get(repository).getSource();
if (commitsForRepo.get(sourceBranch).getType() == GitPushBranchInfo.Type.STANDARD &&
commitsForRepo.getAllCommits().size() == 0) {
// don't push repositories where there is nothing to push.
// however, do push if new branch is created, even without commits
continue;
}
GitPushRepoResult repoResult = pushRepository(pushInfo, commits, repository);