Обсуждение: buildfarm and git pull
Hi Andrew, I have a question about how buildfarm works with git, could you please help? We use buildfarm locally at PGPro to test our branches, and it breaks when I rebase and force push to the repository. To get the remote changes, buildfarm does 'git checkout .' followed by 'git pull', and the latter breaks when the remote branch was rebased. I was wondering if the buildfarm really has to do 'git pull'? Pull is supposed to be used to integrate local changes with remote ones, but buildfarm doesn't have any local changes, does it? It just has to checkout the remote branch as-is. To do that, when the state of working directory is not know, I'd do the following commands: git fetch # get the remote changes git checkout -f <remote>/<branch> # checkout the needed remote branch; on conflict, use the remote files git reset --hard # revert all modifications in tracked files git clean -xfd # recursively delete all unversioned and ignored files Do you think this approach is correct or am I missing something? -- Alexander Kuzmenkov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company
On 09/27/2018 11:32 AM, Alexander Kuzmenkov wrote: > Hi Andrew, > > I have a question about how buildfarm works with git, could you please > help? We use buildfarm locally at PGPro to test our branches, and it > breaks when I rebase and force push to the repository. To get the > remote changes, buildfarm does 'git checkout .' followed by 'git > pull', and the latter breaks when the remote branch was rebased. > > I was wondering if the buildfarm really has to do 'git pull'? Pull is > supposed to be used to integrate local changes with remote ones, but > buildfarm doesn't have any local changes, does it? It just has to > checkout the remote branch as-is. To do that, when the state of > working directory is not know, I'd do the following commands: > > git fetch # get the remote changes > git checkout -f <remote>/<branch> # checkout the needed remote branch; > on conflict, use the remote files > git reset --hard # revert all modifications in tracked files > git clean -xfd # recursively delete all unversioned and ignored files > > Do you think this approach is correct or am I missing something? > possibly. It seems a little violent. We don't do rebase + forced push in Postgres - it's something of a nono in public repositories according to my understanding. Send me a patch and I'll take a look at it. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
On Thu, Sep 27, 2018 at 06:32:59PM +0300, Alexander Kuzmenkov wrote: > It just has to checkout the remote branch as-is. It doesn't clean files, but I would suggest: git checkout -B branch remote/branch Justin
On 10/01/2018 11:45 AM, Justin Pryzby wrote: > On Thu, Sep 27, 2018 at 06:32:59PM +0300, Alexander Kuzmenkov wrote: >> It just has to checkout the remote branch as-is. > It doesn't clean files, but I would suggest: > git checkout -B branch remote/branch > You can see what was done in yesterday's three commits: <https://github.com/PGBuildFarm/client-code/commits/master/PGBuild/SCM.pm> This has been working in a couple of installations, and will be in a release soon. BTW, -hackers isn't the right forum for this. Please take any further discussion to buildfarm-members. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services