Support rename in rest layer

This commit is contained in:
René Pfeuffer
2020-05-11 17:19:38 +02:00
parent fba34b3bab
commit 5421d41161
2 changed files with 30 additions and 4 deletions

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.api.v2.resources;
import com.github.sdorra.spotter.ContentTypes;
@@ -89,11 +89,14 @@ class DiffResultToDiffResultDtoMapper {
} else if (isFileNull(newPath) && isFilePath(oldPath)) {
path = oldPath;
dto.setType("delete");
} else if (!newPath.equals(oldPath)) {
path = newPath;
dto.setType("rename");
} else if (isFilePath(newPath) && isFilePath(oldPath)) {
path = newPath;
dto.setType("modify");
} else {
// TODO copy and rename?
// TODO copy?
throw new IllegalStateException("no file without path");
}