Skip to content

Commit e7f0db6

Browse files
committed
Makefile: use git describe --always to make version.cc
If git-describe fails, an empty string is assigned to CS_VERSION, which breaks the regression tests that expect csdiff version to be available. Unfortunately, `git describe --tags` is not compatible with checkout@v3 GitHub Action.
1 parent 46694ff commit e7f0db6

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

.github/workflows/ci.yml

-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ jobs:
2525
- name: Checkout repository
2626
uses: actions/checkout@v3
2727

28-
- name: Fetch tags to make git-describe work
29-
run: git fetch --tags origin
30-
3128
- name: '[clang] Install a default version for Ubuntu ${{ matrix.version }}'
3229
if: matrix.compiler == 'clang++'
3330
run: |

Makefile

+1-4
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ CMAKE_BUILD_TYPE ?= RelWithDebInfo
2828
fast install version.cc src/version.cc
2929

3030
all: version.cc
31-
git describe --tags
32-
git describe --tags | sed -e "s/^csdiff-//"
33-
git describe --tags | sed -e "s/^csdiff-//" -e "s/-.*-/.$$(git log --pretty="%cd" --date=iso -1 | tr -d ":-" | tr " " . | cut -d. -f 1,2)./"
3431
cat src/version.cc
3532
mkdir -p csdiff_build
3633
cd csdiff_build && $(CMAKE) \
@@ -68,7 +65,7 @@ version.cc: src/version.cc
6865

6966
src/version.cc:
7067
@if test -e .git; then \
71-
cmd='git describe --tags | sed -e "s/^csdiff-//" -e "s/-.*-/.$$(git log --pretty="%cd" --date=iso -1 | tr -d ":-" | tr " " . | cut -d. -f 1,2)./"'; \
68+
cmd='git describe --always | sed -e "s/^csdiff-//" -e "s/-.*-/.$$(git log --pretty="%cd" --date=iso -1 | tr -d ":-" | tr " " . | cut -d. -f 1,2)./"'; \
7269
else \
7370
cmd='basename $$(readlink -f .) | cut -f2 -d-'; \
7471
fi \

0 commit comments

Comments
 (0)