-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Open
Labels
issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedIssue has been reviewed and confirmed to be present or accepted to be implementedtopic/lfstype/enhancementAn improvement of existing functionalityAn improvement of existing functionality
Description
- Gitea version (or commit ref): 1.11.4
- Git version: 2.26.1.windows.1
- Operating system: Win7x64
- Database (use
[x]):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- No (no LFS support)
- Not relevant
- Log gist:
Description
Steps to reproduce:
- Create a new gitea instance or use an existing one
- Add an admin user to gitea with name
lfs_adminand passwordLFS_admin1and extract the attached scripts.zip to a convenient directory. - Modify the value of variable
GITEAHOSTin line 3 ofs01_admin.sh(in attached zip) to match your gitea host name and save. - Run
./s01_admin.sh
in a git bash.
This creates two users (a_user,b_user) and givesa_usera repoa_lfs_test, to whichb_useris added as collaborator withwritepermission - Modify the value of variable
GITEAHOSTin line 4 ofs02_a_user.sh(in attached zip) to match your gitea host and save. - Run
./s02_a_user.sh
in a git bash.
This initializes thea_lfs_testrepo in sub-foldera_repoand puts all *.png files as lockable under LFS control. A fileimg.pngis created and initialized with the content ofwiki.png. This file and.gitattributesare staged, commited and pushed. Afterwards, theimg.pngfile is locked bya_user. - Modify the value of variable
GITEAHOSTin line 4 ofs03_b_user.sh(in attached zip) to match your gitea host and save. - Run
./s03_b_user.sh
in a git bash (perhaps on a different machine, the result is the same).
This clones thea_lfs_testrepo into subfolderb_repoand initializes LFS. Because.gitattributesis checked out, LFS and locks are enabled for.pngfiles.img.pngis force overwritten by the contents ofdice.png, staged, committed and pushed. - Observe the following output after running
./s03_b_user.shin the previous step:
$ ./s03_b_user.sh
Cloning into 'b_repo'...
[...]
'../dice.png' -> './img.png'
[...]
[master d78418b] img->dice
1 file changed, 2 insertions(+), 2 deletions(-)
Locking support detected on remote "origin". Consider enabling it with:
$ git config lfs.http://b_user:B_user1,@localhost:88/a_user/a_lfs_test.git/info/lfs.locksverify true
Unable to push locked files:(1/1), 48 KB | 0 B/s
* img.png - A_User (refs: master)
WARNING: The above files would have halted this push.
Uploading LFS objects: 100% (1/1), 48 KB | 0 B/s, done.
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 355 bytes | 355.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: . Processing 1 references
remote: Processed 1 references in total
To http://localhost:88/a_user/a_lfs_test.git
2e229ad..d78418b master -> master
img.png A_User ID:2- Although a message
Unable to push locked files:(1/1)is returned, only a warningWARNING: The above files would have halted this push.results and the push succeeds2e229ad..d78418b master -> mastereven though the lock ofa_userpersists (git lfs locks->img.png A_User ID:2) - The result is also visible by opening
img.pngin the gitea UI: It shows the lock ofa_user, but the content ofdice.pngpushed byb_user.
Expected result:
The push by b_user should be rejected (at least through a gitea configuration option), because a_user still holds a lock on img.png
Actual Result:
The push succeeds and the locked file img.png is modified by b_user
Requested change:
Please add a gitea configuration setting (either global or even better per repo) to reject such pushes on the server side, since otherwise locks are meaningless if the default client configuration is used. This leaves locks totally up to correct client configuration, which is error prone and negates the "protection" that locks should offer.
Thanks for gitea and for considering this request.
JamesYFC, PostPollux, Gromina, wenerme and GammaGames
Metadata
Metadata
Assignees
Labels
issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedIssue has been reviewed and confirmed to be present or accepted to be implementedtopic/lfstype/enhancementAn improvement of existing functionalityAn improvement of existing functionality