Skip to content

Commit fa82bb7

Browse files
committed
Merge branch 'jk/show-index'
Modernize a less often used command. * jk/show-index: show-index: update documentation for index v2 make show-index a builtin
2 parents 93b74a7 + fb3010c commit fa82bb7

File tree

5 files changed

+25
-8
lines changed

5 files changed

+25
-8
lines changed

Documentation/git-show-index.txt

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,27 @@ SYNOPSIS
1414

1515
DESCRIPTION
1616
-----------
17-
Read the idx file for a Git packfile created with
18-
'git pack-objects' command from the standard input, and
19-
dump its contents.
17+
Read the `.idx` file for a Git packfile (created with
18+
linkgit:git-pack-objects[1] or linkgit:git-index-pack[1]) from the
19+
standard input, and dump its contents. The output consists of one object
20+
per line, with each line containing two or three space-separated
21+
columns:
2022

21-
The information it outputs is subset of what you can get from
22-
'git verify-pack -v'; this command only shows the packfile
23-
offset and SHA-1 of each object.
23+
- the first column is the offset in bytes of the object within the
24+
corresponding packfile
25+
26+
- the second column is the object id of the object
27+
28+
- if the index version is 2 or higher, the third column contains the
29+
CRC32 of the object data
30+
31+
The objects are output in the order in which they are found in the index
32+
file, which should be (in a correctly constructed file) sorted by object
33+
id.
34+
35+
Note that you can get more information on a packfile by calling
36+
linkgit:git-verify-pack[1]. However, as this command considers only the
37+
index file itself, it's both faster and more flexible.
2438

2539
GIT
2640
---

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,6 @@ PROGRAM_OBJS += http-backend.o
689689
PROGRAM_OBJS += imap-send.o
690690
PROGRAM_OBJS += sh-i18n--envsubst.o
691691
PROGRAM_OBJS += shell.o
692-
PROGRAM_OBJS += show-index.o
693692
PROGRAM_OBJS += remote-testsvn.o
694693

695694
# Binary suffix, set to .exe for Windows builds
@@ -1077,6 +1076,7 @@ BUILTIN_OBJS += builtin/send-pack.o
10771076
BUILTIN_OBJS += builtin/serve.o
10781077
BUILTIN_OBJS += builtin/shortlog.o
10791078
BUILTIN_OBJS += builtin/show-branch.o
1079+
BUILTIN_OBJS += builtin/show-index.o
10801080
BUILTIN_OBJS += builtin/show-ref.o
10811081
BUILTIN_OBJS += builtin/stripspace.o
10821082
BUILTIN_OBJS += builtin/submodule--helper.o

builtin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ extern int cmd_serve(int argc, const char **argv, const char *prefix);
220220
extern int cmd_shortlog(int argc, const char **argv, const char *prefix);
221221
extern int cmd_show(int argc, const char **argv, const char *prefix);
222222
extern int cmd_show_branch(int argc, const char **argv, const char *prefix);
223+
extern int cmd_show_index(int argc, const char **argv, const char *prefix);
223224
extern int cmd_status(int argc, const char **argv, const char *prefix);
224225
extern int cmd_stripspace(int argc, const char **argv, const char *prefix);
225226
extern int cmd_submodule__helper(int argc, const char **argv, const char *prefix);

show-index.c renamed to builtin/show-index.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
#include "builtin.h"
12
#include "cache.h"
23
#include "pack.h"
34

45
static const char show_index_usage[] =
56
"git show-index";
67

7-
int cmd_main(int argc, const char **argv)
8+
int cmd_show_index(int argc, const char **argv, const char *prefix)
89
{
910
int i;
1011
unsigned nr;

git.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ static struct cmd_struct commands[] = {
537537
{ "shortlog", cmd_shortlog, RUN_SETUP_GENTLY | USE_PAGER },
538538
{ "show", cmd_show, RUN_SETUP },
539539
{ "show-branch", cmd_show_branch, RUN_SETUP },
540+
{ "show-index", cmd_show_index },
540541
{ "show-ref", cmd_show_ref, RUN_SETUP },
541542
{ "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
542543
{ "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },

0 commit comments

Comments
 (0)