How to block odt file on GIT?

We need to check out the odt files (binaries) from LibreOffice to GitHub (project documentation).

Locking seems impossible or very hacky, which is the best option or alternative solutions?

+3


source to share


1 answer


Write a pre-receive hook that checks for incoming presses, here is a basic full control loop:

path=path/to/protected/file
while read old new ref; do              # for each pushed ref
        git rev-list $old..$new \
        | while read; do                # check for bad commits

                # test here, e.g. 
                test "`git rev-parse $REPLY:$path`" \
                   = "`git rev-parse v1.0:$path`" \
                || {
                        echo "** altered $path in $ref@$REPLY **"
                        exit 1
                }
                # end of this test

        done
done

      



Now no one can push the modified version to your repo.

+1


source







All Articles