Are the style code fixes also committed? It looks like after the fix is done, the previous code is committed, and the styling fixes are tracked en not committed. How do you make that work in the hook? "git add ." again in the hook can have unexpected results if you commit only specific files en not all changes.
Hey Rudi, so if I understand correctly, what you are saying is that the git hook which is running before the commit is not adding the changes which are added during the fix? I don't have the code setup, so I will try that and see if that's really the case and how I missed that.
This could work for comitting specific/all files... # store list of staged files to variable except deleted file since it won't work at re-add list=$(git diff --name-only --cached --diff-filter=d) # run pint, this will unstage any files that pint will fix ./vendor/bin/pint # re-add unstaged files caused by pint back to staging printf $list | xargs git add PS - initially run pint first and add fixed files to staging
Hi Modified files not adding to commit after pint fixed the files The below code doesn't work #!/bin/sh GREEN='\033[1;32m' NC='\033[0m' # No Color list=$(git diff --name-only --cached --diff-filter=d) printf "${GREEN}Running Pint${NC}
thk you
Welcome 🙏
👍
Thanks
Are the style code fixes also committed? It looks like after the fix is done, the previous code is committed, and the styling fixes are tracked en not committed. How do you make that work in the hook? "git add ." again in the hook can have unexpected results if you commit only specific files en not all changes.
Hey Rudi, so if I understand correctly, what you are saying is that the git hook which is running before the commit is not adding the changes which are added during the fix? I don't have the code setup, so I will try that and see if that's really the case and how I missed that.
@@amitavroydev Yeah, If I saw it correctly, it wasn't committed.
This could work for comitting specific/all files...
# store list of staged files to variable except deleted file since it won't work at re-add
list=$(git diff --name-only --cached --diff-filter=d)
# run pint, this will unstage any files that pint will fix
./vendor/bin/pint
# re-add unstaged files caused by pint back to staging
printf $list | xargs git add
PS - initially run pint first and add fixed files to staging
Hi
Modified files not adding to commit after pint fixed the files
The below code doesn't work
#!/bin/sh
GREEN='\033[1;32m'
NC='\033[0m' # No Color
list=$(git diff --name-only --cached --diff-filter=d)
printf "${GREEN}Running Pint${NC}
"
vendor/bin/pint
printf "
==============================================
"
printf $list | xargs git add
#printf "${GREEN}Running Tests${NC}
"
#php artisan test
#printf "
==============================================
"
Need to check