public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: John Szakmeister <john@szakmeister•net>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] [kernel] completion: silence "fatal: Not a git repository" error
Date: Tue, 14 Oct 2014 11:29:41 -0700	[thread overview]
Message-ID: <xmqqfveqzeqy.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1413283785-505-1-git-send-email-john@szakmeister.net> (John Szakmeister's message of "Tue, 14 Oct 2014 06:49:45 -0400")

John Szakmeister <john@szakmeister•net> writes:

> It is possible that a user is trying to run a git command and fail to realize
> that they are not in a git repository or working tree.  When trying to complete
> an operation, __git_refs would fall to a degenerate case and attempt to use
> "git for-each-ref", which would emit the error.
>
> Let's fix this by shunting the error message coming from "git for-each-ref".

Hmph, do you mean this one?

    $ cd /var/tmp ;# not a git repository
    $ git checkout <TAB>

->

    $ git checkout fatal: Not a git repository (or any of the parent directories): .git
    HEAD 

I agree it is ugly, but would it be an improvement for the end user,
who did not realize that she was not in a directory where "git checkout"
makes sense, not to tell her that she is not in a git repository in
some way?

  parent reply	other threads:[~2014-10-14 18:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-14 10:49 [PATCH] [kernel] completion: silence "fatal: Not a git repository" error John Szakmeister
2014-10-14 13:58 ` John Szakmeister
2014-10-14 18:29 ` Junio C Hamano [this message]
2014-10-14 19:18   ` John Szakmeister
2014-10-14 22:14     ` Junio C Hamano

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

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

  git send-email \
    --in-reply-to=xmqqfveqzeqy.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=john@szakmeister$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox