On Thu, 25 Apr 2013 00:36:45 -0700 (PDT)
Douglas Roaden <roadie...@gmail.com> wrote:

> I am a noob developer in the process of wiping and rebuilding a
> proper workflow environment. After reinstalling MsysGit a glaring
> visual aspect of the terminal display hit me in the face.
> doug@DOUG-PC now included... /msysgit (master). I remember this from
> the previous installation but had never given it any real thought...
> the question I have did not arise until it just now slapped me in the
> face! I have read through several tutorials and not one mention has
> been made concerning this command state... does /msysgit (master)
> indicate that this is the branch I am working from? Or is it simply a
> label for the parent? Is this a live branch state immediately after
> install is complete... if so then this state requires change prior to
> closing the terminal does it not? Not sure if it means anything since
> I have yet to discover any mention of it?

When saying "terminal display", do you mean the Git bash window?
If so, here's a possible explanation.
Interactive POSIX shells (bash included) allow you to customize their
prompt by setting (and exporting) several environment variables, with
"PS1" being the most widely used.  Each time the shell is about to
present you its prompt, the contents of that variable is evaluated, and
substitution of several keywords is performed on its contents.  The
result is then output to the console.

In my Git bash from the stock Git for Windows 1.8.1 I have:
$ echo $PS1
\[\033[0m\]\[\033[32m\]\u@\h \[\033[33m\]\w$(__git_ps1)\[\033[0m\]\n$

Notice the "$(__git_ps1)" bit which means "execute a program or a
function named __git_ps1 and substitute what it printed to its standard
output in place of the whole $(...) expression".
Now it's just a matter of recursively searching %ProgramFiles%\Git for
the string "__git_ps1" which yields two files:
%ProgramFiles%\Git\etc\profile and %ProgramFiles%\Git\etc\git-prompt.sh.

The first one is the default shell script file which is read by an
interactive shell, and from its code it can be seen that it sources the
second one which actually defines the __git_ps1 function.

The task of that function is to gather certain information about the
current Git repository (if it finds one) and constructing a substring
out of it, which is then appears in the shell prompt.

The %ProgramFiles%\Git\etc\profile simulates what on a Unix-y system
would be /etc/profile, and that file, in the end, tries to source
per-user shell script.  Hence to defeat the effects of this smart
prompt, you have two options, both of which should be dealt with by
writing your user-specific shell script, which should be %HOME%\.bashrc:

* Redefine the __git_ps1 function to nothing by placing

  __git_ps1()
  {
    true
  }

  to your ~/.bashrc

* Redefine PS1 by placing

  export PS1='$ '

  to that same file.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to