Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package.sh swaps to master branch if .git/config contains upstream #101

Closed
srfraser opened this issue Aug 8, 2015 · 7 comments
Closed
Labels
bug unexpected problem or unintended behavior

Comments

@srfraser
Copy link
Contributor

srfraser commented Aug 8, 2015

If you wish to test whether package.sh works on a different branch, you must make sure that .git/config does not contain a branch definition, such as:

[branch "logrotation-v2"]
    remote = origin
    merge = refs/heads/logrotation-v2

If this definition exists, then package.sh swaps to the master branch and builds that.

Without that entry, the git pull fails (see below), but package.sh carries on with the current branch, allowing the test package build to work.

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> logrotation-v2

package github.com/srfraser/telegraf: exit status 1
@sparrc sparrc added the bug unexpected problem or unintended behavior label Aug 9, 2015
@sparrc
Copy link
Contributor

sparrc commented Aug 9, 2015

thanks for the report, I need to work on a feature to get circleci cross-compiling all pushes (branches and forks)

@sparrc
Copy link
Contributor

sparrc commented Aug 11, 2015

@srfraser do you mean that the git pull failure is "expected behavior"? ie, when git pull fails, package.sh builds from the intended branch?

@sparrc
Copy link
Contributor

sparrc commented Aug 11, 2015

PS: circleci should now be making debs and rpms, see the "artifacts" tab on any successful build

@srfraser
Copy link
Contributor Author

Yes, when the git pull fails, it builds from the intended branch. When it succeeds (because the branch config is there), it builds from master.

It would still be useful to test the building of debs and rpms before it reaches circleci

@sparrc
Copy link
Contributor

sparrc commented Aug 11, 2015

@srfraser, it appears that go get ./... switches to the master branch IFF there is an upstream branch set.

I don't know why it does that, but the only solution I could come up with is to unset the remote branch before running that command, and log a warning that it happened. Let me know what you think (see referenced commit)

@srfraser
Copy link
Contributor Author

There could be an optional argument to package.sh, specifying the branch. If not given, set to master, then after go get ./... then git checkout branchname. It might be more work than desired for this use case, though.

@sparrc
Copy link
Contributor

sparrc commented Aug 11, 2015

I agree but I think it's a bit too much for this use-case, as it stands the script doesn't really have any arg parsing, I would rather keep it simple, especially since you can now get the .deb and .rpm files via circle

@sparrc sparrc closed this as completed Aug 11, 2015
sparrc added a commit that referenced this issue Aug 11, 2015
I really need to remember to do this with the initial commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants