3

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.

Yotam Omer
  • 15,310
  • 11
  • 62
  • 65
Eric Seifert
  • 1,946
  • 2
  • 17
  • 31

1 Answers1

2

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I think this is on the right track. My only question is, why are they considered "submodules". The repo consists of a bunch of folders with various scripts in each folder. None would be considered a submodule, so perhaps I set something up incorrectly? – Eric Seifert Jun 08 '12 at 15:05
  • Maybe I am answering my own question here but, is it a "submodule" if git detected that a folder was already part of another git repo? I did have some of these scripts as seperate git repos before, and then brought them in under one repo. While doing this, some of the existing git folders were not removed by mistake. – Eric Seifert Jun 08 '12 at 15:07
  • @EricSeifert Note that just a .git means a nested repo, which is basically ignored by the parent repo (http://stackoverflow.com/a/918927/6309). A submodule is a nested repo has a special entry in the index (http://stackoverflow.com/a/2300638/6309) *and* is declared in a `.gitmodules` file. If you really wanted to merged completely two repo, you would need a subtree merge strategy (http://stackoverflow.com/questions/899373/transferring-legacy-code-base-from-cvs-to-distributed-repository-e-g-git-or-me/899428#899428): http://git-scm.com/book/en/Git-Tools-Subtree-Merging – VonC Jun 08 '12 at 18:11
  • @EricSeifert and of course, a submodule is a git repo in itself: http://stackoverflow.com/questions/1979167/git-submodule-update/1979194#1979194 – VonC Jun 08 '12 at 18:14
  • Thanks, I deleted the folder with git rm and then added it back and committed. I know I lost commit history, but was not important for the two folders with the issue. – Eric Seifert Jun 11 '12 at 15:17