Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

References() returns forward slashes on Windows #372

Closed
osklyar opened this issue May 2, 2017 · 4 comments
Closed

References() returns forward slashes on Windows #372

osklyar opened this issue May 2, 2017 · 4 comments

Comments

@osklyar
Copy link

osklyar commented May 2, 2017

The following snippet

it, _ := repo.References()
it.ForEach(func(ref *plumbing.Reference) error {
    fmt.Println("found: " + string(ref.Name()))
    return nil
})

will print the following result in windows

found: refs\heads\master
found: refs\remotes\origin\SKOL_542_gradle_overall
found: refs\remotes\origin\master
found: HEAD

Is this intentional behaviour provided ?

@osklyar osklyar changed the title References returns forward slashes on Windows. Intentional? References returns backward slashes on Windows. Intentional? May 2, 2017
@osklyar osklyar closed this as completed May 2, 2017
@osklyar osklyar reopened this May 2, 2017
@osklyar
Copy link
Author

osklyar commented May 2, 2017

Typo in the original title: it should read "backward slashes" on windows instead of "forward" as used by all git configs

@osklyar
Copy link
Author

osklyar commented May 2, 2017

The problem is most likely in readReferenceFile in dotgit.go using d.fs.Join. Surely at this point this join is ok to validate the existence of the reference on the file system, but passing obtained name into NewReferenceFromStrings causes the issue. Possibly it would be better for the latter function to swap the slashes. At least such as solution worked for me as a temporary fix.

@osklyar osklyar changed the title References returns backward slashes on Windows. Intentional? References() returns backward slashes on Windows May 2, 2017
@smola
Copy link
Collaborator

smola commented May 4, 2017

Work in progress to fix this: #369
In particular, this commit: ac19b28

@osklyar
Copy link
Author

osklyar commented May 4, 2017

Thanks Santiago!

@smola smola changed the title References() returns backward slashes on Windows References() returns forward slashes on Windows May 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants