Skip to content

Minimal command for branches #19

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

JohanMabille
Copy link
Member

This PR adds a skeleton of branch command (a lot of options are missing, especially regarding the sync with remote branches).

I've slightly changed the approach regarding the initialization of the wrappers: the constructors now accept pointers on the wrapped objects, and are called from friend classes instead of calling static methods. This makes the calls workflow more intuitive and avoids circulare references.

I'll change the other wrappers so that they follow the same pattern in a dedicated PR.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a minimal branch command for the git2cpp project, adding functionality to list, create, and delete git branches. The implementation refactors the wrapper initialization pattern to use constructors with pointer parameters instead of static methods to avoid circular references.

  • Adds complete branch wrapper infrastructure with iterator support for listing branches
  • Implements branch subcommand with basic create, delete, and list operations
  • Refactors wrapper base class to accept resource pointers in constructor

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/test_branch.py Adds test cases for branch listing and creation/deletion
src/wrapper/wrapper_base.hpp Updates constructor to accept resource pointer parameter
src/wrapper/repository_wrapper.hpp/cpp Adds branch-related methods and iterator support
src/wrapper/commit_wrapper.hpp/cpp Refactors method name and removes circular include
src/wrapper/branch_wrapper.hpp/cpp New wrapper for git branch operations and iterator
src/subcommand/branch_subcommand.hpp/cpp Implements branch command functionality
src/main.cpp Integrates branch subcommand into main application
CMakeLists.txt Adds new branch wrapper source files to build
Comments suppressed due to low confidence (1)

src/wrapper/branch_wrapper.cpp:8

  • [nitpick] The parameter name 'polna_ref' appears to be in a non-English language or contains a typo. Consider using a clearer English name like 'ref' or 'reference'.
branch_wrapper::branch_wrapper(git_reference* polna_ref)

Comment on lines +8 to +10
os.rename("test/data/status_data/embeded_git/", "test/data/status_data/.git/")
yield
os.rename("test/data/status_data/.git/", "test/data/status_data/embeded_git/")
Copy link
Preview

Copilot AI Jul 19, 2025

Choose a reason for hiding this comment

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

The directory name 'embeded_git' contains a spelling error. It should be 'embedded_git'.

Suggested change
os.rename("test/data/status_data/embeded_git/", "test/data/status_data/.git/")
yield
os.rename("test/data/status_data/.git/", "test/data/status_data/embeded_git/")
os.rename("test/data/status_data/embedded_git/", "test/data/status_data/.git/")
yield
os.rename("test/data/status_data/.git/", "test/data/status_data/embedded_git/")

Copilot uses AI. Check for mistakes.

Comment on lines +8 to +10
os.rename("test/data/status_data/embeded_git/", "test/data/status_data/.git/")
yield
os.rename("test/data/status_data/.git/", "test/data/status_data/embeded_git/")
Copy link
Preview

Copilot AI Jul 19, 2025

Choose a reason for hiding this comment

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

The directory name 'embeded_git' contains a spelling error. It should be 'embedded_git'.

Suggested change
os.rename("test/data/status_data/embeded_git/", "test/data/status_data/.git/")
yield
os.rename("test/data/status_data/.git/", "test/data/status_data/embeded_git/")
os.rename("test/data/status_data/embedded_git/", "test/data/status_data/.git/")
yield
os.rename("test/data/status_data/.git/", "test/data/status_data/embedded_git/")

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant