@matheusbsbs / matheus-bagliano / commits / 96653ce304
Fork 0

remote-mediawiki: fix duplicate revisions being imported

Fix a bug with revisions being imported twice. This commit is being backported from Git-Mediawiki.git's e41ee9b ("All revisions imported twice", 2018-02-02) to git.git. See [1] for the original commit and [2] and [3] for the upstream PR and issue. 1. https://github.com/Git-Mediawiki/Git-Mediawiki/commit/e41ee9b3a32416df381cdc79f63350665c84151e 2. https://github.com/Git-Mediawiki/Git-Mediawiki/pull/61 3. https://github.com/Git-Mediawiki/Git-Mediawiki/issues/29 Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Simon Legner committed Sep 21, 2020 at 12:39 UTC 96653ce3041e87f71a8dbbcfd4cb80424758c8fd
1 file changed +3
contrib/mw-to-git/git-remote-mediawiki.perl
+3
@@ -807,7 +807,10 @@ sub get_more_refs {
807 sub mw_import {
808 # multiple import commands can follow each other.
809 my @refs = (shift, get_more_refs('import'));
810 + my $processedRefs;
811 foreach my $ref (@refs) {
812 + next if $processedRefs->{$ref}; # skip duplicates: "import refs/heads/master" being issued twice; TODO: why?
813 + $processedRefs->{$ref} = 1;
814 mw_import_ref($ref);
815 }
816 print {*STDOUT} "done\n";