Skip to content

Git windows 2.22.0 breaks with submodule add #885

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

Open
georgealverson opened this issue Jun 25, 2019 · 5 comments
Open

Git windows 2.22.0 breaks with submodule add #885

georgealverson opened this issue Jun 25, 2019 · 5 comments

Comments

@georgealverson
Copy link

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 ] [--]

@jeking3
Copy link
Contributor

jeking3 commented Jul 6, 2019

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
Copy link
Contributor

jeking3 commented Jul 6, 2019

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

@georgealverson
Copy link
Author

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):

@jeking3
Copy link
Contributor

jeking3 commented Jul 6, 2019

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.

@georgealverson
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants