transport-helper: drop read/write errno checks
[git.git] / git-rebase--common.sh
blob7e39d228717899228dfd735b22196de973e7add3
2 resolvemsg="
3 $(gettext 'Resolve all conflicts manually, mark them as resolved with
4 "git add/rm <conflicted_files>", then run "git rebase --continue".
5 You can instead skip this commit: run "git rebase --skip".
6 To abort and get back to the state before "git rebase", run "git rebase --abort".')
9 write_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
24 apply_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.
35 Your changes are safe in the stash.
36 You can run "git stash pop" or "git stash drop" at any time.
37 ' >&2
42 move_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")"
53 esac
56 output () {
57 case "$verbose" in
58 '')
59 output=$("$@" 2>&1 )
60 status=$?
61 test $status != 0 && printf "%s\n" "$output"
62 return $status
65 "$@"
67 esac