I have got an account on a server at my university. I want to share a program code with another student. I thought I should put it on my github account. Unfortunately, I cannot because the code is part of a contest.
I decided to make a Makefile so that we could easily upload and download files. After a while I finally understood that is not enough. Then I implemented patch system so that only changes are stored. There should be no problem with small simultaneous changes.
The Makefile almost do the job but there are some details I can't solve. The Makefile
all: download PHONY: all, download, upload, getFiles .ONESHELL: getFiles: rm ../.tmp -r mkdir ../.tmp @(ssh $(user)@host "tar c *") | tar xv -C ../.tmp download: getFiles @diff -u ../.tmp . | patch -p1 rm ../.tmp -r upload: getFiles @diff -uN ../.tmp . | (ssh $(user)@host "patch -p1") rm ../.tmp -r
I removed all data from host. Now I want to upload but tar stops program because there are no files to download in order to find out changes.
Moreover, I cannot make my mind in the case: should I use -N in diff or not? Simply, I do not know how it behaves when I delete a file.
There is another problem: when something goes wrong the .tmp directory is not removed. The directory should be removed every time. Next action always download current "repository" status.
I fully recognize the fact it is not a repository, but I cannot set up a server program on the remote host and I think the Makefile will do the job for me.
Any hints will be appreciated.