Skip to content
Snippets Groups Projects
Commit 05f68e7a authored by Brad King's avatar Brad King
Browse files

pre-commit: Fix import of ExternalData files with CRLF newlines

We use `git hash-object` to load the original file into the Git
object store.  Add the `--no-filters` option to avoid applying
any conversion filters that `git add` would apply based on
attributes.  Otherwise file content may not be preserved, such
CRLF newlines when `core.autocrlf` is `true`.
parent ccfad78a
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,7 @@ ExternalData_stage_linked_content() {
obj=$(git rev-parse --verify -q "$ref") || obj=""
if test -z "$obj" -a -f "$staged"; then
# Content is staged by the ExternalData module. Store it in Git.
obj=$(git hash-object -w -- "$staged") ||
obj=$(git hash-object --no-filters -w -- "$staged") ||
die "$file: git hash-object failed to load $staged"
git update-ref "$ref" "$obj" "" ||
die "$file: git update-ref failed to create $ref = $obj"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment