-
Notifications
You must be signed in to change notification settings - Fork 357
Programming exercises: Make .git(.*) files removable and creatable in online editor
#10655
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
Programming exercises: Make .git(.*) files removable and creatable in online editor
#10655
Conversation
59ea9df to
1b5d67f
Compare
…ise, a file must be 'valid'. A valid file cannot be contained in the '.git' folder. All files that start with '.git' could therefore not be deleted. Now, only the parent directory of the file is checked for '.git'.
1b5d67f to
0d2d1b9
Compare
…-exercises/hidden-files-cannot-be-deleted
Programming Exercises: .git* files cannot be removed in online editor
Programming Exercises: .git* files cannot be removed in online editorProgramming Exercises: .git(.*) files cannot be removed in Online Editor
Programming Exercises: .git(.*) files cannot be removed in Online EditorProgramming Exercises: .git(.*) files can be removed in Online Editor
…-cannot-be-deleted
WalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant Repository
participant File
Caller->>Repository: isValidFile(File)
alt file is null or path contains "../"
Repository-->>Caller: return false
else file is directory named ".git"
Repository-->>Caller: return false
else
Repository-->>Caller: (proceed with other logic)
end
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)`src/main/java/**/*.java`: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,de...
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (3)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
…-cannot-be-deleted
…-cannot-be-deleted
…-cannot-be-deleted
|
There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions. |
…-cannot-be-deleted
Programming Exercises: .git(.*) files can be removed in Online EditorProgramming exercises: .git(.*) files can be removed in Online Editor
Programming exercises: .git(.*) files can be removed in Online EditorProgramming exercises: Make .git(.*) files removable and creatable in online editor
marlonnienaber
left a comment
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.
Code looks fine but the branch can't be deployed on Helios. I guess thats because the branch is coming from a fork. How should be handle this @krusche? I tested locally: Unfortunately I can not create .gitignore/.gitkeep files as requested in the issue. Is there any other steps necessary to allow this, besides creating a programming exercise and allowing the online editor? If so please add precise testing instructions. Thx :)
|
Oh yeah. Sorry about the fork, this branch was created when i didn't have push rights yet. |
|
I've added detailed steps to reproduce in the description. This is how it looks on my machine: |
b-fein
left a comment
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.
Did you check that the issue only occurs for filenames starting with .git? The original issue report mentioned any files starting with a . but only gave the .gitkeep files as an example. If other hidden files are indeed not affected, then the solution makes sense and looks simple enough apart from the question in the inline comment.
marlonnienaber
left a comment
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 opened the wrong online editor (for working on exercises) initially. Tested again locally. Works as expected. Code looks good to me.
b-fein
left a comment
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.
Code looks good after inline questions were clarified.
…-cannot-be-deleted
HawKhiem
left a comment
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.
Code 👍
…-cannot-be-deleted
jonas-de
left a comment
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.
can't test on Helios - code looks good
…-cannot-be-deleted
Checklist
General
Server
Motivation and Context
This PR enables users to delete all .git(.*) files, which was incorrectly prohibited previously.
Fixes issue #9309.
Description
To delete a file e.g. in the 'Test' repository of a programming exercise, a file must be 'valid' according to the
Repository::isValidFilemethod. To protect the '.git' folder from deletion, all files with '.git' in their path could not be deleted. Now, deletion only fails, iff the file itself is the '.git' directory or a if the a parent directory is the '.git' folder. This ensures harmless files like '.gitignore' and '.gitkeep' can be deleted, but the '.git' folder itself is still protected.Steps to reproduce:
-) Create a new programming exercise with the default contents.
-) Click on "Edit in editor" to open the File Viewer.
-) Select the "TESTS" repository
-) Create the file ".gitkeep" in the root directory. Notice how it works.
-) Create the directory ".git" in the root directory. Notice how it errors out.
-) Delete the file ".gitkeep" in the root directory. Notice how it works.
Code Review
Manual Tests
Summary by CodeRabbit