◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
24 changes: 22 additions & 2 deletions git/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,24 @@ def _value_to_string(self, value: Union[str, bytes, int, float, bool]) -> str:
return str(value)
return force_text(value)

@needs_values
@set_dirty_and_flush_changes
def set_value(self, section: str, option: str, value: Union[str, bytes, int, float, bool]) -> "GitConfigParser":
@@ -902,9 +920,10 @@ def set_value(self, section: str, option: str, value: Union[str, bytes, int, flo
:return:
This instance
"""
if not self.has_section(section):
self.add_section(section)
self.set(section, option, self._value_to_string(value))
return self

@needs_values
Expand All @@ -929,9 +948,10 @@ def add_value(self, section: str, option: str, value: Union[str, bytes, int, flo
:return:
This instance
"""
if not self.has_section(section):
self.add_section(section)
self._sections[section].add(option, self._value_to_string(value))
return self

def rename_section(self, section: str, new_name: str) -> "GitConfigParser":
Expand Down
Loading
Toggle all file notes Toggle all file annotations