Re: Small issue with "add untracked" option of 'git add -i'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2017-06-12 at 10:59 -0700, Junio C Hamano wrote:
> Together with your other wishes, perhaps something like this is what
> you have in mind.  The original tried to throw in a blank line as a
> separator to help interactive users to more easily tell the boundary
> of blocks of text, but it wasn't consistently doing so (e.g. "update"
> when nothing is dirty was very silent, while "status" gave one blank
> line that is supposed to be shown after the list of changed ones even
> when the list is empty).
> 
That's right. Though I'm not sure of the implementation, I guess the
following patch would make `git add -i` do what I thought it should.

>  git-add--interactive.perl | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/git-add--interactive.perl b/git-add--interactive.perl
> index 709a5f6ce6..0ec09361b4 100755
> --- a/git-add--interactive.perl
> +++ b/git-add--interactive.perl
> @@ -537,7 +537,7 @@ sub list_and_choose {
>  				$last_lf = 1;
>  			}
>  		}
> -		if (!$last_lf) {
> +		if (@stuff && !$last_lf) {
>  			print "\n";
>  		}
>  
> @@ -634,7 +634,6 @@ sub prompt_help_cmd {
>  sub status_cmd {
>  	list_and_choose({ LIST_ONLY => 1, HEADER => $status_head },
>  			list_modified());
> -	print "\n";
>  }
>  
>  sub say_n_paths {
> @@ -667,7 +666,6 @@ sub update_cmd {
>  		       map { $_->{VALUE} } @update);
>  		say_n_paths('updated', @update);
>  	}
> -	print "\n";
>  }
>  
>  sub revert_cmd {
> @@ -701,7 +699,6 @@ sub revert_cmd {
>  		refresh();
>  		say_n_paths('reverted', @update);
>  	}
> -	print "\n";
>  }
>  
>  sub add_untracked_cmd {
> @@ -711,9 +708,8 @@ sub add_untracked_cmd {
>  		system(qw(git update-index --add --), @add);
>  		say_n_paths('added', @add);
>  	} else {
> -		print __("No untracked files.\n");
> +		print __("No untracked file chosen.\n");
>  	}
> -	print "\n";
>  }
>  
>  sub run_git_apply {



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]