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

Fix git clone & update helper scripts #993

Merged
merged 3 commits into from Feb 2, 2015

Conversation

Projects
None yet
2 participants
@remram44
Contributor

remram44 commented Jan 29, 2015

Creating local branches is a bit weird, and moving them is definitely not a good idea.

This places Git in "detached head" mode without creating or changing local branches. Remember that BRANCH might very well be a tag name.

@remram44 remram44 added the Build label Jan 29, 2015

@remram44 remram44 force-pushed the fix-git-update branch 2 times, most recently from 1ddc15d to 833e806 Jan 29, 2015

@remram44 remram44 force-pushed the fix-git-update branch from 833e806 to 4f89f6e Jan 29, 2015

if [ "$("@GIT_EXECUTABLE@" cat-file -t @BRANCH@)" = tag ]; then
"@GIT_EXECUTABLE@" checkout @BRANCH@
else
"@GIT_EXECUTABLE@" checkout origin/@BRANCH@

This comment has been minimized.

@remram44

remram44 Jan 29, 2015

Contributor

Note that the local branch refs/heads/@BRANCH@ will still be created with upstream information (but not checked out); this is because of clone -b.

cd "@GIT_TARGET@"
if [ "$("@GIT_EXECUTABLE@" cat-file -t @BRANCH@)" = tag ]; then
"@GIT_EXECUTABLE@" checkout @BRANCH@
else

This comment has been minimized.

@aashish24

aashish24 Jan 29, 2015

Contributor

so the else will checkout and result in a headless branch

This comment has been minimized.

@remram44

remram44 Jan 30, 2015

Contributor

This will checkout in "detached head" mode in any case, thus not changing local branches. Unfortunately "clone -b" will have already created a local branch if @BRANCH@ is a branch name. I don't know how to stop that.

@aashish24

This comment has been minimized.

Contributor

aashish24 commented Jan 29, 2015

So the logic is:

  1. if tag then create the branch?
  2. if not create the headless branch?
@remram44

This comment has been minimized.

Contributor

remram44 commented Feb 1, 2015

  1. If tag then no branch is created. Goes to detached head, like it already does, except that the update script will work too.
  2. If branchname then a local branch is created by "git clone". I guess I could just run branch -D to get rid of it. Goes to detached head, the update script will work (and won't create local branches).
@aashish24

This comment has been minimized.

Contributor

aashish24 commented Feb 2, 2015

Right..
For the 1) I was misled by my prompt that I have a branch checked out. In both cases it will be detached head.

@aashish24

This comment has been minimized.

Contributor

aashish24 commented Feb 2, 2015

LGTM 👍

aashish24 added a commit that referenced this pull request Feb 2, 2015

Merge pull request #993 from UV-CDAT/fix-git-update
Fix git clone & update helper scripts

@aashish24 aashish24 merged commit de61b65 into master Feb 2, 2015

1 check failed

continuous-integration/travis-ci The Travis CI build failed
Details

@aashish24 aashish24 deleted the fix-git-update branch Feb 2, 2015

@remram44

This comment has been minimized.

Contributor

remram44 commented Jun 8, 2015

Interesting detail: this will fail if someone was to make a lightweight (old-style) tag instead of the new, preferred annotated tags (git tag -a). Apparently came up today with VisTrails' tag for uvcdat-2.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment