Update work scripts
This commit is contained in:
27
scripts/shell/job/gp/git-add-lfs-for-bin-files.sh
Executable file
27
scripts/shell/job/gp/git-add-lfs-for-bin-files.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
is_binary() {
|
||||
if [[ -z "$(file "$1" | grep text)" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
binary_extensions=()
|
||||
|
||||
while IFS= read -r -d '' file; do
|
||||
[[ "$file" =~ 'git/index' ]] && continue
|
||||
|
||||
if is_binary "$file"; then
|
||||
extension="${file##*.}"
|
||||
|
||||
[[ ! ${binary_extensions[@]} =~ $extension ]] && binary_extensions+=("$extension")
|
||||
fi
|
||||
done < <(find . -type f -print0)
|
||||
|
||||
echo "Binary extensions:"
|
||||
for ext in ${binary_extensions[@]}; do
|
||||
echo " *.$ext"
|
||||
# git lfs track "*.$binary_extensions" --lockable
|
||||
done
|
||||
Reference in New Issue
Block a user