update-third-party: Add helper to disable custom gitattributes

Provide a helper function that import scripts can use when the
third-party project defines custom Git attributes in its top-level
`.gitattributes` file.  These must be commented out because Git
does not support custom attributes in a subdirectory where we
where the third-party project is about to be merged.
This commit is contained in:
Brad King
2017-03-24 15:13:55 -04:00
parent 3142808f15
commit f1a5583901

View File

@@ -52,6 +52,14 @@ git_archive () {
tar -C "$extractdir" -x
}
disable_custom_gitattributes() {
pushd "${extractdir}/${name}-reduced"
# Git does not allow custom attributes in a subdirectory where we
# are about to merge the `.gitattributes` file, so disable them.
sed -i '/^\[attr\]/ {s/^/#/}' .gitattributes
popd
}
die () {
echo >&2 "$@"
exit 1