Skip to content

Commit 7720efb

Browse files
committed
fixup! Merge 'cat-file-smudge'
This reverts commit 7576a30, reversing changes made to 6de9d8a. The patch series has been sent upstream and modifications were necessary as a consequence. We will merge the new version of the patch series in one moment. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent a1db819 commit 7720efb

File tree

3 files changed

+8
-116
lines changed

3 files changed

+8
-116
lines changed

Documentation/git-cat-file.txt

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ git-cat-file - Provide content or type and size information for repository objec
99
SYNOPSIS
1010
--------
1111
[verse]
12-
'git cat-file' (-t [--allow-unknown-type]| -s [--allow-unknown-type]| -e | -p | <type> | --textconv | --smudge ) [--use-path=<path>] <object>
12+
'git cat-file' (-t [--allow-unknown-type]| -s [--allow-unknown-type]| -e | -p | <type> | --textconv ) <object>
1313
'git cat-file' (--batch | --batch-check) [--follow-symlinks]
1414

1515
DESCRIPTION
1616
-----------
1717
In its first form, the command provides the content or the type of an object in
1818
the repository. The type is required unless `-t` or `-p` is used to find the
19-
object type, or `-s` is used to find the object size, or `--textconv` or
20-
`--smudge` is used (which imply type "blob").
19+
object type, or `-s` is used to find the object size, or `--textconv` is used
20+
(which implies type "blob").
2121

2222
In the second form, a list of objects (separated by linefeeds) is provided on
2323
stdin, and the SHA-1, type, and size of each object is printed on stdout.
@@ -54,19 +54,8 @@ OPTIONS
5454

5555
--textconv::
5656
Show the content as transformed by a textconv filter. In this case,
57-
<object> has to be of the form <tree-ish>:<path>, or :<path> in
58-
order to apply the filter to the content recorded in the index at
59-
<path>.
60-
61-
--smudge::
62-
Show the content as transformed by the smudge filter configured in
63-
the current working tree for the given <path>. In this case,
64-
<object> has to be of the form <tree-ish>:<path>, or :<path>.
65-
66-
--use-path=<path>::
67-
For use with --textconv or --smudge, to allow specifying an object
68-
name and a path separately, e.g. when it is difficult to figure out
69-
the revision from which the blob came.
57+
<object> has be of the form <tree-ish>:<path>, or :<path> in order
58+
to apply the filter to the content recorded in the index at <path>.
7059

7160
--batch::
7261
--batch=<format>::

builtin/cat-file.c

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,6 @@ struct batch_options {
2020
const char *format;
2121
};
2222

23-
static const char *force_path;
24-
25-
static int smudge_object(const char *path, unsigned mode, unsigned char *sha1,
26-
char **buf, unsigned long *size)
27-
{
28-
enum object_type type;
29-
30-
*buf = read_sha1_file(sha1, &type, size);
31-
if (!*buf)
32-
return error(_("cannot read object %s '%s'"),
33-
sha1_to_hex(sha1), path);
34-
if (type != OBJ_BLOB) {
35-
free(*buf);
36-
return error(_("blob expected for %s '%s'"),
37-
sha1_to_hex(sha1), path);
38-
}
39-
if (S_ISREG(mode)) {
40-
struct strbuf strbuf = STRBUF_INIT;
41-
if (convert_to_working_tree(path, *buf, *size, &strbuf)) {
42-
free(*buf);
43-
*size = strbuf.len;
44-
*buf = strbuf_detach(&strbuf, NULL);
45-
}
46-
}
47-
48-
return 0;
49-
}
50-
5123
static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
5224
int unknown_type)
5325
{
@@ -89,25 +61,12 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
8961
case 'e':
9062
return !has_sha1_file(sha1);
9163

92-
case 'w':
93-
if (!force_path && !obj_context.path[0])
94-
die("git cat-file --smudge %s: <object> must be <sha1:path>",
95-
obj_name);
96-
97-
if (smudge_object(force_path ? force_path : obj_context.path,
98-
force_path ? 0100644 : obj_context.mode,
99-
sha1, &buf, &size))
100-
return -1;
101-
break;
102-
10364
case 'c':
104-
if (!force_path && !obj_context.path[0])
65+
if (!obj_context.path[0])
10566
die("git cat-file --textconv %s: <object> must be <sha1:path>",
10667
obj_name);
10768

108-
if (textconv_object(force_path ? force_path : obj_context.path,
109-
force_path ? 0100644 : obj_context.mode,
110-
sha1, 1, &buf, &size))
69+
if (textconv_object(obj_context.path, obj_context.mode, sha1, 1, &buf, &size))
11170
break;
11271

11372
case 'p':
@@ -481,7 +440,7 @@ static int batch_objects(struct batch_options *opt)
481440
}
482441

483442
static const char * const cat_file_usage[] = {
484-
N_("git cat-file (-t [--allow-unknown-type]|-s [--allow-unknown-type]|-e|-p|<type>|--textconv|--smudge) [--use-path=<path>] <object>"),
443+
N_("git cat-file (-t [--allow-unknown-type]|-s [--allow-unknown-type]|-e|-p|<type>|--textconv) <object>"),
485444
N_("git cat-file (--batch | --batch-check) [--follow-symlinks]"),
486445
NULL
487446
};
@@ -527,10 +486,6 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
527486
OPT_CMDMODE('p', NULL, &opt, N_("pretty-print object's content"), 'p'),
528487
OPT_CMDMODE(0, "textconv", &opt,
529488
N_("for blob objects, run textconv on object's content"), 'c'),
530-
OPT_CMDMODE(0, "smudge", &opt,
531-
N_("for blob objects, run smudge filters on object's content"), 'w'),
532-
OPT_STRING(0, "use-path", &force_path, N_("blob"),
533-
N_("use a specific path for --textconv/--smudge")),
534489
OPT_BOOL(0, "allow-unknown-type", &unknown_type,
535490
N_("allow -s and -t to work with broken/corrupt objects")),
536491
OPT_BOOL(0, "buffer", &batch.buffer_output, N_("buffer --batch output")),
@@ -573,11 +528,6 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
573528
usage_with_options(cat_file_usage, options);
574529
}
575530

576-
if (force_path && opt != 'c' && opt != 'w') {
577-
error("--use-path=<path> needs --textconv or --smudge");
578-
usage_with_options(cat_file_usage, options);
579-
}
580-
581531
if (batch.buffer_output < 0)
582532
batch.buffer_output = batch.all_objects;
583533

t/t8010-cat-file-filters.sh

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)