From 2e566c5ee14d062e3b578d577662dc21af7d6643 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Tue, 1 Sep 2015 08:58:57 +0200 Subject: [PATCH] versioneer lookup: add support for detached checkouts When doing 'git checkout ' or 'git checkout ' there will be no branch info: $ git branch * (detached from 96fc70b) After whitelisting '\(detached.*' we get: $ python setup.py version running version got version from git {'version': '1.2.5-1-gfd73e02', 'branch': 'HEAD', 'full': 'fd73e02f4fa9f286407ad688feeeee3ebaffea60'} Version is currently: 1.2.5-1-gfd73e02 The '-1-gfd73e02' is this commit on top of the 1.2.5 tag. While detached checkouts should be discouraged some buildsystems (e.g. OpenEmbedded) have no real way to avoid it, which is what this patch fixes. Actual people doing a checkout should use a branch. Signed-off-by: Koen Kooi (cherry picked from commit 987e637) --- .versioneer-lookup | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.versioneer-lookup b/.versioneer-lookup index 0ffcdd87..203936b4 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -18,5 +18,8 @@ fix/.* 1.2.8 6c622f7c4332b71c6ece59552ffc87c146155c84 pep440-dev # Special case disconnected checkouts, e.g. 'git checkout ' \(detached.* +# Special case disconnected checkouts, e.g. 'git checkout ' +(detached.* + # every other branch is a development branch and thus gets resolved to 1.3.0-dev for now .* 1.3.0 198d3450d94be1a2 pep440-dev