Changed behaviour of the truncate history: now the operation is more reliable and happens when it is supposed to happen (except when there is a particular case). Updated and fixed manuals.

dev
frnmst/Franco Masotti 7 years ago
parent 912cdb4314
commit f90313aa18
  1. 5
      man/gnupot.config.man
  2. 6
      man/gnupot.man
  3. 15
      src/functions.sh

@ -21,7 +21,7 @@
.\"
.TH GNUPOT.CONFIG 5 "February 2016" "0.4.experimental" "File Formats Manual"
.TH GNUPOT.CONFIG 5 "March 2016" "0.4.experimental" "File Formats Manual"
.SH NAME
gnupot.conf \- Configuration file for GNUpot.
@ -132,7 +132,8 @@ means to keep all commits.
.br
This means that every
.B gnupotKeepMaxCommits
history is truncated and starts from that current commit.
history is squashed and starts from a new commit generated with the
current files.
.br
Under certain circumstances however history gets merged or it does not get
truncated even if this variable is set to a non-zero value. This happens

@ -21,7 +21,7 @@
.\"
.TH GNUPOT 1 "January 2016" "0.4" "User Commands"
.TH GNUPOT 1 "March 2016" "0.4.experimental" "User Commands"
.SH NAME
gnupot \- Libre file syncronization witten in bash, based on git.
@ -95,8 +95,8 @@ Exit status:
.SH FILES
.I ~/.config/gnupot
.RS
Directory of the configuration file as well as the SSH keys (by default
configuration).
Directory where the configuration file and the SSH keys are stored (the
latter by default configuration).
.RE
.I ~/.config/gnupot.config

@ -79,9 +79,10 @@ notify()
{
local msg="$1" ms="$2" action="$3"
[ -z "$action" ] && iconPath=""$gnupotIconsDir"/gnupotIcon.png"
if [ -z "$action" ]; then
iconPath=""$gnupotIconsDir"/gnupotIcon.png"
if [ "$action" = "client" ]; then
elif [ "$action" = "client" ]; then
iconPath=""$gnupotIconsDir"/gnupotSyncLocal.png"
elif [ "$action" = "server" ]; then
@ -89,7 +90,6 @@ iconPath=""$gnupotIconsDir"/gnupotSyncRemote.png"
elif [ "$action" = "warning" ]; then
iconPath=""$gnupotIconsDir"/gnupotWarning.png"
fi
# If you are running GNUpot in a GUI then notify else do nothing.
@ -408,11 +408,10 @@ checkFileChanges()
backupAndPush()
{
# 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 Max backups is set to 0 it means always to do a simple commit
# otherwise don't keep more than $gnupotKeepMaxCommits commits.
if [ "$gnupotKeepMaxCommits" -ne 0 ] \
&& [ $(expr "$(gitGetCommitNumber)" % "$gnupotKeepMaxCommits") -eq 0 ]; then
&& [ "$(gitGetCommitNumber)" -ge "$gnupotKeepMaxCommits" ]; then
git reset $(git commit-tree HEAD^{tree} -m "Compressed history.")
execSSHCmd "git push -f origin master"
# Remove cache of non existing commits.
@ -514,7 +513,7 @@ $INOTIFYWAITCMD ""$gnupotRemoteDir"/refs/heads/master""
# Client sync thread.
syncC()
{
local path="" lockVal=""
local path=""
trap "exit 0" $SIGNALS