• Jérome Perrin's avatar
    test: do not use .keep in objects/ and refs/ git administrative folders · d9b0f2e4
    Jérome Perrin authored and Kirill Smelkov's avatar Kirill Smelkov committed
    This .keep empty file was here because git does not keep empty
    directories, but the expected status for the test was to have empty
    directories. After updating from git 2.48.0 to 2.52.0 this started to
    cause test failures with:
    
        error: refs/.keep: badRefName: invalid refname format
    
    Instead of using marker files, do not store these empty directories in
    git and create them during the test setup.
    
    --------
    kirr:
    
    The new git behaviour was introduced in https://git.kernel.org/pub/scm/git/git.git/commit/?id=1c31be45b3b2,
    and even if we try to rename .keep to e.g. _keep.lock `git fsck` passes
    on name check, but then fails with checking ref content.
    
    Adjusted patch:
    
    - do os.MkdirAll without first statting and checking os.IsNotExist for the
      path because
    
    	$ go doc os.mkdirall
    	package os // import "."
    
    	func MkdirAll(path string, perm FileMode) error
    	    MkdirAll creates a directory named path, along with any necessary parents,
    	    and returns nil, or else returns an error. The permission bits perm (before
    	    umask) are used for all directories that MkdirAll creates. If path is	<-- NOTE
    	    already a directory, MkdirAll does nothing and returns nil.			<-- NOTE
    
    - use 0777 instead of 0755 for perm because this perm is only initial
      perm to which umask is applied. With usual umask of being 0002 the
      result is 0775. We do use 0777 in other places so let's keep it this
      way for consistency.
    
    - use _x_ prefix for xprepareTestdata name to indicate that that
      function terminates on an error - also for consistency with other such
      functions.
    
    /reviewed-by @kirr
    /reviewed-on !14
    d9b0f2e4