git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Small issue with "add untracked" option of 'git add -i'
Date: Thu, 22 Jun 2017 08:43:15 +0530	[thread overview]
Message-ID: <1498101195.1687.4.camel@gmail.com> (raw)
In-Reply-To: <xmqqshj5nl3o.fsf@gitster.mtv.corp.google.com>


On Mon, 2017-06-12 at 10:59 -0700, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > After prompting to get the list of desired files, if the user chose
> > nothing, the message is shown.  "No untracked files chosen." is
> > probably what the code wants to say, I would think.
> 
> 
> 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).
> 
>  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");
I guess I should take take back the following statement from my
previous thread,

> That does seem to be a more apt message to be shown. It's
> unambiguous.

The ambiguity persists. It seems that 'Add untracked' is not
differentiating between 'absence of untracked files' and 'not selecting
any untracked files' currently. It seems to be the root cause of the
ambiguity.

As a result the new message "No untracked file chosen." seems absurd
when user tries to choose the '4: add untracked' option in 'git add -i'
and there are no untracked files in his repository.

    $ git add -i

    *** Commands ***
      1: status    	      2: update    	      3: revert    	      4: add untracked
      5: patch    	      6: diff    	      7: quit    	      8: help
    What now> 4
    No untracked file chosen.


>  	}
> -	print "\n";
>  }
>  
>  sub run_git_apply {


      parent reply	other threads:[~2017-06-22  3:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-12 14:33 Small issue with "add untracked" option of 'git add -i' Kaartic Sivaraam
2017-06-12 17:38 ` Junio C Hamano
2017-06-12 17:58   ` Kaartic Sivaraam
2017-06-12 17:59   ` Junio C Hamano
2017-06-14 13:04     ` Kaartic Sivaraam
2017-06-15  6:50       ` Kaartic Sivaraam
2017-06-21  2:55     ` Kaartic Sivaraam
2017-06-21  4:52       ` Kevin Daudt
2017-06-21 12:05         ` Kaartic Sivaraam
2017-06-22  3:13     ` Kaartic Sivaraam [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1498101195.1687.4.camel@gmail.com \
    --to=kaarticsivaraam91196@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).