From: Wincent Colaiuta Date: Wed, 21 Nov 2007 12:36:38 +0000 (+0100) Subject: Refactor patch_update_cmd X-Git-Tag: v1.5.4-rc0~163 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a7d9da6c972cb7bc79ef47ad7199dfb2a8dcf67f;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 0317ad912..fb1e92a76 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -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;