git-rebase--common.shon commit git-p4: add failing test for shelved CL update involving move/copy (7a10bb3)
   1
   2resolvemsg="
   3$(gettext 'Resolve all conflicts manually, mark them as resolved with
   4"git add/rm <conflicted_files>", then run "git rebase --continue".
   5You can instead skip this commit: run "git rebase --skip".
   6To abort and get back to the state before "git rebase", run "git rebase --abort".')
   7"
   8
   9write_basic_state () {
  10        echo "$head_name" > "$state_dir"/head-name &&
  11        echo "$onto" > "$state_dir"/onto &&
  12        echo "$orig_head" > "$state_dir"/orig-head &&
  13        echo "$GIT_QUIET" > "$state_dir"/quiet &&
  14        test t = "$verbose" && : > "$state_dir"/verbose
  15        test -n "$strategy" && echo "$strategy" > "$state_dir"/strategy
  16        test -n "$strategy_opts" && echo "$strategy_opts" > \
  17                "$state_dir"/strategy_opts
  18        test -n "$allow_rerere_autoupdate" && echo "$allow_rerere_autoupdate" > \
  19                "$state_dir"/allow_rerere_autoupdate
  20        test -n "$gpg_sign_opt" && echo "$gpg_sign_opt" > "$state_dir"/gpg_sign_opt
  21        test -n "$signoff" && echo "$signoff" >"$state_dir"/signoff
  22}
  23
  24apply_autostash () {
  25        if test -f "$state_dir/autostash"
  26        then
  27                stash_sha1=$(cat "$state_dir/autostash")
  28                if git stash apply $stash_sha1 >/dev/null 2>&1
  29                then
  30                        echo "$(gettext 'Applied autostash.')" >&2
  31                else
  32                        git stash store -m "autostash" -q $stash_sha1 ||
  33                        die "$(eval_gettext "Cannot store \$stash_sha1")"
  34                        gettext 'Applying autostash resulted in conflicts.
  35Your changes are safe in the stash.
  36You can run "git stash pop" or "git stash drop" at any time.
  37' >&2
  38                fi
  39        fi
  40}
  41
  42move_to_original_branch () {
  43        case "$head_name" in
  44        refs/*)
  45                message="rebase finished: $head_name onto $onto"
  46                git update-ref -m "$message" \
  47                        $head_name $(git rev-parse HEAD) $orig_head &&
  48                git symbolic-ref \
  49                        -m "rebase finished: returning to $head_name" \
  50                        HEAD $head_name ||
  51                die "$(eval_gettext "Could not move back to \$head_name")"
  52                ;;
  53        esac
  54}
  55
  56output () {
  57        case "$verbose" in
  58        '')
  59                output=$("$@" 2>&1 )
  60                status=$?
  61                test $status != 0 && printf "%s\n" "$output"
  62                return $status
  63                ;;
  64        *)
  65                "$@"
  66                ;;
  67        esac
  68}