diff --git a/renku/command/command_builder/command.py b/renku/command/command_builder/command.py index bcf973bdfe..bb4c1e00f2 100644 --- a/renku/command/command_builder/command.py +++ b/renku/command/command_builder/command.py @@ -21,7 +21,8 @@ import functools import threading from collections import defaultdict -from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional +from pathlib import Path +from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union import click import inject @@ -433,7 +434,7 @@ def with_commit( message: Optional[str] = None, commit_if_empty: bool = False, raise_if_empty: bool = False, - commit_only: Optional[bool] = None, + commit_only: Optional[Union[str, List[Union[str, Path]]]] = None, skip_staging: bool = False, ) -> "Command": """Create a commit. diff --git a/renku/command/command_builder/repo.py b/renku/command/command_builder/repo.py index 11141d82cb..815becf6b2 100644 --- a/renku/command/command_builder/repo.py +++ b/renku/command/command_builder/repo.py @@ -17,7 +17,8 @@ # limitations under the License. """Command builder for repository.""" -from typing import Optional +from pathlib import Path +from typing import List, Optional, Union from renku.command.command_builder.command import Command, CommandResult, check_finalized from renku.core import errors @@ -34,7 +35,7 @@ def __init__( message: Optional[str] = None, commit_if_empty: Optional[bool] = False, raise_if_empty: Optional[bool] = False, - commit_only: Optional[bool] = None, + commit_only: Optional[Union[str, List[Union[str, Path]]]] = None, skip_staging: bool = False, ) -> None: """__init__ of Commit. diff --git a/renku/ui/cli/mergetool.py b/renku/ui/cli/mergetool.py index 28e19a8103..0ebf4b6a7d 100644 --- a/renku/ui/cli/mergetool.py +++ b/renku/ui/cli/mergetool.py @@ -58,4 +58,4 @@ def install(): """Setup mergetool locally.""" from renku.command.mergetool import mergetool_install_command - mergetool_install_command().with_commit().build().execute() + mergetool_install_command().with_commit(commit_only=[".gitattributes"]).require_clean().build().execute()