Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

merge() overwrites base::merge() #451

Open
dave-lovell opened this issue Jun 13, 2023 · 0 comments
Open

merge() overwrites base::merge() #451

dave-lovell opened this issue Jun 13, 2023 · 0 comments

Comments

@dave-lovell
Copy link

I'm raising this issue off the back of this Stack Overflow question, and I've included the reproducible example used in that question.

See the offending line of code here

merge() seems to overwrite the meaning of the base::merge function. This breaks the below code:

d1 <- c("a", "b")
d2 <- c(1,2)
merge(d1,d2) # This works

# Any call to any git2r function will break the code
git2r::config()

# This does not work anymore.
merge(d1,d2)
base::merge(d1,d2)

The error is:

Error in discover_repository(path) : 
  Error in 'git2r_repository_discover': 'path' must be a character vector of length one with non NA value
In addition: Warning messages:
1: In normalizePath(path) : path[1]="a": No such file or directory
2: In normalizePath(path) : path[2]="b": No such file or directory
> traceback()
5: discover_repository(path)
4: repository(repo)
3: lookup_repository(x)
2: merge.character(d1, d2)
1: base::merge(d1, d2)

What astonishes me is that explicitly specifying base::merge does not solve the issue.
It is probably because the git2r::merge function is part of the base namespace, instead of the git2r namespace:

git2r::merge
function (x, y, ...) 
UseMethod("merge")
<bytecode: 0x557184940ee0>
<environment: namespace:base>
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

No branches or pull requests

1 participant