# Re: [PATCH] Bash snippet to show branch and patch in bash prompt

4 messages from 2006-10-30 to 2006-10-30. Participants: Robin Rosenberg, Catalin Marinas.
Thread: https://gitlist.dev/t/43409

## Robin Rosenberg, 2006-10-30 10:42

Subject: [PATCH] Bash snippet to show branch and patch in bash prompt
Message-ID: <20061030104225.11875.57076.stgit@lathund.dewire.com>
URL: https://gitlist.dev/e/20061030104225.11875.57076.stgit%40lathund.dewire.com

```
From: Robin Rosenberg <robin.rosenberg@dewire.com>

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---

 contrib/stgbashprompt.sh |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/contrib/stgbashprompt.sh b/contrib/stgbashprompt.sh
new file mode 100755
index 0000000..792da53
--- /dev/null
+++ b/contrib/stgbashprompt.sh
@@ -0,0 +1,16 @@
+# include this in your bashrc or copy to /etc/bash_completions.d
+
+if [ "$PS1" ]; then
+    # trap 'PS1="\u@\h [$(stg top)] \w]\$ "' DEBUG
+    function stgtag
+    {
+	br=$(stg branch 2>/dev/null)
+	top=$(stg top 2>/dev/null)
+	if [[ -n "$br$top" ]];then
+	    echo "[$top@$br]"
+	    return
+	fi
+    }
+    PS1='\u@\h$(stgtag)\w\$ '
+

```

## Catalin Marinas, 2006-10-30 10:46

Subject: Re: [PATCH] Bash snippet to show branch and patch in bash prompt
Message-ID: <tnxhcxm2i9j.fsf@arm.com>
URL: https://gitlist.dev/e/tnxhcxm2i9j.fsf%40arm.com
In-Reply-To: <20061030104225.11875.57076.stgit@lathund.dewire.com>

```
Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> From: Robin Rosenberg <robin.rosenberg@dewire.com>
>
> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
> ---
>
>  contrib/stgbashprompt.sh |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/contrib/stgbashprompt.sh b/contrib/stgbashprompt.sh
> new file mode 100755
> index 0000000..792da53
> --- /dev/null
> +++ b/contrib/stgbashprompt.sh
> @@ -0,0 +1,16 @@
> +# include this in your bashrc or copy to /etc/bash_completions.d
> +
> +if [ "$PS1" ]; then
> +    # trap 'PS1="\u@\h [$(stg top)] \w]\$ "' DEBUG
> +    function stgtag
> +    {
> +	br=$(stg branch 2>/dev/null)
> +	top=$(stg top 2>/dev/null)
> +	if [[ -n "$br$top" ]];then
> +	    echo "[$top@$br]"
> +	    return
> +	fi
> +    }
> +    PS1='\u@\h$(stgtag)\w\$ '
> +
> +fi

Isn't this the same patch? "stg refresh" :-)?

-- 
Catalin

P.S. could you please send them to my catalin.marinas@gmail.com

```

## Robin Rosenberg, 2006-10-30 10:57

Subject: Re: [PATCH] Bash snippet to show branch and patch in bash prompt
Message-ID: <200610301157.43702.robin.rosenberg.lists@dewire.com>
URL: https://gitlist.dev/e/200610301157.43702.robin.rosenberg.lists%40dewire.com
In-Reply-To: <20061030104225.11875.57076.stgit@lathund.dewire.com>

```
måndag 30 oktober 2006 11:42 skrev Robin Rosenberg:
> From: Robin Rosenberg <robin.rosenberg@dewire.com>
>
> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>

This was a "reply" using stgit, but the reference missed the ange brackets. 

Anyway thanks for the feedback on the prompt.

-- robin

```

## Robin Rosenberg, 2006-10-30 10:59

Subject: Re: [PATCH] Bash snippet to show branch and patch in bash prompt
Message-ID: <200610301159.03654.robin.rosenberg.lists@dewire.com>
URL: https://gitlist.dev/e/200610301159.03654.robin.rosenberg.lists%40dewire.com
In-Reply-To: <20061030104225.11875.57076.stgit@lathund.dewire.com>

```
Oops, didn't refresh before sending.. 


```
