git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] bash completion: add bash.showUntrackedFiles option

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 12, 2013, 22:17 UTC
Message-ID
<7vwquddvnz.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1360699936-28688-2-git-send-email-martinerikwerner@gmail.com>
Martin Erik Werner <martinerikwerner@gmail.com> writes:
Show 7 quoted lines
> Add a config option 'bash.showUntrackedFiles' which allows enabling
> the prompt showing untracked files on a per-repository basis. This is
> useful for some repositories where the 'git ls-files ...' command may
> take a long time.
>
> Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
> ---
OK.

The subject needs to be corrected, though ;-) No need to resend. I'll do s/completion/prompt/ while applying.

Thanks.
Show 31 quoted lines
>  contrib/completion/git-prompt.sh |   11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
> index 9bef053..9b2eec2 100644
> --- a/contrib/completion/git-prompt.sh
> +++ b/contrib/completion/git-prompt.sh
> @@ -43,7 +43,10 @@
>  #
>  # If you would like to see if there're untracked files, then you can set
>  # GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked
> -# files, then a '%' will be shown next to the branch name.
> +# files, then a '%' will be shown next to the branch name.  You can
> +# configure this per-repository with the bash.showUntrackedFiles
> +# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is
> +# enabled.
>  #
>  # If you would like to see the difference between HEAD and its upstream,
>  # set GIT_PS1_SHOWUPSTREAM="auto".  A "<" indicates you are behind, ">"
> @@ -332,8 +335,10 @@ __git_ps1 ()
>  			fi
>  
>  			if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
> -				if [ -n "$(git ls-files --others --exclude-standard)" ]; then
> -					u="%"
> +				if [ "$(git config --bool bash.showUntrackedFiles)" != "false" ]; then
> +					if [ -n "$(git ls-files --others --exclude-standard)" ]; then
> +						u="%"
> +					fi
>  				fi
>  			fi
Previous: Martin Erik WernerNext: Martin Erik Werner
Message 3 of 20 in “Add bash.showUntrackedFiles config option”
  1. 0/2 Add bash.showUntrackedFiles config optionMartin Erik Werner, Feb 12, 2013
  2. 1/2 bash completion: add bash.showUntrackedFiles optionMartin Erik Werner, Feb 12, 2013
  3. Junio C HamanoFeb 12, 2013
  4. 2/2 t9903: add test case for bash.showUntrackedFilesMartin Erik Werner, Feb 12, 2013
  5. Junio C HamanoFeb 12, 2013
  6. 0/3 Add bash.showUntrackedFiles config optionMartin Erik Werner, Feb 13, 2013
  7. 1/3 shell prompt: add bash.showUntrackedFiles optionMartin Erik Werner, Feb 13, 2013
  8. 2/3 t9903: add tests for bash.showUntrackedFilesMartin Erik Werner, Feb 13, 2013
  9. Junio C HamanoFeb 13, 2013
  10. Martin Erik WernerFeb 13, 2013
  11. Junio C HamanoFeb 13, 2013
  12. 3/3 t9903: add extra tests for bash.showDirtyStateMartin Erik Werner, Feb 13, 2013
  13. Junio C HamanoFeb 13, 2013
  14. Martin Erik WernerFeb 13, 2013
  15. Junio C HamanoFeb 13, 2013
  16. Martin Erik WernerFeb 13, 2013
  17. Junio C HamanoFeb 13, 2013
  18. 2/3 t9903: add tests for bash.showUntrackedFilesMartin Erik Werner, Feb 13, 2013
  19. 3/3 t9903: add extra tests for bash.showDirtyStateMartin Erik Werner, Feb 13, 2013
  20. Junio C HamanoFeb 13, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.