diff --git a/Build/Configure.hs b/Build/Configure.hs
--- a/Build/Configure.hs
+++ b/Build/Configure.hs
@@ -12,7 +12,7 @@
 
 tests :: [TestCase]
 tests =
-	[ TestCase "version" getVersion
+	[ TestCase "version" (Config "packageversion" . StringConfig <$> getVersion)
 	, TestCase "git" $ requireCmd "git" "git --version >/dev/null"
 	, TestCase "git version" getGitVersion
 	]
diff --git a/Build/TestConfig.hs b/Build/TestConfig.hs
--- a/Build/TestConfig.hs
+++ b/Build/TestConfig.hs
@@ -7,8 +7,6 @@
 import Utility.SafeCommand
 
 import System.IO
-import System.Cmd
-import System.Exit
 import System.FilePath
 import System.Directory
 
diff --git a/Build/Version.hs b/Build/Version.hs
--- a/Build/Version.hs
+++ b/Build/Version.hs
@@ -10,10 +10,11 @@
 import Data.Char
 import System.Process
 
-import Build.TestConfig
 import Utility.Monad
 import Utility.Exception
 
+type Version = String
+
 {- Set when making an official release. (Distribution vendors should set
  - this too.) -}
 isReleaseBuild :: IO Bool
@@ -25,14 +26,14 @@
  -
  - If git or a git repo is not available, or something goes wrong,
  - or this is a release build, just use the version from the changelog. -}
-getVersion :: Test
+getVersion :: IO Version
 getVersion = do
 	changelogversion <- getChangelogVersion
-	version <- ifM (isReleaseBuild)
+	ifM (isReleaseBuild)
 		( return changelogversion
 		, catchDefaultIO changelogversion $ do
 			let major = takeWhile (/= '.') changelogversion
-			autoversion <- readProcess "sh"
+			autoversion <- takeWhile (\c -> isAlphaNum c || c == '-') <$> readProcess "sh"
 				[ "-c"
 				, "git log -n 1 --format=format:'%ci %h'| sed -e 's/-//g' -e 's/ .* /-g/'"
 				] ""
@@ -40,9 +41,8 @@
 				then return changelogversion
 				else return $ concat [ major, ".", autoversion ]
 		)
-	return $ Config "packageversion" (StringConfig version)
 	
-getChangelogVersion :: IO String
+getChangelogVersion :: IO Version
 getChangelogVersion = do
 	changelog <- readFile "debian/changelog"
 	let verline = takeWhile (/= '\n') changelog
diff --git a/CHANGELOG b/CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,11 @@
+git-repair (1.20141027) unstable; urgency=medium
+
+  * Adjust cabal file to support network-uri split.
+  * Merge Build/ from git-annex, including removing a use of deprecated
+    System.Cmd.
+
+ -- Joey Hess <joeyh@debian.org>  Mon, 27 Oct 2014 11:09:56 -0400
+
 git-repair (1.20141026) unstable; urgency=medium
 
   * Prevent auto gc from happening when fetching from a remote.
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+git-repair (1.20141027) unstable; urgency=medium
+
+  * Adjust cabal file to support network-uri split.
+  * Merge Build/ from git-annex, including removing a use of deprecated
+    System.Cmd.
+
+ -- Joey Hess <joeyh@debian.org>  Mon, 27 Oct 2014 11:09:56 -0400
+
 git-repair (1.20141026) unstable; urgency=medium
 
   * Prevent auto gc from happening when fetching from a remote.
diff --git a/git-repair.cabal b/git-repair.cabal
--- a/git-repair.cabal
+++ b/git-repair.cabal
@@ -1,5 +1,5 @@
 Name: git-repair
-Version: 1.20141026
+Version: 1.20141027
 Cabal-Version: >= 1.8
 License: GPL
 Maintainer: Joey Hess <joey@kitenet.net>
@@ -22,13 +22,22 @@
  using git-repair can help rescue commits you've made to the damaged
  repository and not yet pushed out.
 
+Flag network-uri
+  Description: Get Network.URI from the network-uri package
+  Default: True
+
 Executable git-repair
   Main-Is: git-repair.hs
   GHC-Options: -Wall -threaded
   Build-Depends: MissingH, hslogger, directory, filepath, containers, mtl,
-   network, unix-compat, bytestring, exceptions (>= 0.6), transformers,
+   unix-compat, bytestring, exceptions (>= 0.6), transformers,
    base >= 4.5, base < 5, IfElse, text, process, time, QuickCheck,
    utf8-string, async, optparse-applicative (>= 0.10.0)
+
+  if flag(network-uri)
+    Build-Depends: network-uri (>= 2.6), network (>= 2.6)
+  else
+    Build-Depends: network (< 2.6), network (>= 2.0)
 
   if (os(windows))
     Build-Depends: setenv
