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

unquoted '\' must be followed by new line #681

Closed
fredcarle opened this issue Dec 6, 2017 · 9 comments
Closed

unquoted '\' must be followed by new line #681

fredcarle opened this issue Dec 6, 2017 · 9 comments

Comments

@fredcarle
Copy link

Has anyone seen this before? I get this unquoted '\' must be followed by new line error on some of the repo I try to open with git.PlainOpen().

@orirawlings
Copy link
Contributor

Hey @fredcarle,

Can you share any code or links to the repository you are trying to open so we can try and reproduce the issue?

@fredcarle
Copy link
Author

fredcarle commented Dec 6, 2017

Unfortunately I can't share the link to the repo since it's a private one. But here is the simple code I was using for testing.

        r, err := git.PlainOpen("/link/to/my/local/repo")
	if err != nil {
		log.Panic(err)
	}
	remotes, err := r.Remotes()
	if err != nil {
		log.Panic(err)
	}
	for _, r := range remotes {
		fmt.Println("remote", r.String())
	}

@strib
Copy link
Contributor

strib commented Dec 6, 2017

I've seen this before. In one instance, it was caused by trying to read a config written by Git tower: keybase/client#8812

The parser used to read the git config files really doesn't like backslashes.

@fredcarle
Copy link
Author

That would makes sense since I'm using Tower

@orirawlings orirawlings added the bug label Feb 7, 2018
@orirawlings
Copy link
Contributor

Seems like there is some benefit in extending the git config parser to handle backslashes more gracefully.

@japanoise
Copy link

This is especially problematic on Windows, because the likelihood of having slashes is much higher (Paths, for example)

@Southclaws
Copy link

Southclaws commented May 31, 2018

I'm running into this too, fortunately the repo I'm seeing it on is open source: https://github.com/Southclaws/samp-ctime

The full error I'm getting is 16:8: unquoted '\' must be followed by new line

Could I quickly fix this by modifying some internal .git file? I'm assuming the 16:8 is a line:column in some file.

Edit: yes I removed some outdated lines from .git/config that were left over from the old maintainer of this repo, it included paths to merge/diff tools on a Windows machine.

@scbizu
Copy link

scbizu commented Aug 11, 2018

Resolved this by removing all cols contain \ in .git/config, which seems like generated by Git Tower.

@filipnavara
Copy link
Contributor

It bails out on the following .git/config:

[core]
	repositoryformatversion = 0
	filemode = false
	bare = true
	symlinks = false
	ignorecase = true
[remote "origin"]
	url = E:\\Git\\emclient\\emclient.git

This is perfectly valid and parsable by the original Git parser (https://github.com/git/git/blob/master/config.c#L537-L560).

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

8 participants