Skip to content

Commit 58f6fb5

Browse files
committed
Merge branch 'jc/cachetree' into cr/reset
* jc/cachetree: Simplify cache API git-format-patch --in-reply-to: accept <message@id> with angle brackets git-add -u: do not barf on type changes Remove duplicate note about removing commits with git-filter-branch git-clone: improve error message if curl program is missing or not executable git.el: Allow the add and remove commands to be applied to ignored files. git.el: Allow selecting whether to display uptodate/unknown/ignored files. git.el: Keep the status buffer sorted by filename. hooks--update: Explicitly check for all zeros for a deleted ref.
2 parents cbb390c + 09d5dc3 commit 58f6fb5

File tree

11 files changed

+184
-81
lines changed

11 files changed

+184
-81
lines changed

Documentation/git-filter-branch.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,6 @@ git filter-branch --commit-filter '
220220
fi' HEAD
221221
------------------------------------------------------------------------------
222222

223-
Note that the changes introduced by the commits, and not reverted by
224-
subsequent commits, will still be in the rewritten branch. If you want
225-
to throw out _changes_ together with the commits, you should use the
226-
interactive mode of gitlink:git-rebase[1].
227-
228223
The function 'skip_commits' is defined as follows:
229224

230225
--------------------------

builtin-add.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ static void update_callback(struct diff_queue_struct *q,
9898
die("unexpacted diff status %c", p->status);
9999
case DIFF_STATUS_UNMERGED:
100100
case DIFF_STATUS_MODIFIED:
101+
case DIFF_STATUS_TYPE_CHANGED:
101102
add_file_to_cache(path, verbose);
102103
break;
103104
case DIFF_STATUS_DELETED:
104105
remove_file_from_cache(path);
105-
cache_tree_invalidate_path(active_cache_tree, path);
106106
if (verbose)
107107
printf("remove '%s'\n", path);
108108
break;

builtin-apply.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2394,7 +2394,6 @@ static void remove_file(struct patch *patch, int rmdir_empty)
23942394
if (update_index) {
23952395
if (remove_file_from_cache(patch->old_name) < 0)
23962396
die("unable to remove %s from index", patch->old_name);
2397-
cache_tree_invalidate_path(active_cache_tree, patch->old_name);
23982397
}
23992398
if (!cached) {
24002399
if (S_ISGITLINK(patch->old_mode)) {
@@ -2549,7 +2548,6 @@ static void create_file(struct patch *patch)
25492548
mode = S_IFREG | 0644;
25502549
create_one_file(path, mode, buf, size);
25512550
add_index_file(path, mode, buf, size);
2552-
cache_tree_invalidate_path(active_cache_tree, path);
25532551
}
25542552

25552553
/* phase zero is to remove, phase one is to create */

builtin-log.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,34 @@ static void gen_message_id(char *dest, unsigned int length, char *base)
437437
(int)(email_end - email_start - 1), email_start + 1);
438438
}
439439

440+
static const char *clean_message_id(const char *msg_id)
441+
{
442+
char ch;
443+
const char *a, *z, *m;
444+
char *n;
445+
size_t len;
446+
447+
m = msg_id;
448+
while ((ch = *m) && (isspace(ch) || (ch == '<')))
449+
m++;
450+
a = m;
451+
z = NULL;
452+
while ((ch = *m)) {
453+
if (!isspace(ch) && (ch != '>'))
454+
z = m;
455+
m++;
456+
}
457+
if (!z)
458+
die("insane in-reply-to: %s", msg_id);
459+
if (++z == m)
460+
return a;
461+
len = z - a;
462+
n = xmalloc(len + 1);
463+
memcpy(n, a, len);
464+
n[len] = 0;
465+
return n;
466+
}
467+
440468
int cmd_format_patch(int argc, const char **argv, const char *prefix)
441469
{
442470
struct commit *commit;
@@ -625,7 +653,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
625653
if (numbered)
626654
rev.total = total + start_number - 1;
627655
rev.add_signoff = add_signoff;
628-
rev.ref_message_id = in_reply_to;
656+
if (in_reply_to)
657+
rev.ref_message_id = clean_message_id(in_reply_to);
629658
while (0 <= --nr) {
630659
int shown;
631660
commit = list[nr];

builtin-mv.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
276276
add_file_to_cache(path, verbose);
277277
}
278278

279-
for (i = 0; i < deleted.nr; i++) {
280-
const char *path = deleted.items[i].path;
281-
remove_file_from_cache(path);
282-
cache_tree_invalidate_path(active_cache_tree, path);
283-
}
279+
for (i = 0; i < deleted.nr; i++)
280+
remove_file_from_cache(deleted.items[i].path);
284281

285282
if (active_cache_changed) {
286283
if (write_cache(newfd, active_cache, active_nr) ||

builtin-rm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
227227

228228
if (remove_file_from_cache(path))
229229
die("git-rm: unable to remove %s", path);
230-
cache_tree_invalidate_path(active_cache_tree, path);
231230
}
232231

233232
if (show_only)

builtin-update-index.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,6 @@ static int process_path(const char *path)
195195
int len;
196196
struct stat st;
197197

198-
/* We probably want to do this in remove_file_from_cache() and
199-
* add_cache_entry() instead...
200-
*/
201-
cache_tree_invalidate_path(active_cache_tree, path);
202-
203198
/*
204199
* First things first: get the stat information, to decide
205200
* what to do about the pathname!
@@ -239,7 +234,6 @@ static int add_cacheinfo(unsigned int mode, const unsigned char *sha1,
239234
return error("%s: cannot add to the index - missing --add option?",
240235
path);
241236
report("add '%s'", path);
242-
cache_tree_invalidate_path(active_cache_tree, path);
243237
return 0;
244238
}
245239

@@ -284,7 +278,6 @@ static void update_one(const char *path, const char *prefix, int prefix_length)
284278
die("Unable to mark file %s", path);
285279
goto free_return;
286280
}
287-
cache_tree_invalidate_path(active_cache_tree, path);
288281

289282
if (force_remove) {
290283
if (remove_file_from_cache(p))
@@ -367,7 +360,6 @@ static void read_index_info(int line_termination)
367360
free(path_name);
368361
continue;
369362
}
370-
cache_tree_invalidate_path(active_cache_tree, path_name);
371363

372364
if (!mode) {
373365
/* mode == 0 means there is no such path -- remove */
@@ -474,7 +466,6 @@ static int unresolve_one(const char *path)
474466
goto free_return;
475467
}
476468

477-
cache_tree_invalidate_path(active_cache_tree, path);
478469
remove_file_from_cache(path);
479470
if (add_cache_entry(ce_2, ADD_CACHE_OK_TO_ADD)) {
480471
error("%s: cannot add our version to the index.", path);

0 commit comments

Comments
 (0)