Skip to content

ygn-effects/script-zippey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

script-zippey

Introduction

Zippey is a tool developed by Sippey Fun Lab that enables Git to handle zip-based files (in this case Freecad's .FCStd format) as text rather than binary, simplifying version control. The script is under the BSD 3-Clause License, as detailed in the header of the zippey.py file.

Description

This repository illustrates the way Zippey is used across the organization, allowing FreeCAD's .FCStd files to be processed by Git as plain text content.

If you clone this repository, you can see it in action by running the test_script.sh. It simulates a commit/checkout sequence and compares the resulting file to the original (there should be no difference, obviously). It doesn't require any arguments and can be run as follows:

./test_script.sh

Getting Started

Existing repository

1. Filter setup

To work with an existing repository already using Zippey, you must define the filter and diff attributes in Git's settings file, either globally or per repository. This is necessary because otherwise, Git will retrieve uncompressed files that FreeCAD won't understand.

  • Globally
git config --global filter.zippey.smudge "scripts/zippey/zippey.py d"
git config --global filter.zippey.clean "scripts/zippey/zippey.py e"
git config --global diff.zip.textconv "unzip -c -a"
  • Locally
git config filter.zippey.smudge "scripts/zippey/zippey.py d"
git config filter.zippey.clean "scripts/zippey/zippey.py e"
git config diff.zip.textconv "unzip -c -a"

New repository

1. Installation and script location

There are no dependencies and no specific installation steps, the script only uses standard Python libraries. It can be copied as-is from this repository.

The filter assumes that the script's location in the repo is scripts/zippey/zippey.py for consistency across repositories.

2. Filter setup

The filter can be defined in Git's settings file, either globally or per repository.

  • Globally
git config --global filter.zippey.smudge "scripts/zippey/zippey.py d"
git config --global filter.zippey.clean "scripts/zippey/zippey.py e"
git config --global diff.zip.textconv "unzip -c -a"
  • Locally
git config filter.zippey.smudge "scripts/zippey/zippey.py d"
git config filter.zippey.clean "scripts/zippey/zippey.py e"
git config diff.zip.textconv "unzip -c -a"

3. Filter declaration

The filter and diff attribute can then be declared in the .gitattributes file for the relevant extension

*.FCStd filter=zippey
*.FCStd diff=zip

4. Additional considerations

It is also a good idea to add the .FCStd1 extension in the .gitignore file as they are just backups and would only increase the commit's size unnecessarily.

*.FCStd1

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published