Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
ls-files: convert show_killed_files to take an index
author
Brandon Williams
<bmwill@google.com>
Mon, 12 Jun 2017 22:14:00 +0000
(15:14 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 13 Jun 2017 18:40:51 +0000
(11:40 -0700)
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/ls-files.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
1985fd6
)
diff --git
a/builtin/ls-files.c
b/builtin/ls-files.c
index 8c3f3d8cac91c5b7ce9def93fdf1b1c1c4e2cf80..b82b78036df7041f25fc2b0df87e6942196e72ac 100644
(file)
--- a/
builtin/ls-files.c
+++ b/
builtin/ls-files.c
@@
-120,7
+120,8
@@
static void show_other_files(struct dir_struct *dir)
}
}
}
}
-static void show_killed_files(struct dir_struct *dir)
+static void show_killed_files(const struct index_state *istate,
+ const struct dir_struct *dir)
{
int i;
for (i = 0; i < dir->nr; i++) {
{
int i;
for (i = 0; i < dir->nr; i++) {
@@
-134,29
+135,29
@@
static void show_killed_files(struct dir_struct *dir)
/* If ent->name is prefix of an entry in the
* cache, it will be killed.
*/
/* If ent->name is prefix of an entry in the
* cache, it will be killed.
*/
- pos =
cache_name_pos(
ent->name, ent->len);
+ pos =
index_name_pos(istate,
ent->name, ent->len);
if (0 <= pos)
die("BUG: killed-file %.*s not found",
ent->len, ent->name);
pos = -pos - 1;
if (0 <= pos)
die("BUG: killed-file %.*s not found",
ent->len, ent->name);
pos = -pos - 1;
- while (pos <
activ
e_nr &&
- ce_stage(
active_
cache[pos]))
+ while (pos <
istate->cach
e_nr &&
+ ce_stage(
istate->
cache[pos]))
pos++; /* skip unmerged */
pos++; /* skip unmerged */
- if (
activ
e_nr <= pos)
+ if (
istate->cach
e_nr <= pos)
break;
/* pos points at a name immediately after
* ent->name in the cache. Does it expect
* ent->name to be a directory?
*/
break;
/* pos points at a name immediately after
* ent->name in the cache. Does it expect
* ent->name to be a directory?
*/
- len = ce_namelen(
active_
cache[pos]);
+ len = ce_namelen(
istate->
cache[pos]);
if ((ent->len < len) &&
if ((ent->len < len) &&
- !strncmp(
active_
cache[pos]->name,
+ !strncmp(
istate->
cache[pos]->name,
ent->name, ent->len) &&
ent->name, ent->len) &&
-
active_
cache[pos]->name[ent->len] == '/')
+
istate->
cache[pos]->name[ent->len] == '/')
killed = 1;
break;
}
killed = 1;
break;
}
- if (0 <=
cache_name_pos(
ent->name, sp - ent->name)) {
+ if (0 <=
index_name_pos(istate,
ent->name, sp - ent->name)) {
/* If any of the leading directories in
* ent->name is registered in the cache,
* ent->name will be killed.
/* If any of the leading directories in
* ent->name is registered in the cache,
* ent->name will be killed.
@@
-337,7
+338,7
@@
static void show_files(struct dir_struct *dir)
if (show_others)
show_other_files(dir);
if (show_killed)
if (show_others)
show_other_files(dir);
if (show_killed)
- show_killed_files(dir);
+ show_killed_files(
&the_index,
dir);
}
if (show_cached || show_stage) {
for (i = 0; i < active_nr; i++) {
}
if (show_cached || show_stage) {
for (i = 0; i < active_nr; i++) {