Skip to content

Commit e3f2675

Browse files
committed
Merge branch 'maint-1.7.11' into maint
* maint-1.7.11: Almost 1.7.11.6 gitweb: URL-decode $my_url/$my_uri when stripping PATH_INFO rebase -i: use full onto sha1 in reflog sh-setup: protect from exported IFS receive-pack: do not leak output from auto-gc to standard output t/t5400: demonstrate breakage caused by informational message from prune setup: clarify error messages for file/revisions ambiguity send-email: improve RFC2047 quote parsing fsck: detect null sha1 in tree entries do not write null sha1s to on-disk index diff: do not use null sha1 as a sentinel value
2 parents 871e293 + 9a8eea9 commit e3f2675

27 files changed

+288
-43
lines changed

Documentation/RelNotes/1.7.11.6.txt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Git v1.7.11.6 Release Notes
44
Fixes since v1.7.11.5
55
---------------------
66

7-
This is primarily documentation and low-impact code clarification.
7+
This consists primarily of documentation updates and low-impact code
8+
clarification and bugfixes.
89

910
- "ciabot" script (in contrib/) has been updated with extensive
1011
documentation.
@@ -32,3 +33,30 @@ This is primarily documentation and low-impact code clarification.
3233
- "git commit --amend" let the user edit the log message and then
3334
died when the human-readable committer name was given
3435
insufficiently by getpwent(3).
36+
37+
- The reflog entries left by "git rebase" and "git rebase -i" were
38+
inconsistent (the interactive one gave an abbreviated object name).
39+
40+
- When the user exports a non-default IFS without HT, scripts that
41+
rely on being able to parse "ls-files -s | while read a b c..."
42+
started to fail. Protect them from such a misconfiguration.
43+
44+
- When "git push" triggered the automatic gc on the receiving end, a
45+
message from "git prune" that said it was removing cruft leaked to
46+
the standard output, breaking the communication protocol.
47+
48+
- "git diff" had a confusion between taking data from a path in the
49+
working tree and taking data from an object that happens to have
50+
name 0{40} recorded in a tree.
51+
52+
- "git send-email" did not unquote encoded words that appear on the
53+
header correctly, and lost "_" from strings.
54+
55+
- When the user gives an argument that can be taken as both a
56+
revision name and a pathname without disambiguating with "--", we
57+
used to give a help message "Use '--' to separate". The message
58+
has been clarified to show where that '--' goes on the command
59+
line.
60+
61+
- "gitweb" when used with PATH_INFO failed to notice directories with
62+
SP (and other characters that need URL-style quoting) in them.

builtin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extern int check_pager_config(const char *cmd);
4343
struct diff_options;
4444
extern void setup_diff_pager(struct diff_options *);
4545

46-
extern int textconv_object(const char *path, unsigned mode, const unsigned char *sha1, char **buf, unsigned long *buf_size);
46+
extern int textconv_object(const char *path, unsigned mode, const unsigned char *sha1, int sha1_valid, char **buf, unsigned long *buf_size);
4747

4848
extern int cmd_add(int argc, const char **argv, const char *prefix);
4949
extern int cmd_annotate(int argc, const char **argv, const char *prefix);

