diff extra/fast-export/hg-reset.sh @ 1567:3ad53f43483d live

Update hg-fast-export to current version (with fix-broken-bare upstream branch) for compatibility with current git
author Chris Cannam
date Mon, 10 Oct 2016 12:56:28 +0100
parents e9e55585ebf2
children
line wrap: on
line diff
--- a/extra/fast-export/hg-reset.sh	Tue Jul 19 13:49:56 2016 +0100
+++ b/extra/fast-export/hg-reset.sh	Mon Oct 10 12:56:28 2016 +0100
@@ -24,8 +24,15 @@
 	-r	Mercurial repository to use
 "
 
-. "$(git --exec-path)/git-sh-setup"
-cd_to_toplevel
+IS_BARE=$(git rev-parse --is-bare-repository) \
+    || (echo "Could not find git repo" ; exit 1)
+if test "z$IS_BARE" != ztrue; then
+   # This is not a bare repo, cd to the toplevel
+   TOPLEVEL=$(git rev-parse --show-toplevel) \
+       || (echo "Could not find git repo toplevel" ; exit 1)
+   cd $TOPLEVEL || exit 1
+fi
+GIT_DIR=$(git rev-parse --git-dir) || (echo "Could not find git repo" ; exit 1)
 
 while case "$#" in 0) break ;; esac
 do