git_config_maybe_bool()
[gitweb.git] / git-add--interactive.perl
index 8ce1ec92c2b04e1271b3ee1a41a2ac60d2f8aad4..cd43c3491260cb2aa51f0d19fd18ab66e4ad8217 100755 (executable)
@@ -990,8 +990,7 @@ sub edit_hunk_manually {
 EOF
        close $fh;
 
-       my $editor = $ENV{GIT_EDITOR} || $repo->config("core.editor")
-               || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
+       chomp(my $editor = run_cmd_pipe(qw(git var GIT_EDITOR)));
        system('sh', '-c', $editor.' "$@"', $editor, $hunkfile);
 
        if ($? != 0) {
@@ -1217,7 +1216,11 @@ sub patch_update_file {
        if (@{$mode->{TEXT}}) {
                unshift @hunk, $mode;
        }
-       if (@{$deletion->{TEXT}} && !@hunk) {
+       if (@{$deletion->{TEXT}}) {
+               foreach my $hunk (@hunk) {
+                       push @{$deletion->{TEXT}}, @{$hunk->{TEXT}};
+                       push @{$deletion->{DISPLAY}}, @{$hunk->{DISPLAY}};
+               }
                @hunk = ($deletion);
        }