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

Fix git clone & update helper scripts #993

Merged
merged 3 commits into from Feb 2, 2015
Merged

Fix git clone & update helper scripts #993

merged 3 commits into from Feb 2, 2015

Conversation

remram44
Copy link
Contributor

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 Compare January 29, 2015 16:11
if [ "$("@GIT_EXECUTABLE@" cat-file -t @BRANCH@)" = tag ]; then
"@GIT_EXECUTABLE@" checkout @BRANCH@
else
"@GIT_EXECUTABLE@" checkout origin/@BRANCH@
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@aashish24
Copy link
Contributor

So the logic is:

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

@remram44
Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor

LGTM 👍

aashish24 added a commit that referenced this pull request Feb 2, 2015
Fix git clone & update helper scripts
@aashish24 aashish24 merged commit de61b65 into master Feb 2, 2015
@aashish24 aashish24 deleted the fix-git-update branch February 2, 2015 14:12
@remram44
Copy link
Contributor Author

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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants