@@ -29,6 +29,10 @@ rm_deleted_by_them() {
2929# Checks the git status and tries to `git rm` the files removed from
3030# the target branch to the commit.
3131rm_deleted_by_us () {
32+ echo " =================="
33+ echo " = Remove deleted ="
34+ echo " =================="
35+
3236 delete_name=" deleted by us:"
3337 delete_size_next=${# delete_name} +3
3438 lines=$( git status)
@@ -45,6 +49,10 @@ rm_deleted_by_us() {
4549
4650# Fixes the conflicts using theirs and adds them to the commit.
4751fix_conflicts_using_theirs () {
52+ echo " ================="
53+ echo " = Fix conflicts ="
54+ echo " ================="
55+
4856 conflict_name=" both modified:"
4957 conflict_size_next=${# conflict_name} +3
5058 lines=$( git status)
@@ -54,6 +62,7 @@ fix_conflicts_using_theirs() {
5462 if [[ " $status " == " $conflict_name " ]]; then
5563 path_name=${line: $conflict_size_next : ${# line} }
5664 echo " Resolving using theirs $path_name "
65+ git diff ORIG_HEAD MERGE_HEAD " $path_name "
5766 git checkout --theirs " $path_name "
5867 git add " $path_name "
5968 fi
@@ -62,12 +71,20 @@ fix_conflicts_using_theirs() {
6271}
6372
6473remove_lfs_files () {
74+ echo " ===================="
75+ echo " = Remove lfs files ="
76+ echo " ===================="
77+
6578 while read -r line; do
6679 git rm --cached " $line "
6780 done < <( git lfs ls-files | sed -r ' s/^.{13}//' )
6881}
6982
7083update_headers () {
84+ echo " =================="
85+ echo " = Update headers ="
86+ echo " =================="
87+
7188 # for actual source and header files
7289 find . -type f \( -name " *.cpp" -o -name " *.h" -o -name " *.h.in" \) ! -path " */external/*" ! -name " rfnoc_test.cc" -exec perl -0777 -pi -e " s{/\*.*?\*/}{/*
7390 *
@@ -133,23 +150,22 @@ main() {
133150 fi
134151
135152 # Merge
153+ echo " ========="
154+ echo " = Merge ="
155+ echo " ========="
136156 git fetch -q origin " $source_branch "
137- if ! git merge " $source_branch " ; then
138- # Conflicts
157+ # Git merge will always generate a merge commit because history is different in both branches
158+ if ! git merge " $source_branch " -m " Update main" ; then
159+ # There are conflicts
139160 git status
140161 rm_deleted_by_us
141162 rm_deleted_by_them
142163 fix_conflicts_using_theirs
143164 git commit --no-edit
144165 fi
145-
146- # Remove any remaining lfs files
147166 remove_lfs_files
148- git commit -a --amend --no-edit
149-
150- # Update headers
151167 update_headers
152- git commit -a -m " Adding AGPL copyright to new files "
168+ git commit -a --amend --no-edit
153169
154170 # Push
155171 if [ " $mode " = " push" ]; then
0 commit comments