[kernel-team] 03/03: Fix branch check in d-k-{prerelease, tag} to work in linked working trees
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Sat Jan 2 03:52:40 UTC 2016
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch master
in repository kernel-team.
commit 65739261c7b0db5cfce80ed245f3f81b3c0d0e59
Author: Ben Hutchings <ben at decadent.org.uk>
Date: Sat Jan 2 03:51:16 2016 +0000
Fix branch check in d-k-{prerelease,tag} to work in linked working trees
In a linked working tree, .git is a regular file that refers to a .git
directory elsewhere. Instead of trying to parse it, use
'git status -b --porcelain' to find the current branch or other head.
---
scripts/d-k-prerelease | 9 +++++----
scripts/d-k-tag | 9 +++++----
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/scripts/d-k-prerelease b/scripts/d-k-prerelease
index 9e52863..c0145b0 100755
--- a/scripts/d-k-prerelease
+++ b/scripts/d-k-prerelease
@@ -5,12 +5,13 @@ if ! git diff --quiet HEAD; then
echo >&2 "E: Working tree has uncommitted changes"
exit 1
fi
-head="$(cat .git/HEAD)"
-branch="${head#ref: refs/heads/}"
-if [ "$branch" = "$head" ]; then
- echo >&2 "E: HEAD is not a branch ($head)"
+head="$(git status -b --porcelain)"
+head="${head#\#\# }"
+if [ "$head" = "HEAD (no branch)" ]; then
+ echo >&2 "E: HEAD is not a branch"
exit 1
fi
+branch="${head%...*}"
dist="$(dpkg-parsechangelog -S Distribution)"
if [ "$dist" != UNRELEASED ]; then
diff --git a/scripts/d-k-tag b/scripts/d-k-tag
index 1aaaabe..4b3ddda 100755
--- a/scripts/d-k-tag
+++ b/scripts/d-k-tag
@@ -5,12 +5,13 @@ if ! git diff --quiet HEAD; then
echo >&2 "E: Working tree has uncommitted changes"
exit 1
fi
-head="$(cat .git/HEAD)"
-branch="${head#ref: refs/heads/}"
-if [ "$branch" = "$head" ]; then
- echo >&2 "E: HEAD is not a branch ($head)"
+head="$(git status -b --porcelain)"
+head="${head#\#\#}"
+if [ "$head" = "HEAD (no branch)" ]; then
+ echo >&2 "E: HEAD is not a branch"
exit 1
fi
+branch="${head%...*}"
# Check that distribution agrees with branch
dist=$(dpkg-parsechangelog -S Distribution)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/kernel-team.git
More information about the Kernel-svn-changes
mailing list