git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Server-side preventing some files from being overwritten

From
Thorsten Glaser <t.glaser@tarent.de>
Date
Jul 14, 2016, 15:31 UTC
Message-ID
<alpine.DEB.2.20.1607141725390.25238@tglase.lan.tarent.de>
Hi *,

is there a way, for example with some sort of pre-receive hook, to prevent some files from being overwritten by a push?

Use case:

In some project, we use Flyway to manage the database schema, and Jenkins to automatically build master’s HEAD after each push (and install it, thus activating the schema files almost immediately). Now, I wish to prevent coworkers from changing anything in the SQL subdirectory that has ever been pushed, forcing them to push new SQL files with ALTER statements instead. (Yes, I am aware this will likely make me even less liked. No, this is not an issue.)

As for the comparison, only the changes between the previous HEAD of master and the new HEAD of master after the push would have been accepted need to be taken into account; any intermediate commits, merges, etc. are no problem (because Jenkins does not build them, and because, once a push fails, the developer will have to add a commit reverting their change and moving it to another file on top, I’m no friend of rewriting).

File matching would be “any files under a certain subdirectory”, nothing fancier than that.

I’ve tried a web search (with two different search engines) for “git prevent pushed files from modification”, but this seems to only show people who want to ignore local changes or somesuch…

I’ve asked in IRC, but with no answer for hours I thought that maybe this was the better place to ask for it.

Thanks in advance, //mirabilos

-- 
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-235
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg
Next: Stefan Beller
Message 1 of 12 in “Server-side preventing some files from being overwritten”
  1. Thorsten GlaserJul 14, 2016
  2. Stefan BellerJul 14, 2016
  3. Thorsten GlaserJul 14, 2016
  4. Junio C HamanoJul 14, 2016
  5. Junio C HamanoJul 14, 2016
  6. Stefan BellerJul 14, 2016
  7. Ævar Arnfjörð BjarmasonJul 15, 2016
  8. Thorsten GlaserJul 15, 2016
  9. Thorsten GlaserJul 14, 2016
  10. Junio C HamanoJul 14, 2016
  11. Jakub NarębskiJul 21, 2016
  12. Thorsten GlaserJul 21, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.