]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'hn/refs-errno-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Mon, 4 Oct 2021 04:49:18 +0000 (21:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 4 Oct 2021 04:49:18 +0000 (21:49 -0700)
Futz with the way 'errno' is relied on in the refs API to carry the
failure modes up the call chain.

* hn/refs-errno-cleanup:
  refs: make errno output explicit for read_raw_ref_fn
  refs/files-backend: stop setting errno from lock_ref_oid_basic
  refs: remove EINVAL errno output from specification of read_raw_ref_fn
  refs file backend: move raceproof_create_file() here

1  2 
cache.h
object-file.c
refs/debug.c
refs/files-backend.c

diff --cc cache.h
index f6295f3b048ad0e6446d7fab487b59cf27598edb,eb4dfe6381f548a96439fadc3f27f72c2fd9daa9..4a24b0ce1d80ab720351b78088431b2f8b3b30dd
+++ b/cache.h
@@@ -1210,53 -1202,8 +1210,10 @@@ enum scld_error safe_create_leading_dir
  enum scld_error safe_create_leading_directories_const(const char *path);
  enum scld_error safe_create_leading_directories_no_share(char *path);
  
- /*
-  * Callback function for raceproof_create_file(). This function is
-  * expected to do something that makes dirname(path) permanent despite
-  * the fact that other processes might be cleaning up empty
-  * directories at the same time. Usually it will create a file named
-  * path, but alternatively it could create another file in that
-  * directory, or even chdir() into that directory. The function should
-  * return 0 if the action was completed successfully. On error, it
-  * should return a nonzero result and set errno.
-  * raceproof_create_file() treats two errno values specially:
-  *
-  * - ENOENT -- dirname(path) does not exist. In this case,
-  *             raceproof_create_file() tries creating dirname(path)
-  *             (and any parent directories, if necessary) and calls
-  *             the function again.
-  *
-  * - EISDIR -- the file already exists and is a directory. In this
-  *             case, raceproof_create_file() removes the directory if
-  *             it is empty (and recursively any empty directories that
-  *             it contains) and calls the function again.
-  *
-  * Any other errno causes raceproof_create_file() to fail with the
-  * callback's return value and errno.
-  *
-  * Obviously, this function should be OK with being called again if it
-  * fails with ENOENT or EISDIR. In other scenarios it will not be
-  * called again.
-  */
- typedef int create_file_fn(const char *path, void *cb);
- /*
-  * Create a file in dirname(path) by calling fn, creating leading
-  * directories if necessary. Retry a few times in case we are racing
-  * with another process that is trying to clean up the directory that
-  * contains path. See the documentation for create_file_fn for more
-  * details.
-  *
-  * Return the value and set the errno that resulted from the most
-  * recent call of fn. fn is always called at least once, and will be
-  * called more than once if it returns ENOENT or EISDIR.
-  */
- int raceproof_create_file(const char *path, create_file_fn fn, void *cb);
  int mkdir_in_gitdir(const char *path);
 -char *expand_user_path(const char *path, int real_home);
 +char *interpolate_path(const char *path, int real_home);
 +/* NEEDSWORK: remove this synonym once in-flight topics have migrated */
 +#define expand_user_path interpolate_path
  const char *enter_repo(const char *path, int strict);
  static inline int is_absolute_path(const char *path)
  {
diff --cc object-file.c
Simple merge
diff --cc refs/debug.c
Simple merge
Simple merge