When modifying a submodule, we would garble the
mode, leading to an apparently dangling object.
This fixes the issue.
- if(m & DMDIR) /* directory */
+ if(e->islink)
+ return 0120000;
+ else if(e->ismod)
+ return 0160000;
+ else if(e->mode & DMDIR)
- else if(m & 0111) /* executable */
+ else if(e->mode & 0111)
- else if(m != 0) /* regular */
- else /* symlink */
- return 0120000;
for(d = ent; d != ent + nent; d++){
if(strlen(d->name) >= 255)
sysfatal("overly long filename: %s", d->name);
for(d = ent; d != ent + nent; d++){
if(strlen(d->name) >= 255)
sysfatal("overly long filename: %s", d->name);
- t = seprint(t, etxt, "%o %s", gitmode(d->mode), d->name) + 1;
+ t = seprint(t, etxt, "%o %s", gitmode(d), d->name) + 1;
memcpy(t, d->h.h, sizeof(d->h.h));
t += sizeof(d->h.h);
}
memcpy(t, d->h.h, sizeof(d->h.h));
t += sizeof(d->h.h);
}