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);
41 if (! exists $src{$src}) {
52 if (/^branch (.*)$/) {
53 push @{$src{$src}{BRANCH}}, $1;
54 $src{$src}{HEAD_STATUS} |= 2;
56 elsif (/^tag (.*)$/) {
57 push @{$src{$src}{TAG}}, $1;
58 $src{$src}{HEAD_STATUS} |= 2;
61 $src{$src}{HEAD_STATUS} |= 1;
64 push @{$src{$src}{GENERIC}}, $_;
65 $src{$src}{HEAD_STATUS} |= 2;
71 if ($src{$src}{HEAD_STATUS} == 1) {
72 # Only HEAD is fetched, nothing else.
77 if ($src{$src}{HEAD_STATUS} == 3) {
78 # HEAD is fetched among others.
79 push @this, andjoin('', '', ['HEAD']);
81 push @this, andjoin("branch ", "branches ",
83 push @this, andjoin("tag ", "tags ",
85 push @this, andjoin("commit ", "commits ",
87 my $this = join(', ', @this);
89 $this .= " from $src";
93 print "Merge ", join("; ", @msg), "\n";