C: have space around && and || operators
authorJunio C Hamano <gitster@pobox.com>
Wed, 16 Oct 2013 17:26:39 +0000 (10:26 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 16 Oct 2013 17:26:39 +0000 (10:26 -0700)
Correct all hits from

git grep -e '\(&&\|||\)[^ ]' -e '[^ ]\(&&\|||\)' -- '*.c'

i.e. && or || operators that are followed by anything but a SP,
or that follow something other than a SP or a HT, so that these
operators have a SP around it when necessary.

We usually refrain from making this kind of a tree-wide change in
order to avoid unnecessary conflicts with other "real work" patches,
but in this case, the end result does not have a potentially
cumbersome tree-wide impact, while this is a tree-wide cleanup.

Fixes to compat/regex/regcomp.c and xdiff/xemit.c are to replace a
HT immediately after && with a SP.

This is based on Felipe's patch to bultin/symbolic-ref.c; I did all
the finding out what other files in the whole tree need to be fixed
and did the fix and also the log message while reviewing that single
liner, so any screw-ups in this version are mine.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/read-tree.c
builtin/rev-list.c
builtin/symbolic-ref.c
compat/regex/regcomp.c
xdiff/xemit.c
index 0f5d7fe23f5b1e15e24e93daed68ece7542cf104..0d7ef847a70581214fb88c3a981581670f7decbe 100644 (file)
@@ -178,7 +178,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
 
        if (1 < opts.index_only + opts.update)
                die("-u and -i at the same time makes no sense");
-       if ((opts.update||opts.index_only) && !opts.merge)
+       if ((opts.update || opts.index_only) && !opts.merge)
                die("%s is meaningless without -m, --reset, or --prefix",
                    opts.update ? "-u" : "-i");
        if ((opts.dir && !opts.update))
index 4fc16166374b86927e605ccbfe341aebe0e3240f..0745e2d05330d21152f2aff720d0de338270aa6d 100644 (file)
@@ -322,7 +322,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
                revs.commit_format = CMIT_FMT_RAW;
 
        if ((!revs.commits &&
-            (!(revs.tag_objects||revs.tree_objects||revs.blob_objects) &&
+            (!(revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
              !revs.pending.nr)) ||
            revs.diff)
                usage(rev_list_usage);
index f48195942123692c95ad8e5585f853ad54a3dbe4..71286b4fae4792dce73ab1533204e803e2a61334 100644 (file)
@@ -47,7 +47,7 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
        git_config(git_default_config, NULL);
        argc = parse_options(argc, argv, prefix, options,
                             git_symbolic_ref_usage, 0);
-       if (msg &&!*msg)
+       if (msg && !*msg)
                die("Refusing to perform update with empty message");
 
        if (delete) {
index b2c5d465acd2bd37c1d316353eae544e564fc334..06f30887080bc293994ed470ff9b313ae048dcfb 100644 (file)
@@ -339,7 +339,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
              p = buf;
              *p++ = dfa->nodes[node].opr.c;
              while (++node < dfa->nodes_len
-                    && dfa->nodes[node].type == CHARACTER
+                    && dfa->nodes[node].type == CHARACTER
                     && dfa->nodes[node].mb_partial)
                *p++ = dfa->nodes[node].opr.c;
              memset (&state, '\0', sizeof (state));
index 4d8645867e7d0103d49882877a7e4a8abacd24ea..4266ada23f3c37c1989c7fa4283b423d16c0891b 100644 (file)
@@ -108,7 +108,7 @@ static long def_ff(const char *rec, long len, char *buf, long sz, void *priv)
 {
        if (len > 0 &&
                        (isalpha((unsigned char)*rec) || /* identifier? */
-                        *rec == '_' || /* also identifier? */
+                        *rec == '_' || /* also identifier? */
                         *rec == '$')) { /* identifiers from VMS and other esoterico */
                if (len > sz)
                        len = sz;