Closed easybe closed 3 years ago
Why would we need flag for this ? Can't you just create a branch if it doesn't exist by default ?
Yes, I guess that could work for me.
However,
is also a problem for me. IMHO a git pull
does not really make sense here, as we have uncommitted changes at this point which might lead to an error. Or am I missing something here?
Is it an option to change the current behavior?
That is for collaborative environment where somebody else might push to that branch in the middle of the CI pipeline. It ensures there are no conflicts on push.
That is also not a problem, you could ignore error on it or (better) do it for existing branches only.
OK, I updated the PR.
Note that if a local branch with the same name already exist, it will be reset to the current HEAD.
I hope that is OK.
You miss -q
everywhere. Without it CI may fail.
You miss
-q
everywhere. Without it CI may fail.
I would prefer it that way, but OK, I can add it.
Done
I would prefer it too, but CI fails because git writes to stderr if q is not present.
So with this change, you can basically make persistence commits visible in separate branch and not pollute your master branch with bot commits ? Its enough for me to set some arbitrary non existent branch like -Branch updatebot
?
I remember some people asked for it a long time ago.
Yes, exactly. I create PRs from these branches.
So, are you done and checked if it works in real AU update ? This plugin is used by everybody.
Yes, I am done.
It works in my set up which is based on https://github.com/majkinetor/au-packages-template/blob/master/update_all.ps1.
Not sure how to test it more.
Ah, wait... It won't work like this I think. If packages are on master and you are pulling updatebot
you will get nothing. So you need to get master and switch to another branch after that if I am not mistaken. So there need to be 2 branches as parameters - SourceBranch
and DestinationBranch
For me it works because:
git pull
which failsFor my case "pull" does not make sense...
If you specify master
as the branch, nothing should have changed.
It was there as a safety because time passes since CI pulls the master and AU finishes and your changes are "saved". If anybody commits during that time you can't push on the same branch any more. Contrary to that, pull immediately before commit makes that highly unlikely.
Now it works for you because of your specific setup. It may not work for people who use the same branch for source and destination and have more active users.
So,
In case Branch is different then master, then I agree, pull is probably not needed UNLESS again somebody commits to it, like you have multiple AU scripts for some reason operating for redundancy.
Other problem is that you don't need to have CI - you can perfectly have Git plugin working without any CI whatsoever, then it needs to pull master if AU runs from 2 locations .
So maybe to be sure, we should have 2 params, SourceBranch aka Branch as before (param alias) and DestinationBranch. If you use CI and you are lone developer you could probably just use DestinationBranch and CI will do the rest.
I really don't see any problem here. As I said,
If you specify master as the branch, nothing should have changed.
because a git pull
is still performed.
If you use a different branch, worst case would be that you have a merge conflict when merging the branch. Then you could e.g. re-run or rebase.
If you have two AU scripts pushing to the same branch, the slower one will pull the newly created branch.
I like this solution because the changes are very minimal 🤷♂️
It works on my repo, branch name updates
Not sure why it triggered new build ASAP after bot commit on AppVeyor ... need to look into it.
Note that if a local branch with the same name already exist, it will be reset to the current HEAD.