Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
IDzyre authored Jun 7, 2024
2 parents 1316d6e + 9c7ecca commit ce63d6e
Show file tree
Hide file tree
Showing 16 changed files with 563 additions and 213 deletions.
5 changes: 4 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ GEM
gemoji (>= 3, < 5)
html-pipeline (~> 2.2)
jekyll (>= 3.0, < 5.0)
json (2.7.1)
json (2.7.2)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
Expand All @@ -231,6 +231,8 @@ GEM
mutex_m (0.2.0)
net-http (0.4.1)
uri
nokogiri (1.16.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.3-x86_64-linux)
racc (~> 1.4)
octokit (4.25.1)
Expand Down Expand Up @@ -274,6 +276,7 @@ GEM
yell (2.2.2)

PLATFORMS
arm64-darwin-22
x86_64-linux

DEPENDENCIES
Expand Down
133 changes: 133 additions & 0 deletions _docs/developer/getting_started/commit_to_PR_from_fork.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
---
title: How To Checkout and Commit to a PR from a Forked Repository
category: Developer > Getting Started
---

Contributors who are part of the Submitty organization on Github can
make new branches on our Github repositories and should make PRs from
a *branch directly within the Submitty repository*. External
contributors cannot make new branches on the Submitty repositories.
Instead, external contributors will clone/fork the Submitty repository
and then make a PR from *a branch on their forked repository*.

It is simpler to review a PR made from a branch, and it is easy to
make small revisions as needed and commit and push those changes to
the branch. It is a little more work to do the same with a PR made
from a fork, but it is still possible -- *assuming that the owner of
the forked repository has granted the necessary permissions*. This
allows multiple developers to collaborate and finalize a PR for
merging to the main branch.

If you use Github Desktop or have the Github CLI installed, the simplest
way to work on a fork is to click the **Code** dropdown on the PR's page
on Github and checkout the PR from there.

![alt text](/images/fork-checkout.png)

The instructions below are for command line use of git.

1. **Before** you begin, confirm that your local main branch of Submitty is
up-to-date. Additionally, if the PR's branch is not up-to-date with Submitty's main,
there will be a button on its page on Github that you can press to update it.
You may need to resolve merge conflicts in the process of updating it.

![alt text](/images/update-branch.png)

