smacker / libgit2.cr

Crystal-lang binding to libgit2 with interface similar to rugged
MIT License
34 stars 12 forks source link

crystal spec fails missing directory #12

Closed szabgab closed 2 years ago

szabgab commented 3 years ago

After cloning the repository and installing sudo apt-get install -y libgit2-dev I ran

crystal spec
Unhandled exception: Error opening file with mode 'r': '../libgit2.cr/spec/libgit2/tests/resources/testrepo.git/.': No such file or directory (File::NotFoundError)
straight-shoota commented 3 years ago

The test data from libgit2 and rugged is included via git submodules. You probably need to fetch them as well. git submodule init && git submodule update should do that. Alternatively, you could run git clone with --recurse-submodules.

This extra step should be mentioned in the README.

However, I would suggest to import these remote repositories with git-subtree. Subtrees are IMO way easier to use and reason about than submodules. The main difference is that submodule only keeps a reference to the remote repository (hence you need to explicitly fetch the contents) whereas subtree includes the entire content of the remote repository (but it keeps track on where it came from and it's easy to pull in upstream changes).

szabgab commented 3 years ago

Now it fails on my computer with this error:

Failures:

  1) Git::Diff patch and to_s
     Failure/Error: deltas.size.should eq(2)

       Expected: 2
            got: 5

     # spec/diff_spec.cr:134

and on the GitHub Actions with this: https://github.com/szabgab/libgit2.cr/runs/2907767480?check_suite_focus=true

I wonder if the source of these errors is that I use sudo apt-get install -y libgit2-dev to install the external dependency insead of compiling from source as it is done in the .travis.sh

paulocoghi commented 2 years ago

With the PR https://github.com/smacker/libgit2.cr/pull/14, is it safe to close this issue?