Skip to content

Commit

Permalink
Refactor patch_update_cmd
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wincent Colaiuta authored and Junio C Hamano committed Nov 22, 2007
1 parent 5f5b611 commit a7d9da6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions git-add--interactive.perl
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,12 @@ sub patch_update_cmd {
IMMEDIATE => 1,
HEADER => $status_head, },
@mods);
return if (!$it);
patch_update_file($it->{VALUE}) if ($it);
}

sub patch_update_file {
my ($ix, $num);
my $path = $it->{VALUE};
my $path = shift;
my ($head, @hunk) = parse_diff($path);
for (@{$head->{TEXT}}) {
print;
Expand Down

0 comments on commit a7d9da6

Please sign in to comment.