Skip to content

Fix #109 #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
v1.14.1
=======

* fix #109: when detecting a dirty git workdir
don't consider untracked file
(this was a regression due to #86 in v1.13.1)
* consider the distance 0 when the git node is unknown
(happens when you haven't commited anything)

v1.14.0
=======

Expand Down
4 changes: 2 additions & 2 deletions setuptools_scm/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def from_potential_worktree(cls, wd):
return cls(real_wd)

def is_dirty(self):
out, _, _ = self.do_ex("git status --porcelain")
out, _, _ = self.do_ex("git status --porcelain --untracked-files=no")
return bool(out)

def node(self):
Expand All @@ -50,7 +50,7 @@ def parse(root, describe_command=DEFAULT_DESCRIBE):
dirty = wd.is_dirty()

if rev_node is None:
return meta('0.0', dirty=dirty)
return meta('0.0', distance=0, dirty=dirty)

out, err, ret = do_ex(describe_command, root)
if ret:
Expand Down
6 changes: 5 additions & 1 deletion testing/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def wd(wd):


def test_version_from_git(wd):
assert wd.version == '0.0'
assert wd.version == '0.1.dev0'

wd.commit_testfile()
assert wd.version.startswith('0.1.dev1+')
Expand All @@ -34,8 +34,12 @@ def test_version_from_git(wd):


@pytest.mark.issue(108)
@pytest.mark.issue(109)
def test_git_worktree(wd):
wd.write('test.txt', 'test2')
# untracked files dont change the state
assert wd.version == '0.1.dev0'
wd('git add test.txt')
assert wd.version.startswith('0.1.dev0+d')


Expand Down