FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

update messages in status by SandrineP · Pull Request #99 · QuantStack/git2cpp · GitHub

Repository navigation

update messages in status - #99

Merged
ianthomas23 merged 4 commits into
QuantStack:mainfrom
SandrineP:status_update
Feb 18, 2026
Merged

ianthomas23 merged 4 commits into
QuantStack:mainfrom
SandrineP:status_update

Conversation

SandrineP commented Feb 17, 2026 •
edited
Loading

Copy link
Copy Markdown
Collaborator

Update messages in status using new implemented commands
Add tracking info
Add more tests

SandrineP force-pushed the status_update branch 3 times, most recently from 842d7e3 to c005c7d Compare February 18, 2026 09:48
Comment thread src/subcommand/status_subcommand.cpp Outdated

// TODO: check if this message should be displayed even if there are untracked files
if (!(sl.has_tobecommited_header() | sl.has_notstagged_header() | sl.has_unmerged_header() | sl.has_untracked_header()))
if (is_long & (!(sl.has_tobecommited_header() | sl.has_notstagged_header() | sl.has_unmerged_header() | sl.has_untracked_header())))

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
if (is_long & (!(sl.has_tobecommited_header() | sl.has_notstagged_header() | sl.has_unmerged_header() | sl.has_untracked_header())))
if (is_long & !(sl.has_tobecommited_header() | sl.has_notstagged_header() | sl.has_unmerged_header() | sl.has_untracked_header()))

Comment thread test/test_status.py Outdated
@pytest.mark.parametrize("short_flag", ["", "-s"])
def test_status_typechange(xtl_clone, git2cpp_path, tmp_path, short_flag):
"""Test status shows typechange (file to symlink or vice versa)"""
# Note: This test may need to be skipped on Windows

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'd rather not mention Windows at all. We say in the top-level README that git2cpp "can be compiled and used on any POSIX-compliant system" so nobody on Windows should get this far.

Comment thread test/test_status.py Outdated
os.remove(del_file)

# Stage the two previous files
subprocess.run([git2cpp_path, "add", "staged.txt", "README.md"], cwd=xtl_path)

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'd prefer to always either use check=True or check the returncode is 0 on all subprocess.run calls, otherwise we'll see an error reported later in such tests that won't be as easily understandable as the root cause of the problem.

SandrineP Feb 18, 2026 •
edited
Loading

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We'll go for returncode then, because somethime we check if it's non zero.

Comment thread test/test_status.py Outdated
repo_path.mkdir()

# Initialize repo
subprocess.run([git2cpp_path, "init"], cwd=repo_path)

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Check returncode or use check=True.

Comment thread test/test_status.py Outdated

# Clone it
clone_path = tmp_path / "clone"
subprocess.run(["git", "clone", str(repo_path), str(clone_path)])

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

And here.

Comment thread test/test_status.py Outdated
# Changes to be committed
staged = xtl_path / "staged.txt"
staged.write_text("staged")
subprocess.run([git2cpp_path, "add", "staged.txt"], cwd=xtl_path)

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

And here.

Comment thread src/subcommand/status_subcommand.cpp Outdated

// TODO: check if this message should be displayed even if there are untracked files
if (!(sl.has_tobecommited_header() | sl.has_notstagged_header() | sl.has_unmerged_header() | sl.has_untracked_header()))
if (is_long & (!(sl.has_tobecommited_header() | sl.has_notstagged_header() | sl.has_unmerged_header() | sl.has_untracked_header())))

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We should use boolean operators (&&, ||) instead of bitwise operators here (&, |) toi avoid unecessary conversion to integers.

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I published the review after the suggestion was applied, thus the outdated tag, but the comment is still relevant.

if (is_long & !sl.has_tobecommited_header() & (sl.has_notstagged_header() | sl.has_untracked_header()))
{
std::cout << nothingtocommit_message << std::endl;
}

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The function is quite long, it would make it easier to read if it was split into logical smaller functions.

SandrineP marked this pull request as ready for review February 18, 2026 16:30

ianthomas23 left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

One more change, then looks good to go.

Comment thread test/test_status.py Outdated

ianthomas23 left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks @SandrineP

ianthomas23 merged commit e1814ee into QuantStack:main Feb 18, 2026
2 checks passed
SandrineP deleted the status_update branch February 18, 2026 17:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL