Skip to content

Commit eeefa7c

Browse files
bgianfogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 554555a commit eeefa7c

13 files changed

+28
-30
lines changed

builtin-blame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ static void get_ac_line(const char *inbuf, const char *what,
13481348
/*
13491349
* Now, convert both name and e-mail using mailmap
13501350
*/
1351-
if(map_user(&mailmap, mail+1, mail_len-1, person, tmp-person-1)) {
1351+
if (map_user(&mailmap, mail+1, mail_len-1, person, tmp-person-1)) {
13521352
/* Add a trailing '>' to email, since map_user returns plain emails
13531353
Note: It already has '<', since we replace from mail+1 */
13541354
mailpos = memchr(mail, '\0', mail_len);

builtin-clone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
515515
option_upload_pack);
516516

517517
refs = transport_get_remote_refs(transport);
518-
if(refs)
518+
if (refs)
519519
transport_fetch_refs(transport, refs);
520520
}
521521

builtin-for-each-ref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ static void populate_value(struct refinfo *ref)
576576

577577
if (!prefixcmp(name, "refname"))
578578
refname = ref->refname;
579-
else if(!prefixcmp(name, "upstream")) {
579+
else if (!prefixcmp(name, "upstream")) {
580580
struct branch *branch;
581581
/* only local branches may have an upstream */
582582
if (prefixcmp(ref->refname, "refs/heads/"))

builtin-pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1808,7 +1808,7 @@ static void prepare_pack(int window, int depth)
18081808

18091809
static int git_pack_config(const char *k, const char *v, void *cb)
18101810
{
1811-
if(!strcmp(k, "pack.window")) {
1811+
if (!strcmp(k, "pack.window")) {
18121812
window = git_config_int(k, v);
18131813
return 0;
18141814
}

builtin-remote.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static int get_head_names(const struct ref *remote_refs, struct ref_states *stat
385385
get_fetch_map(remote_refs, &refspec, &fetch_map_tail, 0);
386386
matches = guess_remote_head(find_ref_by_name(remote_refs, "HEAD"),
387387
fetch_map, 1);
388-
for(ref = matches; ref; ref = ref->next)
388+
for (ref = matches; ref; ref = ref->next)
389389
string_list_append(abbrev_branch(ref->name), &states->heads);
390390

391391
free_refs(fetch_map);
@@ -484,7 +484,7 @@ static int read_remote_branches(const char *refname,
484484
const char *symref;
485485

486486
strbuf_addf(&buf, "refs/remotes/%s", rename->old);
487-
if(!prefixcmp(refname, buf.buf)) {
487+
if (!prefixcmp(refname, buf.buf)) {
488488
item = string_list_append(xstrdup(refname), rename->remote_branches);
489489
symref = resolve_ref(refname, orig_sha1, 1, &flag);
490490
if (flag & REF_ISSYMREF)

builtin-shortlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static void insert_one_record(struct shortlog *log,
5656
/* copy author name to namebuf, to support matching on both name and email */
5757
memcpy(namebuf, author, boemail - author);
5858
len = boemail - author;
59-
while(len > 0 && isspace(namebuf[len-1]))
59+
while (len > 0 && isspace(namebuf[len-1]))
6060
len--;
6161
namebuf[len] = 0;
6262

connect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
513513
signal(SIGCHLD, SIG_DFL);
514514

515515
host = strstr(url, "://");
516-
if(host) {
516+
if (host) {
517517
*host = '\0';
518518
protocol = get_protocol(url);
519519
host += 3;

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2691,7 +2691,7 @@ static int parse_num(const char **cp_p)
26912691
num = 0;
26922692
scale = 1;
26932693
dot = 0;
2694-
for(;;) {
2694+
for (;;) {
26952695
ch = *cp;
26962696
if ( !dot && ch == '.' ) {
26972697
scale = 1;

pack-redundant.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,15 @@ static inline struct llist_item *llist_item_get(void)
5555
} else {
5656
int i = 1;
5757
new = xmalloc(sizeof(struct llist_item) * BLKSIZE);
58-
for(;i < BLKSIZE; i++) {
58+
for (; i < BLKSIZE; i++)
5959
llist_item_put(&new[i]);
60-
}
6160
}
6261
return new;
6362
}
6463

6564
static void llist_free(struct llist *list)
6665
{
67-
while((list->back = list->front)) {
66+
while ((list->back = list->front)) {
6867
list->front = list->front->next;
6968
llist_item_put(list->back);
7069
}
@@ -146,7 +145,7 @@ static inline struct llist_item *llist_insert_sorted_unique(struct llist *list,
146145
if (cmp > 0) { /* we insert before this entry */
147146
return llist_insert(list, prev, sha1);
148147
}
149-
if(!cmp) { /* already exists */
148+
if (!cmp) { /* already exists */
150149
return l;
151150
}
152151
prev = l;
@@ -168,7 +167,7 @@ static inline struct llist_item * llist_sorted_remove(struct llist *list, const
168167
int cmp = hashcmp(l->sha1, sha1);
169168
if (cmp > 0) /* not in list, since sorted */
170169
return prev;
171-
if(!cmp) { /* found */
170+
if (!cmp) { /* found */
172171
if (prev == NULL) {
173172
if (hint != NULL && hint != list->front) {
174173
/* we don't know the previous element */
@@ -218,7 +217,7 @@ static inline struct pack_list * pack_list_insert(struct pack_list **pl,
218217
static inline size_t pack_list_size(struct pack_list *pl)
219218
{
220219
size_t ret = 0;
221-
while(pl) {
220+
while (pl) {
222221
ret++;
223222
pl = pl->next;
224223
}
@@ -396,7 +395,7 @@ static size_t get_pack_redundancy(struct pack_list *pl)
396395
return 0;
397396

398397
while ((subset = pl->next)) {
399-
while(subset) {
398+
while (subset) {
400399
ret += sizeof_union(pl->pack, subset->pack);
401400
subset = subset->next;
402401
}
@@ -427,7 +426,7 @@ static void minimize(struct pack_list **min)
427426

428427
pl = local_packs;
429428
while (pl) {
430-
if(pl->unique_objects->size)
429+
if (pl->unique_objects->size)
431430
pack_list_insert(&unique, pl);
432431
else
433432
pack_list_insert(&non_unique, pl);
@@ -479,7 +478,7 @@ static void minimize(struct pack_list **min)
479478
*min = min_perm;
480479
/* add the unique packs to the list */
481480
pl = unique;
482-
while(pl) {
481+
while (pl) {
483482
pack_list_insert(min, pl);
484483
pl = pl->next;
485484
}
@@ -516,7 +515,7 @@ static void cmp_local_packs(void)
516515
struct pack_list *subset, *pl = local_packs;
517516

518517
while ((subset = pl)) {
519-
while((subset = subset->next))
518+
while ((subset = subset->next))
520519
cmp_two_packs(pl, subset);
521520
pl = pl->next;
522521
}
@@ -608,23 +607,23 @@ int main(int argc, char **argv)
608607

609608
for (i = 1; i < argc; i++) {
610609
const char *arg = argv[i];
611-
if(!strcmp(arg, "--")) {
610+
if (!strcmp(arg, "--")) {
612611
i++;
613612
break;
614613
}
615-
if(!strcmp(arg, "--all")) {
614+
if (!strcmp(arg, "--all")) {
616615
load_all_packs = 1;
617616
continue;
618617
}
619-
if(!strcmp(arg, "--verbose")) {
618+
if (!strcmp(arg, "--verbose")) {
620619
verbose = 1;
621620
continue;
622621
}
623-
if(!strcmp(arg, "--alt-odb")) {
622+
if (!strcmp(arg, "--alt-odb")) {
624623
alt_odb = 1;
625624
continue;
626625
}
627-
if(*arg == '-')
626+
if (*arg == '-')
628627
usage(pack_redundant_usage);
629628
else
630629
break;

remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ static int match_explicit(struct ref *src, struct ref *dst,
10381038
case 0:
10391039
if (!memcmp(dst_value, "refs/", 5))
10401040
matched_dst = make_linked_ref(dst_value, dst_tail);
1041-
else if((dst_guess = guess_ref(dst_value, matched_src)))
1041+
else if ((dst_guess = guess_ref(dst_value, matched_src)))
10421042
matched_dst = make_linked_ref(dst_guess, dst_tail);
10431043
else
10441044
error("unable to push to unqualified destination: %s\n"

0 commit comments

Comments
 (0)