Il giorno lun 27 apr 2020 alle 22:36, Carl Sorensen <c_soren...@byu.edu> ha scritto:
git checkout $RELEASE_BRANCH
if [ 0 -eq $(git merge-base --is-ancestor $COMMIT_ID HEAD) ]; then echo "true"; else echo "false"; fi

with $RELEASE_BRANCH being the name of the branch, and $COMMIT_ID replaced with the commit id you want to check.


I know this doesn't solve the GitLab vs GitHub issue. But it is a way to check more easily.


I had to replace [] with the double version [[]] and still I get some spurious output (needs two commits?):

[fede@linux lilypond-git ((release/2.21.0-1) %)]$ if [[ 0 -eq $(git merge-base --is-ancestor 68fb45e7e20071b10c43f2a6f64681d56122e67d) ]]; then echo "true"; else echo "false"; fi
usage: git merge-base [-a | --all] <commit> <commit>...
  or: git merge-base [-a | --all] --octopus <commit>...
  or: git merge-base --independent <commit>...
  or: git merge-base --is-ancestor <commit> <commit>
  or: git merge-base --fork-point <ref> [<commit>]

   -a, --all output all common ancestors
   --octopus find ancestors for a single n-way merge
   --independent list revs not reachable from others
   --is-ancestor is the first one ancestor of the other?
   --fork-point find where <commit> forked from reflog of <ref>

true

I guess I'll use Github for the time being. Much easier.

Thanks anyway!
Federico




Reply via email to