Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.eclipse.jgit.api.errors.CheckoutConflictException happens in Mac #126

Open
YoshikiHigo opened this issue Dec 26, 2018 · 5 comments
Open

Comments

@YoshikiHigo
Copy link
Member

対象:https://github.com/zxing/zxing
コマンド:git fg --src zxing.git --des zxing.fg

> git fg --src zxing.git --des zxing.fg
org.eclipse.jgit.api.errors.CheckoutConflictException: Checkout conflict with file: Cannot delete file: /Users/higo/Data/tmp/zxing.fg/.github
	at org.eclipse.jgit.api.ResetCommand.checkoutIndex(ResetCommand.java:449)
	at org.eclipse.jgit.api.ResetCommand.call(ResetCommand.java:215)
	at finergit.GitRepo.resetHard(GitRepo.java:488)
	at finergit.TreeRewriteFinerRepoBuilder.exec(TreeRewriteFinerRepoBuilder.java:45)
	at finergit.FinerGitMain.exec(FinerGitMain.java:65)
	at finergit.FinerGitMain.main(FinerGitMain.java:40)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at finergit.JarEntryPoint.main(JarEntryPoint.java:21)
Caused by: org.eclipse.jgit.errors.CheckoutConflictException: Checkout conflict with file: Cannot delete file: /Users/higo/Data/tmp/zxing.fg/.github
	at org.eclipse.jgit.dircache.DirCacheCheckout.cleanUpConflicts(DirCacheCheckout.java:1282)
	at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:518)
	at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:484)
	at org.eclipse.jgit.api.ResetCommand.checkoutIndex(ResetCommand.java:447)
	... 10 more
@sh5i
Copy link
Collaborator

sh5i commented Dec 26, 2018

再現しました.コミットされていない(子を持つ)ディレクトリをクリーンアップできないという jgit のバグだと思います.以下のコメントを見る限り,認識はされているようです.
https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java#L1271

@YoshikiHigo
Copy link
Member Author

あー,そうなんですね,どうしようかな..

@sh5i
Copy link
Collaborator

sh5i commented Dec 26, 2018

#114 同様,git コマンドを使えば正しく動きます.
Java 層で解決する場合,正攻法(本家を直す)以外の workaround としては,この例外が上がってきたときに,ディレクトリを消して再挑戦することはできると思います.

@sh5i
Copy link
Collaborator

sh5i commented Dec 26, 2018

あるいは,ファイルをすべて消した状態から始めるという方法もあるかもしれません.

@YoshikiHigo
Copy link
Member Author

とりあえずの対処として,そのエラーが起こった場合には手動で git reset --hard と git clean をすることにします.例の100のプロジェクトで数個程度だったので.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants