Skip to content

Commit

Permalink
chore(bors): merge pull request #719
Browse files Browse the repository at this point in the history
719: build(utils/version): add correct git HEAD paths r=tiagolobocastro a=tiagolobocastro

When this is used a dependency for extensions the build.rs for utils-lib ends up adding an invalid git path to the cargo re-runs. This actually causes continuous rebuilding on the extensions repo. Fixes this by ensure the path exists and by checking specifically for the extensions env var.
The latter one is, to put it bluntly, a hack, but atm I don't know else to do it in a quick way.

Co-authored-by: Tiago Castro <[email protected]>
  • Loading branch information
mayastor-bors and tiagolobocastro committed Jan 22, 2024
2 parents 7dc0df3 + e81151b commit 6869243
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
5 changes: 3 additions & 2 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ module.exports = {
'code-review-rule': ({subject}) => {
const REVIEW_COMMENTS = `Please don't merge code-review commits, instead squash them in the parent commit`;
if (subject.includes('code-review')) return [ false, REVIEW_COMMENTS ];
if (subject.includes('review comments')) return [ false, REVIEW_COMMENTS ];
if (subject.includes('address comments')) return [ false, REVIEW_COMMENTS ];
if (subject.includes('review comment')) return [ false, REVIEW_COMMENTS ];
if (subject.includes('address comment')) return [ false, REVIEW_COMMENTS ];
if (subject.includes('addressed comment')) return [ false, REVIEW_COMMENTS ];
return [ true ];
},
},
Expand Down
3 changes: 3 additions & 0 deletions scripts/git/branch_ancestor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ function findBranchesSharingFirstCommonCommit() {
local BASE_BRANCH
if [[ -z "${1+x}" || "$1" == '.' ]]; then
BASE_BRANCH="$CURRENT_BRANCH"
if [ "$CURRENT_BRANCH" = "" ]; then
return
fi
else
BASE_BRANCH="$1"
fi
Expand Down
13 changes: 10 additions & 3 deletions utils/utils-lib/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ fn main() -> BuildResult {
String::from_utf8_lossy(&output.stderr)
);

let git_path = std::path::Path::new("../../.git");
if git_path.exists() {
println!("cargo:rerun-if-changed=../../.git/HEAD");
fn add_git_head(root: &str) {
let git_path = std::path::Path::new(root).join(".git/HEAD");
if git_path.exists() {
println!("cargo:rerun-if-changed={}", git_path.display());
}
}

add_git_head("../..");
if let Ok(ext) = std::env::var("EXTENSIONS_SRC") {
add_git_head(&ext);
}

Ok(())
Expand Down

0 comments on commit 6869243

Please sign in to comment.