[PATCH 09/23] Introduce --tag-exists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tweak tag

tweak tag
---
 Documentation/git-test.txt |    2 ++
 git-conditions-lib.sh      |   12 ++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-test.txt b/Documentation/git-test.txt
index ea54d20..69c8710 100644
--- a/Documentation/git-test.txt
+++ b/Documentation/git-test.txt
@@ -78,6 +78,8 @@ CONDITIONS
 	Tests if the head is (not) detached.
 '--branch-exists'|'--not-branch-exists branch'::
         Tests if the specified branch does (not) exist.				    
+'--tag-exists'|'--not-tag-exists tag'::
+        Tests if the specified tag does (not) exist.
 
 EXTENDING THE CONDITION LIBRARY
 -------------------------------
diff --git a/git-conditions-lib.sh b/git-conditions-lib.sh
index 5d7a7f8..93a916a 100644
--- a/git-conditions-lib.sh
+++ b/git-conditions-lib.sh
@@ -87,5 +87,17 @@ check_branch_exists_1()
 	fi
 }
 
+check_tag_exists_1()
+{
+	symbolic=$(git rev-parse --quiet --symbolic-full-name --verify "$1")
+ 	if test "${symbolic#refs/tags/}" != "${symbolic}"
+	then
+		echo "Tag '$1' exists."
+	else
+		echo "Tag '$1' does not exist."
+		false
+	fi
+}
+
 
 fi
-- 
1.7.5.rc1.23.g7f622

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]