3 # Copyright (c) 2005 Junio C Hamano
5 # Read .git/FETCH_HEAD and make a human readable merge message
6 # by grouping branches and tags together to form a single line.
13 my ($label, $labels, $stuff) = @_;
14 my $l = scalar @
$stuff;
20 $m = "$label$stuff->[0]";
24 join (', ', @
{$stuff}[0..$l-2]) .
31 my ($bname, $tname, $gname, $src);
34 next if (/^not-for-merge/);
43 if (! exists $src{$src}) {
54 if (/^branch (.*)$/) {
55 push @
{$src{$src}{BRANCH
}}, $1;
56 $src{$src}{HEAD_STATUS
} |= 2;
58 elsif (/^tag (.*)$/) {
59 push @
{$src{$src}{TAG
}}, $1;
60 $src{$src}{HEAD_STATUS
} |= 2;
63 $src{$src}{HEAD_STATUS
} |= 1;
66 push @
{$src{$src}{GENERIC
}}, $_;
67 $src{$src}{HEAD_STATUS
} |= 2;
73 if ($src{$src}{HEAD_STATUS
} == 1) {
74 # Only HEAD is fetched, nothing else.
79 if ($src{$src}{HEAD_STATUS
} == 3) {
80 # HEAD is fetched among others.
81 push @this, andjoin
('', '', ['HEAD']);
83 push @this, andjoin
("branch ", "branches ",
85 push @this, andjoin
("tag ", "tags ",
87 push @this, andjoin
("commit ", "commits ",
89 my $this = join(', ', @this);
95 print "Merge ", join("; ", @msg), "\n";