packfile: replace lseek+read with pread
[git.git] / git-rebase--common.sh
blobf00e13e5d04df09558dba65afd4fe1ed44375fa9
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 test t = "$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 test -n "$reschedule_failed_exec" && : > "$state_dir"/reschedule-failed-exec
25 apply_autostash () {
26 if test -f "$state_dir/autostash"
27 then
28 stash_sha1=$(cat "$state_dir/autostash")
29 if git stash apply $stash_sha1 >/dev/null 2>&1
30 then
31 echo "$(gettext 'Applied autostash.')" >&2
32 else
33 git stash store -m "autostash" -q $stash_sha1 ||
34 die "$(eval_gettext "Cannot store \$stash_sha1")"
35 gettext 'Applying autostash resulted in conflicts.
36 Your changes are safe in the stash.
37 You can run "git stash pop" or "git stash drop" at any time.
38 ' >&2
43 move_to_original_branch () {
44 case "$head_name" in
45 refs/*)
46 message="rebase finished: $head_name onto $onto"
47 git update-ref -m "$message" \
48 $head_name $(git rev-parse HEAD) $orig_head &&
49 git symbolic-ref \
50 -m "rebase finished: returning to $head_name" \
51 HEAD $head_name ||
52 die "$(eval_gettext "Could not move back to \$head_name")"
54 esac
57 output () {
58 case "$verbose" in
59 '')
60 output=$("$@" 2>&1 )
61 status=$?
62 test $status != 0 && printf "%s\n" "$output"
63 return $status
66 "$@"
68 esac