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: Do not store media in local project directory #4

Closed
deadlydog opened this issue Jan 23, 2023 · 10 comments · Fixed by #26
Closed

Feature Request: Do not store media in local project directory #4

deadlydog opened this issue Jan 23, 2023 · 10 comments · Fixed by #26

Comments

@deadlydog
Copy link

First off, this is a very cool project. Thank you for it!

One thing I don't like is that git-sim stores it's media files in the local project directory, and it's easy to accidentally commit them to the git repo if it hasn't been added to the .gitignore file. Most of the time I think the images/videos are only needed temporarily, and could be deleted. There is the --media-dir parameter, but having to provide it every time you use git-sim is cumbersome.

There's a few different ways you could tackle this problem. Some thoughts I had were:

  1. Allow the user to configure a global media directory that would be used instead of default local directory. The user can manually delete the global directory from time to time to clean up the media files.
  2. Save the media to the user's temporary directory, where it will eventually get cleaned up automatically. I'm not sure if this is a cross-platform concept or not and if Python has an easy way of getting the temp path, but hopefully.

Maybe you (or others) have other suggestions?

@initialcommit-io
Copy link
Contributor

Hey there,

Thanks for checking out the project, and great points! I did consider this but for the initial release didn't have the time to implement something besides the --media-dir option you mentioned. It's true that dirtying up the local repo by default isn't really a great practice...

I think for starters a configurable global media directory is a good option. This could be stored and read from a user-level or global-level configuration file similar to how Git's config works.

The only real question in my mind is whether media generated from different repos should all go into the same folder, or whether there should be separate subfolders within the global media folder on a per project basis. Probably the latter would make more sense...

Any interest in helping to implement something like this? Happy to give you the lay of the land of the Python codebase if it's something you're interested in poking at! And you would get the honor of being the first contributor! (Whatever that's worth :D)

@abhijitnathwani
Copy link
Contributor

Hey @initialcommit-io

If the OP is not available to work on this, I'd like to give it a try and implement this. I agree with your suggestion for a global media dir followed by repo sub folders. Maybe the user can set an environment variable for the same ?

@initialcommit-io
Copy link
Contributor

initialcommit-io commented Jan 23, 2023

Hey there!

Sure honestly there's no queue so if you want to try implementing something feel free to do so, test it locally, and submit a pull request for me to check it out.

Environment variable would be a cool addition too!

@PaulisMatrix
Copy link

Hey @initialcommit-io , would def like to work on this. Can you please add a contributions.md to let us know how to contribute/get this setup locally if possible? I think that would be of great help. Thank you!.

@initialcommit-io
Copy link
Contributor

Oh yes @PaulisMatrix good idea, will do that shortly!

@abhijitnathwani
Copy link
Contributor

Hey @initialcommit-io
To approach the solution I was thinking of the following:

  • Users could set an env variable that would point to the media dir. This global directory would have folders based on the repo name.
  • If the args --media-dir is provided, that would take precedence over the env variable, if set, as it would mean user wants to explicitly override the media dir by passing the argument
  • If no env variable or media dir args is passed, the git-sim_media directory would be created in the repo. We could ease out the confusion for tracked files by adding this folder to the .gitignore so that the user doesn't accidentally add it to their repository.

Let me know your thoughts

@Susensio
Copy link

A workaround I use is to define an alias that calls git-sim --media-dir="/tmp/git-sim$(git rev-parse --show-toplevel)"

@initialcommit-io
Copy link
Contributor

@abhijitnathwani I like that solution. It is less complex than having to worry about setting up config files at different scopes, like repo scope / user scope / system scope. I think it's a reasonable assumption for now that users who want to customize this location would be ok with a single global folder which would contain subfolders for each repo like you mentioned. That would also keep them nicely organized in one place, and I think is a good use case for an environment variable.

Just 2 things:

  1. Let's make sure to test/validate that the environment variable method works on Windows/Linux/MacOS

  2. In your third point you mentioned potentially adding an entry automatically into .gitignore, which we could do, but then the user might be confused as to why the .gitignore is suddenly modified in the repo. I think it's better to just add the git-sim_media folder and they can handle it how they want.

Let me know if that sounds ok!

@initialcommit-io
Copy link
Contributor

@PaulisMatrix FYI I just added CONTRIBUTING.md with details on how to contribute and run the source code locally.

@deadlydog
Copy link
Author

Thanks so much for making this happen! 🙌

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

Successfully merging a pull request may close this issue.

5 participants