Skip to content

Commit 3905d78

Browse files
authored
fix(cli): fix mergetool committing more than .gitattributes (#3013)
1 parent e5420f6 commit 3905d78

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

renku/command/command_builder/command.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
import functools
2222
import threading
2323
from collections import defaultdict
24-
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional
24+
from pathlib import Path
25+
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union
2526

2627
import click
2728
import inject
@@ -433,7 +434,7 @@ def with_commit(
433434
message: Optional[str] = None,
434435
commit_if_empty: bool = False,
435436
raise_if_empty: bool = False,
436-
commit_only: Optional[bool] = None,
437+
commit_only: Optional[Union[str, List[Union[str, Path]]]] = None,
437438
skip_staging: bool = False,
438439
) -> "Command":
439440
"""Create a commit.

renku/command/command_builder/repo.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
# limitations under the License.
1818
"""Command builder for repository."""
1919

20-
from typing import Optional
20+
from pathlib import Path
21+
from typing import List, Optional, Union
2122

2223
from renku.command.command_builder.command import Command, CommandResult, check_finalized
2324
from renku.core import errors
@@ -34,7 +35,7 @@ def __init__(
3435
message: Optional[str] = None,
3536
commit_if_empty: Optional[bool] = False,
3637
raise_if_empty: Optional[bool] = False,
37-
commit_only: Optional[bool] = None,
38+
commit_only: Optional[Union[str, List[Union[str, Path]]]] = None,
3839
skip_staging: bool = False,
3940
) -> None:
4041
"""__init__ of Commit.

renku/ui/cli/mergetool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ def install():
5858
"""Setup mergetool locally."""
5959
from renku.command.mergetool import mergetool_install_command
6060

61-
mergetool_install_command().with_commit().build().execute()
61+
mergetool_install_command().with_commit(commit_only=[".gitattributes"]).require_clean().build().execute()

0 commit comments

Comments
 (0)