mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 02:12:17 +02:00
filter-repo: repack with --source or --target
When using --source or --target in combination with filtering paths, users were surprised out how large the resulting repository was. The usage of --source and --target were turning off repacking; while we don't want repacking for partial history rewrites and --source and --target turn on some of the other features we want with partial history rewrites, repacking is something that we still want turned on. Reported-by: Alexey Volkov <alexey.volkov@ark-kun.com> Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
2bfb9cf261
commit
cdb7b77f07
@ -2183,6 +2183,7 @@ EXAMPLES
|
|||||||
args.strip_blobs_with_ids = set()
|
args.strip_blobs_with_ids = set()
|
||||||
if (args.partial or args.refs) and not args.replace_refs:
|
if (args.partial or args.refs) and not args.replace_refs:
|
||||||
args.replace_refs = 'update-no-add'
|
args.replace_refs = 'update-no-add'
|
||||||
|
args.repack = not (args.partial or args.refs)
|
||||||
if args.refs or args.source or args.target:
|
if args.refs or args.source or args.target:
|
||||||
args.partial = True
|
args.partial = True
|
||||||
if not args.refs:
|
if not args.refs:
|
||||||
@ -3890,9 +3891,8 @@ class RepoFilter(object):
|
|||||||
self._save_marks_files()
|
self._save_marks_files()
|
||||||
|
|
||||||
# Notify user how long it took, before doing a gc and such
|
# Notify user how long it took, before doing a gc and such
|
||||||
repack = (not self._args.partial)
|
|
||||||
msg = "New history written in {:.2f} seconds..."
|
msg = "New history written in {:.2f} seconds..."
|
||||||
if repack:
|
if self._args.repack:
|
||||||
msg = "New history written in {:.2f} seconds; now repacking/cleaning..."
|
msg = "New history written in {:.2f} seconds; now repacking/cleaning..."
|
||||||
print(msg.format(time.time()-start))
|
print(msg.format(time.time()-start))
|
||||||
|
|
||||||
@ -3914,9 +3914,11 @@ class RepoFilter(object):
|
|||||||
# Write out data about run
|
# Write out data about run
|
||||||
self._record_metadata(self.results_tmp_dir(), self._orig_refs)
|
self._record_metadata(self.results_tmp_dir(), self._orig_refs)
|
||||||
|
|
||||||
# If repack, then nuke the reflogs and repack. If reset, do a reset --hard
|
# Final cleanup:
|
||||||
|
# If we need a repack, then nuke the reflogs and repack.
|
||||||
|
# If we need a reset, do a reset --hard
|
||||||
reset = not GitUtils.is_repository_bare(target_working_dir)
|
reset = not GitUtils.is_repository_bare(target_working_dir)
|
||||||
RepoFilter.cleanup(target_working_dir, repack, reset,
|
RepoFilter.cleanup(target_working_dir, self._args.repack, reset,
|
||||||
run_quietly=self._args.quiet,
|
run_quietly=self._args.quiet,
|
||||||
show_debuginfo=self._args.debug)
|
show_debuginfo=self._args.debug)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user