33# Copyright (c) 2005 Junio C Hamano.
44#
55
6- USAGE=' [--interactive | -i] [--exec | -x <cmd>] [-v] [--force-rebase | -f]
7- [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'
8- LONG_USAGE=' git-rebase replaces <branch> with a new branch of the
9- same name. When the --onto option is provided the new branch starts
10- out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>
11- It then attempts to create a new commit for each commit from the original
12- <branch> that does not exist in the <upstream> branch.
13-
14- It is possible that a merge failure will prevent this process from being
15- completely automatic. You will have to resolve any such merge failure
16- and run git rebase --continue. Another option is to bypass the commit
17- that caused the merge failure with git rebase --skip. To check out the
18- original <branch> and remove the .git/rebase-apply working files, use the
19- command git rebase --abort instead.
20-
21- Note that if <branch> is not specified on the command line, the
22- currently checked out branch is used.
23-
24- Example: git-rebase master~1 topic
25-
26- A---B---C topic A' \' ' --B' \' ' --C' \' ' topic
27- / --> /
28- D---E---F---G master D---E---F---G master
29- '
30-
316SUBDIRECTORY_OK=Yes
327OPTIONS_KEEPDASHDASH=
338OPTIONS_SPEC=" \
@@ -65,6 +40,7 @@ abort! abort and check out the original branch
6540skip! skip current patch and continue
6641"
6742. git-sh-setup
43+ . git-sh-i18n
6844set_reflog_action rebase
6945require_work_tree_exists
7046cd_to_toplevel
7349'
7450ok_to_skip_pre_rebase=
7551resolvemsg="
76- When you have resolved this problem run \ " git rebase --continue\ " .
77- If you would prefer to skip this patch, instead run \ " git rebase --skip\" .
78- To check out the original branch and stop rebasing run \ " git rebase --abort\" .
52+ $( gettext ' When you have resolved this problem, run "git rebase --continue".
53+ If you prefer to skip this patch, run "git rebase --skip" instead .
54+ To check out the original branch and stop rebasing, run "git rebase --abort". ' )
7955"
8056unset onto
8157cmd=
@@ -161,7 +137,7 @@ move_to_original_branch () {
161137 git symbolic-ref \
162138 -m " rebase finished: returning to $head_name " \
163139 HEAD $head_name ||
164- die " Could not move back to $head_name "
140+ die " $( gettext " Could not move back to $head_name " ) "
165141 ;;
166142 esac
167143}
@@ -180,12 +156,12 @@ run_pre_rebase_hook () {
180156 test -x " $GIT_DIR /hooks/pre-rebase"
181157 then
182158 " $GIT_DIR /hooks/pre-rebase" ${1+" $@ " } ||
183- die " The pre-rebase hook refused to rebase."
159+ die " $( gettext " The pre-rebase hook refused to rebase." ) "
184160 fi
185161}
186162
187163test -f " $apply_dir " /applying &&
188- die ' It looks like git-am is in progress. Cannot rebase.'
164+ die " $( gettext " It looks like git-am is in progress. Cannot rebase." ) "
189165
190166if test -d " $apply_dir "
191167then
@@ -316,12 +292,12 @@ test $# -gt 2 && usage
316292if test -n " $cmd " &&
317293 test " $interactive_rebase " ! = explicit
318294then
319- die " --exec option must be used with --interactive option"
295+ die " $( gettext " The --exec option must be used with the --interactive option" ) "
320296fi
321297
322298if test -n " $action "
323299then
324- test -z " $in_progress " && die " No rebase in progress?"
300+ test -z " $in_progress " && die " $( gettext " No rebase in progress?" ) "
325301 # Only interactive rebase uses detailed reflog messages
326302 if test " $type " = interactive && test " $GIT_REFLOG_ACTION " = rebase
327303 then
@@ -334,11 +310,11 @@ case "$action" in
334310continue)
335311 # Sanity check
336312 git rev-parse --verify HEAD > /dev/null ||
337- die " Cannot read HEAD"
313+ die " $( gettext " Cannot read HEAD" ) "
338314 git update-index --ignore-submodules --refresh &&
339315 git diff-files --quiet --ignore-submodules || {
340- echo " You must edit all merge conflicts and then"
341- echo " mark them as resolved using git add"
316+ echo " $( gettext " You must edit all merge conflicts and then
317+ mark them as resolved using git add" ) "
342318 exit 1
343319 }
344320 read_basic_state
@@ -355,7 +331,7 @@ abort)
355331 case " $head_name " in
356332 refs/* )
357333 git symbolic-ref -m " rebase: aborting" HEAD $head_name ||
358- die " Could not move back to $head_name "
334+ die " $( eval_gettext " Could not move back to \ $ head_name" ) "
359335 ;;
360336 esac
361337 output git reset --hard $orig_head
@@ -367,15 +343,18 @@ esac
367343# Make sure no rebase is in progress
368344if test -n " $in_progress "
369345then
370- die '
371- It seems that there is already a ' " ${state_dir##*/ } " ' directory, and
372- I wonder if you are in the middle of another rebase. If that is the
346+ state_dir_base=${state_dir##*/ }
347+ cmd_live_rebase=" git rebase (--continue | --abort | --skip)"
348+ cmd_clear_stale_rebase=" rm -fr \" $state_dir \" "
349+ die "
350+ $( eval_gettext ' It seems that there is already a $state_dir_base directory, and
351+ I wonder if you ware in the middle of another rebase. If that is the
373352case, please try
374- git rebase (--continue | --abort | --skip)
353+ $cmd_live_rebase
375354If that is not the case, please
376- rm -fr ' " $state_dir " '
355+ $cmd_clear_stale_rebase
377356and run me again. I am stopping in case you still have something
378- valuable there.'
357+ valuable there.' ) "
379358fi
380359
381360if test -n " $rebase_root " && test -z " $onto "
413392 ;;
414393 esac
415394 upstream=` git rev-parse --verify " ${upstream_name} ^0" ` ||
416- die " invalid upstream $upstream_name "
395+ die " $( eval_gettext " invalid upstream \ $ upstream_name" ) "
417396 upstream_arg=" $upstream_name "
418397else
419398 if test -z " $onto "
@@ -437,19 +416,19 @@ case "$onto_name" in
437416 then
438417 case " $onto " in
439418 ?* " $LF " ?* )
440- die " $onto_name : there are more than one merge bases"
419+ die " $( eval_gettext " \$ onto_name: there are more than one merge bases" ) "
441420 ;;
442421 ' ' )
443- die " $onto_name : there is no merge base"
422+ die " $( eval_gettext " \$ onto_name: there is no merge base" ) "
444423 ;;
445424 esac
446425 else
447- die " $onto_name : there is no merge base"
426+ die " $( eval_gettext " \$ onto_name: there is no merge base" ) "
448427 fi
449428 ;;
450429* )
451430 onto=$( git rev-parse --verify " ${onto_name} ^0" ) ||
452- die " Does not point to a valid commit: $onto_name "
431+ die " $( eval_gettext " Does not point to a valid commit: \ $ onto_name" ) "
453432 ;;
454433esac
455434
@@ -472,7 +451,7 @@ case "$#" in
472451 then
473452 head_name=" detached HEAD"
474453 else
475- die " fatal: no such branch: $1 "
454+ die " $( eval_gettext " fatal: no such branch: \$ branch_name " ) "
476455 fi
477456 ;;
4784570)
@@ -492,7 +471,7 @@ case "$#" in
492471 ;;
493472esac
494473
495- require_clean_work_tree " rebase" " Please commit or stash them."
474+ require_clean_work_tree " rebase" " $( gettext " Please commit or stash them." ) "
496475
497476# Now we are rebasing commits $upstream..$orig_head (or with --root,
498477# everything leading up to $orig_head) on top of $onto
@@ -510,10 +489,10 @@ then
510489 then
511490 # Lazily switch to the target branch if needed...
512491 test -z " $switch_to " || git checkout " $switch_to " --
513- say " Current branch $branch_name is up to date."
492+ say " $( eval_gettext " Current branch \ $ branch_name is up to date." ) "
514493 exit 0
515494 else
516- say " Current branch $branch_name is up to date, rebase forced."
495+ say " $( eval_gettext " Current branch \ $ branch_name is up to date, rebase forced." ) "
517496 fi
518497fi
519498
@@ -524,7 +503,7 @@ if test -n "$diffstat"
524503then
525504 if test -n " $verbose "
526505 then
527- echo " Changes from $mb to $onto :"
506+ echo " $( eval_gettext " Changes from \ $ mb to \ $ onto:" ) "
528507 fi
529508 # We want color (if set), but no pager
530509 GIT_PAGER=' ' git diff --stat --summary " $mb " " $onto "
533512test " $type " = interactive && run_specific_rebase
534513
535514# Detach HEAD and reset the tree
536- say " First, rewinding head to replay your work on top of it..."
515+ say " $( gettext " First, rewinding head to replay your work on top of it..." ) "
537516git checkout -q " $onto ^0" || die " could not detach HEAD"
538517git update-ref ORIG_HEAD $orig_head
539518
540519# If the $onto is a proper descendant of the tip of the branch, then
541520# we just fast-forwarded.
542521if test " $mb " = " $orig_head "
543522then
544- say " Fast-forwarded $branch_name to $onto_name ."
523+ say " $( eval_gettext " Fast-forwarded \ $ branch_name to \ $ onto_name." ) "
545524 move_to_original_branch
546525 exit 0
547526fi
0 commit comments