GibboK
GibboK

Reputation: 73928

How to lock odt file on GIT?

We need to lock odt files (binary files) from LibreOffice in GitHub (project documentation).

Lock seems not possible or very hacky, what are the best option or alternative solutions?

Upvotes: 3

Views: 230

Answers (1)

jthill
jthill

Reputation: 60295

Write a pre-receive hook that checks inbound pushes, here's the basic full-inspection 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 nobody can push an altered version to your repo.

Upvotes: 1

Related Questions