alichtman / shallow-backup

Git-integrated backup tool for macOS and Linux devs.
MIT License
1.22k stars 248 forks source link

KeyError: 'all' on commit procedure #306

Closed antonelse closed 1 year ago

antonelse commented 2 years ago

Hi, in making my first commit on a fresh GitHub repo I obtained this error code.

Here the snippet:

Created directory: /Users/***********/shallow-backup/configs
Backing up configs...
Making new commit...
Traceback (most recent call last):
  File "/usr/local/bin/shallow-backup", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/shallow_backup/__main__.py", line 156, in cli
    git_add_all_commit_push(repo, target)
  File "/usr/local/lib/python3.9/site-packages/shallow_backup/git_wrapper.py", line 96, in git_add_all_commit_push
    repo.git.commit(m=COMMIT_MSG[message])
KeyError: 'all'

Thanks a lot :)

zirkelc commented 1 year ago

Same issue here with python 3.11:

2023-01-24_08-52-58

alichtman commented 1 year ago

Thanks for the bug report! Sorry I missed this one.

I see the problem.

https://github.com/alichtman/shallow-backup/blob/0f01f65bdb397dbf3ae769907fcc861924c07f62/shallow_backup/__main__.py#L155-L157

"all" is passed as the commit message here and isn't in the COMMIT_MSG mapping.

https://github.com/alichtman/shallow-backup/blob/b6b0bbe3764a4142ee7d3579c90ffcf858c788ec/shallow_backup/git_wrapper.py#L96 https://github.com/alichtman/shallow-backup/blob/b6b0bbe3764a4142ee7d3579c90ffcf858c788ec/shallow_backup/git_wrapper.py#L13-L19

The commit I just pushed should take care of this. I can release a new version soon, but for now just install from main.

jnv commented 1 year ago

Hi there! Looks like this was fixed but not released.

alichtman commented 1 year ago

Ack, sorry about that! On my todo list.

alichtman commented 1 year ago

Just pushed v6. Available on pypi.