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

git submodule add followed by git crecord fails with IsADirectoryError #27

Open
carun opened this issue Aug 6, 2020 · 3 comments
Open

Comments

@carun
Copy link
Contributor

carun commented Aug 6, 2020

2020-08-06 15:38:07 ~/code/aim-es-v3 (neoface-license-deps)
$ git submodule add --name neoface-license-dependencies ssh://[email protected]:7999/did/neoface-license-dependencies.git docker/neoface-license-dependencies

2020-08-06 15:43:07 ~/code/aim-es-v3 (neoface-license-deps)
$ git status
On branch feature/neoface-license-deps
Your branch is up to date with 'origin/feature/neoface-license-deps'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   .gitmodules
        new file:   docker/neoface-license-dependencies

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)

        modified:   docker/neoface-license-dependencies (untracked content)

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        build/

2020-08-06 15:38:20 ~/code/aim-es-v3 (neoface-license-deps)
$ git crecord
Traceback (most recent call last):
  File "/usr/local/bin/git-crecord", line 11, in <module>
    load_entry_point('git-crecord==20161226.0', 'console_scripts', 'git-crecord')()
  File "/usr/local/lib/python3.6/dist-packages/git_crecord-20161226.0-py3.6.egg/git_crecord/main.py", line 193, in main
  File "/usr/local/lib/python3.6/dist-packages/git_crecord-20161226.0-py3.6.egg/git_crecord/crecord_core.py", line 190, in dorecord
  File "/usr/local/lib/python3.6/dist-packages/git_crecord-20161226.0-py3.6.egg/git_crecord/crecord_core.py", line 111, in recordfunc
  File "/usr/local/lib/python3.6/dist-packages/git_crecord-20161226.0-py3.6.egg/git_crecord/util.py", line 97, in copyfile
  File "/usr/lib/python3.6/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
IsADirectoryError: [Errno 21] Is a directory: '/home/arun/code/aim-es-v3/docker/neoface-license-dependencies'
2020-08-06 15:38:32 ~/code/aim-es-v3 (neoface-license-deps)
$
@andrewshadura
Copy link
Owner

andrewshadura commented Aug 7, 2020

Thanks! I’ll try to find time to investigate this.

@andrewshadura
Copy link
Owner

By the way, have you tried the latest Git version? It shouldn’t make any difference, but just to be sure.

andrewshadura added a commit that referenced this issue Oct 25, 2020
This is a partial solution to #27.

The proper solution is to detect submodules by checking what actually is
in the tree we’re going to commit, e.g.:

    $ git ls-tree HEAD^{tree}
    040000 tree 2ff93a1a60f91a971c8d308337906139f0c989e0	.dir1
    100644 blob c4c4ffc6aa41a87cc618a31d19f6d5724ddf2b10	.file1
    100644 blob db2e58b6f2f8a0f1a297df6efeae1616dc03a058	file2
    040000 tree db286da7891a18e945ba35d3c7d906d47c5fce35	dir2
    040000 tree a0c41a01caaf1ddf01e3944e29f82e0c62e905ed	dir3
    100644 blob 1331ed7c1f61a78fad666a591e9addd2f12b759a	file3
    160000 commit 1fae6eaad2c849fe67a082409502eddb8c08de76	submodule1
@andrewshadura
Copy link
Owner

I’ve added a change which should enable committing submodules, but it still prints a (harmless) error.
I will look into a proper fix later.

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