GitPython icon indicating copy to clipboard operation
GitPython copied to clipboard

Repo.submodule_update throws BadName error

Open keestux opened this issue 6 years ago • 2 comments
trafficstars

The function submodule_update gets confused when there are multiple submodules, especially when one of the submodules has an update. In that case the commit hash is used for the wrong submodule. It is hard to debug, because running the same update again does not show the error.

With debug logging you'll see that update info lines are accumulated, but the code isn't expecting this to be the case.

[10:16.56] git.cmd      DEBUG    Popen(['git', 'fetch', '--prune', '-v', 'origin'], cwd=/foo/mainrepo, universal_newlines=True, shell=None)
[10:16.56] git.cmd      DEBUG    Popen(['git', 'tag', '-d'], cwd=/foo/mainrepo, universal_newlines=False, shell=None)
[10:16.56] git.cmd      DEBUG    Popen(['git', 'fetch', '--prune', '--tags', '-v', 'origin'], cwd=/foo/mainrepo, universal_newlines=True, shell=None)
[10:16.57] git.cmd      DEBUG    Popen(['git', 'diff', '--cached', '--abbrev=40', '--full-index', '--raw'], cwd=/foo/mainrepo, universal_newlines=False, shell=None)
[10:16.57] git.cmd      DEBUG    Popen(['git', 'diff', '--abbrev=40', '--full-index', '--raw'], cwd=/foo/mainrepo, universal_newlines=False, shell=None)
[10:16.57] git.cmd      DEBUG    Popen(['git', 'reset', '--hard', 'origin/master', '--'], cwd=/foo/mainrepo, universal_newlines=False, shell=None)
[10:16.57] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch-check'], cwd=/foo/mainrepo, universal_newlines=False, shell=None)
[10:16.57] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch'], cwd=/foo/mainrepo, universal_newlines=False, shell=None)
[10:16.57] git.cmd      DEBUG    Popen(['git', 'version'], cwd=/foo/mainrepo/sub1, universal_newlines=False, shell=None)
[10:16.57] git.cmd      DEBUG    Popen(['git', 'fetch', '--progress', '-v', 'origin'], cwd=/foo/mainrepo/sub1, universal_newlines=True, shell=None)
[10:16.58] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch-check'], cwd=/foo/mainrepo/sub1, universal_newlines=False, shell=None)
[10:16.58] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch-check'], cwd=/foo/mainrepo/sub1, universal_newlines=False, shell=None)
[10:16.58] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch'], cwd=/foo/mainrepo/sub1, universal_newlines=False, shell=None)
[10:16.58] git.cmd      DEBUG    Popen(['git', 'version'], cwd=/foo/mainrepo/sub2, universal_newlines=False, shell=None)
[10:16.58] git.cmd      DEBUG    Popen(['git', 'fetch', '--progress', '-v', 'origin'], cwd=/foo/mainrepo/sub2, universal_newlines=True, shell=None)
[10:16.58] git.remote   DEBUG    Fetch head lines do not match lines provided via progress information
length of progress lines 80 should be equal to lines in FETCH_HEAD file 19
Will ignore extra progress lines or fetch head lines.
[10:16.58] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch-check'], cwd=/foo/mainrepo/sub2, universal_newlines=False, shell=None)
[10:16.58] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch-check'], cwd=/foo/mainrepo/sub2, universal_newlines=False, shell=None)
[10:16.58] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch'], cwd=/foo/mainrepo/sub2, universal_newlines=False, shell=None)
[10:16.58] git.cmd      DEBUG    Popen(['git', 'version'], cwd=/foo/mainrepo/sub3, universal_newlines=False, shell=None)
[10:16.58] git.cmd      DEBUG    Popen(['git', 'fetch', '--progress', '-v', 'origin'], cwd=/foo/mainrepo/sub3, universal_newlines=True, shell=None)
[10:16.58] git.remote   DEBUG    Fetch head lines do not match lines provided via progress information
length of progress lines 85 should be equal to lines in FETCH_HEAD file 5
Will ignore extra progress lines or fetch head lines.
[10:16.58] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch-check'], cwd=/foo/mainrepo/sub3, universal_newlines=False, shell=None)
[10:16.58] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch-check'], cwd=/foo/mainrepo/sub3, universal_newlines=False, shell=None)
[10:16.58] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch'], cwd=/foo/mainrepo/sub3, universal_newlines=False, shell=None)
[10:16.58] git.cmd      DEBUG    Popen(['git', 'version'], cwd=/foo/mainrepo/sub4, universal_newlines=False, shell=None)
[10:16.58] git.cmd      DEBUG    Popen(['git', 'fetch', '--progress', '-v', 'origin'], cwd=/foo/mainrepo/sub4, universal_newlines=True, shell=None)
[10:16.59] git.remote   DEBUG    Fetch head lines do not match lines provided via progress information
length of progress lines 92 should be equal to lines in FETCH_HEAD file 7
Will ignore extra progress lines or fetch head lines.
[10:16.59] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch-check'], cwd=/foo/mainrepo/sub4, universal_newlines=False, shell=None)
[10:16.59] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch-check'], cwd=/foo/mainrepo/sub4, universal_newlines=False, shell=None)
[10:16.59] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch'], cwd=/foo/mainrepo/sub4, universal_newlines=False, shell=None)
[10:16.59] git.cmd      DEBUG    Popen(['git', 'version'], cwd=/foo/mainrepo/sub4/shared/gcomponent, universal_newlines=False, shell=None)
[10:16.59] git.cmd      DEBUG    Popen(['git', 'fetch', '--progress', '-v', 'origin'], cwd=/foo/mainrepo/sub4/shared/gcomponent, universal_newlines=True, shell=None)
[10:16.59] git.remote   DEBUG    Fetch head lines do not match lines provided via progress information
length of progress lines 95 should be equal to lines in FETCH_HEAD file 3
Will ignore extra progress lines or fetch head lines.
[10:16.59] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch-check'], cwd=/foo/mainrepo/sub4/shared/gcomponent, universal_newlines=False, shell=None)
[10:16.59] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch-check'], cwd=/foo/mainrepo/sub4/shared/gcomponent, universal_newlines=False, shell=None)
[10:16.59] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch'], cwd=/foo/mainrepo/sub4/shared/gcomponent, universal_newlines=False, shell=None)
[10:16.59] git.cmd      DEBUG    Popen(['git', 'version'], cwd=/foo/mainrepo/sub5, universal_newlines=False, shell=None)
[10:16.59] git.cmd      DEBUG    Popen(['git', 'fetch', '--progress', '-v', 'origin'], cwd=/foo/mainrepo/sub5, universal_newlines=True, shell=None)
[10:16.59] git.remote   DEBUG    Fetch head lines do not match lines provided via progress information
length of progress lines 99 should be equal to lines in FETCH_HEAD file 4
Will ignore extra progress lines or fetch head lines.
[10:16.59] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch-check'], cwd=/foo/mainrepo/sub5, universal_newlines=False, shell=None)
[10:17.00] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch-check'], cwd=/foo/mainrepo/sub5, universal_newlines=False, shell=None)
[10:17.00] git.cmd      DEBUG    Popen(['git', 'cat-file', '--batch'], cwd=/foo/mainrepo/sub5, universal_newlines=False, shell=None)
[10:17.00] git.cmd      DEBUG    Popen(['git', 'diff', '--cached', '--abbrev=40', '--full-index', '--raw'], cwd=/foo/mainrepo, universal_newlines=False, shell=None)
[10:17.00] git.cmd      DEBUG    Popen(['git', 'diff', '--abbrev=40', '--full-index', '--raw'], cwd=/foo/mainrepo, universal_newlines=False, shell=None)

keestux avatar Apr 23 '19 08:04 keestux

Thanks for letting me know. I acknowledge it on behalf of knowing that the submodule capabilities are quite buggy :/.

Byron avatar Jul 20 '19 07:07 Byron

is there any workaround or fix already?

Flow86 avatar Apr 21 '21 08:04 Flow86