builtin/blame.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,15 @@ static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, long ctxlen,
110110
int textconv_object(const char *path,
111111
unsigned mode,
112112
const unsigned char *sha1,
113+
int sha1_valid,
113114
char **buf,
114115
unsigned long *buf_size)
115116
{
116117
struct diff_filespec *df;
117118
struct userdiff_driver *textconv;
118119

119120
df = alloc_filespec(path);
120-
fill_filespec(df, sha1, mode);
121+
fill_filespec(df, sha1, sha1_valid, mode);
121122
textconv = get_textconv(df);
122123
if (!textconv) {
123124
free_filespec(df);
@@ -142,7 +143,7 @@ static void fill_origin_blob(struct diff_options *opt,
142143

143144
num_read_blob++;
144145
if (DIFF_OPT_TST(opt, ALLOW_TEXTCONV) &&
145-
textconv_object(o->path, o->mode, o->blob_sha1, &file->ptr, &file_size))
146+
textconv_object(o->path, o->mode, o->blob_sha1, 1, &file->ptr, &file_size))
146147
;
147148
else
148149
file->ptr = read_sha1_file(o->blob_sha1, &type, &file_size);
@@ -2123,7 +2124,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt,
21232124
switch (st.st_mode & S_IFMT) {
21242125
case S_IFREG:
21252126
if (DIFF_OPT_TST(opt, ALLOW_TEXTCONV) &&
2126-
textconv_object(read_from, mode, null_sha1, &buf_ptr, &buf_len))
2127+
textconv_object(read_from, mode, null_sha1, 0, &buf_ptr, &buf_len))
21272128
strbuf_attach(&buf, buf_ptr, buf_len, buf_len + 1);
21282129
else if (strbuf_read_file(&buf, read_from, st.st_size) != st.st_size)
21292130
die_errno("cannot open or read '%s'", read_from);
@@ -2516,7 +2517,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
25162517
die("no such path %s in %s", path, final_commit_name);
25172518

25182519
if (DIFF_OPT_TST(&sb.revs->diffopt, ALLOW_TEXTCONV) &&
2519-
textconv_object(path, o->mode, o->blob_sha1, (char **) &sb.final_buf,
2520+
textconv_object(path, o->mode, o->blob_sha1, 1, (char **) &sb.final_buf,
25202521
&sb.final_buf_size))
25212522
;
25222523
else

builtin/cat-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
146146
die("git cat-file --textconv %s: <object> must be <sha1:path>",
147147
obj_name);
148148

149-
if (!textconv_object(obj_context.path, obj_context.mode, sha1, &buf, &size))
149+
if (!textconv_object(obj_context.path, obj_context.mode, sha1, 1, &buf, &size))
150150
die("git cat-file --textconv: unable to run textconv on %s",
151151
obj_name);
152152
break;

builtin/diff.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ static void stuff_change(struct diff_options *opt,
2929
unsigned old_mode, unsigned new_mode,
3030
const unsigned char *old_sha1,
3131
const unsigned char *new_sha1,
32+
int old_sha1_valid,
33+
int new_sha1_valid,
3234
const char *old_name,
3335
const char *new_name)
3436
{
@@ -54,8 +56,8 @@ static void stuff_change(struct diff_options *opt,
5456

5557
one = alloc_filespec(old_name);
5658
two = alloc_filespec(new_name);
57-
fill_filespec(one, old_sha1, old_mode);
58-
fill_filespec(two, new_sha1, new_mode);
59+
fill_filespec(one, old_sha1, old_sha1_valid, old_mode);
60+
fill_filespec(two, new_sha1, new_sha1_valid, new_mode);
5961

6062
diff_queue(&diff_queued_diff, one, two);
6163
}
@@ -84,6 +86,7 @@ static int builtin_diff_b_f(struct rev_info *revs,
8486
stuff_change(&revs->diffopt,
8587
blob[0].mode, canon_mode(st.st_mode),
8688
blob[0].sha1, null_sha1,
89+
1, 0,
8790
path, path);
8891
diffcore_std(&revs->diffopt);
8992
diff_flush(&revs->diffopt);
@@ -108,6 +111,7 @@ static int builtin_diff_blobs(struct rev_info *revs,
108111
stuff_change(&revs->diffopt,
109112
blob[0].mode, blob[1].mode,
110113
blob[0].sha1, blob[1].sha1,
114+
1, 1,
111115
blob[0].name, blob[1].name);
112116
diffcore_std(&revs->diffopt);
113117
diff_flush(&revs->diffopt);

builtin/receive-pack.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,8 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
977977
const char *argv_gc_auto[] = {
978978
"gc", "--auto", "--quiet", NULL,
979979
};
980-
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
980+
int opt = RUN_GIT_CMD | RUN_COMMAND_STDOUT_TO_STDERR;
981+
run_command_v_opt(argv_gc_auto, opt);
981982
}
982983
if (auto_update_server_info)
983984
update_server_info(0);

combine-diff.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static char *grab_blob(const unsigned char *sha1, unsigned int mode,
111111
return xcalloc(1, 1);
112112
} else if (textconv) {
113113
struct diff_filespec *df = alloc_filespec(path);
114-
fill_filespec(df, sha1, mode);
114+
fill_filespec(df, sha1, 1, mode);
115115
*size = fill_textconv(textconv, df, &blob);
116116
free_filespec(df);
117117
} else {
@@ -823,7 +823,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
823823
&result_size, NULL, NULL);
824824
} else if (textconv) {
825825
struct diff_filespec *df = alloc_filespec(elem->path);
826-
fill_filespec(df, null_sha1, st.st_mode);
826+
fill_filespec(df, null_sha1, 0, st.st_mode);
827827
result_size = fill_textconv(textconv, df, &result);
828828
free_filespec(df);
829829
} else if (0 <= (fd = open(elem->path, O_RDONLY))) {

diff-lib.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
206206
if (silent_on_removed)
207207
continue;
208208
diff_addremove(&revs->diffopt, '-', ce->ce_mode,
209-
ce->sha1, ce->name, 0);
209+
ce->sha1, !is_null_sha1(ce->sha1),
210+
ce->name, 0);
210211
continue;
211212
}
212213
changed = match_stat_with_submodule(&revs->diffopt, ce, &st,
@@ -220,6 +221,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
220221
newmode = ce_mode_from_stat(ce, st.st_mode);
221222
diff_change(&revs->diffopt, oldmode, newmode,
222223
ce->sha1, (changed ? null_sha1 : ce->sha1),
224+
!is_null_sha1(ce->sha1), (changed ? 0 : !is_null_sha1(ce->sha1)),
223225
ce->name, 0, dirty_submodule);
224226

225227
}
@@ -236,11 +238,12 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
236238
static void diff_index_show_file(struct rev_info *revs,
237239
const char *prefix,
238240
struct cache_entry *ce,
239-
const unsigned char *sha1, unsigned int mode,
241+
const unsigned char *sha1, int sha1_valid,
242+
unsigned int mode,
240243
unsigned dirty_submodule)
241244
{
242245
diff_addremove(&revs->diffopt, prefix[0], mode,
243-
sha1, ce->name, dirty_submodule);
246+
sha1, sha1_valid, ce->name, dirty_submodule);
244247
}
245248

246249
static int get_stat_data(struct cache_entry *ce,
@@ -295,7 +298,7 @@ static void show_new_file(struct rev_info *revs,
295298
&dirty_submodule, &revs->diffopt) < 0)
296299
return;
297300

298-
diff_index_show_file(revs, "+", new, sha1, mode, dirty_submodule);
301+
diff_index_show_file(revs, "+", new, sha1, !is_null_sha1(sha1), mode, dirty_submodule);
299302
}
300303

301304
static int show_modified(struct rev_info *revs,
@@ -312,7 +315,7 @@ static int show_modified(struct rev_info *revs,
312315
&dirty_submodule, &revs->diffopt) < 0) {
313316
if (report_missing)
314317
diff_index_show_file(revs, "-", old,
315-
old->sha1, old->ce_mode, 0);
318+
old->sha1, 1, old->ce_mode, 0);
316319
return -1;
317320
}
318321

@@ -347,7 +350,8 @@ static int show_modified(struct rev_info *revs,
347350
return 0;
348351

349352
diff_change(&revs->diffopt, oldmode, mode,
350-
old->sha1, sha1, old->name, 0, dirty_submodule);
353+
old->sha1, sha1, 1, !is_null_sha1(sha1),
354+
old->name, 0, dirty_submodule);
351355
return 0;
352356
}
353357

@@ -380,7 +384,7 @@ static void do_oneway_diff(struct unpack_trees_options *o,
380384
struct diff_filepair *pair;
381385
pair = diff_unmerge(&revs->diffopt, idx->name);
382386
if (tree)
383-
fill_filespec(pair->one, tree->sha1, tree->ce_mode);
387+
fill_filespec(pair->one, tree->sha1, 1, tree->ce_mode);
384388
return;
385389
}
386390

@@ -396,7 +400,7 @@ static void do_oneway_diff(struct unpack_trees_options *o,
396400
* Something removed from the tree?
397401
*/
398402
if (!idx) {
399-
diff_index_show_file(revs, "-", tree, tree->sha1, tree->ce_mode, 0);
403+
diff_index_show_file(revs, "-", tree, tree->sha1, 1, tree->ce_mode, 0);
400404
return;
401405
}
402406

diff-no-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static struct diff_filespec *noindex_filespec(const char *name, int mode)
8282
if (!name)
8383
name = "/dev/null";
8484
s = alloc_filespec(name);
85-
fill_filespec(s, null_sha1, mode);
85+
fill_filespec(s, null_sha1, 0, mode);
8686
if (name == file_from_standard_input)
8787
populate_from_stdin(s);
8888
return s;

diff.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,12 +2541,12 @@ void free_filespec(struct diff_filespec *spec)
25412541
}
25422542

25432543
void fill_filespec(struct diff_filespec *spec, const unsigned char *sha1,
2544-
unsigned short mode)
2544+
int sha1_valid, unsigned short mode)
25452545
{
25462546
if (mode) {
25472547
spec->mode = canon_mode(mode);
25482548
hashcpy(spec->sha1, sha1);
2549-
spec->sha1_valid = !is_null_sha1(sha1);
2549+
spec->sha1_valid = sha1_valid;
25502550
}
25512551
}
25522552

@@ -4693,6 +4693,7 @@ static int is_submodule_ignored(const char *path, struct diff_options *options)
46934693
void diff_addremove(struct diff_options *options,
46944694
int addremove, unsigned mode,
46954695
const unsigned char *sha1,
4696+
int sha1_valid,
46964697
const char *concatpath, unsigned dirty_submodule)
46974698
{
46984699
struct diff_filespec *one, *two;
@@ -4724,9 +4725,9 @@ void diff_addremove(struct diff_options *options,
47244725
two = alloc_filespec(concatpath);
47254726

47264727
if (addremove != '+')
4727-
fill_filespec(one, sha1, mode);
4728+
fill_filespec(one, sha1, sha1_valid, mode);
47284729
if (addremove != '-') {
4729-
fill_filespec(two, sha1, mode);
4730+
fill_filespec(two, sha1, sha1_valid, mode);
47304731
two->dirty_submodule = dirty_submodule;
47314732
}
47324733

@@ -4739,6 +4740,7 @@ void diff_change(struct diff_options *options,
47394740
unsigned old_mode, unsigned new_mode,
47404741
const unsigned char *old_sha1,
47414742
const unsigned char *new_sha1,
4743+
int old_sha1_valid, int new_sha1_valid,
47424744
const char *concatpath,
47434745
unsigned old_dirty_submodule, unsigned new_dirty_submodule)
47444746
{
@@ -4753,6 +4755,8 @@ void diff_change(struct diff_options *options,
47534755
const unsigned char *tmp_c;
47544756
tmp = old_mode; old_mode = new_mode; new_mode = tmp;
47554757
tmp_c = old_sha1; old_sha1 = new_sha1; new_sha1 = tmp_c;
4758+
tmp = old_sha1_valid; old_sha1_valid = new_sha1_valid;
4759+
new_sha1_valid = tmp;
47564760
tmp = old_dirty_submodule; old_dirty_submodule = new_dirty_submodule;
47574761
new_dirty_submodule = tmp;
47584762
}
@@ -4763,8 +4767,8 @@ void diff_change(struct diff_options *options,
47634767

47644768
one = alloc_filespec(concatpath);
47654769
two = alloc_filespec(concatpath);
4766-
fill_filespec(one, old_sha1, old_mode);
4767-
fill_filespec(two, new_sha1, new_mode);
4770+
fill_filespec(one, old_sha1, old_sha1_valid, old_mode);
4771+
fill_filespec(two, new_sha1, new_sha1_valid, new_mode);
47684772
one->dirty_submodule = old_dirty_submodule;
47694773
two->dirty_submodule = new_dirty_submodule;
47704774

0 commit comments

Comments
 (0)