Merge branch 'nd/diff-parseopt'
[gitweb.git] / git-add--interactive.perl
index d190469cd8b5e1dc427b4029d0d1fb937faef584..20eb81cc92f947d872b31a179d43d97772ff25e4 100755 (executable)
@@ -205,8 +205,15 @@ sub list_untracked {
        }
 }
 
-sub get_empty_tree {
-       return '4b825dc642cb6eb9a060e54bf8d69288fbee4904';
+{
+       my $empty_tree;
+       sub get_empty_tree {
+               return $empty_tree if defined $empty_tree;
+
+               $empty_tree = run_cmd_pipe(qw(git hash-object -t tree /dev/null));
+               chomp $empty_tree;
+               return $empty_tree;
+       }
 }
 
 sub get_diff_reference {
@@ -1055,7 +1062,7 @@ sub recount_edited_hunk {
                        $o_cnt++;
                } elsif ($mode eq '+') {
                        $n_cnt++;
-               } elsif ($mode eq ' ') {
+               } elsif ($mode eq ' ' or $mode eq "\n") {
                        $o_cnt++;
                        $n_cnt++;
                }
@@ -1564,7 +1571,7 @@ sub patch_update_file {
                                        error_msg __("No other hunks to search\n");
                                        next;
                                }
-                               if ($1 eq "") {
+                               if ($regex eq "") {
                                        print colored $prompt_color, __("search for regex? ");
                                        $regex = <STDIN>;
                                        if (defined $regex) {