Perhaps the configparser.NoSectionError should be caught to create the section?
Possible (theoretical, non-tested) fix:
section = 'commit'
if not cfgwriter.has_section(section):
cfgwriter.add_section(section)
cfgwriter.set(section, "gpgsign", True)
Stacktrace:
-> 3.2 Enable commit signing
Traceback (most recent call last):
File "/usr/local/bin/gpgit", line 971, in <module>
sys.exit(main())
File "/usr/local/bin/gpgit", line 957, in main
err_msg = gpgit.run()
File "/usr/local/bin/gpgit", line 905, in run
err_msg = substep.funct()
File "/usr/local/bin/gpgit", line 380, in substep2
cfgwriter.set("commit", "gpgsign", True)
File "python/3.6/lib/python/site-packages/git/config.py", line 90, in flush_changes
rval = non_const_func(self, *args, **kwargs)
File "python/3.6/lib/python/site-packages/git/config.py", line 79, in assure_data_present
return func(self, *args, **kwargs)
File "python3.6/configparser.py", line 901, in set
raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'commit'
It appears this is a known issue: https://github.com/NicoHood/gpgit/blob/4ee493d453c04ff5bbce130fa5102622f23fcf9f/gpgit.py#L374-L380
Perhaps the
configparser.NoSectionError
should be caught to create the section?Possible (theoretical, non-tested) fix:
Stacktrace: