Skip to content

Conversation

jia200x
Copy link
Member

@jia200x jia200x commented Aug 22, 2018

Contribution description

This PR adds support for using git-lfs for board documentation images (and related files). It's IMO a good trade-off between having files closer to the code and not bloating the repository.

This PR tracks all files undes board/<board_name>/doc folder as git-lfs files.

git-lfs in a nutshell

Assuming the git-lfs extension is installed (apt-get install git-lfs), simply install git-lfs in the RIOT repo:

git lfs install --local

Then, work with the github repo as you normally do. When pushing to origin or another remote, git-lfs will push a symlink-like file in the repo and upload the real file to another repo. This way the original repo doesn't bloat and only contains symlinks pointing to the actual file.

Github handles LFS files natively, as seen here (there is a Stored with Git LFS message).

So if git-lfs is installed, is exactly the same as using standard git. Both from the local computer and from the github.com file viewer.

FAQ

  • Where are LFS files stored?: Github provides a LFS server in the same repo hidden under RIOT.git/info/lfs
  • If I push files to my origin, will the symlink file point to my repo?: This seems to be handled by Github, the remote location is not included in the symlink file (only a hash and some references to git-lfs.github.com)
  • If someone doesn't have git-lfs, can still use the RIOT repo? It's possible to use the repo without Git LFS. However, make doc will fail wih a Please install git-lfs message. The new make doc target not only checks if git-lfs is installed but also executes git lfs install --local as a dependency.
  • How does it work with Pull Requests?: If someone uploads a picture without using git-lfs, Github will treat it as Git LFS file instead of Binary (see different files here). It's up to maintainers to make sure only Git LFS file get to boards/<board_name>/doc (see Possible improvements)

Possible improvements

  • Git hook for detecting if LFS is installed when changing <board_name>/doc files.

Testing procedure

Try running make doc with and without git-lfs.

Note this doesn't add <board_name>/doc to the RIOT doxygen file, it will be done in a further PR.

Issues/PRs references

None so far.

@jia200x jia200x added Area: doc Area: Documentation Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 22, 2018
@jia200x
Copy link
Member Author

jia200x commented Aug 22, 2018

Murdock should fail if it tries to run make doc. It's intended, and should install the git-lfs dependency before merging this PR (if accepted by the community)

@jia200x jia200x added the Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR label Aug 22, 2018
@jcarrano jcarrano added the State: waiting for other PR State: The PR requires another PR to be merged first label Aug 22, 2018
@jcarrano
Copy link
Contributor

should install the git-lfs dependency before merging this PR

I set the 'Waiting' label. I don't know how applicable it is, but at least it lets people know it depends on something else.

@jia200x
Copy link
Member Author

jia200x commented Aug 22, 2018

I set the 'Waiting' label. I don't know how applicable it is, but at least it lets people know it depends on something else.

That's right, thanks!

@jcarrano
Copy link
Contributor

This PR tracks all files undes board/<board_name>/doc folder as git-lfs files.

Non-binary files as well? Can we filter on extension?

@jia200x
Copy link
Member Author

jia200x commented Aug 22, 2018

Murdock should fail if it tries to run make doc. It's intended, and should install the git-lfs dependency before merging this PR (if accepted by the community)

Oh, it passed... does Murdock run make doc?

@jia200x
Copy link
Member Author

jia200x commented Aug 22, 2018

Non-binary files as well? Can we filter on extension?

Yes, wildcards and basic regex patterns are accepted

@jcarrano
Copy link
Contributor

In my machine:

$ make doc
"make" -BC doc/doxygen
make[1]: Entering directory '/home/jcarrano/source/vanillaRIOT/doc/doxygen'
Please install git lfs.
make[1]: *** [Makefile:52: git-lfs-check] Error 1
make[1]: Leaving directory '/home/jcarrano/source/vanillaRIOT/doc/doxygen'
make: *** [Makefile:10: doc] Error 2

But the check script runs "fine":

Running './dist/tools/doccheck/check.sh' ✓

The reason is that doccheck does not test the exit code of make or any error other than the filters it has configured.

@jia200x
Copy link
Member Author

jia200x commented Aug 22, 2018

The reason is that doccheck does not test the exit code of make or any error other than the filters it has configured.

I see. I will patch that

@jcarrano
Copy link
Contributor

@jia200x I already patched it!

@miri64 miri64 added State: waiting for other PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Oct 5, 2018
@PeterKietzmann
Copy link
Member

This PR has the "waiting for other PR" label set. What is it waiting for?

@jcarrano jcarrano removed the State: waiting for other PR State: The PR requires another PR to be merged first label Mar 5, 2019
@jcarrano
Copy link
Contributor

jcarrano commented Mar 5, 2019

@PeterKietzmann it was waiting for #9819. If LFS was not available, the build would fail silently.

Copy link
Contributor

@jcarrano jcarrano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs a couple of small makefile fixes, and then it's in.

RED=\033[0;31m
NC=\033[0m

git-lfs: git-lfs-check git-lfs-install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make these things phony.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, install should depend on check. With the current definitions there is no guarantee that install won't try to run before check.

@danpetry
Copy link
Contributor

ping @jia200x

@stale
Copy link

stale bot commented Sep 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Sep 20, 2019
@stale stale bot closed this Oct 21, 2019
Copy link
Member

@chrysn chrysn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still like this approach and would love to see it resumed.

@@ -5,3 +5,4 @@
# when the heading is exactly 7 characters long.
*.md conflict-marker-size=100
*.txt conflict-marker-size=100
boards/*/doc/* filter=lfs diff=lfs merge=lfs -text
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe that should say *.jpg *.png immaterial of the precise location?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: doc Area: Documentation Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR State: stale State: The issue / PR has no activity for >185 days Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants