Skip to content

2022 11 11 Use git instead of file system to generate sources

Sebastien edited this page Nov 11, 2022 · 2 revisions

Use git instead of file system to generate sources

  • Status: accepted
  • Date: 2022-11-11

Technical Story: #385

Context and Problem Statement

We noticed that we could not copy files when --to was different than HEAD because it would copy files at a different state (and could even copy file we do not want to be copied, for exemple content of static resources). So we made a rule specifying we cannot generate delta content when --to is different than HEAD. It was ok so far because 99.99% of our customer usage was from HEAD. Then came the #354 issue and so we created the enhancement request #355 We also detected an issue with the current implementation using file system: it does not respect the .gitignore content.

Decision Drivers

  • Generate incremental sources from any state in the repo
  • Respect the .gitignore
  • Keep decent performance

Considered Options

  • Implement file copy from git content
  • Implement file copy from fs after having checkout --to commit
  • Keep it working that way

Decision Outcome

Chosen option: "Implement file copy from git content", because it does not change the current software architecture, respect the .gitignore content and does not kill to much the performance.

Positive Consequences

  • It can do incremental package content generation from any point in the repo
  • It respect the .gitignore rules

Negative Consequences

  • Performance for incremental package content generation are decreased (30% to 50%)

Pros and Cons of the Options

Implement file copy from git content

Use git show to rebuild fs commands (readFile, readdir, pathExists)

  • Good, incremental package content generated from any point in the repo
  • Good, .gitignore rules are enforced
  • Bad, because of performance (30% to 50% drop)
  • Bad, because of huge refactoring

Implement file copy from fs after having checkout --to commit

Use git checkout to and then keep fs based implementation

  • Good, incremental package content generated from any point in the repo
  • Good, because of performance (5% to 10% drop, depending on size of the repo)
  • Good, because the implementation is pretty simple
  • Bad, .gitignore rules are not enforced

Keep it working that way

We just do nothing, sorry for the 0.01% of our users

  • Good, because we do not start a massive refactoring
  • Bad, because it cannot do incremental package content generated from any point in the repo
  • Bad, .gitignore rules are not enforced

Links