Skip to content

Commit

Permalink
Fix UnboundLocalError when using commit context manager (#1722)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vũ Thanh Hà authored Oct 12, 2023
1 parent 33b0405 commit dd18be7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/huggingface_hub/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -1367,9 +1367,7 @@ def commit(
files_to_stage = files_to_be_staged(".", folder=self.local_dir)

if len(files_to_stage):
if len(files_to_stage) > 5:
files_in_msg = str(files_to_stage[:5])[:-1] + ", ...]"

files_in_msg = str(files_to_stage[:5])[:-1] + ", ...]" if len(files_to_stage) > 5 else str(files_to_stage)
logger.error(
"There exists some updated files in the local repository that are not"
f" committed: {files_in_msg}. This may lead to errors if checking out"
Expand Down

0 comments on commit dd18be7

Please sign in to comment.