Code

Merge branch 'js/i18n-scripts'
authorJunio C Hamano <gitster@pobox.com>
Thu, 25 Aug 2011 23:00:16 +0000 (16:00 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Aug 2011 23:00:16 +0000 (16:00 -0700)
* js/i18n-scripts:
  submodule: take advantage of gettextln and eval_gettextln.
  stash: take advantage of eval_gettextln
  pull: take advantage of eval_gettextln
  git-am: take advantage of gettextln and eval_gettextln.
  gettext: add gettextln, eval_gettextln to encode common idiom

1  2 
git-am.sh
git-pull.sh
git-submodule.sh

diff --combined git-am.sh
index b2c4b2b853fd2f0f99e08b108efcc9ace7ca1f3e,6177567b8693ca5a568894f100d3679684d3694d..e78cb547b7875ba68ddedbc507b7b0d7d0a50b31
+++ b/git-am.sh
@@@ -22,7 -22,6 +22,7 @@@ whitespace=     pass it through git-app
  ignore-space-change pass it through git-apply
  ignore-whitespace pass it through git-apply
  directory=      pass it through git-apply
 +exclude=        pass it through git-apply
  C=              pass it through git-apply
  p=              pass it through git-apply
  patch-format=   format the patch(es) are in
@@@ -90,11 -89,8 +90,8 @@@ safe_to_abort () 
        then
                return 0
        fi
-       (
-               gettext "You seem to have moved HEAD since the last 'am' failure.
- Not rewinding to ORIG_HEAD" &&
-               echo
-       ) >&2
+               gettextln "You seem to have moved HEAD since the last 'am' failure.
+ Not rewinding to ORIG_HEAD" >&2
        return 1
  }
  
@@@ -103,9 -99,9 +100,9 @@@ stop_here_user_resolve () 
            printf '%s\n' "$resolvemsg"
            stop_here $1
      fi
-     eval_gettext "When you have resolved this problem run \"\$cmdline --resolved\".
+     eval_gettextln "When you have resolved this problem run \"\$cmdline --resolved\".
  If you would prefer to skip this patch, instead run \"\$cmdline --skip\".
- To restore the original branch and stop patching run \"\$cmdline --abort\"."; echo
+ To restore the original branch and stop patching run \"\$cmdline --abort\"."
  
      stop_here $1
  }
@@@ -119,7 -115,7 +116,7 @@@ go_next () 
  
  cannot_fallback () {
        echo "$1"
-       gettext "Cannot fall back to three-way merge."; echo
+       gettextln "Cannot fall back to three-way merge."
        exit 1
  }
  
@@@ -197,15 -193,10 +194,15 @@@ check_patch_format () 
                return 0
        fi
  
 -      # otherwise, check the first few lines of the first patch to try
 -      # to detect its format
 +      # otherwise, check the first few non-blank lines of the first
 +      # patch to try to detect its format
        {
 -              read l1
 +              # Start from first line containing non-whitespace
 +              l1=
 +              while test -z "$l1"
 +              do
 +                      read l1
 +              done
                read l2
                read l3
                case "$l1" in
@@@ -372,7 -363,7 +369,7 @@@ d
                ;;
        --resolvemsg)
                shift; resolvemsg=$1 ;;
 -      --whitespace|--directory)
 +      --whitespace|--directory|--exclude)
                git_apply_opt="$git_apply_opt $(sq "$1=$2")"; shift ;;
        -C|-p)
                git_apply_opt="$git_apply_opt $(sq "$1$2")"; shift ;;
@@@ -517,8 -508,6 +514,8 @@@ els
        fi
  fi
  
 +git update-index -q --refresh
 +
  case "$resolved" in
  '')
        case "$HAS_HEAD" in
@@@ -619,9 -608,9 +616,9 @@@ d
                        go_next && continue
  
                test -s "$dotest/patch" || {
-                       eval_gettext "Patch is empty.  Was it split wrong?
+                       eval_gettextln "Patch is empty.  Was it split wrong?
  If you would prefer to skip this patch, instead run \"\$cmdline --skip\".
- To restore the original branch and stop patching run \"\$cmdline --abort\"."; echo
+ To restore the original branch and stop patching run \"\$cmdline --abort\"."
                        stop_here $this
                }
                rm -f "$dotest/original-commit" "$dotest/author-script"
  
        if test -z "$GIT_AUTHOR_EMAIL"
        then
-               gettext "Patch does not have a valid e-mail address."; echo
+               gettextln "Patch does not have a valid e-mail address."
                stop_here $this
        fi
  
            action=again
            while test "$action" = again
            do
