difftool: Wrap long lines for readability

Keep everything within 80 columns. Wrap the user-facing messages too. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

David Aguilar committed Jul 25, 2012 at 23:07 UTC a4cd5be30cdd19c43908dc55d8dd39a0fe79075b
1 file changed +32 -14
git-difftool.perl
+32 -14
@@ -93,15 +93,22 @@ sub print_tool_help
93 }
94 }
95
96 - print "'git difftool --tool=<tool>' may be set to one of the following:\n";
96 + print << 'EOF';
97 +'git difftool --tool=<tool>' may be set to one of the following:
98 +EOF
99 print "\t$_\n" for (sort(@found));
100
99 - print "\nThe following tools are valid, but not currently available:\n";
101 + print << 'EOF';
102 +
103 +The following tools are valid, but not currently available:
104 +EOF
105 print "\t$_\n" for (sort(@notfound));
106
102 - print "\nNOTE: Some of the tools listed above only work in a windowed\n";
103 - print "environment. If run in a terminal-only session, they will fail.\n";
107 + print << 'EOF';
108
109 +NOTE: Some of the tools listed above only work in a windowed
110 +environment. If run in a terminal-only session, they will fail.
111 +EOF
112 exit(0);
113 }
114
@@ -114,8 +121,11 @@ sub setup_dir_diff
121 # if $GIT_DIR and $GIT_WORK_TREE are set in ENV, they are actually used
122 # by Git->repository->command*.
123 my $repo_path = $repo->repo_path();
117 - my $diffrepo = Git->repository(Repository => $repo_path, WorkingCopy => $workdir);
118 - my $diffrtn = $diffrepo->command_oneline('diff', '--raw', '--no-abbrev', '-z', @ARGV);
124 + my %repo_args = (Repository => $repo_path, WorkingCopy => $workdir);
125 + my $diffrepo = Git->repository(%repo_args);
126 +
127 + my @gitargs = ('diff', '--raw', '--no-abbrev', '-z', @ARGV);
128 + my $diffrtn = $diffrepo->command_oneline(@gitargs);
129 exit(0) if (length($diffrtn) == 0);
130
131 # Setup temp directories
@@ -140,11 +150,15 @@ sub setup_dir_diff
150 my $i = 0;
151 while ($i < $#rawdiff) {
152 if ($rawdiff[$i] =~ /^::/) {
143 - print "Combined diff formats ('-c' and '--cc') are not supported in directory diff mode.\n";
153 + warn << 'EOF';
154 +Combined diff formats ('-c' and '--cc') are not supported in
155 +directory diff mode ('-d' and '--dir-diff').
156 +EOF
157 exit(1);
158 }
159
147 - my ($lmode, $rmode, $lsha1, $rsha1, $status) = split(' ', substr($rawdiff[$i], 1));
160 + my ($lmode, $rmode, $lsha1, $rsha1, $status) =
161 + split(' ', substr($rawdiff[$i], 1));
162 my $src_path = $rawdiff[$i + 1];
163 my $dst_path;
164
@@ -156,7 +170,7 @@ sub setup_dir_diff
170 $i += 2;
171 }
172
159 - if (($lmode eq $submodule_mode) or ($rmode eq $submodule_mode)) {
173 + if ($lmode eq $submodule_mode or $rmode eq $submodule_mode) {
174 $submodule{$src_path}{left} = $lsha1;
175 if ($lsha1 ne $rsha1) {
176 $submodule{$dst_path}{right} = $rsha1;
@@ -167,14 +181,16 @@ sub setup_dir_diff
181 }
182
183 if ($lmode eq $symlink_mode) {
170 - $symlink{$src_path}{left} = $diffrepo->command_oneline('show', "$lsha1");
184 + $symlink{$src_path}{left} =
185 + $diffrepo->command_oneline('show', "$lsha1");
186 }
187
188 if ($rmode eq $symlink_mode) {
174 - $symlink{$dst_path}{right} = $diffrepo->command_oneline('show', "$rsha1");
189 + $symlink{$dst_path}{right} =
190 + $diffrepo->command_oneline('show', "$rsha1");
191 }
192
177 - if (($lmode ne $null_mode) and ($status !~ /^C/)) {
193 + if ($lmode ne $null_mode and $status !~ /^C/) {
194 $lindex .= "$lmode $lsha1\t$src_path\0";
195 }
196
@@ -199,14 +215,16 @@ sub setup_dir_diff
215 # Populate the left and right directories based on each index file
216 my ($inpipe, $ctx);
217 $ENV{GIT_INDEX_FILE} = "$tmpdir/lindex";
202 - ($inpipe, $ctx) = $repo->command_input_pipe(qw/update-index -z --index-info/);
218 + ($inpipe, $ctx) =
219 + $repo->command_input_pipe(qw(update-index -z --index-info));
220 print($inpipe $lindex);
221 $repo->command_close_pipe($inpipe, $ctx);
222 my $rc = system('git', 'checkout-index', '--all', "--prefix=$ldir/");
223 exit($rc | ($rc >> 8)) if ($rc != 0);
224
225 $ENV{GIT_INDEX_FILE} = "$tmpdir/rindex";
209 - ($inpipe, $ctx) = $repo->command_input_pipe(qw/update-index -z --index-info/);
226 + ($inpipe, $ctx) =
227 + $repo->command_input_pipe(qw(update-index -z --index-info));
228 print($inpipe $rindex);
229 $repo->command_close_pipe($inpipe, $ctx);
230 $rc = system('git', 'checkout-index', '--all', "--prefix=$rdir/");