git2r icon indicating copy to clipboard operation
git2r copied to clipboard

Windows git2r sometimes can't add files to repo

Open nfultz opened this issue 7 years ago • 3 comments

In https://github.com/eddelbuettel/drat/pull/70 Dirk Eddelbuettel and I found inconsistent behavior on windows and linux when trying to add files to a repo. On linux, setwd() to a subfolder (in this case, bin/windows/contrib/3.4 and adding the file as bin/windows/contrib/3.4/drat_0.1.4.zip works consistently, but on windows, it works for him but not for me. That ticket has an example script which fails for me (on Windows). I also have a debugging log showing git2r adding extra folders to file paths here: https://gist.github.com/nfultz/f30d8ab3d8ceb6475454647137970c0a

My current work around is to setwd to the repo directory instead of the package directory.

nfultz avatar Jan 20 '18 02:01 nfultz

@nfultz Thanks for reporting this issue. I'll take a look at it.

stewid avatar Jan 22 '18 21:01 stewid

I think dirk and I have tracked it down to a differing behavior of normalizePath on windows vs linux - for file names that don't have globs, it would be helpful to fail a bit more noisily.

On Mon, Jan 22, 2018 at 9:56 PM, Stefan Widgren [email protected] wrote:

@nfultz https://github.com/nfultz Thanks for reporting this issue. I'll take a look at it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ropensci/git2r/issues/315#issuecomment-359580793, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZjTs_SXnIYeD_RDWu_IvsMlMOu6iHbks5tNQQagaJpZM4RlRVg .

nfultz avatar Jan 22 '18 23:01 nfultz

To follow up, the root cause of the issue would have been much easier to track down if in the add() function, you only suppressWarnings on the normalizePath if there is a glob character in the file name, and otherwise let the warning surface - normalizePath apparently behaves differently on linux vs windows when the file doesn't exist.

nfultz avatar Jan 31 '18 19:01 nfultz