diff --git a/readme b/readme index 7d9b4d3..8323de3 100644 --- a/readme +++ b/readme @@ -15,6 +15,7 @@ SYNOPSIS OPTIONS -h prints the help. -r specifies the reference to the commit to be synchronized. It can be a tag or a branch. By default, it is the last commit of branch main. + It can be different from the actual branch. CAREFUL, the command git branch will always show the original branch name even though a branch switch has happened. -d specifies the destination of the clone or update. Directory must be empty if a new clone is to be made. If the repository to be cloned is local, and its path is passed as a relative path, the path should start from the destination. To avoid mistakes, absolute paths are advised. @@ -27,7 +28,9 @@ DESCRIPTION ## Cloning git_update.sh will only clone in an empty repository, by default the current working directory. -If called in a repository with a .git directory, it will update (see below). If called in a repository with untracked files, it will fail. Only the commit and the necessary objects will be cloned. The commit can be indicated through a reference, either a tag or branch, otherwise the last commit of branch is the default. +If called in a repository with a .git directory, it will update (see below). If called in a repository with untracked files, it will fail. +Only the commit and the necessary objects will be cloned. The commit can be indicated through a reference, either a tag or branch, otherwise the last commit of main is the default. +CAREFUL: the command git branch will always show the original branch name and will not follow the eventual branch changes. git_update.sh clones using " git clone --recurse-submodules --shallow-submodules --depth=1" @@ -45,17 +48,25 @@ A) Cloning the last commit of a branch into a non-existing directory ./path/to/git_update.sh -r myBranch -d myDirectory https://git.mydomain/myname/myrepository.git Result: a directory myDirectory has been created in the current working directory. It is filled with the files of the last commit of branch myBranch as well as the .git. The history only shows the last commit. -B) +B) Updating the current working directory repository, moving it from its current state to a certain tag, calling for an aggressive garbage collection. +./path/to/git_update.sh -r myTag -a https://git.mydomain/myname/myrepository.git +Result: untracked files are still here. all the tracked files have been changed to respect the tag commit. The history only shows the last commit. +git gc has been called with the --aggressive option, hence the objects in the .git have been repacked so as to optimize memory. +CAREFUL: git branch still displays the original branch name and not the one of the tag. + # Development process -git_update.sh has been written by the French association Jean-Cloud (https://www.jean-cloud.net), in the process of developing Shlagernetes, a new orchestration tool. Shlagernetes allows storing services on fallible second-hand servers and tries to consume the less possible resources. +git_update.sh has been written by the French association Jean-Cloud (https://www.jean-cloud.net), in the process of developing Shlagernetes, an orchestration tool. +Shlagernetes allows storing services on fallible second-hand servers and tries to consume the less possible resources. Several tests have been performed in order to find the most energy-saving Git commands. You can find them under /test/performance_tests. Please refer to /doc/development_explanations for more information about the tests and choices made in the elaboration of git_update.sh. - # Testing +The script test_git_update.sh can be found at /test/functional_tests. It will create a repository to test on before testing. +Please refer to the readme of test and the readme of test/functional_tests. # How to contribute -If you have any suggestion or question about git_update.sh, please contact us at contact@jean-cloud.org. We would be delighted to hear your feedback. +If you have any suggestion or question about git_update.sh, please contact us at contact@jean-cloud.org. +We would be delighted to hear your feedback. Feel free to send diff files with improvement suggestions. diff --git a/src/git_update.sh b/src/git_update.sh index 2056059..ef92158 100755 --- a/src/git_update.sh +++ b/src/git_update.sh @@ -8,6 +8,7 @@ SYNOPSIS OPTIONS -h prints the help. -r specifies the reference to the commit to be synchronized. It can be a tag or a branch. By default, it is the last commit of branch main. + It can be different from the actual branch. CAREFUL, the command git branch will always show the original branch name even though a branch switch has happened. -d specifies the destination of the clone or update. Directory must be empty if a new clone is to be made. If the repository to be cloned is local, and its path is passed as a relative path, the path should start from the destination. To avoid mistakes, absolute paths are advised.