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

[PATCH 0/1] Improve instructions around how to set git-prompt preference variables.

From
Edward D'Souza via GitGitGadget <gitgitgadget@gmail.com>
Date
Jun 5, 2019, 15:06 UTC
Message-ID
<pull.255.git.gitgitgadget@gmail.com>

When I first tried to use the git-prompt.sh script, I followed the instructions at the top of the file and everything worked, except for the "GIT_PS1_SHOWDIRTYSTATE" preference. Even though I had it set to true, I wasn't seeing the "()" and "(+)" in my shell prompt. After a few hours of poking around, I finally discovered what I had done wrong: I was setting the variable *after the "source ~/.git-prompt.sh" line, and it has to be set before.

I moved the lines around my .bashrc script and got everything working, but I thought the instructions could be a bit more explicit about how to set these preference variables, especially because this is a silent failure situation; the preference doesn't work if you get the order wrong and there are no warnings or errors to guide you.

This patch started as a PR on the official Github project two years ago ( https://github.com/git/git/pull/425), back when I didn't know the official process for submitting patches. Luckily, a kind user (@dscho) saw it and pointed me in the right direction to get it submitted.

This will be my first time submitting a patch, so hopefully I've figured out the process.

Edward D'Souza (1):
  git-prompt.sh: update shell variable instructions.
 contrib/completion/git-prompt.sh | 5 +++++
 1 file changed, 5 insertions(+)
base-commit: cb5918aa0d50f50e83787f65c2ddc3dcb10159fe
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-255%2Fghedsouza%2Fpatch-1-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-255/ghedsouza/patch-1-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/255
-- 
gitgitgadget
Next: Edward D'Souza via GitGitGadget
Message 1 of 4 in “Improve instructions around how to set git-prompt preference variables.”
  1. 0/1 Improve instructions around how to set git-prompt preference variables.Edward D'Souza via GitGitGadget, Jun 5, 2019
  2. 1/1 git-prompt.sh: update shell variable instructions.Edward D'Souza via GitGitGadget, Jun 5, 2019
  3. SZEDER GáborJun 5, 2019
  4. Edward D'SouzaJun 5, 2019

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.