]> source.dussan.org Git - jgit.git/commit
Fix "jgit checkout -f" to overwrite dirty worktree files 81/117181/9
authorChristian Halstrick <christian.halstrick@sap.com>
Mon, 12 Feb 2018 14:44:04 +0000 (15:44 +0100)
committerChristian Halstrick <christian.halstrick@sap.com>
Tue, 8 Jan 2019 09:01:09 +0000 (10:01 +0100)
commite406d500de01b9ae7155e296baebf3ec8024869d
tree3873d4a07a3c46d662d7ed5d66cd234c2f07188c
parent6c8240a75126013b7f4588d78e66baa54e89cbfc
Fix "jgit checkout -f" to overwrite dirty worktree files

CheckoutCommand had a setForce() method. But this didn't correspond
to native git's 'git checkout -f' option. Deprecate the old setForce()
method and move its implementation to a new method setForceRefUpdate()
and use it to implement the -B option in the CLI class Checkout.

Add a setForced() method and use it to fix the associated '-f' option of
the CLI Checkout class to behave like native git's 'git checkout -f'
which overwrites dirty worktree files during checkout.

This is still not fully matching native git's behavior: updating
additionally dirty index entries is not done yet.

Bug: 530771
Change-Id: I776b78eb623b6ea0aca42f681788f2e4b1667f15
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit.ant/src/org/eclipse/jgit/ant/tasks/GitCheckoutTask.java
org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CheckoutTest.java
org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CheckoutCommandTest.java
org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java