oasis-open / cti-stix-common-objects

OASIS Cyber Threat Intelligence (CTI) TC: A repository for commonly used STIX objects in order to avoid needless duplication. https://github.com/oasis-open/cti-stix-common-objects
BSD 3-Clause "New" or "Revised" License
84 stars 36 forks source link

Add git sparse-checkout to the README #75

Open ejratl opened 4 months ago

ejratl commented 4 months ago

A common complaint about the cti-stix-common-objects repo is that it is very big because it creates and holds STIX objects for every CVE. People who are only working on extensions don't necessarily need all of the CVE objects pulled into their local repo.

git has an answer for this use case: git sparse-checkout. This relatively new feature of git is documented in a blog from Github.

It would be nice to add a paragraph describing how to use this with this repo. I'm creating this issue as a reminder to write this.

rpiazza commented 4 months ago

@ejratl - something to consider: https://github.com/oasis-tcs/cti-stix2/issues/293. If you read to the bottom there is some hesitation to do this before 2.2

rpiazza commented 4 months ago

This seems to work:

git sparse-checkout set asciidoc-shared extension-definition-specifications objects/extension-definition objects/identity objects/location objects/marking-definition

Can you give it a try - it eliminates 99% of the files in the repo :-)

SYNchroACK commented 2 months ago

Did you guys try git LFS?

I guess it might be used for the folder objects and let regular git be used in folders like extension-definition-specifications

rpiazza commented 2 months ago

I looked into git LFS in the past - but never got very far with it. If you have some ideas, I would love to add some directions to the README

SYNchroACK commented 2 months ago

I looked into git LFS in the past - but never got very far with it. If you have some ideas, I would love to add some directions to the README

  1. Users need to have git lfs installed:

    curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash && sudo apt-get install git-lfs
  2. You need to put in objects/ folder the file .gitattributes:

    ./** filter=lfs diff=lfs merge=lfs -text

and from now on, any file (including changes) on the folder objects will be stored in github LFS.

Try to clone this repo to see the speed... but I mean, I never tested it at this level: https://github.com/SYNchroACK/stix-objects-git-lfs

A potential problem is: image