Browse Source

Meta/Reintegrate: propagate branch description from whats-cooking.txt

todo
Junio C Hamano 13 years ago
parent
commit
052051e5b1
  1. 53
      Reintegrate

53
Reintegrate

@ -18,6 +18,51 @@ do @@ -18,6 +18,51 @@ do
shift
done

annotate_merge () {
test -f Meta/whats-cooking.txt || return 0

perl -e '
my ($branch) = $ARGV[0];
my ($in_section) = 0;
my @msg = ();
while (<STDIN>) {
if (/^\* $branch /) {
$in_section = 1;
next;
}
if (/^[-*\[]/) {
last if $in_section;
}
next unless $in_section;
next if (/^ /);
push @msg, $_;
}

if ($in_section && @msg) {
open(my $fh, "-|", qw(git cat-file commit HEAD));
my @original = (<$fh>);
my @final;
$in_section = 0;
for (@original) {
if (!$in_section) {
$in_section = 1 if (/^$/);
next;
}
push @final, $_;
if (/^$/ && $in_section == 1) {
push @final, @msg;
push @final, "\n";
$in_section = 2;
}
}
close $fh;
open($fh, "|-", qw(git commit --amend -F -));
print $fh @final;
close $fh;
}
' <Meta/whats-cooking.txt "$1"
}

case "$generate" in
no)
accept_rerere () {
@ -37,13 +82,19 @@ no) @@ -37,13 +82,19 @@ no)
case "$branch" in '#'* | '') continue ;; esac
case "$eh" in
"" | "#"*)
echo >&2 "* $branch"

save=$(git rev-parse --verify HEAD)
tip=$(git rev-parse --verify "$branch^0")
mb=$(git merge-base "$tip" "$save")
test "$mb" = "$tip" && continue

echo >&2 "* $branch"
git merge $accept_rerere --no-edit "$branch" ||
accept_rerere ||
exit

annotate_merge "$branch" || exit

this=$(git rev-parse --verify HEAD)
if test "$this" = "$save"
then

Loading…
Cancel
Save