-2

I have a java project and when I remove a directory with some classes I can not identify in the git repository was removed, I can only identify that all classes have been removed.

I need to identify it because I have a tool that makes transferring files to another directory.

You can identify the deletion of the directory?

I am using the API JGit.

Thank you.

1 Answers1

1

Git doesn't track directories, only files. There are plenty of explanations just a web search away.

Regarding how to detect this: You can walk the tree of the commit and check if there is still a file within that directory path. If there is not, it means all the files from that directory have been deleted (which is equivalent to the directory being deleted in Git).

To help with the code, it would be good if you include what you already have in the question.

robinst
  • 30,027
  • 10
  • 102
  • 108