-
Notifications
You must be signed in to change notification settings - Fork 4k
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
airbyte-ci format: exclude .gitignored files from format #33249
airbyte-ci format: exclude .gitignored files from format #33249
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Current dependencies on/for this PR: This stack of pull requests is managed by Graphite. |
c6cd01c
to
8afd4a8
Compare
8afd4a8
to
08c8c32
Compare
08c8c32
to
f658064
Compare
24c9ceb
to
775f0f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm glad this works! There's a lot of room to simplify this implementation, however.
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/format_command.py
Outdated
Show resolved
Hide resolved
# Add all files to the git index | ||
.with_exec(["git", "add", "."]) | ||
# Commit all files | ||
.with_exec(["git", "commit", "--message", "Commit for formatting"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe that you need to commit anything for git clean
to do its thing, in which case you can remove everything in between init
and clean
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I don't commit the files they will be considered as untracked files - hence the commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's true that they will be considered as untracked files, however, that does not affect how clean
behaves. See for yourself, try it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also surprised that it works, mind you, so I looked into it. The -X
flag for clean
is the reason it works: https://git-scm.com/docs/git-clean
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/format_command.py
Outdated
Show resolved
Hide resolved
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/format_command.py
Show resolved
Hide resolved
# This is needed to avoid git complaining about the user not being set | ||
.with_exec(["config", "user.email", "ci@airbyte.io"]) | ||
.with_exec(["config", "user.name", "Airbyte CI"]) | ||
# Add all files to the git index | ||
.with_exec(["add", "."]) | ||
# Commit all files | ||
.with_exec(["commit", "--message", "Commit for formatting"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# This is needed to avoid git complaining about the user not being set | |
.with_exec(["config", "user.email", "ci@airbyte.io"]) | |
.with_exec(["config", "user.name", "Airbyte CI"]) | |
# Add all files to the git index | |
.with_exec(["add", "."]) | |
# Commit all files | |
.with_exec(["commit", "--message", "Commit for formatting"]) |
# Commit all files | ||
.with_exec(["commit", "--message", "Commit for formatting"]) | ||
# Remove all gitignored files | ||
.with_exec(["clean", "-dfX"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.with_exec(["clean", "-dfX"]) | |
.with_exec(["clean", "-dfqX"]) |
The -q option makes for less noise in stdout, apparently.
Co-authored-by: Marius Posta <marius@airbyte.io>
65b84fc
to
823514c
Compare
…3249) Co-authored-by: Marius Posta <marius@airbyte.io>
…3249) Co-authored-by: Marius Posta <marius@airbyte.io>
…3249) Co-authored-by: Marius Posta <marius@airbyte.io>
What
Under current implementation
airbyte-ci format check/fix
can format gitignored files.So far we've maintained an exclusion rule in
DEFAULT_FORMAT_IGNORE_LIST
but we don't want to maintain it to match all are git ignore rules.How
git status --ignored --short
DEFAULT_FORMAT_IGNORE_LIST
+ this list from the files to format.🚨 User Impact 🚨
Unfortunately
git status --ignored
is pretty slow (~20s on my laptop) so it'll make the format commands 20s slower...