Subject: [PATCH v3 0/5] commit-graph: write non-split graphs as read-only

From: Taylor Blau <[email-masked]>
Date: Wed, 29 Apr 2020 11:36:26 -0600

Hi,

Here's a brief reroll to incorporate suggestions from Junio and Peff in
the sub-thread beginning at [1]. Not much at all has changed since v2,
with the exception of:

  * fixing the aforementioned issue by sprinkling in some 'umask 022's
    in throughout the new tests

  * adding in a new final patch to apply the same treatment to
    the 'commit-graph-chain' file

[1]: https://lore.kernel.org/git/[email-masked]/

Taylor Blau (5):
  tempfile.c: introduce 'create_tempfile_mode'
  lockfile.c: introduce 'hold_lock_file_for_update_mode'
  commit-graph.c: write non-split graphs as read-only
  commit-graph.c: ensure graph layers respect core.sharedRepository
  commit-graph.c: make 'commit-graph-chain's read-only

 commit-graph.c                | 12 ++++++++++--
 lockfile.c                    | 18 ++++++++++--------
 lockfile.h                    | 32 ++++++++++++++++++++++++++++----
 t/t5318-commit-graph.sh       | 15 ++++++++++++++-
 t/t5324-split-commit-graph.sh | 24 ++++++++++++++++++++++++
 t/t6600-test-reach.sh         |  2 ++
 tempfile.c                    |  6 +++---
 tempfile.h                    | 10 +++++++++-
 8 files changed, 100 insertions(+), 19 deletions(-)

Range-diff against v2:
1:  03c975b0bd = 1:  03c975b0bd tempfile.c: introduce 'create_tempfile_mode'
2:  c1c84552bc = 2:  c1c84552bc lockfile.c: introduce 'hold_lock_file_for_update_mode'
3:  86cf29ce9c ! 3:  8d5503d2e6 commit-graph.c: write non-split graphs as read-only
    @@ Commit message
         commit-graph file into place and then trying to replace it. For these,
         make these files writable.

    +    Helped-by: Junio C Hamano <[email-masked]>
         Signed-off-by: Taylor Blau <[email-masked]>

      ## commit-graph.c ##
    @@ commit-graph.c: static int write_commit_graph_file(struct write_commit_graph_con
      	}

      ## t/t5318-commit-graph.sh ##
    +@@ t/t5318-commit-graph.sh: test_expect_success 'setup full repo' '
    + 	test_oid_init
    + '
    +
    ++test_expect_success POSIXPERM 'tweak umask for modebit tests' '
    ++	umask 022
    ++'
    ++
    + test_expect_success 'verify graph with no graph file' '
    + 	cd "$TRASH_DIRECTORY/full" &&
    + 	git commit-graph verify
     @@ t/t5318-commit-graph.sh: test_expect_success 'write graph' '
      	graph_read_expect "3"
      '
4:  f83437f130 ! 4:  4b74e23af2 commit-graph.c: ensure graph layers respect core.sharedRepository
    @@ commit-graph.c: static int write_commit_graph_file(struct write_commit_graph_con
      		hold_lock_file_for_update_mode(&lk, ctx->graph_name,

      ## t/t5324-split-commit-graph.sh ##
    +@@ t/t5324-split-commit-graph.sh: graph_read_expect() {
    + 	test_cmp expect output
    + }
    +
    ++test_expect_success POSIXPERM 'tweak umask for modebit tests' '
    ++	umask 022
    ++'
    ++
    + test_expect_success 'create commits and write commit-graph' '
    + 	for i in $(test_seq 3)
    + 	do
     @@ t/t5324-split-commit-graph.sh: test_expect_success 'split across alternate where alternate is not split' '
      	test_cmp commit-graph .git/objects/info/commit-graph
      '
-:  ---------- > 5:  864c916067 commit-graph.c: make 'commit-graph-chain's read-only
--
2.26.0.113.ge9739cdccc