Skip to content

Commit

Permalink
Noir subrepo path adjust for mirror.
Browse files Browse the repository at this point in the history
  • Loading branch information
charlielye committed Feb 29, 2024
1 parent 65e4ab9 commit 002e042
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/mirror_noir_subrepo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ on:
branches:
- master
paths:
- 'noir/**'
- '!noir/.gitrepo'
- "noir/noir-repo/**"
- "!noir/noir-repo/.gitrepo"

jobs:
mirror_repo:
Expand All @@ -35,7 +35,7 @@ jobs:
# Do we have a PR active?
PR_URL=$(gh pr list --repo noir-lang/noir --head aztec-packages --json url --jq ".[0].url")
echo "PR_URL=$PR_URL" >> $GITHUB_ENV
- name: Generate PR body
run: |
set -xue # print commands
Expand All @@ -47,7 +47,7 @@ jobs:
AZTEC_SYNC_COMMIT="a7889f8d21684099306b72a87e0fb57b3bba0cb4"
fi
# Create a filtered git log for release-please changelog / metadata
RAW_MESSAGE=$(git log --pretty=format:"%s" $AZTEC_SYNC_COMMIT..HEAD -- noir/ ':!noir/.gitrepo' | grep -v 'git subrepo' || true)
RAW_MESSAGE=$(git log --pretty=format:"%s" $AZTEC_SYNC_COMMIT..HEAD -- noir/noir-repo/ ':!noir/noir-repo/.gitrepo' | grep -v 'git subrepo' || true)
# Fix Aztec PR links and output message
echo "$RAW_MESSAGE" | sed -E 's/\(#([0-9]+)\)/(https:\/\/github.com\/AztecProtocol\/aztec-packages\/pull\/\1)/g'
}
Expand All @@ -73,7 +73,7 @@ jobs:
# otherwise we first reset our staging branch
STAGING_BRANCH=$BRANCH-staging
fi
BASE_NOIR_COMMIT=`git config --file=noir/.gitrepo subrepo.commit`
BASE_NOIR_COMMIT=`git config --file=noir/noir-repo/.gitrepo subrepo.commit`
COMMIT=$(git rev-parse HEAD)
COMMIT_MESSAGE=$(git log -1 --pretty=format:%B)
Expand All @@ -91,7 +91,7 @@ jobs:
}
# force_sync_staging: Push to our aztec-packages staging branch.
function force_sync_staging() {
echo "$COMMIT" > noir/.aztec-sync-commit && git add noir/.aztec-sync-commit
echo "$COMMIT" > noir/noir-repo/.aztec-sync-commit && git add noir/noir-repo/.aztec-sync-commit
# make a new commit with our previous message
git commit -am "$COMMIT_MESSAGE"
# Now push to it with subrepo with computed commit messages
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
- name: Update PR
run: |
set -xue # print commands
# Formatted for updating the PR, overrides for release-please commit message parsing
# Formatted for updating the PR, overrides for release-please commit message parsing
PR_BODY="""BEGIN_COMMIT_OVERRIDE
$(cat .PR_BODY_MESSAGE)
END_COMMIT_OVERRIDE"""
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ There is an automatic mirror pushing noir to a PR on noir side. If the mirror is

Recovering if the sync is not happening with basic pull commands:

- manually editing the commit variable in noir/.gitrepo:
- manually editing the commit variable in noir/noir-repo/.gitrepo:
this needs to exist in the branch we push to, and have the same content as our base. This is similar to submodules, except instead of pointing to the final state of the module, it points to the last commit we have sync'd from, for purposes of commit replay. This can be fixed to match the commit in master after merges.
- manually editing the parent variable in noir/.gitrepo: this is the parent of the last sync commit on aztec side. If you get errors with a commit not being found in the upstream repo, and the commit mentioned is not the commit variable above, it might indicate this is somehow incorrect. This can happen when commit content is ported without its history, e.g. squashes
- manually editing the parent variable in noir/noir-repo/.gitrepo: this is the parent of the last sync commit on aztec side. If you get errors with a commit not being found in the upstream repo, and the commit mentioned is not the commit variable above, it might indicate this is somehow incorrect. This can happen when commit content is ported without its history, e.g. squashes
- use pull --force ONLY where you would use git reset. That is, if you really want to match some upstream noir for a purpose its fine, but you'll lose local changes (if any)

0 comments on commit 002e042

Please sign in to comment.