Community
Participate
Working Groups
The NPE occurs on a checkout --force if there is a file that exists in head, merge, and working tree, but not in the index. Reproducer: $ mkdir chktest $ cd chktest $ git init $ echo foo > foo.txt $ git add foo.txt $ git commit -m "initial" [master (root-commit) 531b309] initial 1 file changed, 1 insertion(+) create mode 100644 foo.txt $ git checkout -b test Switched to a new branch 'test' $ echo bar > bar.txt $ git add bar.txt $ git commit -m "bar.txt" [test 748158a] bar.txt 1 file changed, 1 insertion(+) create mode 100644 bar.txt $ git checkout master Switched to branch 'master' $ echo bar > bar.txt $ git add bar.txt $ git commit -m "bar on master" [master d381c79] bar on master 1 file changed, 1 insertion(+) create mode 100644 bar.txt $ git rm --cached bar.txt rm 'bar.txt' $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) deleted: bar.txt Untracked files: (use "git add <file>..." to include in what will be committed) bar.txt $ git checkout --force test Switched to branch 'test' $ git status On branch test nothing to commit, working tree clean $ git checkout master Switched to branch 'master' $ git rm --cached bar.txt rm 'bar.txt' $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) deleted: bar.txt Untracked files: (use "git add <file>..." to include in what will be committed) bar.txt $ ../jgit-5.10.sh checkout --force test java.lang.NullPointerException at org.eclipse.jgit.dircache.DirCacheCheckout.checkoutEntry(DirCacheCheckout.java:1452) at org.eclipse.jgit.dircache.DirCacheCheckout.keep(DirCacheCheckout.java:1222) at org.eclipse.jgit.dircache.DirCacheCheckout.processEntry(DirCacheCheckout.java:952) at org.eclipse.jgit.dircache.DirCacheCheckout.preScanTwoTrees(DirCacheCheckout.java:309) at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:496) at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:467) at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:248) at org.eclipse.jgit.pgm.Checkout.run(Checkout.java:82) at org.eclipse.jgit.pgm.TextBuiltin.execute(TextBuiltin.java:235) at org.eclipse.jgit.pgm.Main.execute(Main.java:245) at org.eclipse.jgit.pgm.Main.run(Main.java:133) at org.eclipse.jgit.pgm.Main.main(Main.java:105) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/174143
Gerrit change https://git.eclipse.org/r/c/jgit/jgit/+/174143 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=5b1a6e0e382da62e8678afdb2524109efb38eeb4