i18n: git-stash die + gettext messages
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
May 21, 2011 at 18:44 UTC
b1440ce2bdfa9c5083606711b845e9d0019e2702
1 file changed
+18
-18
git-stash.sh
+18
-18
@@ -40,7 +40,7 @@ no_changes () {
40
clear_stash () {
41
if test $# != 0
42
then
43
- die "git stash clear with parameters is unimplemented"
43
+ die "$(gettext "git stash clear with parameters is unimplemented")"
44
fi
45
if current=$(git rev-parse --verify $ref_stash 2>/dev/null)
46
then
@@ -62,7 +62,7 @@ create_stash () {
62
then
63
head=$(git rev-list --oneline -n 1 HEAD --)
64
else
65
- die "You do not have the initial commit yet"
65
+ die "$(gettext "You do not have the initial commit yet")"
66
fi
67
68
if branch=$(git symbolic-ref -q HEAD)
@@ -77,7 +77,7 @@ create_stash () {
77
i_tree=$(git write-tree) &&
78
i_commit=$(printf 'index on %s\n' "$msg" |
79
git commit-tree $i_tree -p $b_commit) ||
80
- die "Cannot save the current index state"
80
+ die "$(gettext "Cannot save the current index state")"
81
82
if test -z "$patch_mode"
83
then
@@ -91,7 +91,7 @@ create_stash () {
91
git write-tree &&
92
rm -f "$TMPindex"
93
) ) ||
94
- die "Cannot save the current worktree state"
94
+ die "$(gettext "Cannot save the current worktree state")"
95
96
else
97
@@ -104,14 +104,14 @@ create_stash () {
104
105
# state of the working tree
106
w_tree=$(GIT_INDEX_FILE="$TMP-index" git write-tree) ||
107
- die "Cannot save the current worktree state"
107
+ die "$(gettext "Cannot save the current worktree state")"
108
109
git diff-tree -p HEAD $w_tree > "$TMP-patch" &&
110
test -s "$TMP-patch" ||
111
- die "No changes selected"
111
+ die "$(gettext "No changes selected")"
112
113
rm -f "$TMP-index" ||
114
- die "Cannot remove temporary index (can't happen)"
114
+ die "$(gettext "Cannot remove temporary index (can't happen)")"
115
116
fi
117
@@ -124,7 +124,7 @@ create_stash () {
124
fi
125
w_commit=$(printf '%s\n' "$stash_msg" |
126
git commit-tree $w_tree -p $b_commit -p $i_commit) ||
127
- die "Cannot record working tree state"
127
+ die "$(gettext "Cannot record working tree state")"
128
}
129
130
save_stash () {
@@ -172,7 +172,7 @@ save_stash () {
172
exit 0
173
fi
174
test -f "$GIT_DIR/logs/$ref_stash" ||
175
- clear_stash || die "Cannot initialize stash"
175
+ clear_stash || die "$(gettext "Cannot initialize stash")"
176
177
create_stash "$stash_msg"
178
@@ -180,7 +180,7 @@ save_stash () {
180
: >>"$GIT_DIR/logs/$ref_stash"
181
182
git update-ref -m "$stash_msg" $ref_stash $w_commit ||
183
- die "Cannot save the current status"
183
+ die "$(gettext "Cannot save the current status")"
184
say Saved working directory and index state "$stash_msg"
185
186
if test -z "$patch_mode"
@@ -193,7 +193,7 @@ save_stash () {
193
fi
194
else
195
git apply -R < "$TMP-patch" ||
196
- die "Cannot remove worktree changes"
196
+ die "$(gettext "Cannot remove worktree changes")"
197
198
if test "$keep_index" != "t"
199
then
@@ -288,7 +288,7 @@ parse_flags_and_rev()
288
289
case $# in
290
0)
291
- have_stash || die "No stash found."
291
+ have_stash || die "$(gettext "No stash found.")"
292
set -- ${ref_stash}@{0}
293
;;
294
1)
@@ -336,11 +336,11 @@ apply_stash () {
336
337
assert_stash_like "$@"
338
339
- git update-index -q --refresh || die 'unable to refresh index'
339
+ git update-index -q --refresh || die "$(gettext "unable to refresh index")"
340
341
# current index state
342
c_tree=$(git write-tree) ||
343
- die 'Cannot apply a stash in the middle of a merge'
343
+ die "$(gettext "Cannot apply a stash in the middle of a merge")"
344
345
unstashed_index_tree=
346
if test -n "$INDEX_OPTION" && test "$b_tree" != "$i_tree" &&
@@ -348,9 +348,9 @@ apply_stash () {
348
then
349
git diff-tree --binary $s^2^..$s^2 | git apply --cached
350
test $? -ne 0 &&
351
- die 'Conflicts in index. Try without --index.'
351
+ die "$(gettext "Conflicts in index. Try without --index.")"
352
unstashed_index_tree=$(git write-tree) ||
353
- die 'Could not save index tree'
353
+ die "$(gettext "Could not save index tree")"
354
git reset
355
fi
356
@@ -376,7 +376,7 @@ apply_stash () {
376
git diff-index --cached --name-only --diff-filter=A $c_tree >"$a" &&
377
git read-tree --reset $c_tree &&
378
git update-index --add --stdin <"$a" ||
379
- die "Cannot unstage modified files"
379
+ die "$(gettext "Cannot unstage modified files")"
380
rm -f "$a"
381
fi
382
squelch=
@@ -417,7 +417,7 @@ drop_stash () {
417
}
418
419
apply_to_branch () {
420
- test -n "$1" || die 'No branch name specified'
420
+ test -n "$1" || die "$(gettext "No branch name specified")"
421
branch=$1
422
shift 1
423