IDEA-86695 Git cherry-pick changes not committed - trying to debug

Don't silently ignore the fact of invalid CheckinEnvironment or empty list to commit, but log an error.
This commit is contained in:
Kirill Likhodedov
2012-05-28 16:04:53 +04:00
parent 08a36f555d
commit 32dc1b5c50
2 changed files with 13 additions and 13 deletions
@@ -142,6 +142,7 @@ public class GitCheckinEnvironment implements CheckinEnvironment {
@NotNull NullableFunction<Object, Object> parametersHolder, Set<String> feedback) {
List<VcsException> exceptions = new ArrayList<VcsException>();
Map<VirtualFile, Collection<Change>> sortedChanges = sortChangesByGitRoot(changes, exceptions);
log.assertTrue(!sortedChanges.isEmpty(), "Trying to commit an empty list of changes: " + changes);
if (GitFileSeparatorConverter.convertSeparatorsIfNeeded(myProject, mySettings, sortedChanges, exceptions)) {
for (Map.Entry<VirtualFile, Collection<Change>> entry : sortedChanges.entrySet()) {
Set<FilePath> files = new HashSet<FilePath>();
@@ -497,21 +497,20 @@ public class GitCherryPicker {
final Collection<Document> committingDocs = markCommittingDocs();
try {
CheckinEnvironment ce = myPlatformFacade.getVcs(myProject).getCheckinEnvironment();
if (ce != null && ce instanceof GitCheckinEnvironment) {
try {
((GitCheckinEnvironment)ce).reset();
List<VcsException> exceptions = ce.commit(myChanges, myCommitMessage);
VcsDirtyScopeManager.getInstance(myProject).filePathsDirty(ChangesUtil.getPaths(myChanges), null);
if (exceptions != null && !exceptions.isEmpty()) {
VcsException exception = exceptions.get(0);
handleError(exception);
}
}
catch (Throwable e) {
LOG.error(e);
handleError(e);
LOG.assertTrue(ce != null && ce instanceof GitCheckinEnvironment, "Invalid CheckinEnvironment: " + ce);
try {
((GitCheckinEnvironment)ce).reset();
List<VcsException> exceptions = ce.commit(myChanges, myCommitMessage);
VcsDirtyScopeManager.getInstance(myProject).filePathsDirty(ChangesUtil.getPaths(myChanges), null);
if (exceptions != null && !exceptions.isEmpty()) {
VcsException exception = exceptions.get(0);
handleError(exception);
}
}
catch (Throwable e) {
LOG.error(e);
handleError(e);
}
}
finally {
unmarkCommittingDocs(committingDocs);