@@ -75,23 +75,20 @@ sub packet_bin_read {
75
75
if ( $bytes_read == 0 ) {
76
76
# EOF - Git stopped talking to us!
77
77
return ( -1, " " );
78
- }
79
- elsif ( $bytes_read != 4 ) {
78
+ } elsif ( $bytes_read != 4 ) {
80
79
die " invalid packet: '$buffer '" ;
81
80
}
82
81
my $pkt_size = hex ($buffer );
83
82
if ( $pkt_size == 0 ) {
84
83
return ( 1, " " );
85
- }
86
- elsif ( $pkt_size > 4 ) {
84
+ } elsif ( $pkt_size > 4 ) {
87
85
my $content_size = $pkt_size - 4;
88
86
$bytes_read = read STDIN , $buffer , $content_size ;
89
87
if ( $bytes_read != $content_size ) {
90
88
die " invalid packet ($content_size bytes expected; $bytes_read bytes read)" ;
91
89
}
92
90
return ( 0, $buffer );
93
- }
94
- else {
91
+ } else {
95
92
die " invalid packet size: $pkt_size " ;
96
93
}
97
94
}
@@ -195,8 +192,7 @@ sub packet_flush {
195
192
$debug -> flush();
196
193
packet_txt_write(" status=success" );
197
194
packet_flush();
198
- }
199
- else {
195
+ } else {
200
196
my ( $res , $pathname ) = packet_required_key_val_read(" pathname" );
201
197
if ( $res == -1 ) {
202
198
die " unexpected EOF while expecting pathname" ;
@@ -240,17 +236,13 @@ sub packet_flush {
240
236
my $output ;
241
237
if ( exists $DELAY {$pathname } and exists $DELAY {$pathname }{" output" } ) {
242
238
$output = $DELAY {$pathname }{" output" }
243
- }
244
- elsif ( $pathname eq " error.r" or $pathname eq " abort.r" ) {
239
+ } elsif ( $pathname eq " error.r" or $pathname eq " abort.r" ) {
245
240
$output = " " ;
246
- }
247
- elsif ( $command eq " clean" and grep ( / ^clean$ / , @capabilities ) ) {
241
+ } elsif ( $command eq " clean" and grep ( / ^clean$ / , @capabilities ) ) {
248
242
$output = rot13($input );
249
- }
250
- elsif ( $command eq " smudge" and grep ( / ^smudge$ / , @capabilities ) ) {
243
+ } elsif ( $command eq " smudge" and grep ( / ^smudge$ / , @capabilities ) ) {
251
244
$output = rot13($input );
252
- }
253
- else {
245
+ } else {
254
246
die " bad command '$command '" ;
255
247
}
256
248
@@ -259,25 +251,21 @@ sub packet_flush {
259
251
$debug -> flush();
260
252
packet_txt_write(" status=error" );
261
253
packet_flush();
262
- }
263
- elsif ( $pathname eq " abort.r" ) {
254
+ } elsif ( $pathname eq " abort.r" ) {
264
255
print $debug " [ABORT]\n " ;
265
256
$debug -> flush();
266
257
packet_txt_write(" status=abort" );
267
258
packet_flush();
268
- }
269
- elsif ( $command eq " smudge" and
259
+ } elsif ( $command eq " smudge" and
270
260
exists $DELAY {$pathname } and
271
- $DELAY {$pathname }{" requested" } == 1
272
- ) {
261
+ $DELAY {$pathname }{" requested" } == 1 ) {
273
262
print $debug " [DELAYED]\n " ;
274
263
$debug -> flush();
275
264
packet_txt_write(" status=delayed" );
276
265
packet_flush();
277
266
$DELAY {$pathname }{" requested" } = 2;
278
267
$DELAY {$pathname }{" output" } = $output ;
279
- }
280
- else {
268
+ } else {
281
269
packet_txt_write(" status=success" );
282
270
packet_flush();
283
271
@@ -297,8 +285,7 @@ sub packet_flush {
297
285
print $debug " ." ;
298
286
if ( length ($output ) > $MAX_PACKET_CONTENT_SIZE ) {
299
287
$output = substr ( $output , $MAX_PACKET_CONTENT_SIZE );
300
- }
301
- else {
288
+ } else {
302
289
$output = " " ;
303
290
}
304
291
}
0 commit comments