]> source.dussan.org Git - jgit.git/commitdiff
Remove deprecated DirCacheCheckout#checkoutEntry methods 48/1200248/2
authorMatthias Sohn <matthias.sohn@sap.com>
Fri, 30 Aug 2024 15:07:01 +0000 (17:07 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Tue, 3 Sep 2024 13:52:50 +0000 (13:52 +0000)
Change-Id: I28d00d7a70af0fbb76e237dd77b929508720ecdb

org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java

index e463e9070a4336f633386f9f078d0264fa081409..7b9e70d4da0a61aa028dfddcc4493ca19985ee1a 100644 (file)
@@ -25,8 +25,9 @@ import java.time.Instant;
 
 import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.api.ResetCommand.ResetType;
+import org.eclipse.jgit.dircache.Checkout;
 import org.eclipse.jgit.dircache.DirCache;
-import org.eclipse.jgit.dircache.DirCacheCheckout;
+import org.eclipse.jgit.dircache.DirCacheCheckout.CheckoutMetadata;
 import org.eclipse.jgit.dircache.DirCacheEditor;
 import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit;
 import org.eclipse.jgit.dircache.DirCacheEntry;
@@ -38,6 +39,7 @@ import org.eclipse.jgit.junit.JGitTestUtil;
 import org.eclipse.jgit.junit.RepositoryTestCase;
 import org.eclipse.jgit.lib.ConfigConstants;
 import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.CoreConfig.EolStreamType;
 import org.eclipse.jgit.lib.FileMode;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.ObjectInserter;
@@ -303,11 +305,12 @@ public class FileTreeIteratorTest extends RepositoryTestCase {
                DirCacheEntry dce = db.readDirCache().getEntry("symlink");
                dce.setFileMode(FileMode.SYMLINK);
                try (ObjectReader objectReader = db.newObjectReader()) {
+                       Checkout checkout = new Checkout(db).setRecursiveDeletion(false);
+                       checkout.checkout(dce,
+                                       new CheckoutMetadata(EolStreamType.DIRECT, null),
+                                       objectReader, null);
                        WorkingTreeOptions options = db.getConfig()
                                        .get(WorkingTreeOptions.KEY);
-                       DirCacheCheckout.checkoutEntry(db, dce, objectReader, false, null,
-                                       options);
-
                        FileTreeIterator fti = new FileTreeIterator(trash, db.getFS(),
                                        options);
                        while (!fti.getEntryPathString().equals("symlink")) {
index fa0a82fd58c194c29828900306b333125e3f8d96..4f78404f48a1d36ca723d4bc4791bac6733fa11b 100644 (file)
@@ -1400,127 +1400,6 @@ public class DirCacheCheckout {
                }
        }
 
-       /**
-        * Updates the file in the working tree with content and mode from an entry
-        * in the index. The new content is first written to a new temporary file in
-        * the same directory as the real file. Then that new file is renamed to the
-        * final filename.
-        *
-        * <p>
-        * <b>Note:</b> if the entry path on local file system exists as a non-empty
-        * directory, and the target entry type is a link or file, the checkout will
-        * fail with {@link java.io.IOException} since existing non-empty directory
-        * cannot be renamed to file or link without deleting it recursively.
-        * </p>
-        *
-        * @param repo
-        *            repository managing the destination work tree.
-        * @param entry
-        *            the entry containing new mode and content
-        * @param or
-        *            object reader to use for checkout
-        * @throws java.io.IOException
-        *             if an IO error occurred
-        * @since 3.6
-        * @deprecated since 5.1, use
-        *             {@link #checkoutEntry(Repository, DirCacheEntry, ObjectReader, boolean, CheckoutMetadata, WorkingTreeOptions)}
-        *             instead
-        */
-       @Deprecated
-       public static void checkoutEntry(Repository repo, DirCacheEntry entry,
-                       ObjectReader or) throws IOException {
-               checkoutEntry(repo, entry, or, false, null, null);
-       }
-
-
-       /**
-        * Updates the file in the working tree with content and mode from an entry
-        * in the index. The new content is first written to a new temporary file in
-        * the same directory as the real file. Then that new file is renamed to the
-        * final filename.
-        *
-        * <p>
-        * <b>Note:</b> if the entry path on local file system exists as a file, it
-        * will be deleted and if it exists as a directory, it will be deleted
-        * recursively, independently if has any content.
-        * </p>
-        *
-        * @param repo
-        *            repository managing the destination work tree.
-        * @param entry
-        *            the entry containing new mode and content
-        * @param or
-        *            object reader to use for checkout
-        * @param deleteRecursive
-        *            true to recursively delete final path if it exists on the file
-        *            system
-        * @param checkoutMetadata
-        *            containing
-        *            <ul>
-        *            <li>smudgeFilterCommand to be run for smudging the entry to be
-        *            checked out</li>
-        *            <li>eolStreamType used for stream conversion</li>
-        *            </ul>
-        * @throws java.io.IOException
-        *             if an IO error occurred
-        * @since 4.2
-        * @deprecated since 6.3, use
-        *             {@link #checkoutEntry(Repository, DirCacheEntry, ObjectReader, boolean, CheckoutMetadata, WorkingTreeOptions)}
-        *             instead
-        */
-       @Deprecated
-       public static void checkoutEntry(Repository repo, DirCacheEntry entry,
-                       ObjectReader or, boolean deleteRecursive,
-                       CheckoutMetadata checkoutMetadata) throws IOException {
-               checkoutEntry(repo, entry, or, deleteRecursive, checkoutMetadata, null);
-       }
-
-       /**
-        * Updates the file in the working tree with content and mode from an entry
-        * in the index. The new content is first written to a new temporary file in
-        * the same directory as the real file. Then that new file is renamed to the
-        * final filename.
-        *
-        * <p>
-        * <b>Note:</b> if the entry path on local file system exists as a file, it
-        * will be deleted and if it exists as a directory, it will be deleted
-        * recursively, independently if has any content.
-        * </p>
-        *
-        * @param repo
-        *            repository managing the destination work tree.
-        * @param entry
-        *            the entry containing new mode and content
-        * @param or
-        *            object reader to use for checkout
-        * @param deleteRecursive
-        *            true to recursively delete final path if it exists on the file
-        *            system
-        * @param checkoutMetadata
-        *            containing
-        *            <ul>
-        *            <li>smudgeFilterCommand to be run for smudging the entry to be
-        *            checked out</li>
-        *            <li>eolStreamType used for stream conversion</li>
-        *            </ul>
-        * @param options
-        *            {@link WorkingTreeOptions} that are effective; if {@code null}
-        *            they are loaded from the repository config
-        * @throws java.io.IOException
-        *             if an IO error occurred
-        * @since 6.3
-        * @deprecated since 6.6.1; use {@link Checkout} instead
-        */
-       @Deprecated
-       public static void checkoutEntry(Repository repo, DirCacheEntry entry,
-                       ObjectReader or, boolean deleteRecursive,
-                       CheckoutMetadata checkoutMetadata, WorkingTreeOptions options)
-                       throws IOException {
-               Checkout checkout = new Checkout(repo, options)
-                               .setRecursiveDeletion(deleteRecursive);
-               checkout.checkout(entry, checkoutMetadata, or, null);
-       }
-
        /**
         * Return filtered content for a specific object (blob). EOL handling and
         * smudge-filter handling are applied in the same way as it would be done