Is the `.pants.bootstrap` file at the root of the ...
# general
g
Is the
.pants.bootstrap
file at the root of the repo meant to be sourced only when the current directory is at the root too? https://www.pantsbuild.org/2.21/docs/using-pants/key-concepts/options#pantsbootstrap-file
c
No, it’s meant to always be sourced.
h
Running pants from a cwd other than the repo root is not pefectly supported so I wouldn't be surprised if there are issues
c
sourcing
.pants.bootstrap
does work for me from a project subfolder, but it may mess up assumptions about CWD and config file paths etc. What kind of issue do you experience?
g
Interesting… the unexpected behavior was due to running pants from source using
PANTS_SOURCE
and
PANTS_PANTSD=true
. After removing those and using the version provided by scie-pants, the script gets sourced from any directory.
the content of the file was a variable to reference the last commit in the checkout
Copy code
#!/usr/bin/env bash
# -*- sh -*-
GIT_HASH=$(git rev-parse --short HEAD)
[[ $(git status --short) != "" ]] && {
    GIT_HASH="$GIT_HASH-dirty"
}
export GIT_HASH
the errors that I was getting was that the env var
GIT_HASH
was not set
c
Ah, there may be strangeness going on when running from pants sources perhaps..