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

Fails when a project has a dirty submodule #19

Open
vilhok opened this issue Jan 7, 2023 · 0 comments
Open

Fails when a project has a dirty submodule #19

vilhok opened this issue Jan 7, 2023 · 0 comments

Comments

@vilhok
Copy link

vilhok commented Jan 7, 2023

Here is a minimum example the causes the crash:

cd /tmp
mkdir dunk-submodule-fail
cd dunk-submodule-fail
git init
mkdir this-is-submodule
cd this-is-submodule
git init 
echo "test" > myfile.txt && git add --all && git commit -m "initial-sub"
cd ..
# git submodule add ./this-is-submodule # not actually needed.
git add --all && git commit -m "initial-parent"

# have an uncommitted changed file in the submodule
echo "breaking change" > this-is-submodule/myfile.txt

git diff | dunk  

traceback

Traceback (most recent call last):
  File "/home/user/.local/bin/dunk", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/pipx/venvs/dunk/lib/python3.10/site-packages/dunk/dunk.py", line 119, in main
    target_code = target_file.read_text()
  File "/usr/lib/python3.10/pathlib.py", line 1134, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "/usr/lib/python3.10/pathlib.py", line 1119, in open
    return self._accessor.open(self, mode, buffering, encoding, errors,
IsADirectoryError: [Errno 21] Is a directory: '/tmp/dunk-submodule-fail/this-is-submodule'

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

1 participant