From fb05ce5b7bb549ef5dbfeaa4ec5740b78c4adcbe Mon Sep 17 00:00:00 2001 From: Emilian Bold Date: Fri, 30 Dec 2016 21:47:01 +0200 Subject: [PATCH] Show warning when core.ignoreCase is true When core.ignoreCase is true, which it is by default on OSX, fast-import will produce empty changesets for renames that just change the case of the file name. As this most probably is not the desired behavior, trigger an error but allow the conversion to proceed if --force is used. --- hg-fast-export.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hg-fast-export.sh b/hg-fast-export.sh index 4ad6720..93342ee 100755 --- a/hg-fast-export.sh +++ b/hg-fast-export.sh @@ -59,6 +59,14 @@ if test "z$IS_BARE" != ztrue; then fi GIT_DIR=$(git rev-parse --git-dir) || (echo "Could not find git repo" ; exit 1) + +IGNORECASEWARN="" +IGNORECASE=`git config core.ignoreCase` +if [ "true" = "$IGNORECASE" ]; then + IGNORECASEWARN="true" +fi; + + while case "$#" in 0) break ;; esac do case "$1" in @@ -72,6 +80,7 @@ do --force) # pass --force to git-fast-import and hg-fast-export.py GFI_OPTS="$GFI_OPTS --force" + IGNORECASEWARN=""; break ;; -*) @@ -85,6 +94,15 @@ do shift done +if [ ! -z "$IGNORECASEWARN" ]; then + echo "Error: The option core.ignoreCase is set to true in the git" + echo "repository. This will produce empty changesets for renames that just" + echo "change the case of the file name." + echo "Use --force to skip this check or change the option with" + echo "git config core.ignoreCase false" + exit 1 +fi; + # Make a backup copy of each state file for i in $SFX_STATE $SFX_MARKS $SFX_MAPPING $SFX_HEADS ; do if [ -f "$GIT_DIR/$PFX-$i" ] ; then