merge finish fails on packages with empty directories
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
git-ubuntu |
Triaged
|
Medium
|
Unassigned |
Bug Description
stirling:
08/11/2021 20:00:52 - ERROR:Command exited 1: git commit -m merge-changelogs debian/changelog
08/11/2021 20:00:52 - ERROR:stdout:
08/11/2021 20:00:52 - ERROR:stderr: ERROR: Empty directories exist and will disappear on commit, causing
extraneous unintended changes:
docs/
docs/
See LP: #1687057.
Use "git commit --no-verify ..." to ignore this problem.
pre-commit hook failed.
Traceback (most recent call last):
File "/snap/
load_
File "/snap/
sys.
File "/snap/
return main(
File "/snap/
return do_finish(
File "/snap/
do_
File "/snap/
repo.
File "/snap/
return git_run(
File "/snap/
return run(['git'] + list(args), env=env, **kwargs)
File "/snap/
raise e
File "/snap/
cp = subprocess.run(
File "/snap/
raise CalledProcessEr
subprocess.
I only ran into this issue during 'merge finish'; earlier steps in the merge procedure would emit warnings about directories (i.e. via the post-checkout hook I gather) but no hard errors or stack traces. I gather this is because this was the first point there was a "real" commit being added.
Workaround was to rm .git/hooks/
Ah, thanks. I think I understand now.
I suppose a fix for now would be to either adjust what we're doing in the pre-commit hook or arrange for "merge finish" to ignore it (using --no-verify or similar).
It's probably still appropriate to display a warning at least, and maybe even require the use of --force or similar, to acknowledge that running the workaround script afterwards will be necessary. This might mean adding functionality to "merge finish" to be able to back itself out with no changes if the commit fails. Alternatively, the hook could be adjusted to interact with "merge finish" somehow.
I think the constraint here should be that the user should be sufficiently notified that the workaround will be required. I'd appreciate feedback on exactly how "merge finish" users think that should be achieved.