From 3f0bfc2925beb2aca2ca90ad134123e3656f37f7 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Tue, 12 Mar 2019 18:24:45 -0700 Subject: [PATCH] filter-repo: avoid relaying progress or checkpoint directives We don't expect to ever get progress or checkpoint directives in normal operation, but the --stdin flag makes it a possibility. In such a case, the progress directives could actually break our parsing since git-fast-import will just print it to its stdout, which is what we read from to find new commit names so we can do commit message hash updating. So, pass these along to a progress_callback, but don't dump them by default. Also, it is not clear checkpoint directives make sense given that we'll be filtering and only getting a subset of history (and I'm dubious on checkpoint's utility in general anyway as fast-import is relatively quick), so pass these along to a callback but don't use them by default. Signed-off-by: Elijah Newren --- git-filter-repo | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/git-filter-repo b/git-filter-repo index 5082c48..7a77b59 100755 --- a/git-filter-repo +++ b/git-filter-repo @@ -1554,9 +1554,11 @@ class FastExportFilter(object): if self._everything_callback: self._everything_callback('progress', progress) - # Now print the resulting progress message - if not progress.dumped: - progress.dump(self._output) + # NOTE: By default, we do NOT print the progress message; git + # fast-import would write it to fast_import_pipes which could mess with + # our parsing of output from the 'ls' and 'get-mark' directives we send + # to fast-import. If users want these messages, they need to process + # and handle them in the appropriate callback above. def _parse_checkpoint(self): """ @@ -1580,9 +1582,11 @@ class FastExportFilter(object): if self._everything_callback: self._everything_callback('checkpoint', checkpoint) - # Now print the resulting checkpoint - if not checkpoint.dumped: - checkpoint.dump(self._output) + # NOTE: By default, we do NOT print the checkpoint message; although it + # we would only realistically get them with --stdin, the fact that we + # are filtering makes me think the checkpointing is less likely to be + # reasonable. In fact, I don't think it's necessary in general. If + # users do want it, they should process it in the checkpoint_callback. def _parse_literal_command(self): """