[restrict_export_to_octez_source.sh]: anchor paths to root

What

restrict_export_to_octez_source.sh: anchor paths to root

Anchor the paths in export-ignore git attributes written to .gitattributes by restrict_export_to_octez_source.sh, by prefixing them with slash.

Why

If the paths are not anchored, they match files throughout the repo. For instance, the line README.md export-ignore does not just remove README.md in the root from the export, it ignores all files named README.md. However, the intent of this script is to only exclude files found at the root (by find).

This fixes an issue in the job build_octez_source, where compilation fails due to a README.md that is excluded from the export.

How

Manually testing the MR

Run the job build_octez_source in pipelines of this MR .

Locally, run something like:

./scripts/ci/restrict_export_to_octez_source.sh
./scripts/ci/create_octez_tarball.sh octez
mv octez.tar.bz2 ../
cd ../
tar xf octez.tar.bz2
cd octez/
eval $(opam env)
make octez

To understand the issue with git attributes better, try the following:

Before making any changes to .git-attributes

Check the attribute of README.MD in the root of the repo:

$ git check-attr export-ignore README.md
README.md: export-ignore: unspecified

Check the attribute of README.MD in a sub-directory:

$ git check-attr export-ignore src/kernel_sdk/core/README.md
src/kernel_sdk/core/README.md: export-ignore: unspecified

Now add README.md to .gitattributes the script restrict_export_to_octez_source.sh would do before this MR, and note that both files are affected:

$ echo 'README.md export-ignore' >> .gitattributes
$ git check-attr export-ignore README.md src/kernel_sdk/core/README.md
README.md: export-ignore: set
src/kernel_sdk/core/README.md: export-ignore: set

Now revert your changes to .gitattributes try anchoring the file instead, and observe that only the README.MD in the root is affected:

$ git restore .gitattributes
$ echo '/README.md export-ignore' >> .gitattributes
$ git check-attr export-ignore README.md src/kernel_sdk/core/README.md
README.md: export-ignore: set
src/kernel_sdk/core/README.md: export-ignore: unspecefied

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Arvid Jakobsson

Merge request reports

Loading