NicoHood / GPGit

A shell script that automates the process of signing Git sources via GPG
MIT License
89 stars 10 forks source link

Enabling commit signing results in a stacktrace #10

Closed wolph closed 6 years ago

wolph commented 6 years ago

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:

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'
NicoHood commented 6 years ago

Closing as I switched back to bash. I dont know if I will use the python version again, bash seems still simpler to code and easier to install.