Bug 383834

Summary: Does not fetch Git tags before attempting to checkout tag
Product: [Developer tools] kdesrc-build Reporter: Kevin Funk <kfunk>
Component: generalAssignee: Michael Pyne <mpyne>
Status: RESOLVED FIXED    
Severity: normal CC: faure
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 17.09
Sentry Crash Report:

Description Kevin Funk 2017-08-22 10:03:55 UTC
Easy to reproduce with KDE Frameworks.

Have something like this in your config file:
```
module-set my-libs
  repository kde-git
  tag v5.34.0
  use-modules \
   karchive \
   kcodecs \
  ...
end module-set
```

Then run:
$ kdesrc-build kcodecs

Resulting error:
# kdesrc-build running: 'git' 'checkout' 'refs/tags/v5.34.0'
# from directory: /home/build/kf5/src/kcodecs
error: pathspec 'refs/tags/v5.34.0' did not match any file(s) known to git.
Comment 1 Kevin Funk 2017-08-22 10:25:11 UTC
In the meantime, this WIP patch solves my issue:

```
diff --git a/modules/ksb/Updater/Git.pm b/modules/ksb/Updater/Git.pm
index af14c16..e5b4b26 100644
--- a/modules/ksb/Updater/Git.pm
+++ b/modules/ksb/Updater/Git.pm
@@ -89,6 +89,9 @@ sub clone
         if (0 != log_command($module, 'git-clone', ['git', 'clone', @args])) {
             croak_runtime("Failed to make initial clone of $module");
         }
+        if (0 != log_command($module, 'git-fetch', ['git', 'fetch', '--tags'])) {
+            croak_runtime("Failed to fetch tags of $module");
+        }
     }
 
     $ipc->notifyPersistentOptionChange(
@@ -384,7 +387,7 @@ sub updateExistingClone
 
     # Download updated objects. This also updates remote heads so do this
     # before we start comparing branches and such.
-    if (0 != log_command($module, 'git-fetch', ['git', 'fetch', $remoteName])) {
+    if (0 != log_command($module, 'git-fetch', ['git', 'fetch', '--tags', $remoteName])) {
         croak_runtime ("Unable to perform git fetch for $remoteName, which should be $cur_repo");
     }
```
Comment 2 David Faure 2017-08-22 10:48:06 UTC
+1, that would remove one step from my monthly KF5 release procedure ;)
Comment 3 Michael Pyne 2017-08-22 23:19:14 UTC
See this bug annoys me because I've run into it myself but never quite got so far as to fix it. Lazy me. :-/

But I have Kevin's patch applied and as long as it makes it through this current build I'll push it out shortly.
Comment 4 Michael Pyne 2017-08-22 23:38:12 UTC
Git commit 9f70d018b9c9b1f07939022e1e00a78fcaeef4b5 by Michael Pyne.
Committed on 22/08/2017 at 23:35.
Pushed by mpyne into branch 'master'.

git: Keep the tags up to date at initial clone and after.

Fixes an annoying lack of tags.
FIXED-IN:17.09

M  +5    -2    modules/ksb/Updater/Git.pm

https://commits.kde.org/kdesrc-build/9f70d018b9c9b1f07939022e1e00a78fcaeef4b5