From 3fe2b5c3c9acdf0ee450836a4a78b5fe41136930 Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Mon, 3 Jan 2022 14:52:12 +0100 Subject: [PATCH] filter-repo: prepend the header line to the "ref-map" file The existance of a header has already been specified in the documentation. Further adapt it to the real text implemented now. Signed-off-by: Markus Heidelberg --- Documentation/git-filter-repo.txt | 2 +- git-filter-repo | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/git-filter-repo.txt b/Documentation/git-filter-repo.txt index 9c00a78..37702b7 100644 --- a/Documentation/git-filter-repo.txt +++ b/Documentation/git-filter-repo.txt @@ -382,7 +382,7 @@ Reference map The `.git/filter-repo/ref-map` file contains a mapping of which local references were changed. - * A header is the first line with the text "old" and "new" + * A header is the first line with the text "old", "new" and "ref" * Reference mappings are in no particular order * An all-zeros hash, or null SHA, represents a non-existant object. When in the "new" column, this means the ref was removed entirely. diff --git a/git-filter-repo b/git-filter-repo index 22826b5..4c7a2c3 100755 --- a/git-filter-repo +++ b/git-filter-repo @@ -3811,6 +3811,7 @@ class RepoFilter(object): batch_check_process = None batch_check_output_re = re.compile(b'^([0-9a-f]{40}) ([a-z]+) ([0-9]+)$') with open(os.path.join(metadata_dir, b'ref-map'), 'bw') as f: + f.write(("%-40s %-40s %s\n" % (_("old"), _("new"), _("ref"))).encode()) for refname, old_hash in orig_refs.items(): if refname not in exported_refs: continue