Просмотр исходного кода

Fix latest_tag git fact parsing

although I haven't been able to put my finger on it, git-log must have
changed between Debian's 2.1.4 and Fedora's 2.5.something.  The previous
version worked on Fedora but not on Debian; hopefully this solution is
more robust.
Alois Mahdal 8 лет назад
Родитель
Сommit
8d5b1c51ca
1 измененных файлов: 5 добавлений и 5 удалений
  1. 5
    5
      src/include/facts.sh

+ 5
- 5
src/include/facts.sh Просмотреть файл

@@ -33,12 +33,12 @@ git_fact() {
33 33
     git_present || warn "can't give fact outside git repo: $fact_name"
34 34
     case "$fact_name" in
35 35
         latest_tag)
36
-            git log --format="%D" \
36
+            git log --format="%d" \
37 37
               | sed 's/,/\n/g' \
38
-              | sed 's/^[[:blank:]]*//; ' \
39
-              | grep -E '^tag: v[[:digit:]]+\.' \
40
-              | cut -d' ' -f2 \
41
-              | head -1
38
+              | sed 's/^[[:blank:]]*//' \
39
+              | grep -E '^\(?tag' \
40
+              | tr -cd '[[:digit:]].v\n' \
41
+              | grep . -m 1
42 42
             ;;
43 43
         latest_version)
44 44
             git_fact latest_tag | git_tag2ver