Skip to content

Conversation

@gg-jonathangriffe
Copy link
Contributor

Context

When using git merge with a file which has a space in its name, the command fails with the error :

  • ValueError: too many values to unpack (expected 4)

What has been done

Since the path is at the end of the parsed line (whose other components do not include spaces), we can simple add maxsplit=3 as an argument to split.

Validation

  • Make a repo
  • Create a file with a space in its name in a first branch
  • In another branch, create the same file with a different content
  • In a branch run git merge <other_branch>
  • Resolve the conflict and run git merge --continue
    If there is no error, it means the bug is fixed.

PR check list

  • As much as possible, the changes include tests (unit and/or functional)
  • If the changes affect the end user (new feature, behavior change, bug fix) then the PR has a changelog entry (see doc/dev/getting-started.md). If the changes do not affect the end user, then the skip-changelog label has been added to the PR.

@gg-jonathangriffe gg-jonathangriffe self-assigned this Oct 28, 2024
@codecov
Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.91%. Comparing base (118ca6d) to head (c97a92b).
Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #992      +/-   ##
==========================================
+ Coverage   91.58%   91.91%   +0.32%     
==========================================
  Files         180      181       +1     
  Lines        7605     7593      -12     
==========================================
+ Hits         6965     6979      +14     
+ Misses        640      614      -26     
Flag Coverage Δ
unittests 91.91% <100.00%> (+0.32%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gg-jonathangriffe gg-jonathangriffe force-pushed the jgriffe/fix-precommit-git-merge-filename-with-spaces branch 2 times, most recently from dc7ba1d to affb096 Compare October 28, 2024 10:36
Copy link
Collaborator

@agateau-gg agateau-gg left a comment

Choose a reason for hiding this comment

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

Super minor remark. I approved nevertheless, feel free to merge when it's fixed.

@gg-jonathangriffe gg-jonathangriffe force-pushed the jgriffe/fix-precommit-git-merge-filename-with-spaces branch from affb096 to c97a92b Compare October 28, 2024 13:07
@agateau-gg agateau-gg linked an issue Oct 28, 2024 that may be closed by this pull request
@agateau-gg agateau-gg merged commit a47d396 into main Oct 28, 2024
28 checks passed
@agateau-gg agateau-gg deleted the jgriffe/fix-precommit-git-merge-filename-with-spaces branch October 28, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ggshield crashes when "git merge"ing files with spaces

4 participants