I just tried to reproduce what you mentioned in Ubuntu Kinetic (22.10) and I got the same results as you did. After going through etckeeper manpage, I see this is the expected behavior:
unclean
This returns true if the directory contains uncommitted changes.
In short, if you have uncommited changes it returns true (0) and if there is no uncommited change it returns false (returned 1 during my test):
root@etckeeper-test:/etc# git status
On branch master
nothing to commit, working tree clean
root@etckeeper-test:/etc# touch a
root@etckeeper-test:/etc# git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
a
nothing added to commit but untracked files present (use "git add" to track)
root@etckeeper-test:/etc# etckeeper unclean
root@etckeeper-test:/etc# echo $?
0
root@etckeeper-test:/etc# rm a
root@etckeeper-test:/etc# git status
On branch master
nothing to commit, working tree clean
root@etckeeper-test:/etc# etckeeper unclean
root@etckeeper-test:/etc# echo $?
1
So I believe this is not a bug at all but expected behavior. Therefore, marking this bug as Invalid.
Hi Tamas,
I just tried to reproduce what you mentioned in Ubuntu Kinetic (22.10) and I got the same results as you did. After going through etckeeper manpage, I see this is the expected behavior:
unclean
This returns true if the directory contains uncommitted changes.
In short, if you have uncommited changes it returns true (0) and if there is no uncommited change it returns false (returned 1 during my test):
root@etckeeper- test:/etc# git status test:/etc# touch a test:/etc# git status
On branch master
nothing to commit, working tree clean
root@etckeeper-
root@etckeeper-
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
a
nothing added to commit but untracked files present (use "git add" to track) test:/etc# etckeeper unclean test:/etc# echo $? test:/etc# rm a test:/etc# git status test:/etc# etckeeper unclean test:/etc# echo $?
root@etckeeper-
root@etckeeper-
0
root@etckeeper-
root@etckeeper-
On branch master
nothing to commit, working tree clean
root@etckeeper-
root@etckeeper-
1
So I believe this is not a bug at all but expected behavior. Therefore, marking this bug as Invalid.