Przeglądaj źródła

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.
Brad King 8 lat temu
rodzic
commit
f1a5583901
1 zmienionych plików z 8 dodań i 0 usunięć
  1. 8 0
      Utilities/Scripts/update-third-party.bash

+ 8 - 0
Utilities/Scripts/update-third-party.bash

@@ -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