Skip to content

8357920: Add .rej and .orig to .gitignore #25474

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

Closed
wants to merge 1 commit into from

Conversation

magicus
Copy link
Member

@magicus magicus commented May 27, 2025

The file types .rej and .orig are often created by diff tools. Adding them to .gitignore will help people from mistakenly committing these files.

See #25306 (comment) for an example of where this happened.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8357920: Add .rej and .orig to .gitignore (Bug - P4) ⚠️ Issue is already resolved. Consider making this a "backport pull request" by setting the PR title to Backport <hash> with the hash of the original commit. See Backports.

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25474/head:pull/25474
$ git checkout pull/25474

Update a local copy of the PR:
$ git checkout pull/25474
$ git pull https://git.openjdk.org/jdk.git pull/25474/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25474

View PR using the GUI difftool:
$ git pr show -t 25474

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25474.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 27, 2025

👋 Welcome back ihse! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented May 27, 2025

@magicus This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8357920: Add .rej and .orig to .gitignore

Reviewed-by: syan, erikj

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 23 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@magicus
Copy link
Member Author

magicus commented May 27, 2025

/integrate auto

@openjdk openjdk bot added rfr Pull request is ready for review auto labels May 27, 2025
@openjdk
Copy link

openjdk bot commented May 27, 2025

@magicus This pull request will be automatically integrated when it is ready

@openjdk
Copy link

openjdk bot commented May 27, 2025

@magicus The following label will be automatically applied to this pull request:

  • build

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@mlbridge
Copy link

mlbridge bot commented May 27, 2025

Webrevs

@@ -23,3 +23,5 @@ NashornProfile.txt
/.gdbinit
/.lldbinit
**/core.[0-9]*
*.rej
Copy link
Member

Choose a reason for hiding this comment

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

How about use below config instead. It will ignore all the related diff files in root directory and in the any sub-directory.

**/*.rej
**/*.orig

Copy link
Member Author

Choose a reason for hiding this comment

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

Patterns without a / in them will match in all subdirectories, so your suggestion is just redundant. I see we have some places where this was done previously; maybe we should remove that to avoid the confusion. ** is only relevant if you want to do something like src/**/*.java.

Copy link
Member Author

Choose a reason for hiding this comment

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

And if you really wanted to just match files in the root directory, you'd have to write /*.rej.

Copy link
Member

@sendaoYan sendaoYan left a comment

Choose a reason for hiding this comment

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

LGTM

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 28, 2025
@openjdk
Copy link

openjdk bot commented May 28, 2025

/integrate

@openjdk
Copy link

openjdk bot commented May 28, 2025

Going to push as commit 7bd8375.
Since your change was applied there have been 23 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 28, 2025
@openjdk openjdk bot closed this May 28, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 28, 2025
@openjdk
Copy link

openjdk bot commented May 28, 2025

@openjdk[bot] Pushed as commit 7bd8375.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@magicus magicus deleted the update-gitignore branch May 28, 2025 14:39
@egahlin
Copy link
Member

egahlin commented May 30, 2025

Not sure this is helping.

When I do "git status" now, I can't see the *.rej files, so I have to remove the filter from .gitignore.

@erikj79
Copy link
Member

erikj79 commented May 30, 2025

Not sure this is helping.

When I do "git status" now, I can't see the *.rej files, so I have to remove the filter from .gitignore.

To see ignored files, there is a switch:

git status --ignored

It will show all ignored files and directories though so includes the build dir, but could still help you.

@magicus
Copy link
Member Author

magicus commented May 30, 2025

When I do "git status" now, I can't see the *.rej files

Why would you want to do that?

@egahlin
Copy link
Member

egahlin commented May 30, 2025

Why would you want to do that?

To see what I couldn't merge or apply without a conflict.

@kimbarrett
Copy link

kimbarrett commented Jun 2, 2025

Why would you want to do that?

To see what I couldn't merge or apply without a conflict.

+1

I think I hate this change. I just wasted some time on that very problem.

If those files exist, they are interesting. They just shouldn't be committed. This change treats them as uninteresting.
I don't know what a better solution is, as I'm not a git (or perhaps jcheck?) expert. But something that only prevents
committing would be very much better.

@magicus
Copy link
Member Author

magicus commented Jun 2, 2025

I am open for reverting this if it causes trouble in established workflows.

But the problem with committed .rej files is real too, and I'm not sure how to solve that without using .gitignore. I think we need to either:

A) establish that this new behavior is much worse than the risk for integrating unwanted files (if so, we can just revert this), or

B) find another solution that allows us to remove this change but still catch the unwanted .rej and .orig files.

I don't have any good suggestions on B, and I am not sure how we could decide if A is applicable or not.

@erikj79
Copy link
Member

erikj79 commented Jun 2, 2025

This does seem like a reasonably easy check for jcheck to perform, at least in theory. It could be configured with a regex for file name patterns we don't want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto build [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

5 participants