#392: Strange message "already on master" ---------------------------+------------------------------------------------ Reporter: eschnett | Owner: eric9 Type: defect | Status: new Priority: minor | Milestone: Component: GetComponents | Version: Keywords: | ---------------------------+------------------------------------------------ GetComponents outputs "already on master" for every git repository. This message should not appear.
#392: Strange message "already on master" ----------------------------+----------------------------------------------- Reporter: eschnett | Owner: eric9 Type: defect | Status: accepted Priority: minor | Milestone: Component: GetComponents | Version: Resolution: | Keywords: ----------------------------+----------------------------------------------- Changes (by eric9):
* status: new => accepted
Comment:
Noted. It must be trying to change branches one too many times.
#392: Strange message "already on master" ----------------------------+----------------------------------------------- Reporter: eschnett | Owner: eric9 Type: defect | Status: accepted Priority: minor | Milestone: Component: GetComponents | Version: Resolution: | Keywords: ----------------------------+-----------------------------------------------
Comment (by knarf):
Can somebody with more git experience please look into this? With more git repositories in the future we must not get these warnings.
#392: Strange message "already on master" ----------------------------+----------------------------------------------- Reporter: eschnett | Owner: eric9 Type: defect | Status: accepted Priority: minor | Milestone: ET_2013_11 Component: GetComponents | Version: Resolution: | Keywords: ----------------------------+----------------------------------------------- Changes (by rhaas):
* milestone: => ET_2013_11
#392: Strange message "already on master" ----------------------------+----------------------------------------------- Reporter: eschnett | Owner: eric9 Type: defect | Status: review Priority: minor | Milestone: ET_2013_11 Component: GetComponents | Version: Resolution: | Keywords: ----------------------------+----------------------------------------------- Changes (by rhaas):
* status: accepted => review
Comment:
The attached two patches should take of this. Changes are:
* only call checkout if we are not already on the desired branch (HEAD!=branch) * when going back to the current branch, do not try to create it (it already exists since we were on it) and do not reset the local branch to the remote one since this wipes local commits that have not been pushed. If we are not on "branch" the the user did a git checkout manually to switch branches and is likely able to do so again (or rebase) if she wants to do so.
* work around very old git version on queenbee
the attached patches avoid the warning (and do a proper update) on both my workstation (new git) and on queenbee (ancient)
#392: Strange message "already on master" ----------------------------+----------------------------------------------- Reporter: eschnett | Owner: eric9 Type: defect | Status: review Priority: minor | Milestone: ET_2013_11 Component: GetComponents | Version: Resolution: | Keywords: ----------------------------+-----------------------------------------------
Comment (by knarf):
0002-work-around-old-svn-version-on-queenbee.patch looks good, please apply. I also opened a ticket with the qb admins to update the client. The patch has the "problem" that it will fail if /dev/null does not exist though, which might be the case in chroots for instance if /dev isn't loop-mounted there.
#392: Strange message "already on master" ----------------------------+----------------------------------------------- Reporter: eschnett | Owner: eric9 Type: defect | Status: review Priority: minor | Milestone: ET_2013_11 Component: GetComponents | Version: Resolution: | Keywords: ----------------------------+-----------------------------------------------
Comment (by rhaas):
I think requiring /dev/null is probably fine, our build system also uses /dev/null it seems, eg in lib/make/configure.
#392: Strange message "already on master" ----------------------------+----------------------------------------------- Reporter: eschnett | Owner: eric9 Type: defect | Status: review Priority: minor | Milestone: ET_2013_11 Component: GetComponents | Version: Resolution: | Keywords: ----------------------------+-----------------------------------------------
Comment (by knarf):
0002 isn't necessary anymore. A new version of svn has been installed on queenbee. Use {{{ soft add +subversion-1.8.3-gcc-4.3.2 }}} to get it. This has been added to the new users tutorial as well.
#392: Strange message "already on master" ----------------------------+----------------------------------------------- Reporter: eschnett | Owner: eric9 Type: defect | Status: review Priority: minor | Milestone: ET_2013_11 Component: GetComponents | Version: Resolution: | Keywords: ----------------------------+-----------------------------------------------
Comment (by rhaas):
Anyone to review patch 0001? Someone who knows git?
#392: Strange message "already on master" ----------------------------+----------------------------------------------- Reporter: eschnett | Owner: eric9 Type: defect | Status: review Priority: minor | Milestone: ET_2013_11 Component: GetComponents | Version: Resolution: | Keywords: ----------------------------+-----------------------------------------------
Comment (by barry.wardell):
0001 doesn't look like it does quite the right thing. It checks that the two hashes (current and branch) are the same and doesn't do the checkout if they are. This could be wrong in a couple of cases: if two branches point to the same commit, or if the repository is on a detached head which also happens to be pointed to by a branch.
I think the following (untested) patch might be a better approach.
#392: Strange message "already on master" ----------------------------+----------------------------------------------- Reporter: eschnett | Owner: eric9 Type: defect | Status: review Priority: minor | Milestone: ET_2013_11 Component: GetComponents | Version: Resolution: | Keywords: ----------------------------+-----------------------------------------------
Comment (by rhaas):
I agree. The original solution would have failed in the situations that Barry outlined. git symbolic-ref seems to do the trick, with the exception that it prepends "refs/heads/" to the branch name. The attached patch adjusts the regex patterns for this.
Please note that none of our regex patterns are anchored (to the beginning or end) so that "master" and "master-untested" will both match. This is a bug.
#392: Strange message "already on master" ----------------------------+----------------------------------------------- Reporter: eschnett | Owner: eric9 Type: defect | Status: review Priority: minor | Milestone: ET_2013_11 Component: GetComponents | Version: Resolution: | Keywords: ----------------------------+-----------------------------------------------
Comment (by barry.wardell):
The new patch looks good to me. I don't think there would be any bug in this version since string equality is used in place of a regex.
#392: Strange message "already on master" ----------------------------+----------------------------------------------- Reporter: eschnett | Owner: eric9 Type: defect | Status: closed Priority: minor | Milestone: ET_2013_11 Component: GetComponents | Version: Resolution: fixed | Keywords: ----------------------------+----------------------------------------------- Changes (by rhaas):
* status: review => closed * resolution: => fixed
Comment:
There is indeed no issue with regex in this patch. There are other places in GetComponents (eg line 1711: {{{#!python # three possibilities: # 1. branch exists locally, needs update # 2. branch exists remotely, needs local tracking branch # 3. branch is actually tag, do nothing
if ( `cd $repo_loc && $git branch` =~ /$branch/m ) { }}}) where regex are used however.
Applied as git hash de0b1dd9feb097591130c33bf7a61862cacf4ff0 of CRL.
trac@lists.einsteintoolkit.org