Skip to content

feat(fork): implement repository forking functionality in gt new#1442

Merged
notheotherben merged 18 commits intomainfrom
feature/support_for_forking
Apr 16, 2025
Merged

feat(fork): implement repository forking functionality in gt new#1442
notheotherben merged 18 commits intomainfrom
feature/support_for_forking

Conversation

@cedi
Copy link
Copy Markdown
Collaborator

@cedi cedi commented Apr 16, 2025

  • add 'from' argument to create a fork of an existing remote repository
  • add fork_repo method to GitHubService for forking repositories
  • create ForkRepository task to handle repository forking
  • update GitClone to use default struct initialization
  • implement GitAddRemote task for adding/removing git remotes
  • add tests for ForkRepository and GitAddRemote functionalities

Fixes #1424

- add 'from' argument to create a fork of an existing remote repository
- add fork_repo method to GitHubService for forking repositories
- create ForkRepository task to handle repository forking
- update GitClone to use default struct initialization
- implement GitAddRemote task for adding/removing git remotes
- add tests for ForkRepository and GitAddRemote functionalities
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2025

Codecov Report

Attention: Patch coverage is 92.88256% with 20 lines in your changes missing coverage. Please review.

Project coverage is 85.49%. Comparing base (e46c2c6) to head (8a34799).
Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
src/online/service/github.rs 76.47% 16 Missing ⚠️
src/tasks/fork_remote.rs 96.72% 2 Missing ⚠️
src/commands/clone.rs 50.00% 1 Missing ⚠️
src/commands/open.rs 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1442      +/-   ##
==========================================
+ Coverage   85.28%   85.49%   +0.21%     
==========================================
  Files          97       98       +1     
  Lines        9889    10143     +254     
==========================================
+ Hits         8434     8672     +238     
- Misses       1455     1471      +16     
Files with missing lines Coverage Δ
src/commands/new.rs 95.57% <100.00%> (+1.94%) ⬆️
src/completion/completer.rs 100.00% <100.00%> (ø)
src/engine/features.rs 100.00% <100.00%> (ø)
src/online/service/mod.rs 100.00% <ø> (ø)
src/tasks/git_clone.rs 100.00% <100.00%> (ø)
src/tasks/git_remote.rs 96.34% <100.00%> (+3.31%) ⬆️
src/tasks/mod.rs 58.53% <ø> (ø)
src/commands/clone.rs 86.66% <50.00%> (ø)
src/commands/open.rs 77.46% <0.00%> (ø)
src/tasks/fork_remote.rs 96.72% <96.72%> (ø)
... and 1 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/commands/new.rs Outdated
Comment thread src/commands/new.rs
];

if let Some(from_repo) = matches.get_one::<String>("from") {
let from_repo_id: Identifier = from_repo.as_str().parse()?;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder whether we need to support --from https://github.com/... style remotes here (instead of just supporting valid identifiers). Presumably that would be a different codepath since it wouldn't support any of the remote fork workflows etc.

Comment thread src/commands/new.rs
async fn complete(&self, core: &Core, completer: &Completer, _matches: &ArgMatches) {
completer.offer("--open");
completer.offer("--no-create-remote");
completer.offer("--from");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I haven't checked, but we may want to look at completer and _matches to determine whether the current completion target is "whatever follows --from" and ensure we're suggesting full repo names in that case as well.

This isn't a big deal to be fair, but it could make for a nicer autocomplete experience.

Comment thread src/engine/features.rs Outdated
Comment thread src/online/service/github.rs Outdated
Comment thread src/tasks/fork_repo.rs Outdated
Comment thread src/tasks/fork_repo.rs Outdated
Comment thread src/tasks/git_clone.rs Outdated
Comment thread src/tasks/fork_repo.rs Outdated
@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

Comment thread src/commands/new.rs Outdated
Comment thread src/engine/features.rs
Comment thread src/online/service/github.rs Outdated
Comment thread src/online/service/github.rs
Comment thread src/tasks/fork_repo.rs
Comment thread src/tasks/fork_repo.rs Outdated
@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

@github-actions github-actions bot added docs Changes to the documentation feature A new feature for Git-Tool labels Apr 16, 2025
@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

@notheotherben notheotherben enabled auto-merge April 16, 2025 22:04
@notheotherben notheotherben disabled auto-merge April 16, 2025 22:04
@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

@notheotherben notheotherben enabled auto-merge April 16, 2025 22:37
@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://brave-meadow-00ba9e303-1442.westeurope.1.azurestaticapps.net

@notheotherben notheotherben merged commit 72a750b into main Apr 16, 2025
12 checks passed
@notheotherben notheotherben deleted the feature/support_for_forking branch April 16, 2025 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Changes to the documentation feature A new feature for Git-Tool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add support for creating new repos based on an existing upstream

2 participants