MCPcopy Index your code
hub / github.com/Codeplain-ai/codeplain / add_all_files_and_commit

Function add_all_files_and_commit

git_utils.py:117–136  ·  view source on GitHub ↗

Adds all files to the git repository and commits them.

(
    repo_path: Union[str, os.PathLike],
    commit_message: str,
    module_name: Optional[str] = None,
    frid: Optional[str] = None,
    render_id: Optional[str] = None,
)

Source from the content-addressed store, hash-verified

115
116
117def add_all_files_and_commit(
118 repo_path: Union[str, os.PathLike],
119 commit_message: str,
120 module_name: Optional[str] = None,
121 frid: Optional[str] = None,
122 render_id: Optional[str] = None,
123) -> Repo:
124 """Adds all files to the git repository and commits them."""
125 repo = Repo(repo_path)
126 repo.git.add(".")
127
128 message = _get_full_commit_message(commit_message, module_name, frid, render_id)
129
130 # Check if there are any changes to commit
131 if not repo.is_dirty(untracked_files=True):
132 repo.git.commit("--allow-empty", "-m", message)
133 else:
134 repo.git.commit("-m", message)
135
136 return repo
137
138
139def revert_changes(repo_path: Union[str, os.PathLike]) -> Repo:

Calls 1

_get_full_commit_messageFunction · 0.85