Style fixes, add a space after if/for/while.
The majority of code in core git appears to use a single space after if/for/while. This is an attempt to bring more code to this standard. These are entirely cosmetic changes. Signed-off-by: Brian Gianforcaro <b.gianfo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
554555ac7d
commit
eeefa7c90e
@ -1348,7 +1348,7 @@ static void get_ac_line(const char *inbuf, const char *what,
|
|||||||
/*
|
/*
|
||||||
* Now, convert both name and e-mail using mailmap
|
* Now, convert both name and e-mail using mailmap
|
||||||
*/
|
*/
|
||||||
if(map_user(&mailmap, mail+1, mail_len-1, person, tmp-person-1)) {
|
if (map_user(&mailmap, mail+1, mail_len-1, person, tmp-person-1)) {
|
||||||
/* Add a trailing '>' to email, since map_user returns plain emails
|
/* Add a trailing '>' to email, since map_user returns plain emails
|
||||||
Note: It already has '<', since we replace from mail+1 */
|
Note: It already has '<', since we replace from mail+1 */
|
||||||
mailpos = memchr(mail, '\0', mail_len);
|
mailpos = memchr(mail, '\0', mail_len);
|
||||||
|
@ -515,7 +515,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
|||||||
option_upload_pack);
|
option_upload_pack);
|
||||||
|
|
||||||
refs = transport_get_remote_refs(transport);
|
refs = transport_get_remote_refs(transport);
|
||||||
if(refs)
|
if (refs)
|
||||||
transport_fetch_refs(transport, refs);
|
transport_fetch_refs(transport, refs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ static void populate_value(struct refinfo *ref)
|
|||||||
|
|
||||||
if (!prefixcmp(name, "refname"))
|
if (!prefixcmp(name, "refname"))
|
||||||
refname = ref->refname;
|
refname = ref->refname;
|
||||||
else if(!prefixcmp(name, "upstream")) {
|
else if (!prefixcmp(name, "upstream")) {
|
||||||
struct branch *branch;
|
struct branch *branch;
|
||||||
/* only local branches may have an upstream */
|
/* only local branches may have an upstream */
|
||||||
if (prefixcmp(ref->refname, "refs/heads/"))
|
if (prefixcmp(ref->refname, "refs/heads/"))
|
||||||
|
@ -1808,7 +1808,7 @@ static void prepare_pack(int window, int depth)
|
|||||||
|
|
||||||
static int git_pack_config(const char *k, const char *v, void *cb)
|
static int git_pack_config(const char *k, const char *v, void *cb)
|
||||||
{
|
{
|
||||||
if(!strcmp(k, "pack.window")) {
|
if (!strcmp(k, "pack.window")) {
|
||||||
window = git_config_int(k, v);
|
window = git_config_int(k, v);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -385,7 +385,7 @@ static int get_head_names(const struct ref *remote_refs, struct ref_states *stat
|
|||||||
get_fetch_map(remote_refs, &refspec, &fetch_map_tail, 0);
|
get_fetch_map(remote_refs, &refspec, &fetch_map_tail, 0);
|
||||||
matches = guess_remote_head(find_ref_by_name(remote_refs, "HEAD"),
|
matches = guess_remote_head(find_ref_by_name(remote_refs, "HEAD"),
|
||||||
fetch_map, 1);
|
fetch_map, 1);
|
||||||
for(ref = matches; ref; ref = ref->next)
|
for (ref = matches; ref; ref = ref->next)
|
||||||
string_list_append(abbrev_branch(ref->name), &states->heads);
|
string_list_append(abbrev_branch(ref->name), &states->heads);
|
||||||
|
|
||||||
free_refs(fetch_map);
|
free_refs(fetch_map);
|
||||||
@ -484,7 +484,7 @@ static int read_remote_branches(const char *refname,
|
|||||||
const char *symref;
|
const char *symref;
|
||||||
|
|
||||||
strbuf_addf(&buf, "refs/remotes/%s", rename->old);
|
strbuf_addf(&buf, "refs/remotes/%s", rename->old);
|
||||||
if(!prefixcmp(refname, buf.buf)) {
|
if (!prefixcmp(refname, buf.buf)) {
|
||||||
item = string_list_append(xstrdup(refname), rename->remote_branches);
|
item = string_list_append(xstrdup(refname), rename->remote_branches);
|
||||||
symref = resolve_ref(refname, orig_sha1, 1, &flag);
|
symref = resolve_ref(refname, orig_sha1, 1, &flag);
|
||||||
if (flag & REF_ISSYMREF)
|
if (flag & REF_ISSYMREF)
|
||||||
|
@ -56,7 +56,7 @@ static void insert_one_record(struct shortlog *log,
|
|||||||
/* copy author name to namebuf, to support matching on both name and email */
|
/* copy author name to namebuf, to support matching on both name and email */
|
||||||
memcpy(namebuf, author, boemail - author);
|
memcpy(namebuf, author, boemail - author);
|
||||||
len = boemail - author;
|
len = boemail - author;
|
||||||
while(len > 0 && isspace(namebuf[len-1]))
|
while (len > 0 && isspace(namebuf[len-1]))
|
||||||
len--;
|
len--;
|
||||||
namebuf[len] = 0;
|
namebuf[len] = 0;
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
|
|||||||
signal(SIGCHLD, SIG_DFL);
|
signal(SIGCHLD, SIG_DFL);
|
||||||
|
|
||||||
host = strstr(url, "://");
|
host = strstr(url, "://");
|
||||||
if(host) {
|
if (host) {
|
||||||
*host = '\0';
|
*host = '\0';
|
||||||
protocol = get_protocol(url);
|
protocol = get_protocol(url);
|
||||||
host += 3;
|
host += 3;
|
||||||
|
2
diff.c
2
diff.c
@ -2691,7 +2691,7 @@ static int parse_num(const char **cp_p)
|
|||||||
num = 0;
|
num = 0;
|
||||||
scale = 1;
|
scale = 1;
|
||||||
dot = 0;
|
dot = 0;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
ch = *cp;
|
ch = *cp;
|
||||||
if ( !dot && ch == '.' ) {
|
if ( !dot && ch == '.' ) {
|
||||||
scale = 1;
|
scale = 1;
|
||||||
|
@ -55,16 +55,15 @@ static inline struct llist_item *llist_item_get(void)
|
|||||||
} else {
|
} else {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
new = xmalloc(sizeof(struct llist_item) * BLKSIZE);
|
new = xmalloc(sizeof(struct llist_item) * BLKSIZE);
|
||||||
for(;i < BLKSIZE; i++) {
|
for (; i < BLKSIZE; i++)
|
||||||
llist_item_put(&new[i]);
|
llist_item_put(&new[i]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void llist_free(struct llist *list)
|
static void llist_free(struct llist *list)
|
||||||
{
|
{
|
||||||
while((list->back = list->front)) {
|
while ((list->back = list->front)) {
|
||||||
list->front = list->front->next;
|
list->front = list->front->next;
|
||||||
llist_item_put(list->back);
|
llist_item_put(list->back);
|
||||||
}
|
}
|
||||||
@ -146,7 +145,7 @@ static inline struct llist_item *llist_insert_sorted_unique(struct llist *list,
|
|||||||
if (cmp > 0) { /* we insert before this entry */
|
if (cmp > 0) { /* we insert before this entry */
|
||||||
return llist_insert(list, prev, sha1);
|
return llist_insert(list, prev, sha1);
|
||||||
}
|
}
|
||||||
if(!cmp) { /* already exists */
|
if (!cmp) { /* already exists */
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
prev = l;
|
prev = l;
|
||||||
@ -168,7 +167,7 @@ redo_from_start:
|
|||||||
int cmp = hashcmp(l->sha1, sha1);
|
int cmp = hashcmp(l->sha1, sha1);
|
||||||
if (cmp > 0) /* not in list, since sorted */
|
if (cmp > 0) /* not in list, since sorted */
|
||||||
return prev;
|
return prev;
|
||||||
if(!cmp) { /* found */
|
if (!cmp) { /* found */
|
||||||
if (prev == NULL) {
|
if (prev == NULL) {
|
||||||
if (hint != NULL && hint != list->front) {
|
if (hint != NULL && hint != list->front) {
|
||||||
/* we don't know the previous element */
|
/* we don't know the previous element */
|
||||||
@ -218,7 +217,7 @@ static inline struct pack_list * pack_list_insert(struct pack_list **pl,
|
|||||||
static inline size_t pack_list_size(struct pack_list *pl)
|
static inline size_t pack_list_size(struct pack_list *pl)
|
||||||
{
|
{
|
||||||
size_t ret = 0;
|
size_t ret = 0;
|
||||||
while(pl) {
|
while (pl) {
|
||||||
ret++;
|
ret++;
|
||||||
pl = pl->next;
|
pl = pl->next;
|
||||||
}
|
}
|
||||||
@ -396,7 +395,7 @@ static size_t get_pack_redundancy(struct pack_list *pl)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while ((subset = pl->next)) {
|
while ((subset = pl->next)) {
|
||||||
while(subset) {
|
while (subset) {
|
||||||
ret += sizeof_union(pl->pack, subset->pack);
|
ret += sizeof_union(pl->pack, subset->pack);
|
||||||
subset = subset->next;
|
subset = subset->next;
|
||||||
}
|
}
|
||||||
@ -427,7 +426,7 @@ static void minimize(struct pack_list **min)
|
|||||||
|
|
||||||
pl = local_packs;
|
pl = local_packs;
|
||||||
while (pl) {
|
while (pl) {
|
||||||
if(pl->unique_objects->size)
|
if (pl->unique_objects->size)
|
||||||
pack_list_insert(&unique, pl);
|
pack_list_insert(&unique, pl);
|
||||||
else
|
else
|
||||||
pack_list_insert(&non_unique, pl);
|
pack_list_insert(&non_unique, pl);
|
||||||
@ -479,7 +478,7 @@ static void minimize(struct pack_list **min)
|
|||||||
*min = min_perm;
|
*min = min_perm;
|
||||||
/* add the unique packs to the list */
|
/* add the unique packs to the list */
|
||||||
pl = unique;
|
pl = unique;
|
||||||
while(pl) {
|
while (pl) {
|
||||||
pack_list_insert(min, pl);
|
pack_list_insert(min, pl);
|
||||||
pl = pl->next;
|
pl = pl->next;
|
||||||
}
|
}
|
||||||
@ -516,7 +515,7 @@ static void cmp_local_packs(void)
|
|||||||
struct pack_list *subset, *pl = local_packs;
|
struct pack_list *subset, *pl = local_packs;
|
||||||
|
|
||||||
while ((subset = pl)) {
|
while ((subset = pl)) {
|
||||||
while((subset = subset->next))
|
while ((subset = subset->next))
|
||||||
cmp_two_packs(pl, subset);
|
cmp_two_packs(pl, subset);
|
||||||
pl = pl->next;
|
pl = pl->next;
|
||||||
}
|
}
|
||||||
@ -608,23 +607,23 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
const char *arg = argv[i];
|
const char *arg = argv[i];
|
||||||
if(!strcmp(arg, "--")) {
|
if (!strcmp(arg, "--")) {
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!strcmp(arg, "--all")) {
|
if (!strcmp(arg, "--all")) {
|
||||||
load_all_packs = 1;
|
load_all_packs = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!strcmp(arg, "--verbose")) {
|
if (!strcmp(arg, "--verbose")) {
|
||||||
verbose = 1;
|
verbose = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!strcmp(arg, "--alt-odb")) {
|
if (!strcmp(arg, "--alt-odb")) {
|
||||||
alt_odb = 1;
|
alt_odb = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(*arg == '-')
|
if (*arg == '-')
|
||||||
usage(pack_redundant_usage);
|
usage(pack_redundant_usage);
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
2
remote.c
2
remote.c
@ -1038,7 +1038,7 @@ static int match_explicit(struct ref *src, struct ref *dst,
|
|||||||
case 0:
|
case 0:
|
||||||
if (!memcmp(dst_value, "refs/", 5))
|
if (!memcmp(dst_value, "refs/", 5))
|
||||||
matched_dst = make_linked_ref(dst_value, dst_tail);
|
matched_dst = make_linked_ref(dst_value, dst_tail);
|
||||||
else if((dst_guess = guess_ref(dst_value, matched_src)))
|
else if ((dst_guess = guess_ref(dst_value, matched_src)))
|
||||||
matched_dst = make_linked_ref(dst_guess, dst_tail);
|
matched_dst = make_linked_ref(dst_guess, dst_tail);
|
||||||
else
|
else
|
||||||
error("unable to push to unqualified destination: %s\n"
|
error("unable to push to unqualified destination: %s\n"
|
||||||
|
@ -427,7 +427,7 @@ static int get_common_commits(void)
|
|||||||
|
|
||||||
save_commit_buffer = 0;
|
save_commit_buffer = 0;
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
int len = packet_read_line(0, line, sizeof(line));
|
int len = packet_read_line(0, line, sizeof(line));
|
||||||
reset_timeout();
|
reset_timeout();
|
||||||
|
|
||||||
|
5
var.c
5
var.c
@ -21,9 +21,8 @@ static struct git_var git_vars[] = {
|
|||||||
static void list_vars(void)
|
static void list_vars(void)
|
||||||
{
|
{
|
||||||
struct git_var *ptr;
|
struct git_var *ptr;
|
||||||
for(ptr = git_vars; ptr->read; ptr++) {
|
for (ptr = git_vars; ptr->read; ptr++)
|
||||||
printf("%s=%s\n", ptr->name, ptr->read(IDENT_WARN_ON_NO_NAME));
|
printf("%s=%s\n", ptr->name, ptr->read(IDENT_WARN_ON_NO_NAME));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *read_var(const char *var)
|
static const char *read_var(const char *var)
|
||||||
@ -31,7 +30,7 @@ static const char *read_var(const char *var)
|
|||||||
struct git_var *ptr;
|
struct git_var *ptr;
|
||||||
const char *val;
|
const char *val;
|
||||||
val = NULL;
|
val = NULL;
|
||||||
for(ptr = git_vars; ptr->read; ptr++) {
|
for (ptr = git_vars; ptr->read; ptr++) {
|
||||||
if (strcmp(var, ptr->name) == 0) {
|
if (strcmp(var, ptr->name) == 0) {
|
||||||
val = ptr->read(IDENT_ERROR_ON_NO_NAME);
|
val = ptr->read(IDENT_ERROR_ON_NO_NAME);
|
||||||
break;
|
break;
|
||||||
|
@ -326,7 +326,7 @@ static void wt_status_collect_untracked(struct wt_status *s)
|
|||||||
setup_standard_excludes(&dir);
|
setup_standard_excludes(&dir);
|
||||||
|
|
||||||
fill_directory(&dir, NULL);
|
fill_directory(&dir, NULL);
|
||||||
for(i = 0; i < dir.nr; i++) {
|
for (i = 0; i < dir.nr; i++) {
|
||||||
struct dir_entry *ent = dir.entries[i];
|
struct dir_entry *ent = dir.entries[i];
|
||||||
if (!cache_name_is_other(ent->name, ent->len))
|
if (!cache_name_is_other(ent->name, ent->len))
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user