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

MissingObjectException when running git status after adding an empty directory to jgit #120

Open
MohammedKHC0 opened this issue Dec 13, 2024 · 1 comment

Comments

@MohammedKHC0
Copy link

Version

7.1.0

Operating System

Linux/Unix

Bug description

Run the following commands to reproduce

  1. jgit init
  2. mkdir test
  3. jgit add test
  4. jgit status

It crash with MissingObjectException unknown object 00000000000000000

Actual behavior

It crash with MissingObjectException unknown object 00000000000000000

Expected behavior

Work just like actual c git, if you run the same commands it won't crash.

Relevant log output

No response

Other information

I think in order to fix the bug. Before adding a directory check if it's not empty.

@msohn
Copy link
Member

msohn commented Dec 13, 2024

I tried using the tip of the master branch and couldn't reproduce the problem.
Running add on an empty folder shouldn't do anything because git only tracks files but not directories.
This means after the add command the repository is still empty and running find on the .git directory finds no objects:

$ find .git/
.git/
.git/config
.git/objects
.git/objects/pack
.git/objects/info
.git/HEAD
.git/logs
.git/logs/refs
.git/logs/refs/heads
.git/hooks
.git/refs
.git/refs/heads
.git/refs/tags
.git/index
.git/branches

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