0

Ok, so this is an edge case, I am looking to use a repository for shared edited files. The problem I am having is that, while text files, we cannot merge them due to a dumb fingerprint protection which would not allow the file to be opened if we were to merge things.

so we plan on treating it as a binary file.

Our plan is that whenever someone wanted to work on the files they would have to "check-out" the files to make sure no one else is going to edit the files and waste their time since they might have to re-do the changes that someone else had.

Is there a way we can use a repository like GIT to force all files as read-only until they are checked out, or warn the user that the file is checked out and that any changes would need to be re-done?

What work flow would you use for something like this, I would like a more automated process instead of just asking people to "check-out" a file to lock it, even then the local files of people who haven't checked if it were locked could be wasting their time.

Krum110487
  • 611
  • 1
  • 7
  • 20

1 Answers1

1

Is there a way we can use a repository like GIT to force all files as read-only until they are checked out

The simple answer is no. Git does not have any lock mechanism. Its the opposite, you can keep working locally without even knowing that someone else is editing the same file.

What you can so is to write a script that user will invoke it and it will do what ever you want on your server side.

Unfortunately git does not support such a thing, its agains the concept beyhond git.

Here is a similar question asking more or less the same thing

Is there a way to lock individual files or directories on fork when using github?

Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • Yea, I use git for development sometimes, but I wasn't sure if it had any extra ways to do something like this, it seems my fears were true. are there any other repos out there that could achieve this? Mainly I want to prevent someone from working on a file while someone else is, or warn them not to work on a file. – Krum110487 Sep 30 '15 at 23:17
  • but any other repos you could recommend me looking into, I used perforce for my previous job, I know it could lock, but not free. I am pretty sure SVN can lock (if I recall) – Krum110487 Sep 30 '15 at 23:23
  • Mercurial has a [LockExtension](https://www.mercurial-scm.org/wiki/LockExtension) you could use. It isn't distributed with the base code, but it is documented with the product. – Jeremy Fortune Oct 01 '15 at 00:00
  • @Krum110487 - Perforce is free for small teams (<20 AFAICR), yes, SVN have native locking – Lazy Badger Oct 01 '15 at 06:39