Merge branch 'stable-2.12'

* stable-2.12:
  config-gerrit: Add missing database types
  config-gerrit: List database types in alphabetical order
  Submit: Eliminate confusing error message
  Fix submittabilty of merge commits that resolve conflicts
  Fix display of "Related changes" after change is rebased in web UI
  MergeValidators: Don't assume submitter record exists
  Add migration command for PostgreSQL in 2.12.1 release notes
  doc: fix link to cmd-index-activate.html page
  Update 2.12.1 release notes with more fixes
  Update 2.12.1 release notes
  Fix keyboard shortcuts for non-US keyboards
  SetParent: Explicitly set to All-Projects when not specified
  CreateProject: Explicitly set parent to All-Projects when not specified
  Organize imports
  Release notes for Gerrit 2.12.1
  Show submodule difference properly in side by side view
  Update JGit to 4.1.2.201602141800-r

The change done in I30f2f8a8e ("Fix submittabilty of merge commits that
resolve conflicts") is not compatible with the master branch due to the
database being migrated to notedb, and is reverted by this merge.

This reverts commit 126af24dd5.

Change-Id: I72fb5db6e9edbf2c97c9a3e33b8133887f71beed
This commit is contained in:
David Pursehouse
2016-02-29 18:10:51 +09:00
17 changed files with 271 additions and 63 deletions

View File

@@ -150,9 +150,13 @@ public class PatchFile {
if (tw == null) {
return Text.EMPTY;
}
if (tw.getFileMode(0).getObjectType() != Constants.OBJ_BLOB) {
if (tw.getFileMode(0).getObjectType() == Constants.OBJ_BLOB) {
return new Text(repo.open(tw.getObjectId(0), Constants.OBJ_BLOB));
} else if (tw.getFileMode(0).getObjectType() == Constants.OBJ_COMMIT) {
String str = "Subproject commit " + ObjectId.toString(tw.getObjectId(0));
return new Text(str.getBytes());
} else {
return Text.EMPTY;
}
return new Text(repo.open(tw.getObjectId(0), Constants.OBJ_BLOB));
}
}

View File

@@ -32,7 +32,6 @@ import com.google.gerrit.reviewdb.client.PatchSet;
import org.eclipse.jgit.diff.Edit;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.patch.CombinedFileHeader;
import org.eclipse.jgit.patch.FileHeader;
import org.eclipse.jgit.util.IntList;
@@ -97,10 +96,7 @@ public class PatchListEntry {
header = compact(hdr);
if (hdr instanceof CombinedFileHeader
|| hdr.getHunks().isEmpty() //
|| hdr.getOldMode() == FileMode.GITLINK
|| hdr.getNewMode() == FileMode.GITLINK) {
if (hdr instanceof CombinedFileHeader || hdr.getHunks().isEmpty()) {
edits = Collections.emptyList();
} else {
edits = Collections.unmodifiableList(editList);

View File

@@ -312,14 +312,6 @@ public class PatchListLoader implements Callable<PatchList> {
private PatchListEntry newEntry(RevTree aTree, FileHeader fileHeader,
long size, long sizeDelta) {
final FileMode oldMode = fileHeader.getOldMode();
final FileMode newMode = fileHeader.getNewMode();
if (oldMode == FileMode.GITLINK || newMode == FileMode.GITLINK) {
return new PatchListEntry(fileHeader, Collections.<Edit> emptyList(),
size, sizeDelta);
}
if (aTree == null // want combined diff
|| fileHeader.getPatchType() != PatchType.UNIFIED
|| fileHeader.getHunks().isEmpty()) {

View File

@@ -179,9 +179,7 @@ class PatchScriptBuilder {
}
boolean hugeFile = false;
if (a.mode == FileMode.GITLINK || b.mode == FileMode.GITLINK) {
// Do nothing
} else if (a.src == b.src && a.size() <= context
if (a.src == b.src && a.size() <= context
&& content.getEdits().isEmpty()) {
// Odd special case; the files are identical (100% rename or copy)
// and the user has asked for context that is larger than the file.
@@ -471,6 +469,10 @@ class PatchScriptBuilder {
} else if (mode.getObjectType() == Constants.OBJ_BLOB) {
srcContent = Text.asByteArray(db.open(id, Constants.OBJ_BLOB));
} else if (mode.getObjectType() == Constants.OBJ_COMMIT) {
String strContent = "Subproject commit " + ObjectId.toString(id);
srcContent = strContent.getBytes();
} else {
srcContent = Text.NO_BYTES;
}