Skip to content

Conversation

@SandrineP
Copy link
Collaborator

Add git config sub-command.
git config list
git config set
git config get
git config unset

@SandrineP SandrineP marked this pull request as ready for review January 14, 2026 14:08
{
if (m_name.empty())
{
std::cout << "error: wrong number of arguments, should be 1" << std::endl;
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this raise an exception rather than just write to cout, so that git2cpp exits with a non-zero exit code? git gives an exit code of 129.

Copy link
Member

Choose a reason for hiding this comment

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

good catch

{
if (m_name.empty() | m_value.empty())
{
std::cout << "error: wrong number of arguments, should be 2" << std::endl;
Copy link
Member

Choose a reason for hiding this comment

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

Exception here too.

{
if (m_name.empty())
{
std::cout << "error: wrong number of arguments, should be 1" << std::endl;
Copy link
Member

Choose a reason for hiding this comment

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

Exception here too.

import pytest


def test_config_list(commit_env_config, git2cpp_path, tmp_path, monkeypatch):
Copy link
Member

Choose a reason for hiding this comment

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

We don't actually need the monkeypatch to be specified here, it will be used anyway. Probably we've done the same in lots of other places, I guess it can be future work to go through and remove the unwanted ones or perhaps a python linter will do this for us eventually.

cmd_get = [git2cpp_path, "config", "get", "core.bare"]
p_get = subprocess.run(cmd_get, capture_output=True, cwd=tmp_path, text=True)
assert p_get.returncode == 0
print(p_get.stdout)
Copy link
Member

Choose a reason for hiding this comment

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

Debug print can be removed?

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.

3 participants