Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: format rebase script #363759

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

WIP: format rebase script #363759

wants to merge 1 commit into from

Conversation

infinisil
Copy link
Member

Motivated by NixOS/nixfmt#159 and the treewide Nixpkgs reformatting. Doesn't fully work though, see FIXME.

Ping @NixOS/nix-formatting

Things done

  • Test
  • More test

This work is funded by Tweag and Antithesis

Add a 👍 reaction to pull requests you find important.

@infinisil infinisil marked this pull request as draft December 9, 2024 23:51
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Dec 9, 2024
Comment on lines +31 to +38
# FIXME: Problem, example with PR 363407 (60b1ab8ae23e1b15f8054e8fe4d8775bdfe26bc5)
# (After resolving an irrelevant conflict), the merge with strategy theirs causes a syntax error
# We need to not merge any files, but always take the entire file from the other side
# Kind of something with reset or checkout maybe?
#
# Probably a filter-branch should work, by effectively ignoring the formatting commit, and just reapplying the formatting on all files.
# The formatting commit should only be used to speed this up. In particular there might be intermediate commits that need to be formatted that haven't been formatted at all before (in that exact state)
# After the filter branch, a rebase should work without problems
Copy link
Member Author

Choose a reason for hiding this comment

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

Here's how to reproduce the problem (assuming you're in a Nixpkgs checkout)

git fetch [email protected]:tweag/nixpkgs.git
git checkout file_picker
git worktree add ../format-rebase format-rebase
../format-rebase/maintainers/scripts/format-rebase/run.sh treewide-pinned
Executing: /home/tweagysil/src/nixpkgs/format-rebase/maintainers/scripts/format-rebase/format-head.sh /tmp/tmp.xhoR8v9FKd/reformatted-files
Formatting pkgs/by-name/fl/fluffychat/package.nix
pkgs/by-name/fl/fluffychat/package.nix:12:3:
   |
12 |   targetFlutterPlatform ? "linux",
   |   ^
unexpected 't'
expecting expression

warning: execution failed: /home/tweagysil/src/nixpkgs/format-rebase/maintainers/scripts/format-rebase/format-head.sh /tmp/tmp.xhoR8v9FKd/reformatted-files

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nix-formatting-team-treewide-nixpkgs-formatting/56666/12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants