okay, riddle me this

i have a file in my home directory called .git-prompt.sh that defines a function called __git_ps1

i include the output of that function in my $PS1 by writing it into my .bashrc file like so:

source ~/.git-prompt.sh

export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWUPSTREAM="auto"

if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m$(__git_ps1 " (%s)" 2> /dev/null)\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1 " (%s)" 2> /dev/null)\$ '
fi
unset color_prompt force_color_prompt

and it all works well and good, except that i made a change to the function to make it work better for what i do

when i log into my shell, it loads a version of .git_prompt.sh without my changes, somehow

if i manually source ~/.git-prompt.sh, the changes i made come into effect

how could that even be possible

@monorail is it because the environment variables need to be set before sourcing the script, so it currently only takes effect the second time it's loaded?

otherwise, the next debugging steps I'd try world be removing the source command and seeing if it still loads, adding echo statements inside the script, and seeing if the shell can start with a debug mode