bz-main-project depends on bz-commons-values. Both are git repositories and the branch in the git_repository dependency is set to masterbz-main-project, the build properly clone bz-commons-values project and uses the values from its master branchbz-commons-values source code and push the changes to originbz-main-project with bazel build //...DEBUG: /home/oskrpko/.cache/bazel/_bazel_oskrpko/c429044b6da761f38a72b0fea910fe72/external/bazel_tools/tools/build_defs/repo/git.bzl:45:9: git.bzl: Cloning or updating (--depth=1) repository bz-commons-values using strip_prefix of [None].bz-commons-values from its initial clone. Since the git repository dependency uses a branch and not a tag or commit we expected bazel to detect the changes to the remote branch to be properly fetched.bazel clean --expunge or bazel sync, we get the new code from the bz-commons-values origin. However I don't think we should have to clean the cache to get the new code.bz-main-project, for example in WORKSPACE, and we rebuild it. We still don't get the new changes from bz-commons-values origin, but we even do not see ...Cloning or updating log message.... Whether or not we make a change in the dependent project, I think the build should use the latest sources from the dependency origin when using a branch.NA
git clone https://github.com/oskrpko/bz-commons-values.gitgit clone https://github.com/oskrpko/bz-main-project.gitbz-main-project execute bazel build //...bz-commons-values and push master to originbz-main-project execute bazel build //...CentOS 7
bazel info release?release 0.27.0
bazel info release returns "development version" or "(@non-git)", tell us how you built Bazel.I did not built it myself. I used yum install bazel
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?NA. I did not build bazel from the sources.
From my searches on the web I understood that a git_repository with a branch attribute is supposed to be followed. I did not find mention of this specific issue.
I think this is intended. I don't think Bazel should check the repository on each build command (that would make all builds slow).
I would suggest specifying the commit in the call to git_repository, and update it when you want.
Found this behavior surprising.
When pointing at a branch, the expectation I had was that I would be using the latest commit from that branch, not the commit that branch happened to point to at the time that the repository was cloned.