The Unified and Autonomous Development Platform
Do not change mode when rename a file online.
Robin Shenc1d45ef364f6
diff --git a/commons.git/src/main/java/com/pmease/commons/git/FileEdit.java b/commons.git/src/main/java/com/pmease/commons/git/FileEdit.javaindex 349bcddce8..cf4426af35 100644--- a/commons.git/src/main/java/com/pmease/commons/git/FileEdit.java+++ b/commons.git/src/main/java/com/pmease/commons/git/FileEdit.java@@ -40,6 +40,8 @@ public class FileEdit implements Serializable {private final PathAndContent newFile;+ private Integer modeBits = FileMode.TREE.getBits();+public FileEdit(@Nullable String oldPath, @Nullable PathAndContent newFile) {this.oldPath = GitUtils.normalizePath(oldPath);this.newFile = newFile;@@ -66,13 +68,14 @@ public class FileEdit implements Serializable {while (treeWalk.next()) {String name = treeWalk.getNameString();if (name.equals(currentOldPath)) {- if ((treeWalk.getFileMode(0).getBits() & FileMode.TYPE_FILE) == 0)+ modeBits = treeWalk.getFileMode(0).getBits();+ if ((modeBits & FileMode.TYPE_FILE) == 0)throw new NotFileException("Path does not represent a file: " + treeWalk.getPathString());oldPathFound = true;if (name.equals(currentNewPath)) {newPathFound = true;ObjectId blobId = inserter.insert(Constants.OBJ_BLOB, newFile.getContent());- entries.add(new TreeFormatterEntry(name, treeWalk.getFileMode(0), blobId));+ entries.add(new TreeFormatterEntry(name, FileMode.fromBits(modeBits), blobId));}} else if (name.equals(currentNewPath)) {throw new ObjectAlreadyExistException("Path already exist: " + treeWalk.getPathString());@@ -124,7 +127,7 @@ public class FileEdit implements Serializable {if (childId == null) {childName = splitted.get(i);childId = inserter.insert(Constants.OBJ_BLOB, newFile.getContent());- childMode = FileMode.REGULAR_FILE;+ childMode = FileMode.fromBits(modeBits);} else {TreeFormatter childFormatter = new TreeFormatter();childFormatter.append(childName, childMode, childId);diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/EditSavePanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/EditSavePanel.javaindex 91c2fc18c6..c158fdb705 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/EditSavePanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/editsave/EditSavePanel.java@@ -134,7 +134,7 @@ public abstract class EditSavePanel extends Panel {if (target != null) {replace(changedContainer);target.add(changedContainer);- String script = String.format("$('#%s .edit-save input[type=submit]').val('Commit and overwrite change');",+ String script = String.format("$('#%s .edit-save input[type=submit]').val('Commit and overwrite');",getMarkupId());target.appendJavaScript(script);} else {