johnmehr / gitup

A minimalist, dependency-free FreeBSD program to clone/pull Git repositories.
BSD 2-Clause "Simplified" License
50 stars 9 forks source link

Fix logic error in save_file() #90

Closed dadv closed 1 year ago

dadv commented 1 year ago

Latest commit 8274df4efb2b7684607da15353c662df7c506eb6 seems to be incomplete.

Recent import of llvm15 into FreeBSD source tree https://cgit.freebsd.org/src/commit/contrib/llvm-project/libcxx/include/__string?id=81ad626541db97eb356e2c1d4a20eb2a26a766ab changed contrib/llvm-project/libcxx/include/__string from plain file to a directory and gitup fails to repair or update local tree that pre-dates noted import with error:

save_file: write file failure /usr/src/contrib/llvm-project/libcxx/include/__string/char_traits.h: Not a directory

Attached patch fixes the problem. It verifies if last component of path containing file is really directory and removes it otherwise then recreates the path. patch-gitup.c.txt

johnmehr commented 1 year ago

Does the error still happen with the last month's commit (8274df4)?

dadv commented 1 year ago

Does the error still happen with the last month's commit (8274df4)?

I used gitup from recent ports, so yes, still fails and the patch helps.

johnmehr commented 1 year ago

I haven't tagged the latest commit yet (sorry about that). Could you please clone the latest commit and give it a try? Thanks!

dadv commented 1 year ago

Ports version has it all, I checked source with my eyes. Also take a look: https://cgit.freebsd.org/ports/commit/net/gitup/Makefile?id=a9247f5c853c62a702d42b2584853794c32946e9

johnmehr commented 1 year ago

I didn't see that the ports tree got a revision bump and included the latest commit without me tagging a new version number (sorry for the confusion on my part and the extra work on yours).

Your patch is in and it should be fixed now. Thank you!

nunotexbsd commented 1 year ago

Commited: https://cgit.freebsd.org/ports/commit/?id=a5ba35ba52d8d784d598076b7e3db71c70556238

Thanks