Git commands executed by Go




  • Avatar
    Mike O'Brien

    Actually, I'm curious about this too (But for different reasons). For some reason Go takes foreeeeeever to check if a repo has any changes or when it pulls the latest.

  • Avatar

    Hi Jon,

    Just so we understand the problem better, are these the steps that reproduce the problem?

    - You push a change to submodule 

    - You pull that change in parent(which uses submodule and is configured as material for the pipeline)

    - You commit the change (lets call it 'sub update')

    - Go auto/manual trigger uses 'sub update' revision

    - Go agent picks up work(a job from the first stage of the pipeline that is scheduled off 'sub update' revision)

    - Go agent fails the job because one of the submodules is not updated.

    If your failure scenario is different, can you please clarify what are the major steps that make it fail?

    Sachin & JJ 

  • Avatar

    @Sachin & JJ 

    I have resolved my problem now, but I am still interested in the answer to this question.

    To be clear, I do not think there is any problem with Go (or git). It is a just a case of my changes not making it into git where I expected them to be. The aim of my question was to get a series of commands I could run on a local command-line in order to see which revisions get pulled down, inspect the status of the repositories etc.

    The answer I was looking for would be something like:

    For updates

    cd <material destination directory>

    git pull origin <branch>

    git submodule update --init

    For intial builds

    cd <material destination directory>

    git clone <repo url>

    git submodule ...

    The steps are as you describe: I commit and push to a submodule and it's parent. When the pipeline is triggered, a Go agent fails the job because an item of the submodule is at the wrong version.

    Thanks for your reply,


  • Avatar
    Sachin Sudheendra

    Hi Jon,

    The sequence of commands that the agent executes for an existing repositiory:

    git fetch origin

    git gc --auto

    git reset --hard

    git config --get-regexp ^submodule\..+\.url

    for every submodule folder

       git config --remove-section (for every submodule.<submodule-folder>)

       deletes submodule folder


    git submodule update --init

    git submodule status


    JJ & Sachin

  • Avatar

    Thanks Sachin, that's exactly what I was looking for. Are you able to give me the commands when the repository doesn't already exist?

Please sign in to leave a comment.