Datomic/codeq

origin url doesn't have to end with ".git"

Closed this issue · 0 comments

In core.clj in get-repo-uri (line 306) it is asserted that the origin remote url ends with ".git", but it's possible to have a remote url that doesn't end with .git:

/tmp ➤ git clone git://github.com/Datomic/codeq                                
Cloning into 'codeq'...
remote: Counting objects: 141, done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 141 (delta 52), reused 140 (delta 51)
Receiving objects: 100% (141/141), 30.34 KiB, done.
Resolving deltas: 100% (52/52), done.
/tmp ➤ cd codeq                                                                
codeq ➤ git remote show -n origin                                    git:master
* remote origin
  Fetch URL: git://github.com/Datomic/codeq
  Push  URL: git://github.com/Datomic/codeq
  HEAD branch: (not queried)
  Remote branch: (status not queried)
    master
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push' (status not queried):
    (matching) pushes to (matching)

When running on such repository, it of-course fails:

java -server -Xmx1g -jar ~/usr/src/codeq/target/codeq-0.1.0-SNAPSHOT-standalone.jar datomic:free://localhost:4334/git
Exception in thread "main" java.lang.AssertionError: Assert failed: Can't find remote origin
(and (pos? (count name)) (.endsWith name ".git"))
    at datomic.codeq.core$get_repo_uri.invoke(core.clj:306)
    at datomic.codeq.core$main.doInvoke(core.clj:531)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:614)
    at datomic.codeq.core$_main.doInvoke(core.clj:539)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at datomic.codeq.core.main(Unknown Source)

(it actually hangs until killed with ctrl-c).