From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Hansen Subject: Re: [PATCH] git-prompt.sh: Omit prompt for ignored directories Date: Thu, 09 Oct 2014 18:09:15 -0400 Message-ID: <5437078B.6020307@bbn.com> References: <1412795040-19267-1-git-send-email-jess.austin@gmail.com> <5435A8A7.2030008@bbn.com> <54361F30.8020603@bbn.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: git@vger.kernel.org, szeder@ira.uka.de To: Jess Austin X-From: git-owner@vger.kernel.org Fri Oct 10 00:09:25 2014 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XcLtk-00009L-MF for gcvg-git-2@plane.gmane.org; Fri, 10 Oct 2014 00:09:25 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751975AbaJIWJU (ORCPT ); Thu, 9 Oct 2014 18:09:20 -0400 Received: from smtp.bbn.com ([128.33.0.80]:60378 "EHLO smtp.bbn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751856AbaJIWJT (ORCPT ); Thu, 9 Oct 2014 18:09:19 -0400 Received: from socket.bbn.com ([192.1.120.102]:60781) by smtp.bbn.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1XcLtc-0006o3-1d; Thu, 09 Oct 2014 18:09:16 -0400 X-Submitted: to socket.bbn.com (Postfix) with ESMTPSA id C44D54061D User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On 2014-10-09 06:27, Jess Austin wrote: > On Thu, Oct 9, 2014 at 12:37 AM, Richard Hansen wrote: >> On 2014-10-08 17:37, Jess Austin wrote: >>> On Wed, Oct 8, 2014 at 4:12 PM, Richard Hansen 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