X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=read-tree.c;h=4422dbf424a5f4fd491811648acd3273aba529f3;hb=b411fda15df4897a1308bbb5950088ea6138cbad;hp=bb50a800d79dbfb7836b6cba1c62935d9a78577e;hpb=6d5129ac098e8b9c270efd5fa2695163122a0a46;p=git.git diff --git a/read-tree.c b/read-tree.c index bb50a800..4422dbf4 100644 --- a/read-tree.c +++ b/read-tree.c @@ -273,10 +273,26 @@ static void unlink_entry(char *name) static void progress_interval(int signum) { - signal(SIGALRM, progress_interval); progress_update = 1; } +static void setup_progress_signal(void) +{ + struct sigaction sa; + struct itimerval v; + + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = progress_interval; + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART; + sigaction(SIGALRM, &sa, NULL); + + v.it_interval.tv_sec = 1; + v.it_interval.tv_usec = 0; + v.it_value = v.it_interval; + setitimer(ITIMER_REAL, &v, NULL); +} + static void check_updates(struct cache_entry **src, int nr) { static struct checkout state = { @@ -289,8 +305,6 @@ static void check_updates(struct cache_entry **src, int nr) unsigned last_percent = 200, cnt = 0, total = 0; if (update && verbose_update) { - struct itimerval v; - for (total = cnt = 0; cnt < nr; cnt++) { struct cache_entry *ce = src[cnt]; if (!ce->ce_mode || ce->ce_flags & mask) @@ -302,12 +316,8 @@ static void check_updates(struct cache_entry **src, int nr) total = 0; if (total) { - v.it_interval.tv_sec = 1; - v.it_interval.tv_usec = 0; - v.it_value = v.it_interval; - signal(SIGALRM, progress_interval); - setitimer(ITIMER_REAL, &v, NULL); fprintf(stderr, "Checking files out...\n"); + setup_progress_signal(); progress_update = 1; } cnt = 0; @@ -337,12 +347,12 @@ static void check_updates(struct cache_entry **src, int nr) if (ce->ce_flags & mask) { ce->ce_flags &= ~mask; if (update) - checkout_entry(ce, &state); + checkout_entry(ce, &state, NULL); } } if (total) { - fputc('\n', stderr); signal(SIGALRM, SIG_IGN); + fputc('\n', stderr); } } @@ -404,7 +414,7 @@ static void verify_uptodate(struct cache_entry *ce) return; if (!lstat(ce->name, &st)) { - unsigned changed = ce_match_stat(ce, &st); + unsigned changed = ce_match_stat(ce, &st, 1); if (!changed) return; errno = 0; @@ -560,9 +570,11 @@ static int threeway_merge(struct cache_entry **stages) */ if ((head_deleted && remote_deleted) || (head_deleted && remote && remote_match) || - (remote_deleted && head && head_match)) + (remote_deleted && head && head_match)) { + if (index) + return deleted_entry(index, index); return 0; - + } /* * Added in both, identically. */ @@ -704,7 +716,7 @@ static int read_cache_unmerged(void) return deleted; } -static const char read_tree_usage[] = "git-read-tree ( | -m [-u | -i] [ []])"; +static const char read_tree_usage[] = "git-read-tree ( | -m [--aggressive] [-u | -i] [ []])"; static struct cache_file cache_file; @@ -715,6 +727,7 @@ int main(int argc, char **argv) merge_fn_t fn = NULL; setup_git_directory(); + git_config(git_default_config); newfd = hold_index_file_for_update(&cache_file, get_index_file()); if (newfd < 0)