filter-branch: use printf instead of echo -e
[gitweb.git] / git-filter-branch.sh
index 3365a3b866b510db5bf9ca20a0341c34c21b7a69..98c76ec589b053c112ddc86b6821f2acf17b7ab0 100755 (executable)
@@ -81,11 +81,11 @@ set_ident () {
        finish_ident COMMITTER
 }
 
-USAGE="[--setup <command>] [--env-filter <command>]
+USAGE="[--setup <command>] [--subdirectory-filter <directory>] [--env-filter <command>]
        [--tree-filter <command>] [--index-filter <command>]
        [--parent-filter <command>] [--msg-filter <command>]
        [--commit-filter <command>] [--tag-name-filter <command>]
-       [--subdirectory-filter <directory>] [--original <namespace>]
+       [--original <namespace>]
        [-d <directory>] [-f | --force] [--state-branch <branch>]
        [--] [<rev-list options>...]"
 
@@ -154,6 +154,10 @@ do
        --setup)
                filter_setup="$OPTARG"
                ;;
+       --subdirectory-filter)
+               filter_subdir="$OPTARG"
+               remap_to_ancestor=t
+               ;;
        --env-filter)
                filter_env="$OPTARG"
                ;;
@@ -175,10 +179,6 @@ do
        --tag-name-filter)
                filter_tag_name="$OPTARG"
                ;;
-       --subdirectory-filter)
-               filter_subdir="$OPTARG"
-               remap_to_ancestor=t
-               ;;
        --original)
                orig_namespace=$(expr "$OPTARG/" : '\(.*[^/]\)/*$')/
                ;;
@@ -627,12 +627,12 @@ then
                                print H "$_:$f\n" or die;
                        }
                        close(H) or die;' || die "Unable to save state")
-       state_tree=$(/bin/echo -e "100644 blob $state_blob\tfilter.map" | git mktree)
+       state_tree=$(printf '100644 blob %s\tfilter.map\n' "$state_blob" | git mktree)
        if test -n "$state_commit"
        then
-               state_commit=$(/bin/echo "Sync" | git commit-tree "$state_tree" -p "$state_commit")
+               state_commit=$(echo "Sync" | git commit-tree "$state_tree" -p "$state_commit")
        else
-               state_commit=$(/bin/echo "Sync" | git commit-tree "$state_tree" )
+               state_commit=$(echo "Sync" | git commit-tree "$state_tree" )
        fi
        git update-ref "$state_branch" "$state_commit"
 fi