Bug 32473 - Exclude compiled files from some git commands
Summary: Exclude compiled files from some git commands
Status: RESOLVED MOVED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-15 07:43 UTC by Jonathan Druart
Modified: 2023-01-11 15:27 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2022-12-15 07:43:06 UTC
Not sure how to achieve that for now, but we need to exclude the following files from git command output 

koha-tmpl/intranet-tmpl/prog/js/vue/dist/main.js
koha-tmpl/intranet-tmpl/prog/css/staff-global.css
koha-tmpl/opac-tmpl/bootstrap/css/*.css

git diff, git status, etc. We don't want developers to think about them every time they are inspecting git index.

Kind of related with https://gitlab.com/koha-community/koha-misc4dev/-/issues/60
Comment 1 Jonathan Druart 2022-12-15 07:54:40 UTC
We could use `git update-index --assume-unchanged `

But when? from where?
Comment 2 Julian Maurice 2022-12-15 07:58:43 UTC
You can use this technique: https://git-scm.com/docs/gitattributes#_marking_files_as_binary

Files are still shown by git diff but not their contents
Comment 3 Jonathan Druart 2022-12-15 08:46:00 UTC
(In reply to Julian Maurice from comment #2)
> You can use this technique:
> https://git-scm.com/docs/gitattributes#_marking_files_as_binary
> 
> Files are still shown by git diff but not their contents

I really would like them to be invisible to devs. Not there for stash, status, diff, etc.
Comment 4 Julian Maurice 2022-12-16 08:55:15 UTC
(In reply to Jonathan Druart from comment #3)
> I really would like them to be invisible to devs. Not there for stash,
> status, diff, etc.

Maybe we should really exclude them from git then ?
It's a good practice to avoid tracking compiled files in git. In addition to the problems you already mentioned, they increase the repository size.
But that would make the build step required in production environments that use git, which might be not wanted.
Another potential solution would be to move them to another git repository (like what was suggested for PO files) and use it as an optional git submodule ? On a dev environment you wouldn't need it, and in prod environments you could just grab the already compiled files.
Anyway, all of that might be too complicated just to hide a few files from git output :)

I never used `update-index --assume-unchanged` so I don't know what it implies, but it looks like it will generate confusing errors for those that don't know what the 'assume unchanged' flag is, and how to unset it
Comment 5 Martin Renvoize 2023-01-10 10:20:51 UTC
My feeling is that they shouldn't be in git at all, as Julian suggests.

The should get built at the packaging state for production, ktd already builds as required at start (and we've got work underway to set watchers should you want that option).

I'm not sure the dev install type should be a deciding factor.. it's not a recommended way to install in production so I think it's OK for it to be a somewhat second class citizen.. we just need to document the build step into any dev install instructions that still exist.
Comment 6 David Cook 2023-01-11 00:04:48 UTC
(In reply to Martin Renvoize from comment #5)
> My feeling is that they shouldn't be in git at all, as Julian suggests.
> 
> The should get built at the packaging state for production, ktd already
> builds as required at start (and we've got work underway to set watchers
> should you want that option).
> 
> I'm not sure the dev install type should be a deciding factor.. it's not a
> recommended way to install in production so I think it's OK for it to be a
> somewhat second class citizen.. we just need to document the build step into
> any dev install instructions that still exist.

+1
Comment 7 Jonathan Druart 2023-01-11 12:09:17 UTC
Well, yes, ok, we all agree they should not be versioned, but that was not the point of this bug report.
Here I wanted a quick solution to stop them bothering devs (they are always showing as modified in git commands).

What we really want, the long term solution, is to remove all compiled files (so main.js for the vue app, and the css files generated by yarn build) from the git repo. But it's not as easy as... what I thought would be easy to implement here.

So basically if it's not easy to have the quick solution, maybe better to spend time on the long term version...
Comment 8 Jonathan Druart 2023-01-11 15:27:27 UTC
Replaced by bug 32609.