Skip to content

travisify: make sure build.sh is committed as executable on Windows #25

Description

@imagejan

When running travisify.sh on Windows (Git Bash), the committed build.sh script is not executable. Apparently, setting with chmod isn't sufficient on Windows:

chmod +x "$tmpFile"

In my experience, using git update-index is required:

git update-index --chmod=+x .travis/build.sh

My bash scripting skills are limited, so I was unsure where to add this line, but think it would likely belong into the update() function:

update() {
file=$1
msg=$2
test "$msg" || msg="Travis: update $file"
if [ -e "$file" ]
then
if diff -q "$file" "$tmpFile" >/dev/null
then
info "$file is already OK"
else
info "Updating $file"
$EXEC rm -rf "$file"
$EXEC mv -f "$tmpFile" "$file"
fi
else
info "Creating $file"
$EXEC mkdir -p "$(dirname "$file")"
$EXEC mv "$tmpFile" "$file"
fi
rm -rf "$tmpFile"
$EXEC git add "$file"
$EXEC git diff-index --quiet HEAD -- || $EXEC git commit -m "$msg"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions