git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Manlio Perillo <manlio.perillo@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-completion.bash: add support for path completion
Date: Wed, 19 Dec 2012 14:49:59 -0800	[thread overview]
Message-ID: <7vy5gt7j3c.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <50D23960.4070108@gmail.com> (Manlio Perillo's message of "Wed, 19 Dec 2012 23:02:08 +0100")

Manlio Perillo <manlio.perillo@gmail.com> writes:

>> 	git mv COPYING README X
>
> Assuming X is a new untracked directory, do you think it is an usability
> problem if an user try to do:
>
> 	git mv COPYING README <TAB>
>
> and X does not appear in the completion list?

It is hard to say.  Will it show "Documentation/" in the list?  Will
it show "git.c" in the list?

Your "git mv git.<TAB>" completing to "git mv git.c" would be an
improvement compared to the stock "less git.<TAB>" that offers
"git.c" and "git.o" as choices.  For things like "mv" and "rm", this
may not make too much of a difference, "git add <TAB>" would be a
vast improvement from the stock one.  The users will notice that the
completion knows what it is doing, and will come to depend on it.

But at that point, if "git mv COPYING README <TAB>" offers only
directories that contain tracked files, the users may get irritated,
because it is likely that the destination directory was created
immediately before the user started typing "git mv".  You will hear
"Surely I created X, it is there, why aren't you showing it to me?"

The updated completion knows what it is doing everywhere else, and
it sets the user-expectation at that level.  Uneven cleverness will
stand out like a sore thumb and hurts the user perception, which is
arguably unfair, but nothing in life is fair X-<.

I think over-showing the choices is much better than hiding some
choices, if we cannot do a perfect completion in some cases.  "You
should know that I won't be moving these files in Y, as I already
marked it to be ignored in the .gitignore file!" is less grave a
gripe than "You know I created X just a minute ago, and it is there,
why aren't you showing it to me?" because you can simply say "but Y
is there as a directory." admitting that you are less clever than
the user expects you to be, but at least you are giving the choice
to the user of not picking it.

In the ideal world (read: I am *not* saying "you should implement it
this way, or we won't look at your patch"), I think you would want
to show tracked files (because it may be the third path that the
user wants to move with the command, not the destination directory)
and any directory on the filesystem (it could be the third path that
is being moved if it has tracked files, or it could be the final
destination directory argument).

  reply	other threads:[~2012-12-19 22:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-16 21:24 [PATCH] git-completion.bash: add support for path completion Manlio Perillo
2012-12-17  4:50 ` Junio C Hamano
2012-12-17 11:17   ` Manlio Perillo
2012-12-17 19:42     ` Junio C Hamano
2012-12-18 16:25       ` Manlio Perillo
2012-12-19 22:02       ` Manlio Perillo
2012-12-19 22:49         ` Junio C Hamano [this message]
2012-12-19 23:50           ` Manlio Perillo

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=7vy5gt7j3c.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=manlio.perillo@gmail.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).