aboutsummaryrefslogtreecommitdiff
path: root/git-add--interactive.perl
diff options
context:
space:
mode:
authorWincent Colaiuta <win@wincent.com>2007-11-21 13:36:38 +0100
committerJunio C Hamano <gitster@pobox.com>2007-11-22 00:51:56 -0800
commita7d9da6c972cb7bc79ef47ad7199dfb2a8dcf67f (patch)
tree80a41b3b6640deb21e1e218702d00ae9ff19c399 /git-add--interactive.perl
parent5f5b611805ed60a303ccbc07ebd9a5bac2dabb92 (diff)
downloadgit-a7d9da6c972cb7bc79ef47ad7199dfb2a8dcf67f.tar.gz
git-a7d9da6c972cb7bc79ef47ad7199dfb2a8dcf67f.tar.xz
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>
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-xgit-add--interactive.perl6
1 files changed, 4 insertions, 2 deletions
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;