Skip to content

.gitattributes: Treat SVG as binary#21807

Merged
crasbe merged 1 commit intoRIOT-OS:masterfrom
maribu:gitattributes/svg-is-binary
Oct 19, 2025
Merged

.gitattributes: Treat SVG as binary#21807
crasbe merged 1 commit intoRIOT-OS:masterfrom
maribu:gitattributes/svg-is-binary

Conversation

@maribu
Copy link
Copy Markdown
Member

@maribu maribu commented Oct 19, 2025

Contribution description

This may not be fully accurate. But changes to an SVG file are usually better viewed with a graphical tool than a diff and contributor stats are really messed up with svg files being treated as text files.

Testing procedure

In master

git check-attr --all -- doc/doxygen/src/riot-logo.svg
# No output

This PR

git check-attr --all -- doc/doxygen/src/riot-logo.svg 
doc/doxygen/src/riot-logo.svg: binary: set
doc/doxygen/src/riot-logo.svg: diff: unset
doc/doxygen/src/riot-logo.svg: merge: unset
doc/doxygen/src/riot-logo.svg: text: unset

Issues/PRs references

This hopefully fixes misleading contribution stats showing many thousand lines of code changes when adding a new SVG file to the doc.

This may not be fully accurate. But changes to an SVG file are usually
better viewed with a graphical tool than a `diff` and contributor
stats are really messed up with svg files being treated as text files.
@maribu maribu added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Oct 19, 2025
@crasbe crasbe added the Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation label Oct 19, 2025
Copy link
Copy Markdown
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

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

Perhaps you can (temporarily) add an .svg file to the PR to see if it works?

@maribu
Copy link
Copy Markdown
Member Author

maribu commented Oct 19, 2025

I already did add this commit to a PR that contained an SVG, but it did not work there. I assume that Github will not honor the .gitattributes from a random PR, but only the one of the base repo. That might make sense from a security point of view - there might be some ways to obfuscate changes in a PR by adding a malicious .gitattributes file to the PR.

@riot-ci
Copy link
Copy Markdown

riot-ci commented Oct 19, 2025

Murdock results

✔️ PASSED

d5086be .gitattributes: Treat SVG as binary

Success Failures Total Runtime
10552 0 10552 08m:19s

Artifacts

@crasbe crasbe added this pull request to the merge queue Oct 19, 2025
Merged via the queue into RIOT-OS:master with commit 9334926 Oct 19, 2025
28 checks passed
@maribu maribu deleted the gitattributes/svg-is-binary branch October 19, 2025 20:06
@maribu
Copy link
Copy Markdown
Member Author

maribu commented Oct 19, 2025

Nope, the stats in Github are still considering SVG files as text files.

Locally, it does work, though:

commit 145fd81dd09424abd4678830cd161965d10234c9 (HEAD -> boards/olimexino-stm32f3, origin/boards/olimexino-stm32f3)
Author: Marian Buschsieweke <[email protected]>
Date:   Tue Dec 31 14:02:22 2024 +0100

    boards/olimexino-stm32f3: add board definition

3    0   boards/olimexino-stm32f3/Makefile
17   0   boards/olimexino-stm32f3/Makefile.dep
18   0   boards/olimexino-stm32f3/Makefile.features
29   0   boards/olimexino-stm32f3/Makefile.include
-    -   boards/olimexino-stm32f3/dist/OLIMEXINO-STM32F3_Rev_C1.svg
56   0   boards/olimexino-stm32f3/doc.md
144  0   boards/olimexino-stm32f3/include/arduino_iomap.h
67   0   boards/olimexino-stm32f3/include/board.h
50   0   boards/olimexino-stm32f3/include/gpio_params.h
271  0   boards/olimexino-stm32f3/include/periph_conf.h

@miri64
Copy link
Copy Markdown
Member

miri64 commented Oct 20, 2025

I always liked that I could actually track changes to the SVG XML in Git... Can we revert this, especially after all it did not have the desired effect? Also, GitHub is very good with showing the graphical differences in a SVG. See, e.g., 3dec472

@maribu
Copy link
Copy Markdown
Member Author

maribu commented Oct 20, 2025

I honestly cannot tell if you are trolling with claiming to look on a text diff of an XML that elides all the relevant context and is tens of thousands of lines of code, or if that is a serious request. Please clarify.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Oct 20, 2025

I honestly cannot tell if you are trolling with claiming to look on a text diff of an XML that elides all the relevant context and is tens of thousands of lines of code, or if that is a serious request. Please clarify.

No, I am really looking at SVG diffs, especially if they are as cleaned up as most SVGs in the doc/ directory are. I can't really say much about vendor SVGs which this PR seems mostly to be about, I do admit I rarely look at those and given what I see sometimes coming out of proprietary graphics editors I can understand if that is something that is more confusing than helpful.

@benpicco benpicco added this to the Release 2025.10 milestone Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR 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.

5 participants