rebase: cherry-pick: add copyright
[git] / git-rebase--cherrypick.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2014 Felipe Contreras
4 #
5
6 GIT_CHERRY_PICK_HELP="$resolvemsg"
7 export GIT_CHERRY_PICK_HELP
8
9 case "$action" in
10 continue)
11         # do we have anything to commit?
12         if ! git diff-index --cached --quiet HEAD --
13         then
14                 git commit --no-verify -e ||
15                         die "Could not commit staged changes."
16         fi
17         git cherry-pick --continue &&
18         move_to_original_branch
19         return
20         ;;
21 skip)
22         git cherry-pick --skip &&
23         move_to_original_branch
24         return
25         ;;
26 esac
27
28 mkdir -p "$state_dir" || die "Could not create temporary $state_dir"
29 : > "$state_dir"/cherrypick || die "Could not mark as cherrypick"
30
31 if test -n "$rebase_root"
32 then
33         revisions="$onto...$orig_head"
34 else
35         revisions="$upstream...$orig_head"
36 fi
37
38 if test -n "$keep_empty"
39 then
40         extra="--allow-empty"
41 else
42         extra="--skip-empty --cherry-pick"
43 fi
44 test -n "$GIT_QUIET" && extra="$extra -q"
45 test -z "$force_rebase" && extra="$extra --ff"
46 test -n "$strategy" && extra="$extra --strategy=$strategy"
47 for x in "$strategy_opts"
48 do
49         test -z "$x" && continue
50         x=$(eval "echo $x")
51         extra="$extra -X${x#--}"
52 done
53 test -n "$allow_rerere_autoupdate" && extra="$extra $allow_rerere_autoupdate"
54
55 git cherry-pick --no-merges --right-only --topo-order --do-walk --action-name rebase $extra "$revisions"
56 ret=$?
57
58 if test 0 != $ret
59 then
60         write_basic_state
61         return $ret
62 fi
63
64 move_to_original_branch