Skip to content
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

Feature request: show untracked files in the default view #762

Closed
proski opened this issue Nov 16, 2017 · 8 comments
Closed

Feature request: show untracked files in the default view #762

proski opened this issue Nov 16, 2017 · 8 comments

Comments

@proski
Copy link
Contributor

proski commented Nov 16, 2017

It's a familiar embarrassment for software developers. A pull request is submitted and fails to pass checks because of missing files. The files are on the developer's system, but they are not part of the commit.

Let's make it a thing of the past.

I know, tig status would show untracked files. But I don't normally run tig status. I run tig without arguments most of the time, and it gives me almost all information I need. The untracked files are an exception, but they should not be.

Let's have a special line on top for the untracked files if they are present. That line would be above unstaged and staged changes, since the untracked files are further from becoming a commit than the changes that git knows about.

If the untracked files are shown by default, it would also encourage the developers to keep .gitignore files up-to-date.

koutcher added a commit to koutcher/tig that referenced this issue Nov 21, 2018
koutcher added a commit to koutcher/tig that referenced this issue Nov 21, 2018
koutcher added a commit to koutcher/tig that referenced this issue Nov 21, 2018
koutcher added a commit to koutcher/tig that referenced this issue Nov 21, 2018
koutcher added a commit to koutcher/tig that referenced this issue Nov 23, 2018
koutcher added a commit to koutcher/tig that referenced this issue Dec 2, 2018
koutcher added a commit to koutcher/tig that referenced this issue Dec 2, 2018
koutcher added a commit to koutcher/tig that referenced this issue Dec 14, 2018
koutcher added a commit to koutcher/tig that referenced this issue Dec 14, 2018
koutcher added a commit to koutcher/tig that referenced this issue Dec 14, 2018
koutcher added a commit to koutcher/tig that referenced this issue Dec 14, 2018
koutcher added a commit to koutcher/tig that referenced this issue Dec 31, 2018
koutcher added a commit to koutcher/tig that referenced this issue Jan 3, 2019
koutcher added a commit to koutcher/tig that referenced this issue Jan 6, 2019
@proski
Copy link
Contributor Author

proski commented Mar 30, 2019

I confirm it's working. Nice to have Staged/Unstaged/Untracked lines! The only thing I'm not sure about is that the "Untracked changes" shows all three lists, and untracked files go last:

Changes to be committed:
M Makefile
Changes not staged for commit:
D .mailmap
M Kconfig
Untracked files:
? README.md

Still, it's very helpful even it its current form. Thank you!

@koutcher
Copy link
Collaborator

koutcher commented Mar 31, 2019

Yes, you are right, especially when there is a lot of staged/unstaged files.

It should be possible to move the cursor to the Untracked files section of the status view when it's opened from the Untracked changes line.

@proski
Copy link
Contributor Author

proski commented Apr 1, 2019

How about removing unrelated sections?

@koutcher
Copy link
Collaborator

koutcher commented Apr 2, 2019

This is not impossible, however, if you then want to stage some file immediately, you may miss the Staged files section. You’d have to go back to main view and to reopen the status view the regular way to recover it. Not very convenient, don’t you think ?

@proski
Copy link
Contributor Author

proski commented Apr 2, 2019

There are so many advanced functions that I'm not aware of! I agree that it would be more convenient to see newly staged files in the same view. I'm not sure if all staged files need to be listed.

@koutcher
Copy link
Collaborator

koutcher commented Apr 4, 2019

Hiding the staged/unstaged files and showing them when needed is not so easy as the cursor must be repositioned correctly.

What about the following patch that let them all visible while moving the cursor to the top of the Untracked files ?

diff --git a/src/main.c b/src/main.c
index ba869af..9e8fc90 100644
--- a/src/main.c
+++ b/src/main.c
@@ -547,9 +547,10 @@ main_request(struct view *view, enum request request, struct line *line)
                if (line->type == LINE_STAT_UNSTAGED
                    || line->type == LINE_STAT_STAGED)
                        open_stage_view(view, NULL, line->type, flags);
-               else if (line->type == LINE_STAT_UNTRACKED)
+               else if (line->type == LINE_STAT_UNTRACKED) {
                        open_status_view(view, flags);
-               else
+                       status_exists(&status_view, NULL, LINE_STAT_UNTRACKED);
+               } else
                        open_diff_view(view, flags);
                break;

@proski
Copy link
Contributor Author

proski commented Apr 5, 2019

I've tested it. It looks a bit strange, but I think it's OK. It highlights the right thing.

@koutcher
Copy link
Collaborator

#909 now looks pretty good to me. It shows only untracked files. If you start to stage files with u, it doesn't switch to the full status view but you'll see the Staged changes line appear in the main view and you can press s to switch to the full status view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants