unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.78k stars 270 forks source link

crash and unhelpful error message on push/pull with bad URL #1527

Open atacratic opened 4 years ago

atacratic commented 4 years ago

Suppose my .unisonConfig has a mistake in the remote URL, for example it includes the .git on the end that GitHub gives you when you copy the HTTPS URL to clone.

GitUrl {
  _unison_datetime = "https://github.com/atacratic/unison-datetime.git"
}

Then push/pull fails with a hard-to-understand error message, and ucm terminates.

._unison_datetime> pull
fatal: refusing to merge unrelated histories/atacratic/unison-datetime.git ...
unison: callCommand: git --git-dir '/home/chris/.cache/unisonlanguage/gitfiles/https$colon$$forward-slash$$forward-slash$github.com$forward-slash$atacratic$forward-slash$unison-datetime.git/.git' --work-tree '/home/chris/.cache/unisonlanguage/gitfiles/https$colon$$forward-slash$$forward-slash$github.com$forward-slash$atacratic$forward-slash$unison-datetime.git' pull --force --quiet (exit 128): failed
chris@chris-thinkpad:~/unison$

It would be good to get some extra validation of the URL at load time, given this will be a common error. (Or maybe just cope with the .git suffix.)

aryairani commented 4 years ago

Hi @atacratic, I agree that that message is bad. However, IMO it should work just fine with .git at the end. Anything that you can pass to command-line git should work, as that's all ucm is doing (up to the Unison path part of the url).