Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion commitizen/commands/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ def __init__(self, config: BaseConfig, arguments: dict):
self.config: BaseConfig = config
self.cz = factory.commiter_factory(self.config)
self.arguments = arguments
self.temp_file: str = os.path.join(tempfile.gettempdir(), "cz.commit.backup")
name = "cz.commit.backup"
if "USER" in os.environ:
name = name + "." + os.environ['USER']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer something like this:

user = os.environ.get('USER', "")
name = f"cz.commit{user}.backup

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the apply. we have 100+ users project using this package which have this issue, but I am new commiter for this python package. I will rebuild this issue only after work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No rush, take your time

self.temp_file: str = os.path.join(tempfile.gettempdir(), name)

def read_backup_message(self) -> str:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the file be read here?

# Check the commit backup file exists
Expand Down