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

Redundant entries added to .gitignore when user selects "Ignore" in the Changes tab menu #2537

Open
justinTM opened this issue Aug 23, 2017 · 16 comments

Comments

@justinTM
Copy link

Description

From the Changes tab, if the user selects an item (file, directory, etc.) > right clicks > "Ignore", then a duplicate entry is added to the .gitignore file.

Example:
If the file .DS_Store is marked "Ignore" for, say, 100 times, then 100 copies of .DS_Store entry will be added to the .gitignore file, regardless if it already exists.

Version

GitHub Desktop version: 0.8.0

OS version: OS X El Capitan, version 10.11.6

Steps to Reproduce

  1. [First step]
  2. [Second step]
  3. [and so on]

Expected behavior: Ignore the ignore; check if the file already exists. If it does already exist, ignore the user action (silently or with a message to the user).

Actual behavior: Infinite duplicates of the already-existing .gitignore entry can be created regardless of existing matching entries.

Reproduces how often: Always (not intermittent).

Logs

Additional Information

@shiftkey
Copy link
Member

shiftkey commented Aug 23, 2017

This behaviour occurs due to the fact that Git will only apply gitignore rules to untracked files - once a file is tracked it doesn't care about your .gitignore file contents.

One way to ensure that you can't get into this loop would be to discard the changes to the tracked file as part of this operation, but that doesn't address the underlying issue about how to handle already-tracked files that the user wants to ignore - do we delete the file so that it can be committed?

@shiftkey
Copy link
Member

@justinTM can you confirm that the file you were trying to ignore is already tracked in Git?

@justinTM
Copy link
Author

justinTM commented Aug 24, 2017

@justinTM can you confirm that the file you were trying to ignore is already tracked in Git?

@shiftkey Yes, the file .DS_Store was tracked (and committed) before the entry in .gitignore was created; my bad!

I would suggest the issue still remain open, as there could be some improvement to this functionality, regardless of my brain fart? :)

@shiftkey
Copy link
Member

@justinTM all good, just adding some context as to what Git is doing here

@shiftkey
Copy link
Member

Looking into what we'd need to change here:

  • onIgnore only takes in a string representing the new pattern here and here - we'd need to pass information about the file back to the dispatcher.
  • onIgnore also supports wildcard expressions - I'd probably leave that behaviour alone here because going through the repository to remove all track files matching some extension feels like overreach.
  • Dispatcher.ignore() would also need to know about the file, so it can pass this through to the GitStore
  • AppStore._ignore() could look at the AppFileStatus of the changed file and discard the change (optionally?) if it's a modified file

@shiftkey shiftkey added the help wanted Issues marked as ideal for external contributors label Aug 24, 2017
@shiftkey
Copy link
Member

If someone wants to take a shot at this, I've added some guidance above.

@shiftkey shiftkey self-assigned this Oct 12, 2017
@shiftkey shiftkey added this to the 1.0.x milestone Oct 12, 2017
@shiftkey shiftkey removed the help wanted Issues marked as ideal for external contributors label Oct 12, 2017
@shiftkey shiftkey removed this from the 1.0.x milestone Oct 31, 2017
@shiftkey
Copy link
Member

Dropping this from the milestone as the work requires some additional thought around UX - see #3164 (comment) and replies

@JeanCollas
Copy link

JeanCollas commented Jul 24, 2018

Thanks, I am happy that you already know the issue, I hope it will be fixed soon.

@bartclaeys
Copy link

Seems like this issue hasn't been fixed yet?

@phantomdesvin
Copy link

Hi. It would be ideal that, when the user adds something new to ignore, if there are tracked files that match that ignore command, GitHub Desktop could bring a message like “The following files are already tracked so they won’t be ignored. Select the files that you wan’t to untrack so they can be ignored from now on” and some visual interface for untracking those files. That would keep users from making this mistake and would improve the workflow as right now you have to use the command prompt to untrack files.

@steveward steveward mentioned this issue Jan 15, 2020
@gabessdsp
Copy link

Just wondering if there are any updates to this?

FrostBird347 added a commit to FrostBird347/DMPServerMap that referenced this issue Apr 9, 2020
@WaGi-Coding
Copy link

WaGi-Coding commented Oct 3, 2020

Pretty annoying issue, hope it gets resolved in the next few decades already.
Wasted so much time on this already. I thought Github Desktop will make things easier, in fact it does not if you do not follow a workflow they want you to follow ^^

creuzige added a commit to usnistgov/Texture-Sampling-PhaseMeasurement-BiasErrors that referenced this issue Dec 1, 2020
@Birgerev
Copy link

Three year old issue, any fix planned? This thing has been annoying me since the day I started using the desktop app, is there any workaround or temporary fix?

@justinTM
Copy link
Author

justinTM commented Dec 15, 2020 via email

@vaidasma
Copy link

Bump! seems this has been an issue since 2017, is this still being investigated?

@lfkdev
Copy link

lfkdev commented Dec 18, 2021

Still a big problem.

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

No branches or pull requests

10 participants