From: Junio C Hamano Date: Sat, 31 Oct 2009 03:07:08 +0000 (-0700) Subject: Merge branch 'jc/maint-1.6.3-graft-trailing-space' X-Git-Tag: v1.6.6-rc0~80 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/97d484bea211f6d16c52d153ae02ea7a42668330?hp=-c Merge branch 'jc/maint-1.6.3-graft-trailing-space' * jc/maint-1.6.3-graft-trailing-space: info/grafts: allow trailing whitespaces at the end of line --- 97d484bea211f6d16c52d153ae02ea7a42668330 diff --combined commit.c index fedbd5e526,eee5ab803b..6393e1b362 --- a/commit.c +++ b/commit.c @@@ -50,6 -50,7 +50,6 @@@ struct commit *lookup_commit(const unsi static unsigned long parse_commit_date(const char *buf, const char *tail) { - unsigned long date; const char *dateptr; if (buf + 6 >= tail) @@@ -72,7 -73,10 +72,7 @@@ if (buf >= tail) return 0; /* dateptr < buf && buf[-1] == '\n', so strtoul will stop at buf-1 */ - date = strtoul(dateptr, NULL, 10); - if (date == ULONG_MAX) - date = 0; - return date; + return strtoul(dateptr, NULL, 10); } static struct commit_graft **commit_graft; @@@ -132,8 -136,8 +132,8 @@@ struct commit_graft *read_graft_line(ch int i; struct commit_graft *graft = NULL; - if (buf[len-1] == '\n') - buf[--len] = 0; + while (len && isspace(buf[len-1])) + buf[--len] = '\0'; if (buf[0] == '#' || buf[0] == '\0') return NULL; if ((len + 1) % 41) { @@@ -212,7 -216,7 +212,7 @@@ int write_shallow_commits(int fd, int u else { if (write_in_full(fd, hex, 40) != 40) break; - if (write_in_full(fd, "\n", 1) != 1) + if (write_str_in_full(fd, "\n") != 1) break; } } @@@ -262,11 -266,7 +262,11 @@@ int parse_commit_buffer(struct commit * bufptr[47] != '\n') return error("bad parents in commit %s", sha1_to_hex(item->object.sha1)); bufptr += 48; - if (graft) + /* + * The clone is shallow if nr_parent < 0, and we must + * not traverse its real parents even when we unhide them. + */ + if (graft && (graft->nr_parent < 0 || grafts_replace_parents)) continue; new_parent = lookup_commit(parent); if (new_parent) @@@ -564,13 -564,13 +564,13 @@@ static struct commit_list *merge_bases_ while (interesting(list)) { struct commit *commit; struct commit_list *parents; - struct commit_list *n; + struct commit_list *next; int flags; commit = list->item; - n = list->next; + next = list->next; free(list); - list = n; + list = next; flags = commit->object.flags & (PARENT1 | PARENT2 | STALE); if (flags == (PARENT1 | PARENT2)) { @@@ -598,11 -598,11 +598,11 @@@ free_commit_list(list); list = result; result = NULL; while (list) { - struct commit_list *n = list->next; + struct commit_list *next = list->next; if (!(list->item->object.flags & STALE)) insert_by_date(list->item, &result); free(list); - list = n; + list = next; } return result; }