Skip to content

Remove git directory by default on checkout#3705

Open
jaudiger wants to merge 3 commits intomainfrom
remove-git-dir
Open

Remove git directory by default on checkout#3705
jaudiger wants to merge 3 commits intomainfrom
remove-git-dir

Conversation

@jaudiger
Copy link
Copy Markdown
Contributor

This PR update the default behaviour on Git checkout when using gitCheckout from git recipe or Brioche.gitCheckout. As of today, the .git folder is always present after a checkout, but most of the time, we don't need this folder to be present for the recipe's source. Some recipes do need it to retrieve their version, but that's not the majority.

One of the consequence to have .git folder present in the source is it introduces some variances in the filesystem. On multiple git checkouts from the same remote, the output's hash will be each time different. .git folder is not designed to be fixed, it embeds some metadata such as timestamps, which prevent its reproducibility even on a shallow clone.

One direct impact of this source hash variance is each time we update git recipe or one of its dependencies, Brioche rebuilds all the recipes relying on gitCheckout which can take multiple hours. With this PR, we will remove one source of variance in the recipe's source, and hopefully reduce the build time of the CI.

A new option has been introduced keepGitDir to keep the .git folder when the recipes need it.

@jaudiger jaudiger self-assigned this Mar 28, 2026
@jaudiger
Copy link
Copy Markdown
Contributor Author

@kylewlacy I didn't broadly set keepGitDir. I would prefer to try putting this PR in the merge queue, and see the recipes that really need it after each CI failures.

@jaudiger jaudiger requested a review from kylewlacy March 28, 2026 07:17
Copy link
Copy Markdown
Member

@kylewlacy kylewlacy left a comment

Choose a reason for hiding this comment

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

LGTM

@kylewlacy kylewlacy added this pull request to the merge queue Mar 29, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants