Skip to content

Commit 152a9c1

Browse files
committed
Merge branch 'fc/trivial'
A random collection of style fixes and minor doc updates. * fc/trivial: setup: trivial style fixes run-command: trivial style fixes diff: trivial style fix revision: trivial style fixes pretty: trivial style fix describe: trivial style fixes transport-helper: trivial style fix sha1-name: trivial style cleanup branch: trivial style fix revision: add missing include doc/pull: clarify the illustrations t: replace pulls with merges merge: simplify ff-only option
2 parents f26f72d + abf03ee commit 152a9c1

16 files changed

+30
-41
lines changed

Documentation/git-pull.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Assume the following history exists and the current branch is
4242
A---B---C master on origin
4343
/
4444
D---E---F---G master
45+
^
46+
origin/master in your repository
4547
------------
4648

4749
Then "`git pull`" will fetch and replay the changes from the remote
@@ -51,7 +53,7 @@ result in a new commit along with the names of the two parent commits
5153
and a log message from the user describing the changes.
5254

5355
------------
54-
A---B---C remotes/origin/master
56+
A---B---C origin/master
5557
/ \
5658
D---E---F---G---H master
5759
------------

builtin/branch.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,9 +975,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
975975
die(_("no such branch '%s'"), argv[0]);
976976
}
977977

978-
if (!branch_has_merge_config(branch)) {
978+
if (!branch_has_merge_config(branch))
979979
die(_("Branch '%s' has no upstream information"), branch->name);
980-
}
981980

982981
strbuf_addf(&buf, "branch.%s.remote", branch->name);
983982
git_config_set_multivar(buf.buf, NULL, NULL, 1);

builtin/describe.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "hash.h"
1010
#include "argv-array.h"
1111

12-
#define SEEN (1u<<0)
12+
#define SEEN (1u << 0)
1313
#define MAX_TAGS (FLAG_BITS - 1)
1414

1515
static const char * const describe_usage[] = {
@@ -36,7 +36,6 @@ static const char *diff_index_args[] = {
3636
"diff-index", "--quiet", "HEAD", "--", NULL
3737
};
3838

39-
4039
struct commit_name {
4140
struct commit_name *next;
4241
unsigned char peeled[20];
@@ -46,6 +45,7 @@ struct commit_name {
4645
unsigned char sha1[20];
4746
char *path;
4847
};
48+
4949
static const char *prio_names[] = {
5050
"head", "lightweight", "annotated",
5151
};
@@ -488,9 +488,8 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
488488
} else if (dirty) {
489489
die(_("--dirty is incompatible with commit-ishes"));
490490
} else {
491-
while (argc-- > 0) {
491+
while (argc-- > 0)
492492
describe(*argv++, argc == 0);
493-
}
494493
}
495494
return 0;
496495
}

