You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since 84019cb (#1769), gix status works in repositories that have not yet had their first commit. Rather than reporting an error, it shows the status of each file that has unstaged changes. This includes:
Files in the ? state that have been created but are not in the index.
Files in the M state that are in the index but have different contents on disk.
However, it does not show:
Files in the A state that are in the index and the same on disk.
In contrast, those are shown when the repository has been born, i.e., when there is an actual HEAD commit.
Expected behavior 🤔
Staged but not committed changes should be shown in the output of gix status. Since gix status now supports being run before the first commit, this should be the case then, too, where every file in the index is uncommitted.
These files should be shown in the A state, unless there is a reason to depart from the way Git presents them.
Git behavior
Git shows these files in the A state:
ek in 🌐 catenary in ~/src
❯ git init repo
Initialized empty Git repository in /home/ek/src/repo/.git/
ek in 🌐 catenary in ~/src
❯ cd repo
ek in 🌐 catenary in repo on main
❯ echo old >file
ek in 🌐 catenary in repo on main [?]
❯ git add .
ek in 🌐 catenary in repo on main [+]
❯ git status
On branch main
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: file
ek in 🌐 catenary in repo on main [+]
❯ git status --short
A file
(The file contents "old" are used to avoid deviating from the procedure shown below to produce the bug in gitoxide. But since further steps are only needed to verify that the bug in gitoxide does not extend further, they are omitted in the run with Git shown above, which is why the above terminal log has no "new".)
Steps to reproduce 🕹
Build gitoxide after 84019cb (#1769) and replace ~/repos/gitoxide/target/debug/gix with the path to the built gix executable, if different, in the following. This tests more than the specific situation that has the bug, in order to show specifically when the bug does and does not occur:
git init repo
cd repo
echo old >file
~/repos/gitoxide/target/debug/gix status # The file should be listed in the ? state and it is.
git add file
~/repos/gitoxide/target/debug/gix status # The file should be listed in the A state but it is not listed at all (this is the bug).echo new >file
~/repos/gitoxide/target/debug/gix status # The file should be listed in the M state and it is.
git add file
~/repos/gitoxide/target/debug/gix status # Verify before we commit that the bug is still observable.
git commit -m 'Initial commit'~/repos/gitoxide/target/debug/gix status # The file should not be shown, is not.
touch other-file
~/repos/gitoxide/target/debug/gix status # The other file should be listed in the ? state and it is.
git add other-file
~/repos/gitoxide/target/debug/gix status # The other file should be listed in the A state and it is.
Here's a full transcript of a run of that, on an Arch Linux system:
ek in 🌐 catenary in ~/src
❯ git init repo
Initialized empty Git repository in /home/ek/src/repo/.git/
ek in 🌐 catenary in ~/src
❯ cd repo
ek in 🌐 catenary in repo on main
❯ echo old >file
ek in 🌐 catenary in repo on main [?]
❯ ~/repos/gitoxide/target/debug/gix status # The file should be listed in the ? state and it is.
15:22:25 status done 0.0 files in 0.00s (0.0 files/s)
? file
ek in 🌐 catenary in repo on main [?]
❯ git add file
ek in 🌐 catenary in repo on main [+]
❯ ~/repos/gitoxide/target/debug/gix status # The file should be listed in the A state but it is not listed at all (this is the bug).
15:22:36 status done 1.0 files in 0.00s (808.0 files/s)
ek in 🌐 catenary in repo on main [+]
❯ echo new >file
ek in 🌐 catenary in repo on main [!+]
❯ ~/repos/gitoxide/target/debug/gix status # The file should be listed in the M state and it is.
15:22:47 status done 1.0 files in 0.00s (684.0 files/s)
M file
ek in 🌐 catenary in repo on main [!+]
❯ git add file
ek in 🌐 catenary in repo on main [+]
❯ ~/repos/gitoxide/target/debug/gix status # Verify before we commit that the bug is still observable.
15:22:56 status done 1.0 files in 0.00s (800.0 files/s)
ek in 🌐 catenary in repo on main [+]
❯ git commit -m 'Initial commit'
[main (root-commit) e6b257f] Initial commit
1 file changed, 1 insertion(+)
create mode 100644 file
ek in 🌐 catenary in repo on main
❯ ~/repos/gitoxide/target/debug/gix status # The file should not be shown, is not.
15:23:09 status done 1.0 files in 0.00s (614.0 files/s)
ek in 🌐 catenary in repo on main
❯ touch other-file
ek in 🌐 catenary in repo on main [?]
❯ ~/repos/gitoxide/target/debug/gix status # The other file should be listed in the ? state and it is.
15:23:18 status done 1.0 files in 0.00s (674.0 files/s)
? other-file
ek in 🌐 catenary in repo on main [?]
❯ git add other-file
ek in 🌐 catenary in repo on main [+]
❯ ~/repos/gitoxide/target/debug/gix status # The other file should be listed in the A state and it is.
15:23:27 status done 2.0 files in 0.00s (1.4K files/s)
A other-file
The text was updated successfully, but these errors were encountered:
Current behavior 😯
Since 84019cb (#1769),
gix status
works in repositories that have not yet had their first commit. Rather than reporting an error, it shows the status of each file that has unstaged changes. This includes:?
state that have been created but are not in the index.M
state that are in the index but have different contents on disk.However, it does not show:
A
state that are in the index and the same on disk.In contrast, those are shown when the repository has been born, i.e., when there is an actual
HEAD
commit.Expected behavior 🤔
Staged but not committed changes should be shown in the output of
gix status
. Sincegix status
now supports being run before the first commit, this should be the case then, too, where every file in the index is uncommitted.These files should be shown in the
A
state, unless there is a reason to depart from the way Git presents them.Git behavior
Git shows these files in the
A
state:(The file contents "old" are used to avoid deviating from the procedure shown below to produce the bug in gitoxide. But since further steps are only needed to verify that the bug in gitoxide does not extend further, they are omitted in the run with Git shown above, which is why the above terminal log has no "new".)
Steps to reproduce 🕹
Build gitoxide after 84019cb (#1769) and replace
~/repos/gitoxide/target/debug/gix
with the path to the builtgix
executable, if different, in the following. This tests more than the specific situation that has the bug, in order to show specifically when the bug does and does not occur:Here's a full transcript of a run of that, on an Arch Linux system:
The text was updated successfully, but these errors were encountered: