Re: [PATCH 1/2] git-svn.perl: perform deletions before anything else
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 9, 2012, 20:08 UTC
- Message-ID
- <7vzkcrvkfa.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1328813725-16638-1-git-send-email-stevenrwalter@gmail.com>
Steven Walter <stevenrwalter@gmail.com> writes:
> - my %o = ( D => 1, R => 0, C => -1, A => 3, M => 3, T => 3 ); > + my %o = ( D => -2, R => 0, C => -1, A => 3, M => 3, T => 3 );
I know this code arrangement dates back to cf52b8f (git-svn: fix several corner-case and rare bugs with 'commit', 2006-02-20), but somehow I find it extremely hard to follow. The absolute values do not matter (this is only used to sort the classes of operations), and the fact that A/M/T shares the same value does not help a stable sort result (as it is used as a key to sort {} that is not given any key other than $o{$ab->{chg}} to tie-break). I suspect that writing it this way
my %o = (D => 0, C => 1, R => 2, A => 3, M => 4, T => 5)
or even
my $ord = 0;
my %o = map { $_ => $ord++ } qw(D C R A M T);would make it much easier to follow.