summaryrefslogtreecommitdiff
path: root/builtin/ls-files.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/ls-files.c')
-rw-r--r--builtin/ls-files.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index be74f0a03b..b148607f7a 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -11,6 +11,7 @@
#include "builtin.h"
#include "config.h"
#include "convert.h"
+#include "environment.h"
#include "quote.h"
#include "dir.h"
#include "gettext.h"
@@ -25,7 +26,7 @@
#include "setup.h"
#include "sparse-index.h"
#include "submodule.h"
-#include "object-store.h"
+#include "odb.h"
#include "hex.h"
@@ -251,7 +252,7 @@ static void expand_objectsize(struct repository *repo, struct strbuf *line,
{
if (type == OBJ_BLOB) {
unsigned long size;
- if (oid_object_info(repo, oid, &size) < 0)
+ if (odb_read_object_info(repo->objects, oid, &size) < 0)
die(_("could not get object info about '%s'"),
oid_to_hex(oid));
if (padded)
@@ -413,14 +414,21 @@ static void show_files(struct repository *repo, struct dir_struct *dir)
if (!(show_cached || show_stage || show_deleted || show_modified))
return;
- if (!show_sparse_dirs)
- ensure_full_index(repo->index);
-
for (i = 0; i < repo->index->cache_nr; i++) {
const struct cache_entry *ce = repo->index->cache[i];
struct stat st;
int stat_err;
+ if (S_ISSPARSEDIR(ce->ce_mode) && !show_sparse_dirs) {
+ /*
+ * This is the first time we've hit a sparse dir,
+ * so expansion will leave the first 'i' entries
+ * alone.
+ */
+ ensure_full_index(repo->index);
+ ce = repo->index->cache[i];
+ }
+
construct_fullname(&fullname, repo, ce);
if ((dir->flags & DIR_SHOW_IGNORED) &&