diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2013-02-13 23:12:03 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2013-02-13 23:12:40 +0100 |
commit | 647acec3d9ead269b977dc03c52c8e1d86ca3980 (patch) | |
tree | f2e22d17cddaa15c5ceb9c5be245d86179471845 | |
parent | c0cfcc76e004e041f7e166e55e5d00e8b9b22aff (diff) | |
parent | 9a5f4b46ccac22dd3dec8205ab50ec84f495db2f (diff) | |
download | jgit-647acec3d9ead269b977dc03c52c8e1d86ca3980.tar.gz jgit-647acec3d9ead269b977dc03c52c8e1d86ca3980.zip |
Merge branch 'stable-2.3'
* stable-2.3:
Prepare post 2.3.0.201302130906 builds
JGit v2.3.0.201302130906
Replace explicit version by property where possible
Add better documentation to DirCacheCheckout
Prepare post 2.3rc1 builds
JGit v2.3.0.201302060400-rc1
Change-Id: I5a7626014dc38e7623937a4241dbf8a6db05c1f9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 files changed, 148 insertions, 10 deletions
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/pom.xml index 2d80a2b6f7..9431d315a0 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/pom.xml +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/pom.xml @@ -63,7 +63,7 @@ <dependency> <groupId>org.eclipse.jgit</groupId> <artifactId>org.eclipse.jgit</artifactId> - <version>2.3.0-SNAPSHOT</version> + <version>${project.version}</version> </dependency> </dependencies> diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/pom.xml index 3eacb67049..3acd173af3 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/pom.xml +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/pom.xml @@ -63,17 +63,17 @@ <dependency> <groupId>org.eclipse.jgit</groupId> <artifactId>org.eclipse.jgit.junit</artifactId> - <version>2.3.0-SNAPSHOT</version> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.eclipse.jgit</groupId> <artifactId>org.eclipse.jgit.junit.http</artifactId> - <version>2.3.0-SNAPSHOT</version> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.eclipse.jgit</groupId> <artifactId>org.eclipse.jgit.http.server</artifactId> - <version>2.3.0-SNAPSHOT</version> + <version>${project.version}</version> </dependency> </dependencies> diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/pom.xml index 68101521d1..572eb76a3d 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/pom.xml +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/pom.xml @@ -64,19 +64,19 @@ <dependency> <groupId>org.eclipse.jgit</groupId> <artifactId>org.eclipse.jgit</artifactId> - <version>2.3.0-SNAPSHOT</version> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.eclipse.jgit</groupId> <artifactId>org.eclipse.jgit.pgm</artifactId> - <version>2.3.0-SNAPSHOT</version> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.eclipse.jgit</groupId> <artifactId>org.eclipse.jgit.ui</artifactId> - <version>2.3.0-SNAPSHOT</version> + <version>${project.version}</version> </dependency> </dependencies> diff --git a/org.eclipse.jgit.packaging/pom.xml b/org.eclipse.jgit.packaging/pom.xml index f00be89b0a..cf17609597 100644 --- a/org.eclipse.jgit.packaging/pom.xml +++ b/org.eclipse.jgit.packaging/pom.xml @@ -99,7 +99,7 @@ <dependency> <groupId>org.eclipse.jgit</groupId> <artifactId>org.eclipse.jgit</artifactId> - <version>2.3.0-SNAPSHOT</version> + <version>${project.version}</version> <classifier>sources</classifier> </dependency> <dependency> diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java index 7629de6434..292206e539 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java @@ -683,6 +683,8 @@ public class DirCacheCheckout { } if (i == null) { + // Nothing in Index + // At least one of Head, Index, Merge is not empty // make sure not to overwrite untracked files if (f != null) { // A submodule is not a file. We should ignore it @@ -711,17 +713,37 @@ public class DirCacheCheckout { */ if (h == null) + // Nothing in Head + // Nothing in Index + // At least one of Head, Index, Merge is not empty + // -> only Merge contains something for this path. Use it! + // Potentially update the file update(name, mId, mMode); // 1 else if (m == null) + // Nothing in Merge + // Something in Head + // Nothing in Index + // -> only Head contains something for this path and it should + // be deleted. Potentially removes the file! remove(name); // 2 else { // 3 + // Something in Merge + // Something in Head + // Nothing in Index + // -> Head and Merge contain something (maybe not the same) and + // in the index there is nothing (e.g. 'git rm ...' was + // called before). Ignore the cached deletion and use what we + // find in Merge. Potentially updates the file. if (equalIdAndMode(hId, hMode, mId, mMode)) keep(dce); else conflict(name, dce, h, m); } } else { + // Something in Index if (h == null) { + // Nothing in Head + // Something in Index /** * <pre> * clean I==H I==M H M Result @@ -737,17 +759,54 @@ public class DirCacheCheckout { */ if (m == null || equalIdAndMode(mId, mMode, iId, iMode)) { + // Merge contains nothing or the same as Index + // Nothing in Head + // Something in Index if (m==null && walk.isDirectoryFileConflict()) { + // Nothing in Merge and current path is part of + // File/Folder conflict + // Nothing in Head + // Something in Index if (dce != null && (f == null || f.isModified(dce, true))) + // No file or file is dirty + // Nothing in Merge and current path is part of + // File/Folder conflict + // Nothing in Head + // Something in Index + // -> File folder conflict and Merge wants this + // path to be removed. Since the file is dirty + // report a conflict conflict(name, dce, h, m); else + // A file is present and file is not dirty + // Nothing in Merge and current path is part of + // File/Folder conflict + // Nothing in Head + // Something in Index + // -> File folder conflict and Merge wants this path + // to be removed. Since the file is not dirty remove + // file and index entry remove(name); } else + // Something in Merge or current path is not part of + // File/Folder conflict + // Merge contains nothing or the same as Index + // Nothing in Head + // Something in Index + // -> Merge contains nothing new. Keep the index. keep(dce); } else + // Merge contains something and it is not the same as Index + // Nothing in Head + // Something in Index + // -> Index contains something new (different from Head) + // and Merge is different from Index. Report a conflict conflict(name, dce, h, m); } else if (m == null) { + // Nothing in Merge + // Something in Head + // Something in Index /** * <pre> @@ -761,36 +820,115 @@ public class DirCacheCheckout { */ if (iMode == FileMode.GITLINK) { + // A submodule in Index + // Nothing in Merge + // Something in Head // Submodules that disappear from the checkout must // be removed from the index, but not deleted from disk. remove(name); } else { + // Something different from a submodule in Index + // Nothing in Merge + // Something in Head if (equalIdAndMode(hId, hMode, iId, iMode)) { + // Index contains the same as Head + // Something different from a submodule in Index + // Nothing in Merge + // Something in Head if (f == null || f.isModified(dce, true)) + // file is dirty + // Index contains the same as Head + // Something different from a submodule in Index + // Nothing in Merge + // Something in Head + // -> file is dirty but is should be removed. That's + // a conflict conflict(name, dce, h, m); else + // file doesn't exist or is clean + // Index contains the same as Head + // Something different from a submodule in Index + // Nothing in Merge + // Something in Head + // -> Remove from index and delete the file remove(name); } else + // Index contains something different from Head + // Something different from a submodule in Index + // Nothing in Merge + // Something in Head + // -> Something new is in index (and maybe even on the + // filesystem). But Merge wants the path to be removed. + // Report a conflict conflict(name, dce, h, m); } } else { + // Something in Merge + // Something in Head + // Something in Index if (!equalIdAndMode(hId, hMode, mId, mMode) && !equalIdAndMode(hId, hMode, iId, iMode) && !equalIdAndMode(mId, mMode, iId, iMode)) + // All three contents in Head, Merge, Index differ from each + // other + // -> All contents differ. Report a conflict. conflict(name, dce, h, m); - else if (equalIdAndMode(hId, hMode, iId, iMode) + else + // At least two of the contents of Head, Index, Merge + // are the same + // Something in Merge + // Something in Head + // Something in Index + + if (equalIdAndMode(hId, hMode, iId, iMode) && !equalIdAndMode(mId, mMode, iId, iMode)) { + // Head contains the same as Index. Merge differs + // Something in Merge + // For submodules just update the index with the new SHA-1 if (dce != null && FileMode.GITLINK.equals(dce.getFileMode())) { + // Index and Head contain the same submodule. Merge + // differs + // Something in Merge + // -> Nothing new in index. Move to merge. + // Potentially updates the file + + // TODO check that we don't overwrite some unsaved + // file content update(name, mId, mMode); } else if (dce != null && (f == null || f.isModified(dce, true))) { + // File doesn't exist or is dirty + // Head and Index don't contain a submodule + // Head contains the same as Index. Merge differs + // Something in Merge + // -> Merge wants the index and file to be updated + // but the file is dirty. Report a conflict conflict(name, dce, h, m); } else { + // File exists and is clean + // Head and Index don't contain a submodule + // Head contains the same as Index. Merge differs + // Something in Merge + // -> Standard case when switching between branches: + // Nothing new in index but something different in + // Merge. Update index and file update(name, mId, mMode); } } else { + // Head differs from index or merge is same as index + // At least two of the contents of Head, Index, Merge + // are the same + // Something in Merge + // Something in Head + // Something in Index + + // Can be formulated as: Either all three states are + // equal or Merge is equal to Head or Index and differs + // to the other one. + // -> In all three cases we don't touch index and file. + keep(dce); } } @@ -175,7 +175,7 @@ <maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format> <bundle-manifest>${project.build.directory}/META-INF/MANIFEST.MF</bundle-manifest> - <jgit-last-release-version>2.1.0.201209190230-r</jgit-last-release-version> + <jgit-last-release-version>2.2.0.201212191850-r</jgit-last-release-version> <jsch-version>0.1.46</jsch-version> <junit-version>4.5</junit-version> <!-- TODO: update Maven dependency for args4j to 2.0.21 as soon as available on Maven Central --> |