Skip to content

Commit 33973a5

Browse files
samvEric Wong
authored andcommitted
git-svn: fix some mistakes with interpreting SVN mergeinfo commit ranges
SVN's list of commit ranges in mergeinfo tickets is inclusive, whereas git commit ranges are exclusive on the left hand side. Also, the end points of the commit ranges may not exist; they simply delineate ranges of commits which may or may not exist. Fix these two mistakes. Signed-off-by: Sam Vilain <[email protected]> Acked-by: Eric Wong <[email protected]>
1 parent 7d944c3 commit 33973a5

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

git-svn.perl

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3015,14 +3015,8 @@ sub lookup_svn_merge {
30153015
for my $range ( @ranges ) {
30163016
my ($bottom, $top) = split "-", $range;
30173017
$top ||= $bottom;
3018-
my $bottom_commit =
3019-
$gs->rev_map_get($bottom, $uuid) ||
3020-
$gs->rev_map_get($bottom+1, $uuid);
3021-
my $top_commit;
3022-
for (; !$top_commit && $top >= $bottom; --$top) {
3023-
$top_commit =
3024-
$gs->rev_map_get($top, $uuid);
3025-
}
3018+
my $bottom_commit = $gs->find_rev_after( $bottom, 1, $top );
3019+
my $top_commit = $gs->find_rev_before( $top, 1, $bottom );
30263020

30273021
unless ($top_commit and $bottom_commit) {
30283022
warn "W:unknown path/rev in svn:mergeinfo "
@@ -3031,7 +3025,7 @@ sub lookup_svn_merge {
30313025
}
30323026

30333027
push @merged_commit_ranges,
3034-
"$bottom_commit..$top_commit";
3028+
"$bottom_commit^..$top_commit";
30353029

30363030
if ( !defined $tip or $top > $tip ) {
30373031
$tip = $top;

t/t9151-svn-mergeinfo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ test_expect_success 'svn non-merge merge commits did not become git merge commit
3333
[ -z "$bad_non_merges" ]
3434
'
3535

36-
test_expect_failure 'everything got merged in the end' '
36+
test_expect_success 'everything got merged in the end' '
3737
unmerged=$(git rev-list --all --not master)
3838
[ -z "$unmerged" ]
3939
'

0 commit comments

Comments
 (0)