builtin/diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static int builtin_diff_tree(struct rev_info *revs,
169169
if (ent1->item->flags & UNINTERESTING)
170170
swap = 1;
171171
sha1[swap] = ent0->item->sha1;
172-
sha1[1-swap] = ent1->item->sha1;
172+
sha1[1 - swap] = ent1->item->sha1;
173173
diff_tree_sha1(sha1[0], sha1[1], "", &revs->diffopt);
174174
log_tree_diff_flush(revs);
175175
return 0;

builtin/merge.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,6 @@ static int option_parse_n(const struct option *opt,
186186
return 0;
187187
}
188188

189-
static int option_parse_ff_only(const struct option *opt,
190-
const char *arg, int unset)
191-
{
192-
fast_forward = FF_ONLY;
193-
return 0;
194-
}
195-
196189
static struct option builtin_merge_options[] = {
197190
{ OPTION_CALLBACK, 'n', NULL, NULL, NULL,
198191
N_("do not show a diffstat at the end of the merge"),
@@ -210,9 +203,9 @@ static struct option builtin_merge_options[] = {
210203
OPT_BOOL('e', "edit", &option_edit,
211204
N_("edit message before committing")),
212205
OPT_SET_INT(0, "ff", &fast_forward, N_("allow fast-forward (default)"), FF_ALLOW),
213-
{ OPTION_CALLBACK, 0, "ff-only", NULL, NULL,
206+
{ OPTION_SET_INT, 0, "ff-only", &fast_forward, NULL,
214207
N_("abort if fast-forward is not possible"),
215-
PARSE_OPT_NOARG | PARSE_OPT_NONEG, option_parse_ff_only },
208+
PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, FF_ONLY },
216209
OPT_RERERE_AUTOUPDATE(&allow_rerere_auto),
217210
OPT_BOOL(0, "verify-signatures", &verify_signatures,
218211
N_("Verify that the named commit has a valid GPG signature")),

pretty.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ void pp_user_info(struct pretty_print_context *pp,
497497
static int is_empty_line(const char *line, int *len_p)
498498
{
499499
int len = *len_p;
500-
while (len && isspace(line[len-1]))
500+
while (len && isspace(line[len - 1]))
501501
len--;
502502
*len_p = len;
503503
return !len;

revision.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ struct cmdline_pathspec {
15191519
static void append_prune_data(struct cmdline_pathspec *prune, const char **av)
15201520
{
15211521
while (*av) {
1522-
ALLOC_GROW(prune->path, prune->nr+1, prune->alloc);
1522+
ALLOC_GROW(prune->path, prune->nr + 1, prune->alloc);
15231523
prune->path[prune->nr++] = *(av++);
15241524
}
15251525
}
@@ -1531,7 +1531,7 @@ static void read_pathspec_from_stdin(struct rev_info *revs, struct strbuf *sb,
15311531
int len = sb->len;
15321532
if (len && sb->buf[len - 1] == '\n')
15331533
sb->buf[--len] = '\0';
1534-
ALLOC_GROW(prune->path, prune->nr+1, prune->alloc);
1534+
ALLOC_GROW(prune->path, prune->nr + 1, prune->alloc);
15351535
prune->path[prune->nr++] = xstrdup(sb->buf);
15361536
}
15371537
}
@@ -2134,7 +2134,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
21342134
* call init_pathspec() to set revs->prune_data here.
21352135
* }
21362136
*/
2137-
ALLOC_GROW(prune_data.path, prune_data.nr+1, prune_data.alloc);
2137+
ALLOC_GROW(prune_data.path, prune_data.nr + 1, prune_data.alloc);
21382138
prune_data.path[prune_data.nr++] = NULL;
21392139
parse_pathspec(&revs->prune_data, 0, 0,
21402140
revs->prefix, prune_data.path);
@@ -2987,7 +2987,7 @@ static struct commit *get_revision_internal(struct rev_info *revs)
29872987
if (revs->max_count) {
29882988
c = get_revision_1(revs);
29892989
if (c) {
2990-
while (0 < revs->skip_count) {
2990+
while (revs->skip_count > 0) {
29912991
revs->skip_count--;
29922992
c = get_revision_1(revs);
29932993
if (!c)
@@ -3002,9 +3002,8 @@ static struct commit *get_revision_internal(struct rev_info *revs)
30023002
if (c)
30033003
c->object.flags |= SHOWN;
30043004

3005-
if (!revs->boundary) {
3005+
if (!revs->boundary)
30063006
return c;
3007-
}
30083007

30093008
if (!c) {
30103009
/*
@@ -3050,9 +3049,8 @@ struct commit *get_revision(struct rev_info *revs)
30503049

30513050
if (revs->reverse) {
30523051
reversed = NULL;
3053-
while ((c = get_revision_internal(revs))) {
3052+
while ((c = get_revision_internal(revs)))
30543053
commit_list_insert(c, &reversed);
3055-
}
30563054
revs->commits = reversed;
30573055
revs->reverse = 0;
30583056
revs->reverse_output_stage = 1;

revision.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "grep.h"
66
#include "notes.h"
77
#include "commit.h"
8+
#include "diff.h"
89

910
#define SEEN (1u<<0)
1011
#define UNINTERESTING (1u<<1)

run-command.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -406,13 +406,12 @@ int start_command(struct child_process *cmd)
406406
unsetenv(*cmd->env);
407407
}
408408
}
409-
if (cmd->git_cmd) {
409+
if (cmd->git_cmd)
410410
execv_git_cmd(cmd->argv);
411-
} else if (cmd->use_shell) {
411+
else if (cmd->use_shell)
412412
execv_shell_cmd(cmd->argv);
413-
} else {
413+
else
414414
sane_execvp(cmd->argv[0], (char *const*) cmd->argv);
415-
}
416415
if (errno == ENOENT) {
417416
if (!cmd->silent_exec_failure)
418417
error("cannot run %s: %s", cmd->argv[0],
@@ -446,7 +445,6 @@ int start_command(struct child_process *cmd)
446445
cmd->pid = -1;
447446
}
448447
close(notify_pipe[0]);
449-
450448
}
451449
#else
452450
{
@@ -480,11 +478,10 @@ int start_command(struct child_process *cmd)
480478
if (cmd->env)
481479
env = make_augmented_environ(cmd->env);
482480

483-
if (cmd->git_cmd) {
481+
if (cmd->git_cmd)
484482
cmd->argv = prepare_git_cmd(cmd->argv);
485-
} else if (cmd->use_shell) {
483+
else if (cmd->use_shell)
486484
cmd->argv = prepare_shell_cmd(cmd->argv);
487-
}
488485

489486
cmd->pid = mingw_spawnvpe(cmd->argv[0], cmd->argv, env, cmd->dir,
490487
fhin, fhout, fherr);

setup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
563563
{
564564
const char *env_ceiling_dirs = getenv(CEILING_DIRECTORIES_ENVIRONMENT);
565565
struct string_list ceiling_dirs = STRING_LIST_INIT_DUP;
566-
static char cwd[PATH_MAX+1];
566+
static char cwd[PATH_MAX + 1];
567567
const char *gitdirenv, *ret;
568568
char *gitfile;
569569
int len, offset, offset_parent, ceil_offset = -1;
@@ -578,7 +578,7 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
578578
if (nongit_ok)
579579
*nongit_ok = 0;
580580

581-
if (!getcwd(cwd, sizeof(cwd)-1))
581+
if (!getcwd(cwd, sizeof(cwd) - 1))
582582
die_errno("Unable to read current working directory");
583583
offset = len = strlen(cwd);
584584

0 commit comments

Comments
 (0)