Skip to content

Commit f6fbbf8

Browse files
author
Sebastian Messmer
committed
Workaround for git bug
1 parent 3726c66 commit f6fbbf8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/gitversionbuilder/versioninforeader.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ def _there_are_untracked_files_in_cwd():
6262

6363

6464
def _there_are_modified_files_in_cwd():
65-
# Workaround for a bug where - when we run "chmod 755 file" on a file that already has 755 and is committed to git as such, the next run of "it diff-index" will show it as a difference.
66-
# This is only the case for the first run, so we run it once to not run into this bug.
67-
subprocess.call(["git", "diff-index", "--exit-code", "--quiet", "HEAD"])
68-
return (0 != subprocess.call(["git", "diff-index", "--exit-code", "--quiet", "HEAD"])) or (0 != subprocess.call(["git", "diff-index", "--cached", "--exit-code", "--quiet", "HEAD"]))
65+
# Usually we'd like to use "git diff-index" here.
66+
# But there seems to be a bug that when we run "chmod 755 file" on a file that already has 755 and is committed to git as such, the next run of "git diff-index" will show it as a difference.
67+
# "git diff" seams to work
68+
return (0 != subprocess.call(["git", "diff", "--exit-code", "--quiet", "HEAD"])) or (0 != subprocess.call(["git", "diff", "--cached", "--exit-code", "--quiet", "HEAD"]))
6969

7070

7171
def _cwd_is_not_empty():

0 commit comments

Comments
 (0)