-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed how to retrieve git tags (#64)
* Calculating latest matching tag by executing 'git log' instead of 'git tag'. * Updated the documentation with how latest tag is retrieved. * Updated version to alpha9 Co-authored-by: Furkan Bayraktar <[email protected]>
- Loading branch information
1 parent
4ec8422
commit c4c9490
Showing
8 changed files
with
60 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
(ns polylith.clj.core.git.tag | ||
(:require [clojure.string :as str] | ||
[polylith.clj.core.shell.interface :as shell] | ||
[polylith.clj.core.util.interface.str :as str-util])) | ||
|
||
(defn log-lines [ws-dir] | ||
(str/split-lines (shell/sh "git" "log" (str "--pretty=format:%H %d") :dir ws-dir))) | ||
|
||
(defn skip-tag [string] | ||
(if (str/starts-with? string "tag: ") | ||
(subs string 5) | ||
string)) | ||
|
||
(defn matching-tag [tag pattern] | ||
(when (re-find (re-pattern pattern) tag) | ||
tag)) | ||
|
||
(defn tags [line pattern] | ||
(when-let [string (str-util/take-until | ||
(str-util/skip-until line "tag: ") ")")] | ||
(when-let [tag (first (filter identity | ||
(map #(matching-tag (skip-tag %) pattern) | ||
(str/split string #", "))))] | ||
{:tag tag | ||
:sha (subs line 0 40)}))) | ||
|
||
(defn matching-tags [ws-dir pattern] | ||
(filterv identity (map #(tags % pattern) | ||
(log-lines ws-dir)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters