This repository has been archived on 2021-09-04. You can view files and clone it, but cannot push or open issues or pull requests.
gnupot/other/ideas_for_file_conflict_res...

96 lines
3.6 KiB
Plaintext
Raw Normal View History

2015-06-01 16:07:52 +02:00
# SOME IDEAS FOR A BETTER FILE CONFLICT RESOLVER FUNCTION.
#
# if [ "$returnedVal" -eq 1 ]; then
# notifyCmd "Resolving file conflicts." \
#"$gnupotDefaultNotificationTime"
# SOME IDEAS.
# Server and clients have master and tmp branches.
# If there is no problems, branches are equal.
# Otherwise:
#
# git pull origin tmp
# <compare master & tmp branches: get conflicting files list>
# <move master files>
# git checkout ??-b?? tmp # change to tmp branch
# <move tmp files>
# <merge branches in master branch without deleting tmp branch>
# git push origin master
# git push origin tmp
# END OF SOME IDEAS.
# IT DOES NOT WORK BUT THIS IS THE previous IDEA:
# get file conflict list
#conflictList=$(git diff --name-only --diff-filter=U)
# Create locally tmp branch if it doen not exist.
#git checkout -b tmp
#for conflict in $conflictList; do
# move conflicting files to new names
# mv "$conflict" "$conflict"."$REMOTE_USR"."$DATE"
#done
#git commit -a -m "??resolved??"
# change to master branch
#git checkout master
#for conflict in $conflictList; do
# move conflicting files to new names
# mv "$conflict" "$conflict"."$REMOTE_USR"."$DATE"
#done
# tmp U master
#git merge tmp
#if [ "$action" == "push" ]; then
#git push origin master
#else
# :
#fi
#notifyCmd "File conflicts resolved." \
#"$gnupotDefaultNotificationTime"
# echo 1
# fi
# echo 0
# Clean useless files and keep maximum user defined number of backups.
# Do the syncing. To be able to clean: git config --system \
# receive.denyNonFastForwards true
#backupAndPush()
#{
# local commitSha=""
# if Max backups is set to 0 it means always to do a simple commit.
# Otherwise use mod operator to find out when to truncate history (if
# result is 0 it means that history must be truncated.
# if [ "$gnupotKeepMaxCommits" -ne 0 ] \
#&& [ $(expr "$(gitGetCommitNumber)" % "$gnupotKeepMaxCommits") -eq 0 ]; then
# Get sha of interest.
# commitSha=$(git rev-list --max-count="$gnupotKeepMaxCommits" \
#HEAD | tail -n 1)
# From man git-checkout:
# Create a new orphan branch, named <new_branch>, started from
# <start_point> and switch to it.
# git checkout --orphan tmp "$commitSha"
# Change old commit.
# git commit -m "Truncated history $USERDATA"
# From man git-rebase:
# Forward-port local commits to the updated upstream head.
# git rebase --onto tmp "$commitSha" master
#git rebase --continue
# git checkout master
# Delete tmp branch.
# git branch -D tmp
# Garbage collector for stuff older than 1d.
# TODO better.
# git gc --auto --prune=1d
# execSSHCmd "git push -f origin master"
# else
# execSSHCmd "git push origin master"
# fi
#
# return 0
#}