• Git automation

    From The Doctor@21:1/5 to All on Sat May 3 21:32:49 2025
    XPost: comp.unix.bsd.freebsd.misc

    I have a directory /path/to/

    where is Have programmes with .git is found .

    How can i cron a script so that the git pull can be run in the
    subdirectories with a .git subdirectory , ogin to the next one until done
    and report results in e-mail ?
    --
    Member - Liberal International This is doctor@nk.ca Ici doctor@nk.ca
    Yahweh, King & country!Never Satan President Republic!Beware AntiChrist rising! Look at Psalms 14 and 53 on Atheism ;
    Australia -Save the Nation from Donald Trump - Vote out Albanese!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to The Doctor on Sat May 3 22:56:50 2025
    XPost: comp.unix.bsd.freebsd.misc

    On Sat, 3 May 2025 21:32:49 -0000 (UTC), The Doctor wrote:

    I have a directory /path/to/

    where is Have programmes with .git is found .

    How can i cron a script so that the git pull can be run in the
    subdirectories with a .git subdirectory , ogin to the next one until
    done and report results in e-mail ?

    You could use the “update-all” script from here <https://gitlab.com/ldo/git-useful> as a starting point, for finding subdirectories of a specified directory that have a .git subdirectory in
    them.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Doctor@21:1/5 to ldo@nz.invalid on Sat May 3 23:52:41 2025
    XPost: comp.unix.bsd.freebsd.misc

    In article <vv66vi$hbt1$7@dont-email.me>,
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On Sat, 3 May 2025 21:32:49 -0000 (UTC), The Doctor wrote:

    I have a directory /path/to/

    where is Have programmes with .git is found .

    How can i cron a script so that the git pull can be run in the
    subdirectories with a .git subdirectory , ogin to the next one until
    done and report results in e-mail ?

    You could use the “update-all” script from here ><https://gitlab.com/ldo/git-useful> as a starting point, for finding >subdirectories of a specified directory that have a .git subdirectory in >them.

    I will have a look. Must recall to blog this.
    --
    Member - Liberal International This is doctor@nk.ca Ici doctor@nk.ca
    Yahweh, King & country!Never Satan President Republic!Beware AntiChrist rising! Look at Psalms 14 and 53 on Atheism ;
    Australia -Save the Nation from Donald Trump - Vote out Albanese!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steven G. Kargl@21:1/5 to The Doctor on Sun May 4 00:38:24 2025
    XPost: comp.unix.bsd.freebsd.misc

    On Sat, 03 May 2025 21:32:49 +0000, The Doctor wrote:

    I have a directory /path/to/

    where is Have programmes with .git is found .

    How can i cron a script so that the git pull can be run in the
    subdirectories with a .git subdirectory , ogin to the next one until done
    and report results in e-mail ?

    Use crontab to execute Try something like

    % cat zxc
    #! /bin/sh

    cd ${HOME}
    |
    DIRS="$(find . -type d -name .git | sed s/\\/.git//)"

    for i in $DIRS ; do
    cd $i
    git pull -ff
    cd ${HOME}
    done

    --
    steve

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Fritz Wuehler@21:1/5 to All on Sun May 4 02:37:42 2025
    The Doctor <doc...@doctor.nl2k.ab.ca> [TD]:
    How can i cron a script so that the git pull can be run in the subdirectories with a .git subdirectory , ogin to the next one
    until done and report results in e-mail ?


    # get a list of directories with .git
    find "/path/to/" -type d -name '.git' -print0 |

    # prepare a bunch of shell commands
    xargs -0 --replace=MY_GIT_DIR \
    echo '(D='MY_GIT_DIR';
    cd "$D" && echo Working in "$D";
    git pull your_git_options_here;
    )' |

    # execute them sequentially
    sh 2>&1 |

    # and send their output somewhere by email
    mail -s 'git jobs output' me@example.com

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Raymond Rayson@21:1/5 to Raymond Rayson on Sun May 4 01:44:42 2025
    XPost: comp.unix.bsd.freebsd.misc

    On Sun, 4 May 2025 01:24:33 -0000 (UTC), Raymond Rayson wrote:

    On Sat, 3 May 2025 21:32:49 -0000 (UTC), The Doctor wrote:

    I have a directory /path/to/

    where is Have programmes with .git is found .

    How can i cron a script so that the git pull can be run in the
    subdirectories with a .git subdirectory , ogin to the next one until done
    and report results in e-mail ?

    `for REPO in $TOPDIR; do git -C $REPO pull ${GITPULLOPTIONS}; done`

    Do not input the opening and closing accents (` characters) in
    your cronjob; they were my attempt to delineate a code block.



    --
    Best,
    Ray

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Raymond Rayson@21:1/5 to The Doctor on Sun May 4 01:24:33 2025
    XPost: comp.unix.bsd.freebsd.misc

    On Sat, 3 May 2025 21:32:49 -0000 (UTC), The Doctor wrote:

    I have a directory /path/to/

    where is Have programmes with .git is found .

    How can i cron a script so that the git pull can be run in the
    subdirectories with a .git subdirectory , ogin to the next one until done
    and report results in e-mail ?

    `for REPO in $TOPDIR; do git -C $REPO pull ${GITPULLOPTIONS}; done`


    --
    Best,
    Ray

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)