Skip to content

IndexFile._to_relative_path - fix case where absolute path gets stripped of trailing slash #2012

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

kamilkozik7
Copy link
Contributor

@kamilkozik7 kamilkozik7 commented Mar 7, 2025

I encountered this issue on MacOS, python 3.7 and later

Added fix and appropriate unit test.

Stripping of trailing slash seems to be happening in os.path.relpath, altough I am not sure whether that is expected behaviour. In case it is not expected, and ever gets fixed, I added an additional check ( and not result.endswith(os.sep)) to make sure that the trailing slash doesn't get duplicated.

@kamilkozik7 kamilkozik7 force-pushed the fix-trailing-slash branch 3 times, most recently from 2bbb6ee to 3a40c1c Compare March 7, 2025 17:55
@kamilkozik7 kamilkozik7 marked this pull request as ready for review March 7, 2025 18:07
Copy link

@kelibezhani kelibezhani left a comment

Choose a reason for hiding this comment

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

LGTM

@Byron Byron force-pushed the fix-trailing-slash branch from 3a40c1c to 11f7faf Compare March 12, 2025 12:31
Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

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

Great, thanks a lot for the fix!
Looks good to me, too!

@Byron Byron merged commit e85a895 into gitpython-developers:main Mar 12, 2025
24 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants