Browse Source

[enh] deliver.sh: rework some parts:
- don't use git alias sub-commands.
- 'cp' instead of 'mv':
- because '/tmp' files have permissions which do not allow removing.
- 'git rm' failed if element do not exists: ignore unmatch.
- reset 'delivery' branch if exist.

Moul 2 years ago
parent
commit
8909046ac3
1 changed files with 4 additions and 5 deletions
  1. 4 5
      deliver.sh

+ 4 - 5
deliver.sh

@@ -24,13 +24,12 @@ c_header="/* *******************************************************************
 /*                                                                            */
 /* ************************************************************************** */\n" 
 
-# Add 42 headers on top of source files
 add_42_headers() {
     for file in "src"/*; do
         add_42_header "$file"
     done
     add_42_header "Makefile"
-    git st
+    git status
     git diff
     git add src Makefile
     git commit -m "[mod] add 42 headers on top of files."
@@ -45,16 +44,16 @@ add_42_header() {
         echo $c_header > $tmp
     fi
     cat $src_file >> $tmp
-    mv $tmp $src_file
+    cp $tmp $src_file
 }
 
 clean_repository() {
     make fclean
-    git rm -rf doc non_use_src leaks.sh deliver.sh
+    git rm -rf --ignore-unmatch doc non_use_src leaks.sh deliver.sh
     rm -f toto
     git commit -m "[mod] remove non used elements."
 }
 
-git checkout -b deliver
+git checkout -B deliver
 add_42_headers
 clean_repository