-
Notifications
You must be signed in to change notification settings - Fork 248
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
Git commit breaks sometimes if submodules exist #229
Comments
➜ shallow-backup -no_splash -dotfiles
Detected git repo.
##########
# DOTFILES
##########
Backing up dotfolders...
Backing up dotfiles...
Making new commit...
Traceback (most recent call last):
File "/usr/local/bin/shallow-backup", line 11, in <module>
load_entry_point('shallow-backup==2.5a0', 'console_scripts', 'shallow-backup')()
└ <function load_entry_point at 0x108158290>
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
│ │ └ {}
│ └ ()
└ <click.core.Command object at 0x1084522d0>
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
│ └ <click.core.Context object at 0x1082c4950>
└ <click.core.Command object at 0x1084522d0>
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
│ │ └ <click.core.Context object at 0x1082c4950>
│ └ <click.core.Command object at 0x1084522d0>
└ <click.core.Context object at 0x1082c4950>
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
│ │ └ {'dotfiles': True, 'all': False, 'configs': False, 'delete_config': False, 'destroy_backup': False, 'fonts': False, 'new_path': ...
│ └ ()
└ <function cli at 0x1086cb290>
File "/usr/local/lib/python3.7/site-packages/shallow_backup-2.5a0-py3.7.egg/shallow_backup/__main__.py", line 119, in cli
git_add_all_commit_push(repo, 'dotfiles')
│ └ <git.Repo "/Users/alichtman/shallow-backup/.git">
└ <function git_add_all_commit_push at 0x1086345f0>
File "/usr/local/lib/python3.7/site-packages/shallow_backup-2.5a0-py3.7.egg/shallow_backup/git_wrapper.py", line 79, in git_add_all_commit_push
repo.git.commit(m=COMMIT_MSG[message])
│ │ └ 'dotfiles'
│ └ {'fonts': 'Back up fonts.', 'packages': 'Back up packages.', 'configs': 'Back up configs.', 'all': 'Full back up.', 'dotfiles': ...
└ <git.Repo "/Users/alichtman/shallow-backup/.git">
File "/usr/local/lib/python3.7/site-packages/git/cmd.py", line 548, in <lambda>
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
│ │ │ └ {'m': 'Back up dotfiles.'}
│ │ └ ()
│ └ 'commit'
└ <git.cmd.Git object at 0x1086b6a60>
File "/usr/local/lib/python3.7/site-packages/git/cmd.py", line 1014, in _call_process
return self.execute(call, **exec_kwargs)
│ │ └ {}
│ └ ['git', 'commit', '-m', 'Back up dotfiles.']
└ <git.cmd.Git object at 0x1086b6a60>
File "/usr/local/lib/python3.7/site-packages/git/cmd.py", line 825, in execute
raise GitCommandError(command, status, stderr_value, stdout_value)
│ │ │ │ └ b'On branch master\nChanges not staged for commit:\n\tmodified: dotfiles (modified content)\n\nno changes added to commit'
│ │ │ └ b''
│ │ └ 1
│ └ ['git', 'commit', '-m', 'Back up dotfiles.']
└ <class 'git.exc.GitCommandError'>
git.exc.GitCommandError: Cmd('git') failed due to: exit code(1)
cmdline: git commit -m Back up dotfiles.
stdout: 'On branch master
Changes not staged for commit:
modified: dotfiles (modified content)
|
I've added two "fixes" for this. One takes care of the nasty looking error and the other is a flag that can be passed in to skip the commit. This works for my workflow since I don't really use any features of this except the dotfile backup for mirroring on GitHub.
The ¯\(ツ)/¯ If you have a better solution, I'm happy to hear about it. |
For some reason, I'm having the same issue when I try to save only packages, with or without the
|
I think this bug was the longest standing bug in any of my projects, ever. I opened this bug report (#229) over 4 years ago! It's really not that complicated of a fix, either. I'm disappointed that this took me so long to fix. `shallow-backup` will only support a nested `dotfiles` repo. If it exists, prompt the user to make a commit in the submodule first to avoid a failed commit on the parent repo later. Fix #229
I have no idea why this just broke. I think this is a new change in
git
, as I know for sure this method worked until, like, today.I was able to fix this error by committing the changes in my submodule, but I haven't fixed it programmatically yet.
The fix will likely be in the
git_add_all_commit_push
method with something like:I'd like to be able to interactively decide on commit messages for the dotfiles submodule, so some thought needs to go into how to fix this.
:(
This will stay broken for a little bit until I figure out a good solution. A temporary fix would be downgrading your
git
version to 2.19? I think that version would work, but not sure.For my workflow, this actually isn't breaking. It's just a nasty looking error.
The text was updated successfully, but these errors were encountered: