From 9dadba3a2ab286f04317116f2d9ad549d4e9eb54 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Wed, 10 Apr 2013 21:11:30 +0400 Subject: [PATCH] [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. --- plugins/git4idea/src/git4idea/push/GitPusher.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/git4idea/src/git4idea/push/GitPusher.java b/plugins/git4idea/src/git4idea/push/GitPusher.java index e56d15c1b6c4..fd06e8c149d4 100644 --- a/plugins/git4idea/src/git4idea/push/GitPusher.java +++ b/plugins/git4idea/src/git4idea/push/GitPusher.java @@ -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);