2. From the PR on the Github website, find the name of the
user + branch name. It should be formatted something like this:
```
contributorusername:contributor_branch_name
```
Additionally, find the name of the fork on the fork's page on Github.
The `fork_name` may simply be `Submitty`, or the author may have chosen to another name.
3. Next, make a local branch on your computer in your working repository
with the proposed code changes. Here are the command lines
(substitute the user, branch, and fork names we found above):
If you **are not** using ssh keys on git:
```
git checkout -b contributorusername-contributor_branch_name main
git pull https://github.com/contributorusername/fork_name.git contributor_branch_name
```
If you **are** using ssh keys on git:
```
git checkout -b contributorusername-contributor_branch_name main
git pull git@github.com:contributorusername/fork_name.git contributor_branch_name
```
4. This has made a local branch named
`contributorusername-contributor_branch_name`. Go ahead and test
and review the PR and make code edits and new commits to your
local branch as needed.
5. In order to push the changes to the contributor's fork (and the PR
on Github from the fork), you will specify the upstream to be the
contributor's fork:
If you **are not** using ssh keys on git:
```
git remote add upstream https://github.com/contributorusername/fork_name.git
```
If you **are** using ssh keys on git:
```
git remote add upstream git@github.com:contributorusername/fork_name.git
```
Confirm that the upstream was set:
```
git remote -v
```
Which should print something like this if you **are not** using ssh keys on git:
```
origin https://github.com/Submitty/Submitty.git (fetch)
origin https://github.com/Submitty/Submitty.git (push)
upstream https://github.com/contributorusername/fork_name.git (fetch)
upstream https://github.com/contributorusername/fork_name.git (push)
```
Or this if you **are** using ssh keys on git:
```
origin git@github.com:Submitty/Submitty.git (fetch)
origin git@github.com:Submitty/Submitty.git (push)
upstream git@github.com:contributorusername/fork_name.git (fetch)
upstream git@github.com:contributorusername/fork_name.git (push)
```
6. Now once you are finished with your code changes, first commit them to
the local branch (named
`contributorusername-contributor_branch_name`).
And then push them from your local branch to the external
contributor's fork and update the PR on github:
```
git push upstream contributorusername-contributor_branch_name:contributor_branch_name
```
*NOTE: If you encounter a permissions error, it is possible that the external
contributor didn't grant access for collaboration on the branch.*
7. Confirm that you can see the changes on the Github website for the PR.
8. NOTE that when you move on to work on another PR from a fork, you will need to
cleanup / unset the upstream before you can set it to another repository:
```
git remote rm upstream
```
---
See also [How to Make a Pull Request](make_a_pull_request) and
[How to Review a Pull Request](review_a_pull_request).
5 changes: 4 additions & 1 deletion _docs/developer/getting_started/make_a_pull_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Be sure to read the [Suggestions for New Developers](/developer/getting_started/


2. Contributors from outside the Submitty GitHub organization should
clone the repo on their own GitHub page, and create a branch with
clone/fork the repo on their own GitHub page, and create a branch with
the modifications to be included with this pull request (PR).

_**IMPORTANT NOTE**:_ Please grant write access to the Submitty
Expand Down Expand Up @@ -167,8 +167,11 @@ Be sure to read the [Suggestions for New Developers](/developer/getting_started/
for specific reviewers.
---
See also [How to Review a Pull Request](review_a_pull_request).
---
These guidelines drawn from:
Expand Down
8 changes: 4 additions & 4 deletions _docs/developer/getting_started/phpstorm.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Under the `Mappings` tab, set the following:
This step will configure PhpStorm to use the PHP CLI that is configured inside your vagrant machine.
It is important to use this PHP installation as opposed to some other one as it ensures environment consistency among developers and production servers.

Under PhpStorm settings, open `Languages & Frameworks` > `PHP`. Press the `...` button next to `CLI Interpreter` and, on the left list of the interpreters window, press the `+` and select `From Docker, Vagrant, VM, Remote...`.
Under PhpStorm settings, open `PHP`. Press the `...` button next to `CLI Interpreter` and, on the left list of the interpreters window, press the `+` and select `From Docker, Vagrant, VM, Remote...`.
Select `Vagrant` from the list of radio buttons.
Then press `OK` to add the interpreter and `OK` to save the list of interpreters.

Expand All @@ -61,7 +61,7 @@ Open `Tools` > `Deployment...` > `Options`. Set `Upload changed files automatica

## Enable PHP debugging using xdebug

Under PhpStorm settings, open `Languages & Frameworks` > `PHP` > `Debug`. In the pre-configuration steps, press `Validate` to open the configuration validator. Choose `Remote Web Server` and set the following:
Under PhpStorm settings, open `PHP` > `Debug`. In the pre-configuration steps, press `Validate` to open the configuration validator. Choose `Remote Web Server` and set the following:

- `Path to create validation script`: `<submitty repository root>/site/public`
- `Deployment Server`: Use the SFTP connection you set up in the first step
Expand Down Expand Up @@ -91,7 +91,7 @@ Now you can browse the tables in the database window by expanding the tabs next

## Running PHPUnit tests

Under PhpStorm settings, open `Languages & Frameworks` > `PHP` > `Test Frameworks`. Press the `+` button to add a testing configuration, using the `PHPUnit by Remote Interpreter` type. Choose the interpreter you configured in earlier steps. Then set:
Under PhpStorm settings, open `PHP` > `Test Frameworks`. Press the `+` button to add a testing configuration, using the `PHPUnit by Remote Interpreter` type. Choose the interpreter you configured in earlier steps. Then set:

- `PHPUnit Library`: `Use Composer autoloader`
- `Path to script`: `/usr/local/submitty/GIT_CHECKOUT/Submitty/site/vendor/autoloader.php`
Expand Down Expand Up @@ -132,7 +132,7 @@ Press `OK` to save the run configuration. If you then `Debug` the configuration,

During debugging, you may get decently upset at how often you step into magic methods and class loaders etc. There's an easy fix for this:

Under PhpStorm settings, open `Languages & Frameworks` > `PHP` > `Debug` > `Step Filters`. Check `Skip magic methods` and add the following to `Skipped Methods`:
Under PhpStorm settings, open `PHP` > `Debug` > `Step Filters`. Check `Skip magic methods` and add the following to `Skipped Methods`:

- `app\views\AbstractView->__construct`
- `app\models\AbstractModel->convertName`
Expand Down
5 changes: 5 additions & 0 deletions _docs/developer/getting_started/review_a_pull_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ What do you need to do?
Now you have a version of the code in a new branch on the main repo.
Review the PR normally and delete the temporary branch when you are done
* If you need to make edits to a PR made from a branch in a forked
repo, see:
[How to Checkout and Commit to a Fork PR](commit_to_PR_from_fork)
4. [Re-install the system](/developer/development_instructions/index)
as necessary
Expand Down Expand Up @@ -108,5 +112,6 @@ What do you need to do?
hopefully, in short order, approving that the code be merged into
the main branch.
---
See also [How to Make a Pull Request](make_a_pull_request).
Loading

0 comments on commit ce63d6e

Please sign in to comment.