In this commit, functionality is added to generate diffs of specific Git commits for a given project. The Git diffing function is modified to generate strings of diffs in addition to its existing behavior, and an additional function is added to the application to perform diffing based on specified Git commit ids.
Main changes:
- Added the `git_commit_diff` function which takes a project id and commit id, retrieves the corresponding Git repository, finds the specific commit, and generates a diff against its parent commit.
- The resulting diff is converted to a string using the existing `diff_hunks_to_string` function.
- The `diff_hunks_to_string` function is updated to be a standalone function as it is now utilized in two places.
- Added the `getCommitDiff` function to the front-end, which invokes the newly added `git_commit_diff`.
- The `git_commit_diff` function is added to the main function, ensuring it can be executed in the application
The button click event was modified to show a modal only if a certain condition is not met; otherwise, it will immediately update the base branch. The condition depends on the state of the `mergeUpstreamWarningDismissed` variable.
Changes:
- Replaced the direct function call `updateTargetModal.show` upon button click with a conditional function.
- Now, on button click, if `mergeUpstreamWarningDismissed` is true, the base branch gets updated using `branchController.updateBaseBranch()`.
- If `mergeUpstreamWarningDismissed` is false, the previous functionality remains, i.e., `updateTargetModal.show` gets called
- stopPropagation on parent container prevents normal link from opening
- added on:click handler workaround
I tried for a while to figure out a different way around this, but I wasn't able
to both prevent bubbling (closing peek tray) while also opening the browser.
This update introduces a dismissable warning for merging upstream work from the base branch. The user can now choose not to show this warning again, and this choice is remembered by the system. This is achieved by adding a checkbox that triggers a new function, `projectMergeUpstreamWarningDismissed`, altering the interface's vertical space, and tweaking the execution of the `branchController.updateBaseBranch` method.
Detailed changes:
- Introduced a checkbox to the warning modal, binded to `mergeUpstreamWarningDismissedCheckbox`.
- Adjusted the vertical spacing between elements in the warning modal, from `space-y-2` to `space-y-4`.
- Modified the onclick method of the merge button to call `mergeUpstreamWarningDismissed.set(true)`, if `mergeUpstreamWarningDismissedCheckbox` is checked.
- Added `mergeUpstreamWarningDismissed` and `mergeUpstreamWarningDismissedCheckbox` variables to control the checkbox state, using the new `projectMergeUpstreamWarningDismissed` method.
- New `projectMergeUpstreamWarningDismissed` method added to handle persistent dismissal of the warning across sessions