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

porcelain.status() fails when submodule directories are present #517

Closed
teward opened this issue Apr 17, 2017 · 3 comments
Closed

porcelain.status() fails when submodule directories are present #517

teward opened this issue Apr 17, 2017 · 3 comments

Comments

@teward
Copy link

teward commented Apr 17, 2017

Hello.

There is a small issue with Dulwich and it's Porcelain.status() functions. I'm working on a git project that has submodules and some other folders, and I get some failure cases with porcelain.status() (this is from a Python 3 shell):

Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from dulwich.repo import Repo; from dulwich import porcelain
>>> repo = Repo('.')
>>> porcelain.status()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/dulwich/porcelain.py", line 743, in status
    unstaged_changes = list(get_unstaged_changes(r.open_index(), r.path))
  File "/usr/local/lib/python3.5/dist-packages/dulwich/index.py", line 567, in get_unstaged_changes
    blob = blob_from_path_and_stat(full_path, os.lstat(full_path))
  File "/usr/local/lib/python3.5/dist-packages/dulwich/index.py", line 545, in blob_from_path_and_stat
    with open(fs_path, 'rb') as f:
IsADirectoryError: [Errno 21] Is a directory: b'./ChatExchange'
>>> porcelain.status(repo)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/dulwich/porcelain.py", line 743, in status
    unstaged_changes = list(get_unstaged_changes(r.open_index(), r.path))
  File "/usr/local/lib/python3.5/dist-packages/dulwich/index.py", line 567, in get_unstaged_changes
    blob = blob_from_path_and_stat(full_path, os.lstat(full_path))
  File "/usr/local/lib/python3.5/dist-packages/dulwich/index.py", line 545, in blob_from_path_and_stat
    with open(fs_path, 'rb') as f:
IsADirectoryError: [Errno 21] Is a directory: b'./ChatExchange'
>>> import os
>>> os.getcwd()
'/home/teward/VCS Repos/GitHub/teward/SmokeDetector'

Why it's checking a directory that is a submodule, I'm not sure. Is this a limitation of the 'porcelain' system, and ultimately not the proper way to get current git status?

@jelmer
Copy link
Owner

jelmer commented Apr 19, 2017 via email

@teward
Copy link
Author

teward commented May 4, 2017

@jelmer Your message never got back to me, sorry. Is it not possible to check if there's a submodule and if so "skip" that directory? While that's not the easiest thing to do, surely somewhere in git repo data and configuration that information is stored, and we can exclude submodule items from checks.

@jelmer
Copy link
Owner

jelmer commented May 4, 2017 via email

@jelmer jelmer closed this as completed in e174472 Jul 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants