Commit Graph

11 Commits

Author SHA1 Message Date
Paul Carleton
88320daffa fix(git): import BadName directly to fix pyright errors
Import `BadName` from `git.exc` directly instead of accessing it via
`git.exc.BadName`, which pyright doesn't recognize as a valid attribute
access on the `git` module.

This fixes the pyright CI failures introduced by the recent security
patches (GHSA merges).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-18 13:22:52 +00:00
Jenn Newton
a37158bc15 Merge commit from fork
Validate that repo_path arguments in tool calls are within the
configured --repository path when the --repository flag is set.

The fix:
- Adds validate_repo_path() that resolves paths and checks
  containment using Path.relative_to()
- Resolves symlinks before comparison
- Maintains backward compatibility when --repository is not set

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Paul Carleton <paulc@anthropic.com>
2025-12-17 16:04:30 +00:00
Jenn Newton
9e5d5b8e4b Merge commit from fork
Add validation to reject arguments starting with '-' and verify
arguments resolve to valid git refs via rev_parse before passing
to git CLI commands. This prevents flag-like values from being
interpreted as command-line options (e.g., --output=/path/to/file).

CWE-88: Improper Neutralization of Argument Delimiters in a Command

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-17 16:01:19 +00:00
João M. Martins
1b5f64e7e4 Fix test_git_diff to use dynamic branch name 2025-12-10 10:11:46 +11:00
UmakanthKaspa
2f93d3c717 Add comprehensive tests for git server functions (#2970)
- Add tests for git_diff_unstaged, git_diff_staged, and git_diff
- Add tests for git_commit and git_reset operations
- Add tests for git_log with different parameters
- Add tests for git_create_branch with base branch support
- Add tests for git_show including initial commit edge case
- Achieve 100% test coverage of git server functions (12/12)
- All 23 tests pass with 0 errors
2025-11-25 21:43:09 +00:00
Christoph Blecker
99813ce5c9 Update gitpython library for git mcp server (#2948)
* bump: gitpython dependency from 3.1.43 to 3.1.45

* test: use default branch name instead of hardcoding 'master'

* fix: handle d.diff as string in GitPython 3.1.45+
2025-11-25 20:35:33 +00:00
UmakanthKaspa
4225ab46e1 Add test for git_status function
Adds test coverage for the previously untested git_status function.
  The test verifies that the function returns valid git status output
  containing branch information.
2025-11-06 16:58:07 +00:00
Taj Baba
a67e3b0a92 fix: mcp_server_git: correct add logic for ["."] (#2379) 2025-08-11 12:09:26 +01:00
JavieHush
e4d856214b feat: Add git branch functionality and unit tests
This commit introduces the `git branch` tool to the MCP Git server, allowing users to list branches with various filtering options.

Changes include:
- Implemented `git_branch` function in `src/git/src/mcp_server_git/server.py` to support listing local, remote, and all branches, as well as filtering by `contains` and `not_contains` SHA values.
- Added comprehensive unit tests for the `git branch` functionality in `src/git/tests/test_server.py`, covering different branch types and commit filtering scenarios.
- Updated `src/git/README.md`.
2025-05-28 16:18:42 +08:00
Mike Gehard
98e78c37b4 Use a test fixture to set proper patterns. 2024-12-08 16:26:59 -05:00
Mike Gehard
021a95c904 Allow to check out branches
The git server currently lacks branch switching capabilities, limiting both
LLMs and developers. This adds branch checkout so LLMs can
help developers add new functionality in a new feature branch.
2024-12-08 16:26:58 -05:00