Code

Refactor patch_update_cmd
authorWincent Colaiuta <win@wincent.com>
Wed, 21 Nov 2007 12:36:38 +0000 (13:36 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Nov 2007 08:51:56 +0000 (00:51 -0800)
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>
git-add--interactive.perl

index 0317ad9127b374a9ded536e6fb2c825a3b13828c..fb1e92a7664f77aa5ca4ca30b4711bafaf155466 100755 (executable)
@@ -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;