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

StGit-enabled bash-prompt

From
Robin Rosenberg <robin.rosenberg.lists@dewire.com>
Date
Oct 26, 2006, 21:17 UTC
Message-ID
<200610262317.30209.robin.rosenberg.lists@dewire.com>
Hi,

I added the following snippet to my .bashrc to help me keep track of what patch I'm working on. I got annoyed at typing stg top/stg series all the time.

This changes the bash prompt to include the current git branch and the top stgit patch to the prompt.

Of course you will read and understand this code. I don't know how good an idea it is to use the DEBUG trap this way.

NO WARRANTY (as always)
-- robin
if [ "$PS1" ]; then
    function stgtag
    {
        br=$(stg branch 2>/dev/null)
        top=$(stg top 2>/dev/null)
        if [[ -n "$br$top" ]];then
            echo " [$top@$br] "
        fi
    }
    trap 'PS1="\u@\h$(stgtag)\w]\$ "' DEBUG
Next: Ben Clifford
Message 1 of 3 in “StGit-enabled bash-prompt”
  1. Robin RosenbergOct 26, 2006
  2. Ben CliffordOct 27, 2006
  3. Robin RosenbergOct 27, 2006

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.