[pitivi] bin: Make it possible to source pitivi-git-environment



commit 7046ac1129f982950f4b09a88f3445e9c5d861d5
Author: Thibault Saunier <thibault saunier collabora com>
Date:   Sat May 25 09:39:53 2013 -0400

    bin: Make it possible to source pitivi-git-environment

 bin/pitivi-git-environment.sh |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/bin/pitivi-git-environment.sh b/bin/pitivi-git-environment.sh
index 9169db4..61d5766 100755
--- a/bin/pitivi-git-environment.sh
+++ b/bin/pitivi-git-environment.sh
@@ -390,13 +390,20 @@ if [ $ready_to_run == 1 ]; then
         declare -F "$FUNCTION_NAME" > /dev/null 2>&1
         return $?
         }
-    if function_exists __git_ps1
+
+    if [[ "${BASH_SOURCE[0]}" != "${0}" ]]
     then
-        # Display "PTV env:", path, the output of __git_ps1, " $ "
-        changed_PS1='PS1="\[$(tput bold)$(tput setb 1)$(tput setaf 7)\]PTV env:\w\[$(tput 
sgr0)\]\$(__git_ps1)$ "'
+      echo "pitivi-git environment is being sourced"
+      export PS1="[ptv] $PS1"
     else
-        # Display "PTV env:", path, " $ "
-        changed_PS1='PS1="\[$(tput bold)$(tput setb 1)$(tput setaf 7)\]PTV env:\w\[$(tput sgr0)\] $ "'
+      if function_exists __git_ps1
+      then
+          # Display "PTV env:", path, the output of __git_ps1, " $ "
+          changed_PS1='PS1="\[$(tput bold)$(tput setb 1)$(tput setaf 7)\]PTV env:\w\[$(tput 
sgr0)\]\$(__git_ps1)$ "'
+      else
+          # Display "PTV env:", path, " $ "
+          changed_PS1='PS1="\[$(tput bold)$(tput setb 1)$(tput setaf 7)\]PTV env:\w\[$(tput sgr0)\] $ "'
+      fi
+      bash --rcfile <(cat ~/.bashrc; echo $changed_PS1)
     fi
-    bash --rcfile <(cat ~/.bashrc; echo $changed_PS1)
 fi


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]