Commit c65eb24c546a37c8225a1e8b00bd3ab81818243f

lhchavez 2021-09-08T08:47:39

Avoid double negatives in the justification for truncation Turns out, double negatives are harder to parse than positive statements.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/src/indexer.c b/src/indexer.c
index d5e3288..ce77375 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -1307,8 +1307,11 @@ int git_indexer_commit(git_indexer *idx, git_indexer_progress *stats)
 
 #if !defined(NO_MMAP) && defined(GIT_WIN32)
 	/*
-	 * Truncate file to undo rounding up to next page_size in append_to_pack only
-	 * when mmap was used, to prevent failures in non-Windows remote filesystems.
+	 * Some non-Windows remote filesystems fail when truncating files if the
+	 * file permissions change after opening the file (done by p_mkstemp).
+	 *
+	 * Truncation is only needed when mmap is used to undo rounding up to next
+	 * page_size in append_to_pack.
 	 */
 	if (p_ftruncate(idx->pack->mwf.fd, idx->pack->mwf.size) < 0) {
 		git_error_set(GIT_ERROR_OS, "failed to truncate pack file '%s'", idx->pack->pack_name);