Embed git commit hash into an executable

The problem When we write our programs or libraries, usually we ship to the end user a packaged binary. If a user wants to report a bug or ask for a feature, one of the most important information to have is “which version of the software are you using ?” Since as any good programmer you likely use a source code control system, you should not rely only on the numeric version, but it’s practical to include also the git commit hash of the software you are actually shipping....

July 1, 2023 · Andrea Manzini

migrating a repository from mercurial to git

Since bitbucket is sunsetting the support for mercurial repositories, I wrote a quick and dirty script to automate the migration from mercurial to GIT: #!/bin/bash set -e set -u if [ "$#" -ne 3 ]; then echo "Illegal number of parameters" echo "usage: migrate.sh reponame hgrepourl gitrepourl" exit 1 fi REPONAME=$1 HGURL=$2 GITURL=$3 echo "Migrating $REPONAME from $HGURL to $GITURL..." cd /tmp hg clone $HGURL cd $REPONAME hg bookmark -r default master hg bookmarks hg cd ....

December 15, 2019 · Andrea Manzini