aboutsummaryrefslogtreecommitdiff
path: root/android_merge_from_upstream.sh
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2020-06-24 16:10:06 -0700
committerGeorge Burgess <gbiv@chromium.org>2020-06-24 23:20:46 +0000
commitefb96d1a55f64e72489e219ea65d974e5468a753 (patch)
tree652af9deb3d71ea46aa8752dda2984345da7cc29 /android_merge_from_upstream.sh
parent74a6b0951679e53f9bd43170bbddb3455a068792 (diff)
downloadtoolchain-utils-efb96d1a55f64e72489e219ea65d974e5468a753.tar.gz
android_merge_from_upstream: fix up naming
This replaces `master` with `main` where possible, per the linked bug. It also switches to a more concise way of making sure we're never on the local branch. BUG=chromium:1099035 TEST=Ran the script in android-llvm Change-Id: I0e656057acec857a2c91480cbd822a5bc6778563 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2265045 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'android_merge_from_upstream.sh')
-rwxr-xr-xandroid_merge_from_upstream.sh22
1 files changed, 7 insertions, 15 deletions
diff --git a/android_merge_from_upstream.sh b/android_merge_from_upstream.sh
index cf07d4bf..b63eb6e1 100755
--- a/android_merge_from_upstream.sh
+++ b/android_merge_from_upstream.sh
@@ -18,11 +18,11 @@ remote_branch="${remote}/upstream-mirror-master"
my_dir="$(dirname "$(readlink -m "$0")")"
cd "${my_dir}"
-ensure_head_is_upstream_master() {
- local current_rev master_rev
+ensure_head_is_upstream_main() {
+ local current_rev main_rev
current_rev="$(git rev-parse HEAD)"
- master_rev="$(git rev-parse ${local_upstream})"
- if [[ "${current_rev}" != "${master_rev}" ]]; then
+ main_rev="$(git rev-parse ${local_upstream})"
+ if [[ "${current_rev}" != "${main_rev}" ]]; then
echo "Please checkout ${local_upstream} and rerun this" >&2
exit
fi
@@ -42,16 +42,8 @@ ensure_no_local_branch_present() {
exit 1
fi
- # If we're *on* that branch, deleting it is difficult.
- local current_branch
- current_branch="$(git branch --show-current)"
- if [[ "${current_branch}" == "${local_branch_name}" ]]; then
- local rev
- rev="$(git rev-parse HEAD)"
- # This is fine, since we assume HEAD == upstream-mirror-master anyway
- # (e.g., the existing branch was pointless.)
- git checkout "${rev}"
- fi
+ # If we're *on* that branch, deleting it is difficult. Always detach.
+ git checkout --detach || return
git branch -D "${local_branch_name}"
}
@@ -61,7 +53,7 @@ get_merge_commit_list() {
git log --oneline "${merge_base}..${remote_branch}"
}
-ensure_head_is_upstream_master
+ensure_head_is_upstream_main
ensure_no_local_branch_present
echo "Ensuring repository is up-to-date..."