Refactor patch_update_cmd
Split patch_update_cmd into two functions, one to prompt the user for a path to patch and another to do the actual work given that file path. This lays the groundwork for a future commit which will teach git-add--interactive to accept a path parameter and jump directly to the patch subcommand for that path, bypassing the interactive prompt. Signed-off-by: Wincent Colaiuta <win@wincent.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Wincent Colaiuta committed
Nov 21, 2007 at 13:36 UTC
a7d9da6c972cb7bc79ef47ad7199dfb2a8dcf67f
1 file changed
+4
-2
git-add--interactive.perl
+4
-2
@@ -564,10 +564,12 @@ sub patch_update_cmd {
564
IMMEDIATE => 1,
565
HEADER => $status_head, },
566
@mods);
567
- return if (!$it);
567
+ patch_update_file($it->{VALUE}) if ($it);
568
+}
569
570
+sub patch_update_file {
571
my ($ix, $num);
570
- my $path = $it->{VALUE};
572
+ my $path = shift;
573
my ($head, @hunk) = parse_diff($path);
574
for (@{$head->{TEXT}}) {
575
print;