nvim-tree.lua icon indicating copy to clipboard operation
nvim-tree.lua copied to clipboard

New git glyph option: 'added'

Open cheeze2000 opened this issue 6 months ago • 7 comments

Is this a question? No.

Can this functionality be implemented utilising API? No, I think.

Is your feature request related to a problem? Please describe. Files that are added to the index are treated the same way as if they are staged. I linked the source code below that is responsible for this behaviour.

Describe the solution you'd like Separate the two cases together by adding a new git glyph option, 'added'.

Describe alternatives you've considered None.

Additional context Relevant source code

cheeze2000 avatar Feb 24 '24 12:02 cheeze2000

Works for me! That would be most useful.

Any other tweaks in the git decorator would be most gratefully appreciated.

alex-courtis avatar Feb 25 '24 01:02 alex-courtis

Please describe.** Files that are added to the index are treated the same way as if they are staged. I linked the source code below that is responsible for this behaviour.

Isn't the git index the same as staging area? We add files to the index/staging area using git add?

Quoting the git book

The staging area is a file, generally contained in your Git directory, that stores information about what will go into your next commit. Its technical name in Git parlance is the “index”, but the phrase “staging area” works just as well.

Is there a difference?

mohamedarish avatar Feb 27 '24 03:02 mohamedarish

Is there a difference?

Git does still recognise them as different until you commit. In this case README change is staged and added has been added:

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

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	modified:   README
	new file:   added

: ; git status --porcelain=v1
M  README
A  added

alex-courtis avatar Mar 01 '24 23:03 alex-courtis

The example you stated shows how git differentiated a modified file and a new file being added.

The issue is for indexed/staged.

indexed and staged are the same thing from what I know.

The plugin already differentiates new file and modified file using untracked and unstaged.

mohamedarish avatar Mar 03 '24 06:03 mohamedarish

@mohamedarish What Alex showed is correct and is what I meant. Git Status treats "new file added" vs "file modified" differently. It's unnecessary to go into minute details as long as I can get the message across (which I did).

cheeze2000 avatar Mar 03 '24 08:03 cheeze2000

As I said, isn't that already implemented using git.untracked and git.unstaged

mohamedarish avatar Mar 04 '24 14:03 mohamedarish

@mohamedarish The issue concerns files that are staged or added to the index. I'm not talking about untracked or unstaged. The XY path of adding an untracked file to the index is "A ", which is treated as "staged".

cheeze2000 avatar Mar 04 '24 14:03 cheeze2000