aboutsummaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorMichael Contreras <michael@inetric.com>2013-03-30 18:06:42 -0400
committerEric Wong <normalperson@yhbt.net>2013-05-09 01:07:39 +0000
commite234ac9d47b6618f7b7338f95f34d0b70782e4cb (patch)
treebaee311f98066eff3566e786889c3c95ab286e9a /git-svn.perl
parent9b795193a6a7e963db62d9cd8e86752a40940520 (diff)
downloadgit-e234ac9d47b6618f7b7338f95f34d0b70782e4cb.tar.gz
git-e234ac9d47b6618f7b7338f95f34d0b70782e4cb.tar.xz
git-svn: avoid self-referencing mergeinfo
When svn.pushmergeinfo is set, the target branch is included in the mergeinfo if it was previously merged into one of the source branches. SVN does not do this. Remove merge target branch path from resulting mergeinfo when svn.pushmergeinfo is set to better match the behavior of SVN. Update the svn-mergeinfo-push test. [ew: 80 columns] Signed-off-by: Michael Contreras <michael@inetric.com> Reported-by: Avishay Lavie <avishay.lavie@gmail.com> Acked-by: Eric Wong <normalperson@yhbt.net>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl11
1 files changed, 8 insertions, 3 deletions
diff --git a/git-svn.perl b/git-svn.perl
index 6c7bd9503..705f5ab4c 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -669,12 +669,14 @@ sub merge_revs_into_hash {
}
sub merge_merge_info {
- my ($mergeinfo_one, $mergeinfo_two) = @_;
+ my ($mergeinfo_one, $mergeinfo_two, $ignore_branch) = @_;
my %result_hash = ();
merge_revs_into_hash(\%result_hash, $mergeinfo_one);
merge_revs_into_hash(\%result_hash, $mergeinfo_two);
+ delete $result_hash{$ignore_branch} if $ignore_branch;
+
my $result = '';
# Sort below is for consistency's sake
for my $branchname (sort keys(%result_hash)) {
@@ -695,6 +697,7 @@ sub populate_merge_info {
my $all_parents_ok = 1;
my $aggregate_mergeinfo = '';
my $rooturl = $gs->repos_root;
+ my ($target_branch) = $gs->full_pushurl =~ /^\Q$rooturl\E(.*)/;
if (defined($rewritten_parent)) {
# Replace first parent with newly-rewritten version
@@ -726,7 +729,8 @@ sub populate_merge_info {
# Merge previous mergeinfo values
$aggregate_mergeinfo =
merge_merge_info($aggregate_mergeinfo,
- $par_mergeinfo, 0);
+ $par_mergeinfo,
+ $target_branch);
next if $parent eq $parents[0]; # Skip first parent
# Add new changes being placed in tree by merge
@@ -769,7 +773,8 @@ sub populate_merge_info {
my $newmergeinfo = "$branchpath:" . join(',', @revsin);
$aggregate_mergeinfo =
merge_merge_info($aggregate_mergeinfo,
- $newmergeinfo, 1);
+ $newmergeinfo,
+ $target_branch);
}
if ($all_parents_ok and $aggregate_mergeinfo) {
return $aggregate_mergeinfo;