plugins/git: Set job error before emitResult()
ClosedPublic

Authored by aspotashev on Feb 24 2017, 6:55 PM.

Details

Summary

GitPlugin::copy()->exec() did always return true, even on failure.

Test Plan

Copy-paste files/folders inside a Git root without write permissions on the destination folder is expected to fail. ProjectManagerViewPlugin::pasteFromContextMenu() will display a warning dialog in this case.

Diff Detail

Repository
R33 KDevPlatform
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
aspotashev created this revision.Feb 24 2017, 6:55 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptFeb 24 2017, 6:55 PM
kfunk accepted this revision.Feb 24 2017, 10:09 PM

To 5.1 branch please

This revision is now accepted and ready to land.Feb 24 2017, 10:09 PM
This revision was automatically updated to reflect the committed changes.
apol added a subscriber: apol.Mar 1 2017, 12:11 PM

Are you sure this doesn't change the behvior in other areas? now it's calling emitResult and it didn't use to.

In D4771#91293, @apol wrote:

Are you sure this doesn't change the behvior in other areas? now it's calling emitResult and it didn't use to.

Here is the exhaustive list of code paths that use gitplugin's class StandardJob:

  1. KDevelop::copyUrl() -> IBasicVersionControl::copy() implemented in GitPlugin::copy() -> return new StandardJob(...)
  2. KDevelop::renameUrl() -> IBasicVersionControl::move() implemented in GitPlugin::move() -> return new StandardJob(...)

(I've grepped kdevelop.git and kdevplatform.git for all calls to move() and copy() to be sure.)

In both KDevelop::renameUrl and KDevelop::copyUrl the obtained StandardJob object is only used to call exec() on it and then it's abandoned (I hope it's also deleted by DeleteLater). Since I manually tested renameUrl/copyUrl in one scenario (cut/copy-paste), those should work for all.