Skip to content

Commit

Permalink
determineVersion.sh: prevent traversing into outer git repo for git-d…
Browse files Browse the repository at this point in the history
…escribe call

When building nethogs inside another git repo (as is i.e. done as part
of a buildroot build) the version is picked up from the outer git repo,
which is confusing as well as introducing reproducibility problems when
rebuilding the same nethogs version produces different results if the
outer repository changes.
  • Loading branch information
BubuOT committed Sep 20, 2024
1 parent 0fe341e commit 6423bdf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions determineVersion.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

(git describe --tags 2>/dev/null || pwd | sed -e "s/.*\\///" | sed -e "s/[^-]*//") | tail -c +2
if [ $(git rev-parse --show-toplevel 2>/dev/null) == $(pwd) ]; then
git describe --tags 2>/dev/null | tail -c +2
else
pwd | sed -e "s/.*\\///" | sed -e "s/[^-]*//" | tail -c +2
fi

0 comments on commit 6423bdf

Please sign in to comment.