From: Richard Hansen <rhansen@bbn.com>
To: Jess Austin <jess.austin@gmail.com>
Cc: git@vger.kernel.org, szeder@ira.uka.de
Subject: Re: [PATCH] git-prompt.sh: Omit prompt for ignored directories
Date: Thu, 09 Oct 2014 18:09:15 -0400 [thread overview]
Message-ID: <5437078B.6020307@bbn.com> (raw)
In-Reply-To: <CANp8Xb_kdpzYjWZxoWFtT+UWwMPpFD0znkoEKVpdukGf61Preg@mail.gmail.com>
On 2014-10-09 06:27, Jess Austin wrote:
> On Thu, Oct 9, 2014 at 12:37 AM, Richard Hansen <rhansen@bbn.com> wrote:
>> On 2014-10-08 17:37, Jess Austin wrote:
>>> On Wed, Oct 8, 2014 at 4:12 PM, Richard Hansen <rhansen@bbn.com> wrote:
>>>> On 2014-10-08 15:04, Jess Austin wrote:
>>>>> Introduce a new environmental variable, GIT_PS1_OMITIGNORED, which
>>>>> tells __git_ps1 to display nothing when the current directory is
>>>>> set (e.g. via .gitignore) to be ignored by git. In the absence of
>>>>> GIT_PS1_OMITIGNORED this change has no effect.
>>>>>
>>>>> Many people manage e.g. dotfiles in their home directory with git.
>>>>> This causes the prompt generated by __git_ps1 to refer to that "top
>>>>> level" repo while working in any descendant directory. That can be
>>>>> distracting, so this patch helps one shut off that noise.
...
>>
>> $ PS1='\n\w$(__git_ps1 " (%s)")\n\$ '
>>
>> /home/rhansen/projects (dotfiles)
>> $ GIT_PS1_OMITIGNORED=y
>>
>> /home/rhansen/projects <-- Git prompt goes away as desired
>> $ cd foo
>>
>> /home/rhansen/projects/foo (master) <-- Git prompt back as expected
>> $ echo ignored/ >>.gitignore && mkdir -p ignored && cd ignored
>>
>> /home/rhansen/projects/foo/ignored <-- I want the Git prompt here
>> $
>>
>> In other words: If I were to use this feature, I'd want to be able to
>> hide the prompt when I'm in an ignored directory in my dotfiles work
>> tree, but show the prompt when I'm in an ignored directory in any other
>> work tree.
>
> Would you want this configured in each repo (i.e. via a line in ".git/config"),
> or would you prefer something global so that it only need be set in one
> place? I'm not sure how the latter technique would work, so if that seems
> better please advise on how to go about that.
A 'git config' variable is fine. The bash.showDirtyState,
bash.showUntrackedFiles, and bash.showUpstream config variables seem
like good examples to follow.
-Richard
next prev parent reply other threads:[~2014-10-09 22:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-08 19:04 [PATCH] git-prompt.sh: Omit prompt for ignored directories Jess Austin
2014-10-08 21:12 ` Richard Hansen
[not found] ` <CANp8Xb8ETG-ZFCqrOk=f-RbxtRxehBmAR1O5ozLH80zimWq_Gw@mail.gmail.com>
2014-10-08 21:37 ` Fwd: " Jess Austin
2014-10-09 5:37 ` Richard Hansen
2014-10-09 10:27 ` Jess Austin
2014-10-09 22:09 ` Richard Hansen [this message]
2014-10-14 2:32 ` [PATCH] git-prompt.sh: Hide prompt for ignored pwd Jess Austin
2014-10-14 18:47 ` Johannes Sixt
2014-10-14 19:08 ` Richard Hansen
2014-10-15 4:06 ` [PATCH] git-prompt.sh: Option to hide " Jess Austin
2014-10-15 20:28 ` Richard Hansen
2015-01-05 7:03 ` [PATCH v4] " Richard Hansen
2015-01-06 23:31 ` Junio C Hamano
2015-01-07 1:22 ` [PATCH v5 0/2] " Richard Hansen
2015-01-07 1:22 ` [PATCH v5 1/2] git-prompt.sh: if pc mode, immediately set PS1 to a plain prompt Richard Hansen
2015-01-14 11:45 ` [PATCH v5 1/2] git-prompt.sh: if pc mode, immediately set PS1 SZEDER Gábor
2015-01-07 1:22 ` [PATCH v5 2/2] git-prompt.sh: Option to hide prompt for ignored pwd Richard Hansen
2014-10-14 19:21 ` [PATCH] git-prompt.sh: Hide " Richard Hansen
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=5437078B.6020307@bbn.com \
--to=rhansen@bbn.com \
--cc=git@vger.kernel.org \
--cc=jess.austin@gmail.com \
--cc=szeder@ira.uka.de \
/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.
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 NNTP newsgroup(s).