-               gettext "Commit Body is:"; echo
+               gettextln "Commit Body is:"
                echo "--------------------------"
                cat "$dotest/final-commit"
                echo "--------------------------"
                # working tree.
                resolved=
                git diff-index --quiet --cached HEAD -- && {
-                       gettext "No changes - did you forget to use 'git add'?
+                       gettextln "No changes - did you forget to use 'git add'?
  If there is nothing left to stage, chances are that something else
- already introduced the same changes; you might want to skip this patch."; echo
+ already introduced the same changes; you might want to skip this patch."
                        stop_here_user_resolve $this
                }
                unmerged=$(git ls-files -u)
                if test -n "$unmerged"
                then
-                       gettext "You still have unmerged paths in your index
- did you forget to use 'git add'?"; echo
+                       gettextln "You still have unmerged paths in your index
+ did you forget to use 'git add'?"
                        stop_here_user_resolve $this
                fi
                apply_status=0
        fi
        if test $apply_status != 0
        then
-               eval_gettext 'Patch failed at $msgnum $FIRSTLINE'; echo
+               eval_gettextln 'Patch failed at $msgnum $FIRSTLINE'
                stop_here_user_resolve $this
        fi
  
diff --combined git-pull.sh
index eec3a07f0fa45013e8d9fa9a3dd1a2fab98a2970,d3ffd8fc6eab115988884b1ea3e4c22a1e45e802..63da37bcc2730358140ae4b862040ed8fb0ed77e
@@@ -10,7 -10,7 +10,7 @@@ SUBDIRECTORY_OK=Ye
  OPTIONS_SPEC=
  . git-sh-setup
  . git-sh-i18n
 -set_reflog_action "pull $*"
 +set_reflog_action "pull${1+ $*}"
  require_work_tree
  cd_to_toplevel
  
@@@ -217,12 -217,9 +217,9 @@@ the
        # $orig_head commit, but we are merging into $curr_head.
        # First update the working tree to match $curr_head.
  
-       (
-               eval_gettext "Warning: fetch updated the current branch head.
+       eval_gettextln "Warning: fetch updated the current branch head.
  Warning: fast-forwarding your working tree from
- Warning: commit \$orig_head." &&
-               echo
-       ) >&2
+ Warning: commit \$orig_head." >&2
        git update-index -q --refresh
        git read-tree -u -m "$orig_head" "$curr_head" ||
                die "$(eval_gettext "Cannot fast-forward your working tree.
diff --combined git-submodule.sh
index f46862f61b48a970f6ec24a9ae7624905ba3013a,986c5d6a74730477f51de6e704ba896ee7fee677..814d0d914eaf994462e61559b0692c958f97513b
@@@ -122,17 -122,12 +122,17 @@@ module_clone(
        path=$1
        url=$2
        reference="$3"
 +      quiet=
 +      if test -n "$GIT_QUIET"
 +      then
 +              quiet=-q
 +      fi
  
        if test -n "$reference"
        then
 -              git-clone "$reference" -n "$url" "$path"
 +              git-clone $quiet "$reference" -n "$url" "$path"
        else
 -              git-clone -n "$url" "$path"
 +              git-clone $quiet -n "$url" "$path"
        fi ||
        die "$(eval_gettext "Clone of '\$url' into submodule path '\$path' failed")"
  }
@@@ -228,12 -223,9 +228,9 @@@ cmd_add(
  
        if test -z "$force" && ! git add --dry-run --ignore-missing "$path" > /dev/null 2>&1
        then
-               (
-                       eval_gettext "The following path is ignored by one of your .gitignore files:
+               eval_gettextln "The following path is ignored by one of your .gitignore files:
  \$path
- Use -f if you really want to add it." &&
-                       echo
-               ) >&2
+ Use -f if you really want to add it." >&2
                exit 1
        fi
  
        then
                if test -d "$path"/.git -o -f "$path"/.git
                then
-                       eval_gettext "Adding existing repo at '\$path' to the index"; echo
+                       eval_gettextln "Adding existing repo at '\$path' to the index"
                else
                        die "$(eval_gettext "'\$path' already exists and is not a valid git repo")"
                fi
@@@ -701,10 -693,7 +698,7 @@@ cmd_summary() 
                                ;; # removed
                        *)
                                # unexpected type
-                               (
-                                       eval_gettext "unexpected mode \$mod_dst" &&
-                                       echo
-                               ) >&2
+                               eval_gettextln "unexpected mode \$mod_dst" >&2
                                continue ;;
                        esac
                fi
        done |
        if test -n "$for_status"; then
                if [ -n "$files" ]; then
-                       gettext "# Submodules changed but not updated:"; echo
+                       gettextln "# Submodules changed but not updated:"
                else
-                       gettext "# Submodule changes to be committed:"; echo
+                       gettextln "# Submodule changes to be committed:"
                fi
                echo "#"
                sed -e 's|^|# |' -e 's|^# $|#|'