From: Junio C Hamano Date: Mon, 29 Aug 2005 06:02:01 +0000 (-0700) Subject: Merge refs/heads/portable from http://www.cs.berkeley.edu/~ejr/gits/git.git X-Git-Tag: v0.99.6~65 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/10d781b9caa4f71495c7b34963bef137216f86a8?ds=inline;hp=-c Merge refs/heads/portable from cs.berkeley.edu/~ejr/gits/git.git --- 10d781b9caa4f71495c7b34963bef137216f86a8 diff --combined apply.c index 3ebbf6b1dc,ee59be643e..e87190ea38 --- a/apply.c +++ b/apply.c @@@ -387,7 -387,7 +387,7 @@@ static char *git_header_name(char *line default: continue; case '\n': - break; + return NULL; case '\t': case ' ': second = name+len; for (;;) { @@@ -1377,7 -1377,7 +1377,7 @@@ static struct excludes static int use_patch(struct patch *p) { - const char *pathname = p->new_name ? : p->old_name; + const char *pathname = p->new_name ? p->new_name : p->old_name; struct excludes *x = excludes; while (x) { if (fnmatch(x->path, pathname, 0) == 0) diff --combined cache.h index 1478631b40,e4f4664572..d407f39001 --- a/cache.h +++ b/cache.h @@@ -58,7 -58,11 +58,11 @@@ * We accept older names for now but warn. */ extern char *gitenv_bc(const char *); + #ifdef __GNUC__ #define gitenv(e) (getenv(e) ? : gitenv_bc(e)) + #else + #define gitenv(e) (getenv(e) ? getenv(e) : gitenv_bc(e)) + #endif /* * Basic data structures for the directory cache @@@ -100,7 -104,7 +104,7 @@@ struct cache_entry unsigned int ce_size; unsigned char sha1[20]; unsigned short ce_flags; - char name[0]; + char name[]; }; #define CE_NAMEMASK (0x0fff) @@@ -283,7 -287,7 +287,7 @@@ extern int checkout_entry(struct cache_ extern struct alternate_object_database { struct alternate_object_database *next; char *name; - char base[0]; /* more */ + char base[]; /* more */ } *alt_odb_list; extern void prepare_alt_odb(void); @@@ -296,7 -300,7 +300,7 @@@ extern struct packed_git unsigned int pack_last_used; unsigned int pack_use_cnt; unsigned char sha1[20]; - char pack_name[0]; /* something like ".git/objects/pack/xxxxx.pack" */ + char pack_name[]; /* something like ".git/objects/pack/xxxxx.pack" */ } *packed_git; struct pack_entry { @@@ -309,9 -313,8 +313,9 @@@ struct ref struct ref *next; unsigned char old_sha1[20]; unsigned char new_sha1[20]; + unsigned char force; struct ref *peer_ref; /* when renaming */ - char name[0]; + char name[]; }; extern int git_connect(int fd[2], char *url, const char *prog); diff --combined connect.c index 7cd587357e,c0bf869e96..825c439acc --- a/connect.c +++ b/connect.c @@@ -82,26 -82,15 +82,26 @@@ int path_match(const char *path, int nr struct refspec { char *src; char *dst; + char force; }; +/* + * A:B means fast forward remote B with local A. + * +A:B means overwrite remote B with local A. + * +A is a shorthand for +A:A. + * A is a shorthand for A:A. + */ static struct refspec *parse_ref_spec(int nr_refspec, char **refspec) { int i; - struct refspec *rs = xmalloc(sizeof(*rs) * (nr_refspec + 1)); + struct refspec *rs = xcalloc(sizeof(*rs), (nr_refspec + 1)); for (i = 0; i < nr_refspec; i++) { char *sp, *dp, *ep; sp = refspec[i]; + if (*sp == '+') { + rs[i].force = 1; + sp++; + } ep = strchr(sp, ':'); if (ep) { dp = ep + 1; @@@ -227,10 -216,8 +227,10 @@@ static int match_explicit_refs(struct r error("dst ref %s receives from more than one src.", matched_dst->name); } - else + else { matched_dst->peer_ref = matched_src; + matched_dst->force = rs[i].force; + } } return -errs; } @@@ -396,8 -383,10 +396,10 @@@ int git_connect(int fd[2], char *url, c close(pipefd[1][0]); close(pipefd[1][1]); if (protocol == PROTO_SSH) { - const char *ssh = getenv("GIT_SSH") ? : "ssh"; - const char *ssh_basename = strrchr(ssh, '/'); + const char *ssh, *ssh_basename; + ssh = getenv("GIT_SSH"); + if (!ssh) ssh = "ssh"; + ssh_basename = strrchr(ssh, '/'); if (!ssh_basename) ssh_basename = ssh; else diff --combined ls-files.c index e53d245884,56f3919e06..0d79104e0d --- a/ls-files.c +++ b/ls-files.c @@@ -205,7 -205,7 +205,7 @@@ static int excluded(const char *pathnam struct nond_on_fs { int len; - char name[0]; + char name[]; }; static struct nond_on_fs **dir; @@@ -496,7 -496,7 +496,7 @@@ static void verify_pathspec(void char c = n[i]; if (prev && prev[i] != c) break; - if (c == '*' || c == '?') + if (!c || c == '*' || c == '?') break; if (c == '/') len = i+1;