Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Setting working dir correctly for git2r commits #70
Hi Dirk, I'm trying to get appveyor to push windows zips for DeclareDesign, we had been getting clean builds but containing
at then end - (I had't caught this before christmas because many of our changes to master at that time were for pkgdown websites, which trigger builds but the .zip doesn't change and git would correctly not record a change).
Anyway, I spent some time debugging, and finally noticed that on the git2r side, we both
Unclear to me why this is broken for appveyor/windows and not for travis/linux, but changing the two lines in this PR seems to fix it. Probably git2r has changed since these lines were written ?
Hm. It works here. I mostly do this from the command line and I don't always push. But see
~/git/drat-test-repo$ git init ## create repo Initialized empty Git repository in /home/deddelbuettel/git/drat-test-repo/.git/ ~/git/drat-test-repo(master)$ git checkout -b gh-pages Switched to a new branch 'gh-pages' ~/git/drat-test-repo(gh-pages)$ touch foo ~/git/drat-test-repo(gh-pages)$ git add foo ~/git/drat-test-repo(gh-pages)$ git commit -m '123' ## have a fist commit [gh-pages (root-commit) 0f933e9] 123 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 foo ~/git/drat-test-repo(gh-pages)$ cd .. ~/git/drat-test-repo(master)$ cd .. ~/git$ build.r drat ## build a tar ball * checking for file ‘drat/DESCRIPTION’ ... OK * preparing ‘drat’: * checking DESCRIPTION meta-information ... OK * installing the package to build vignettes * creating vignettes ... OK * checking for LF line-endings in source and make files and shell scripts * checking for empty or unneeded directories * building ‘drat_0.1.4.tar.gz’ ~/git$ dratInsert.r -c '"some silly message"' -r drat-test-repo/ drat_0.1.4.tar.gz Added and committed drat_0.1.4.tar.gz plus PACKAGES files. Still need to push. ~/git$
But it is likely that platform specfic code does something wrong. I'll look at the PR.
Ditto for Windoze:
~/git/drat-test-repo(gh-pages)$ mkdir -p bin/windows/contrib/3.4 ~/git/drat-test-repo(gh-pages)$ cd .. ~/git$ wget https://cloud.r-project.org/bin/windows/contrib/3.4/drat_0.1.4.zip --2018-01-19 14:53:31-- https://cloud.r-project.org/bin/windows/contrib/3.4/drat_0.1.4.zip Resolving cloud.r-project.org (cloud.r-project.org)... 18.104.22.168, 22.214.171.124, 126.96.36.199, ... Connecting to cloud.r-project.org (cloud.r-project.org)|188.8.131.52|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 74781 (73K) [application/zip] Saving to: ‘drat_0.1.4.zip’ drat_0.1.4.zip 100%[=====================================================================================================================>] 73.03K --.-KB/s in 0.003s 2018-01-19 14:53:31 (22.8 MB/s) - ‘drat_0.1.4.zip’ saved [74781/74781] ~/git$ dratInsert.r -c '"adding win binary"' -r drat-test-repo/ drat_0.1.4.zip Added and committed drat_0.1.4.zip plus PACKAGES files. Still need to push. ~/git$ ls drat-test-repo/bin/windows/contrib/3.4/ drat_0.1.4.zip PACKAGES PACKAGES.gz PACKAGES.rds ~/git$
Here is my MWE on windows outside of appveyor triggering the weird error using CRAN git2r and drat:
This lead to -
Here is a short debugging session that shows that git2r is for some reason mangling the file name to add - https://gist.github.com/nfultz/f30d8ab3d8ceb6475454647137970c0a
Did it, or didn't it, commit? Mine did:
~/git/drat-test-repo(gh-pages)$ git ls * 936f8d0 - (HEAD -> gh-pages) adding win binary (3 hours ago) <Dirk Eddelbuettel> * 32a9aa8 - some silly message (4 hours ago) <Dirk Eddelbuettel> * 0f933e9 - 123 (4 hours ago) <Dirk Eddelbuettel> ~/git/drat-test-repo(gh-pages)$
Works here on Linux.
R> setwd(tempdir()) R> require(git2r) Loading required package: git2r R> require(drat) Loading required package: drat R> dir.create("mydrat") R> repo <- git2r::init("mydrat") R> git2r::config(repo, user.name="Alice", user.email="email@example.com") R> repo <- git2r::repository("mydrat") R> cat("Here I am", file="mydrat/README") R> git2r::add(repo, "README") R> my_initial_commit <- git2r::commit(repo, message="Initial Commit") R> git2r::branch_create(my_initial_commit, name = "gh-pages") R> download.file("https://cloud.r-project.org/bin/windows/contrib/3.4/drat_0.1.4.zip", "drat_0.1.4.zip") trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.4/drat_0.1.4.zip' Content type 'application/zip' length 74825 bytes (73 KB) ================================================== downloaded 73 KB R> drat::insertPackage("drat_0.1.4.zip", "mydrat", "my commit message") Added and committed drat_0.1.4.zip plus PACKAGES files. Still need to push. R> system("cd mydrat && git ls") * 3baa26f - (HEAD -> gh-pages) my commit message (25 seconds ago) <Alice> * 9697990 - (master) Initial Commit (36 seconds ago) <Alice>R> R>
Shall we talk to Stefan? I am not sure this is a drat issue.
referenced this pull request
Jan 20, 2018
I've tracked down the underlying issue to a behavior in
where p is the file name passed in (eg "bin/windows/contrib/3.4/drat_0.1.4.zip")
On linux, normalizePath on a file it can't find ->
On windows 10:
git2r is suppressing those warnings in order to make globbing work, otherwise we would have noticed this sooner. It's somewhat accidental that linux is working in this case, to the extent that drat is relying on system-dependent error handling.
However, if drat set either the working directory or relative file path differently, normalizePath could return the canonicalized path, which git2r could then edit appropriately.
I'm going to continue using my patched drat for appveyor in the meantime. I still don't understand why windows worked for you - I've tried it on three different windows boxes as well as appveyor.
Thanks for your patience.
Good and patient work above (didn't see the earlier message at first). It is painful to work through all those cases but I guess we then want to maybe copy files "by hand" in R and then present a non-path file argument to
I'll lean on you for some testing then.