cob icon indicating copy to clipboard operation
cob copied to clipboard

Inconsistent behavior of isClean check

Open lwolf opened this issue 5 years ago • 3 comments

For some reason !isClean() introduced in the #3 doesn't always work as expected.

Here is the output from git status and cob:

$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

$ cob
2020/07/02 15:30:59 the repository is dirty: commit all changes before running 'cob'

This fails both locally and in the CI for some repos, but doesn't fail for others.

Could this check be optional, so it could be force disabled in the CI where one doesn't care about loosing state.

lwolf avatar Jul 02 '20 14:07 lwolf

@lwolf would be great if this could be fixed. Do you have a patched fork? (yes: https://github.com/lwolf/cob/commit/3e1328ecb99e373d35190ee599b6b3fdecb18853) I can't use it because of the same issue. I have some additional temp files locally, that are not part of the git tree and the tool fails, even when I specify a clean path like:

% cob --bench-args "test -run '^$' -bench . -benchmem ./routing"
2021/07/20 10:29:23 the repository is dirty: commit all changes before running 'cob'
zsh: exit 1     cob --bench-args "test -run '^$' -bench . -benchmem ./routing"

szuecs avatar Jul 20 '21 08:07 szuecs

I have the same problem, it makes this code unusable.

treussart avatar Dec 06 '23 06:12 treussart

I fix this problem by remove the check, https://github.com/knqyf263/cob/commit/145be31e9925d4df6207c51b1106a6851595a82b

I suggest changing libraries to https://github.com/go-git/go-git but It seems that there is a problem with this function :

https://github.com/go-git/go-git/issues/167 https://github.com/go-git/go-git/issues/387

treussart avatar Dec 06 '23 10:12 treussart