Skip to content

Commit 8f92733

Browse files
committed
topic: slight code shuffling for readability
1 parent d3cd72a commit 8f92733

File tree

1 file changed

+28
-19
lines changed

1 file changed

+28
-19
lines changed

git-topic.perl

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ sub rebase_marker {
7777

7878
sub describe_topic {
7979
my ($topic) = @_;
80+
8081
open(CONF, '-|', qw(git repo-config --get),
81-
"branch.$topic.description")
82-
or die;
82+
"branch.$topic.description")
83+
or die;
8384
my $it = join('',<CONF>);
8485
close(CONF);
8586
chomp($it);
@@ -88,29 +89,26 @@ sub describe_topic {
8889
}
8990
}
9091

91-
sub wrap_print {
92-
my ($string) = @_;
93-
format STDOUT =
94-
~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
95-
$string
96-
~~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
97-
$string
98-
.
99-
write;
100-
}
92+
my @in_next = read_revs_short('^master', $stage[0]);
10193

10294
open(TOPIC, '-|', qw(git for-each-ref),
103-
'--sort=-authordate',
104-
'--format=%(objectname) %(authordate) %(refname)',
105-
"refs/heads/$topic_pattern")
106-
or die;
107-
108-
my @in_next = read_revs_short('^master', $stage[0]);
95+
'--sort=-authordate',
96+
'--format=%(objectname) %(authordate) %(refname)',
97+
"refs/heads/$topic_pattern")
98+
or die;
10999

100+
my @topic = ();
110101
while (<TOPIC>) {
111102
chomp;
112103
my ($sha1, $date, $topic) = m|^([0-9a-f]{40})\s(.*?)\srefs/heads/(.+)$|
113-
or next;
104+
or next;
105+
push @topic, [$sha1, $date, $topic];
106+
}
107+
108+
my @last_merge_to_next = ();
109+
110+
for (@topic) {
111+
my ($sha1, $date, $topic) = @$_;
114112
my @revs = read_revs($base, $sha1, (1<<@stage)-1);
115113
next unless (@revs || $all);
116114
@@ -141,3 +139,14 @@ sub wrap_print {
141139
wrap_print("$mark $item->[1]");
142140
}
143141
}
142+
143+
sub wrap_print {
144+
my ($string) = @_;
145+
format STDOUT =
146+
~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
147+
$string
148+
~~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
149+
$string
150+
.
151+
write;
152+
}

0 commit comments

Comments
 (0)