Skip to content

Commit

Permalink
Merge branch 'jc/cachetree' into cr/reset
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
Junio C Hamano committed Sep 14, 2007
2 parents cbb390c + 09d5dc3 commit 58f6fb5
Show file tree
Hide file tree
Showing 11 changed files with 184 additions and 81 deletions.
5 changes: 0 additions & 5 deletions Documentation/git-filter-branch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,6 @@ git filter-branch --commit-filter '
fi' HEAD
------------------------------------------------------------------------------

Note that the changes introduced by the commits, and not reverted by
subsequent commits, will still be in the rewritten branch. If you want
to throw out _changes_ together with the commits, you should use the
interactive mode of gitlink:git-rebase[1].

The function 'skip_commits' is defined as follows:

--------------------------
Expand Down
2 changes: 1 addition & 1 deletion builtin-add.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ static void update_callback(struct diff_queue_struct *q,
die("unexpacted diff status %c", p->status);
case DIFF_STATUS_UNMERGED:
case DIFF_STATUS_MODIFIED:
case DIFF_STATUS_TYPE_CHANGED:
add_file_to_cache(path, verbose);
break;
case DIFF_STATUS_DELETED:
remove_file_from_cache(path);
cache_tree_invalidate_path(active_cache_tree, path);
if (verbose)
printf("remove '%s'\n", path);
break;
Expand Down
2 changes: 0 additions & 2 deletions builtin-apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -2394,7 +2394,6 @@ static void remove_file(struct patch *patch, int rmdir_empty)
if (update_index) {
if (remove_file_from_cache(patch->old_name) < 0)
die("unable to remove %s from index", patch->old_name);
cache_tree_invalidate_path(active_cache_tree, patch->old_name);
}
if (!cached) {
if (S_ISGITLINK(patch->old_mode)) {
Expand Down Expand Up @@ -2549,7 +2548,6 @@ static void create_file(struct patch *patch)
mode = S_IFREG | 0644;
create_one_file(path, mode, buf, size);
add_index_file(path, mode, buf, size);
cache_tree_invalidate_path(active_cache_tree, path);
}

/* phase zero is to remove, phase one is to create */
Expand Down
31 changes: 30 additions & 1 deletion builtin-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,34 @@ static void gen_message_id(char *dest, unsigned int length, char *base)
(int)(email_end - email_start - 1), email_start + 1);
}

static const char *clean_message_id(const char *msg_id)
{
char ch;
const char *a, *z, *m;
char *n;
size_t len;

m = msg_id;
while ((ch = *m) && (isspace(ch) || (ch == '<')))
m++;
a = m;
z = NULL;
while ((ch = *m)) {
if (!isspace(ch) && (ch != '>'))
z = m;
m++;
}
if (!z)
die("insane in-reply-to: %s", msg_id);
if (++z == m)
return a;
len = z - a;
n = xmalloc(len + 1);
memcpy(n, a, len);
n[len] = 0;
return n;
}

int cmd_format_patch(int argc, const char **argv, const char *prefix)
{
struct commit *commit;
Expand Down Expand Up @@ -625,7 +653,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
if (numbered)
rev.total = total + start_number - 1;
rev.add_signoff = add_signoff;
rev.ref_message_id = in_reply_to;
if (in_reply_to)
rev.ref_message_id = clean_message_id(in_reply_to);
while (0 <= --nr) {
int shown;
commit = list[nr];
Expand Down
7 changes: 2 additions & 5 deletions builtin-mv.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
add_file_to_cache(path, verbose);
}

for (i = 0; i < deleted.nr; i++) {
const char *path = deleted.items[i].path;
remove_file_from_cache(path);
cache_tree_invalidate_path(active_cache_tree, path);
}
for (i = 0; i < deleted.nr; i++)
remove_file_from_cache(deleted.items[i].path);

if (active_cache_changed) {
if (write_cache(newfd, active_cache, active_nr) ||
Expand Down
1 change: 0 additions & 1 deletion builtin-rm.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ int cmd_rm(int argc, const char **argv, const char *prefix)

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

if (show_only)
Expand Down
9 changes: 0 additions & 9 deletions builtin-update-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,6 @@ static int process_path(const char *path)
int len;
struct stat st;

/* We probably want to do this in remove_file_from_cache() and
* add_cache_entry() instead...
*/
cache_tree_invalidate_path(active_cache_tree, path);

/*
* First things first: get the stat information, to decide
* what to do about the pathname!
Expand Down Expand Up @@ -239,7 +234,6 @@ static int add_cacheinfo(unsigned int mode, const unsigned char *sha1,
return error("%s: cannot add to the index - missing --add option?",
path);
report("add '%s'", path);
cache_tree_invalidate_path(active_cache_tree, path);
return 0;
}

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

if (force_remove) {
if (remove_file_from_cache(p))
Expand Down Expand Up @@ -367,7 +360,6 @@ static void read_index_info(int line_termination)
free(path_name);
continue;
}
cache_tree_invalidate_path(active_cache_tree, path_name);

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

cache_tree_invalidate_path(active_cache_tree, path);
remove_file_from_cache(path);
if (add_cache_entry(ce_2, ADD_CACHE_OK_TO_ADD)) {
error("%s: cannot add our version to the index.", path);
Expand Down
Loading

0 comments on commit 58f6fb5

Please sign in to comment.