Refuse to push changes with a dirty git client#155946
Refuse to push changes with a dirty git client#155946Daniel-B-Smith wants to merge 2 commits intorust-lang:mainfrom
Conversation
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
I'm not sure this is the way everyone need to follow, I definitely want to push to remote even there are untrack files left(for example some test files, etc), I may push to remote then |
|
I don’t feel strongly about untracked files. I’m happy to put that behind
an environment variable one way or the other or just drop it altogether.
…On Tue, Apr 28, 2026 at 11:13 PM Yukang ***@***.***> wrote:
*chenyukang* left a comment (rust-lang/rust#155946)
<#155946 (comment)>
I'm not sure this is the way everyone need to follow, I definitely want to
push to remote even there are untrack files left(for example some test
files, etc), I may push to remote then git clean -fd to remove them later.
—
Reply to this email directly, view it on GitHub
<#155946 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZA2YFIMUTMNT44UMCJCKL4YFXMFAVCNFSM6AAAAACYJ5IGMOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DGNBQGU3DOMBWHA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
80ce775 to
650a1cb
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
91b0ccd to
bc046f2
Compare
c9ad739 to
74eecd9
Compare
|
I updated the check to ignore untracked files. PTAL |
| fi | ||
|
|
||
| if [ -n "$(git status --porcelain --untracked-files=no)" ]; then | ||
| echo "error: working tree is dirty, refusing to push" |
There was a problem hiding this comment.
this seems better:
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
echo "error: tracked files have uncommitted changes, refusing to push"
echo " commit, stash, or discard those changes first."
echo " untracked files are ignored by this check."
echo "You may use \`git push --no-verify\` to skip this check."
exit 1
fi
I've run into the issue more than once where I've fixed an issue in my client but forgotten to commit it one way or another. The verification succeeds because the files on disk are correct even though the files in the commit being pushed are incorrect.
This change checks to see if there are any uncommitted changes or untracked files in the client before running the tidy checks.