GitPython icon indicating copy to clipboard operation
GitPython copied to clipboard

Git windows 2.22.0 breaks with submodule add

Open georgealverson opened this issue 6 years ago • 5 comments

The traceback below shows that git for windows has become pickier in the latest release (2.22.0). It appears it will no longer accept git submodule -b add .

This works fine in 'git version 2.21.0.windows.1'.

========================================

gt.submodule('add','../../utils',b='master') \Python36\lib\site-packages\git\cmd.py", line 548, in return lambda *args, **kwargs: self._call_process(name, *args, **kwargs) \Python36\lib\site-packages\git\cmd.py", line 1014, in _call_process return self.execute(call, **exec_kwargs) \Python36\lib\site-packages\git\cmd.py", line 825, in execute raise GitCommandError(command, status, stderr_value, stdout_value) git.exc.GitCommandError: Cmd('git') failed due to: exit code(1) cmdline: git submodule -b master add ../../utils stderr: 'usage: git submodule [--quiet] [--cached] or: git submodule [--quiet] add [-b ] [-f|--force] [--name ] [--reference ] [--]

georgealverson avatar Jun 25 '19 23:06 georgealverson

Same on linux:

user@54a7984eef0c:/tmp$ git submodule -b master add ../../utils
usage: git submodule [--quiet] [--cached]
   or: git submodule [--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
   or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
   or: git submodule [--quiet] init [--] [<path>...]
   or: git submodule [--quiet] deinit [-f|--force] (--all| [--] <path>...)
   or: git submodule [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--[no-]recommend-shallow] [--reference <repository>] [--recursive] [--] [<path>...]
   or: git submodule [--quiet] set-branch (--default|--branch <branch>) [--] <path>
   or: git submodule [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
   or: git submodule [--quiet] foreach [--recursive] <command>
   or: git submodule [--quiet] sync [--recursive] [--] [<path>...]
   or: git submodule [--quiet] absorbgitdirs [--] [<path>...]
user@54a7984eef0c:/tmp$ git submodule add -b master ../../utils
fatal: repository 'utils' does not exist
fatal: clone of 'utils' into submodule path '/tmp/utils' failed

Note the first invocation is a usage error (showing the original issue reported for Windows is present on Linux); the second one got past that and errored out for a different (and expected) reason.

jeking3 avatar Jul 06 '19 10:07 jeking3

@georgealverson could you post the complete stack trace so we can see where it originates from?

jeking3 avatar Jul 06 '19 10:07 jeking3

Hi,

The pertinent section is marked below with '>>>'.

I haven't checked under Linux, but I believe your example should not work unless you have an available repo under ../../utils. That's what the error message seems to indicate.

Best, George

Traceback (most recent call last): File "C:\Users\galve\source\repos\CMS Python Scripts\Scripts\CmsNotes.py", line 1517, in main(sys.argv[1:]) File "C:\Users\galve\source\repos\CMS Python Scripts\Scripts\CmsNotes.py", line 1494, in main notes.gitSetFromTemplate() File "C:\Users\galve\source\repos\CMS Python Scripts\Scripts\CmsNotes.py", line 997, in gitSetFromTemplate

gt.submodule('add','../../utils',b='master')

File "C:\Users\galve\AppData\Local\Programs\Python\Python36\lib\site-packages\git\cmd.py", line 548, in return lambda *args, **kwargs: self._call_process(name, *args, **kwargs) File "C:\Users\galve\AppData\Local\Programs\Python\Python36\lib\site-packages\git\cmd.py", line 1014, in _call_process return self.execute(call, **exec_kwargs) File "C:\Users\galve\AppData\Local\Programs\Python\Python36\lib\site-packages\git\cmd.py", line 825, in execute raise GitCommandError(command, status, stderr_value, stdout_value) git.exc.GitCommandError: Cmd('git') failed due to: exit code(1) cmdline: git submodule -b master add ../../utils stderr: 'usage: git submodule [--quiet] [--cached] or: git submodule [--quiet] add [-b ] [-f|--force] [--name ] [--reference ] [--] [] or: git submodule [--quiet] status [--cached] [--recursive] [--] [...] or: git submodule [--quiet] init [--] [...] or: git submodule [--quiet] deinit [-f|--force] (--all| [--] ...) or: git submodule [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--[no-]recommend-shallow] [--reference ] [--recursive] [--] [...] or: git submodule [--quiet] set-branch (--default|--branch ) [--] or: git submodule [--quiet] summary [--cached|--files] [--summary-limit ] [commit] [--] [...] or: git submodule [--quiet] foreach [--recursive] or: git submodule [--quiet] sync [--recursive] [--] [...] or: git submodule [--quiet] absorbgitdirs [--] [...]' Traceback (most recent call last):

georgealverson avatar Jul 06 '19 11:07 georgealverson

Actually, what I posted clearly shows one way is a usage error and the other way is as you said, but it proves the change to a more strict command line processing in git.

jeking3 avatar Jul 06 '19 18:07 jeking3

Yes, of course. Always read to the end of the message!

georgealverson avatar Jul 06 '19 18:07 georgealverson