Browse Source

Fix crash on incremental bundling with warnings

For example, if the HEAD is excluded:

    warning: ref 'refs/heads/master' is excluded by the rev-list options
    warning: ref 'HEAD' is excluded by the rev-list options
    fatal: Refusing to create empty bundle.

The fatal message always appears last (though that's of course undocumented).
tags/v1.0
JustAnotherArchivist 1 year ago
parent
commit
e08919d89f
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      codearchiver/modules/git.py

+ 1
- 1
codearchiver/modules/git.py View File

@@ -119,7 +119,7 @@ class Git(codearchiver.core.Module):
objectsToExclude = baseBundleObjects & commitsAndTags
input = ''.join(f'^{o}\n' for o in objectsToExclude).encode('ascii')
status, _, stderr = codearchiver.subprocess.run_with_log(cmd, cwd = directory, input = input, check = False)
if status == 128 and stderr == 'fatal: Refusing to create empty bundle.\n':
if status == 128 and (stderr == 'fatal: Refusing to create empty bundle.\n' or stderr.endswith('\nfatal: Refusing to create empty bundle.\n')):
# Manually write an empty bundle instead
# Cf. Documentation/technical/bundle-format.txt and Documentation/technical/pack-format.txt in git's repository for details on the formats
_logger.info('Writing empty bundle directly instead')


Loading…
Cancel
Save