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: File locking in User interface #8687

Open
4 of 7 tasks
davidsvantesson opened this issue Oct 25, 2019 · 11 comments
Open
4 of 7 tasks

Feature: File locking in User interface #8687

davidsvantesson opened this issue Oct 25, 2019 · 11 comments
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/summary This issue aggregates a bunch of other issues

Comments

@davidsvantesson
Copy link
Contributor

davidsvantesson commented Oct 25, 2019

Git LFS support file locking. File locking with git lfs can be used without storing the file as a git lfs file.

I would like to have the following functionality in Gitea UI:

@lunny lunny added the type/enhancement An improvement of existing functionality label Oct 26, 2019
blueworrybear added a commit to blueworrybear/gitea that referenced this issue Oct 27, 2019
@blueworrybear
Copy link
Contributor

@davidsvantesson @guillep2k @lunny
I make a update to respect file locking. Files will not be editable if LFS locked.

However, I'm not sure if it's a good idea to allow user lock files in the UI.
For example, I'm not sure how to check is a file is lockable.

I'll keep working on this enhancement. I will send a PR at first at first.

@davidsvantesson
Copy link
Contributor Author

Better to make smaller PRs than implement all at once. Determining if a file is locked is a first good step.

Locking a file actually doesn't require the lockable attribute. The lockable attribute is only used to make files read-only when they are not locked. But I am not sure if it is a good idea to allow locking a file in the UI that has not been set as lockable.

This is what I can find about determining if a file has the lockable attribute:
https://stackoverflow.com/a/56492205

blueworrybear added a commit to blueworrybear/gitea that referenced this issue Oct 28, 2019
@zeripath
Copy link
Contributor

I think you can't really rely on the lockable attribute in the .gitattributes file - probably if the attribute isn't there you might have to put a warning up but people can have attributes set in multiple ways so only providing locking to those files in .gitattributes would be annoying to them.

(As an aside when you create a file in the editor we read the .gitattributes to determine if it should be lfs'd - because there's no other way of knowing.)

lafriks pushed a commit that referenced this issue Oct 29, 2019
* update #8687 respect file locking

* upate #8687 Add LFS locker information

* update #8719 enhance coding style and return error
@davidsvantesson
Copy link
Contributor Author

If a file is "lockable" according to .gitattributes, shouldn't we force to lock the file before editing? I mean that would best correspond to how a checkout on computer works; The file is read-only until locking the file.

@zeripath
Copy link
Contributor

I suspect it's better to just give the user the option to lock in all cases, but have a slightly different UI when editing a file where the lockable attribute is set. Allowing people to lock new files is harder - you'd have to remember to remove the lock if they change the filename, and you can't easily test if the filename would be lockable without making a temporary repo (this could potentially be avoided), an index from the branch and then running git check-attr - it's really not free although I think we could make the index creation in read-tree a bit more efficient only reading in the .gitattributes. Similarly if you lock a file when editing are you supposed to lock the new file you're renaming it to?

We also don't have a mechanism to force the user to unlock if they've locked for any period of time. So if they navigate away a user could use this UI to lock all files.

The other issue is which .gitattributes do you interrogate - presumably you look at the one for the branch you're editing. Git lfs locks are locks for the whole of the repo.

@zeripath zeripath reopened this Oct 31, 2019
@davidsvantesson
Copy link
Contributor Author

Is git lfs using the .gitattributes file of the currently checked out branch, or the master (default) branch?

@zeripath
Copy link
Contributor

zeripath commented Nov 1, 2019

Git lfs uses what you have checked out or in your index. It runs git check-attr on the file.

@stale
Copy link

stale bot commented Jan 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Jan 1, 2020
@lunny lunny added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Jan 1, 2020
@stale stale bot removed the issue/stale label Jan 1, 2020
@lcnittl
Copy link

lcnittl commented Jan 15, 2020

Ad Show if a file is locked and who locked it:
Do you think it would be nice to show locks (probably only the lock symbol) also already in the <Code> tab's file tree?

@davidsvantesson
Copy link
Contributor Author

Yes, for files that are locked. Maybe for files that has the lockable attribute and is not locked it could be shown also (but not for other files).

@lcnittl
Copy link

lcnittl commented Jan 16, 2020

True, open lock for lockable but not locked, closed lock for (lockable AND) locked ones.

@lunny lunny added type/summary This issue aggregates a bunch of other issues and removed type/enhancement An improvement of existing functionality labels Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/summary This issue aggregates a bunch of other issues
Projects
None yet
Development

No branches or pull requests

5 participants