Search code examples
gitgitolite

Git / Gitolite Some folders empty, permissions issue?


I am using git, but in a centralized manor. I have a server hosting a repo that we pull/push to. I noticed a couple of the folders in the repo when pulled/cloned on another machine are empty (noticed this when I got a new computer and cloned the repo to is). I looked on the gitolite web interface and the permissions of these folders are "m---------", where as the others are drwxr-xr-x. I am not sure how it even got this way... I have tried a few things but am not able to fix it.


Solution

  • That could be explained, in the gitweb source by:

    # convert file mode in octal to symbolic file mode string
    sub mode_str {
      my $mode = oct shift;
    
      if (S_ISGITLINK($mode)) {
        return 'm---------';
      } elsif (S_ISDIR($mode & S_IFMT)) {
        return 'drwxr-xr-x';
      } elsif (S_ISLNK($mode)) {
        return 'lrwxrwxrwx';
      } elsif (S_ISREG($mode)) {
        # git cares only about the executable bit
        if ($mode & S_IXUSR) {
          return '-rwxr-xr-x';
        } else {
          return '-rw-r--r--';
        };
      } else {
        return '----------';
      }
    }
    

    With S_IFGITLINK => 0160000, which is a special mode for submodules

    Since 2007 and this patch, submodule entries are shown in gitweb:

    There is only link to the history of submodule entry in the supermodule (current repository) for now, because gitweb doesn't know where to search for submodule repository objects.

    So they aren't empty directories, only submodules root directories.

    See "Git - easy way pull latest of all submodules" for more.