cmake.local fails for inadmissible branch names

Issue #233 resolved
Mikael Mortensen created an issue

Not sure it's a bug, but I cannot do this

git checkout dolfin-1.3.0
./cmake.local

where dolfin-1.3.0 is the detached release (tag). The checkout is fine, but this line in cmake.local fails

BRANCH=`git branch | grep '*' | cut -d' ' -f2 | sed s:/:.:g`

I currently get around it by hardcoding $BRANCH in cmake.local. Perhaps cmake.local should be hardcoded for releases?

Comments (14)

  1. Martin Sandve Alnæs

    I use my own build script, where I map all branch names other than master and next to "wip" (work in progress). Avoids this problem and avoids buildup of ridiculous amounts of build directories. Together with ccache I think this is sufficient.

    The bottleneck in my workflow is anyway the need to figure out manually when running cmake scripts is necessary, and the fact that the results of these scripts are not in the build directories.

  2. Anders Logg (Chalmers)

    Is it more efficient to have a common wip directory than using per-branch directories? (In terms of speed of recompilation, when ccache is used.)

  3. Martin Sandve Alnæs

    I use master, next and wip. So I build in wip while working on a topic branch, checkout next and build in next, merge, build again in next, and then I can switch back to wip without rebuilding. So multiple build dirs is useful.

    But the question is, are you switching back and forth between multiple topic branches a lot? If not the savings of having a build dir for each branch are minimal. With cmake.local, every new fix-issue-nnn etc. gives a new build dir which eats away disk space and has to be manually removed. I prefer a bit slower builds over having to manually check things like that all the time.

  4. Martin Sandve Alnæs

    In other words it's more efficient with one build dir per branch in terms of compilation time but it scales poorly in terms of disk usage and adds manual maintenance work.

  5. Anders Logg (Chalmers)

    ok, thanks. I have a lot of disk space (a couple of TB) so that is not a problem. And I occasionally run git clean -fdx anyway so those directories get cleaned out semi-automatically.

  6. Johannes Ring

    I am not sure how to fix this in cmake.local. However, instead of doing this

    git checkout dolfin-1.3.0
    

    you can do this

    git checkout -b mikaem/dolfin-1.3.0 dolfin-1.3.0
    
  7. Lawrence Mitchell

    You could use:

    git symbolic-ref --short HEAD 2> /dev/null || git describe HEAD
    

    Which produces the branch name when on a branch, the tag name if on a checked out tag, or something like:

    dolfin-1.3.0-977-g41c5bcc
    

    If on a detached head that isn't tagged.

  8. Log in to comment