Skip to content

Commit

Permalink
Merge branch 'rs/logical-vs-binary-or'
Browse files Browse the repository at this point in the history
Code cleanup.

* rs/logical-vs-binary-or:
  use logical OR (||) instead of binary OR (|) in logical context
  • Loading branch information
Junio C Hamano committed Jun 20, 2013
2 parents 73018c0 + 0b437a1 commit 02dfccf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion builtin/apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -3525,7 +3525,7 @@ static int check_patch(struct patch *patch)
ok_if_exists = 0;

if (new_name &&
((0 < patch->is_new) | (0 < patch->is_rename) | patch->is_copy)) {
((0 < patch->is_new) || patch->is_rename || patch->is_copy)) {
int err = check_to_create(new_name, ok_if_exists);

if (err && threeway) {
Expand Down
8 changes: 4 additions & 4 deletions builtin/ls-files.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ static void show_files(struct dir_struct *dir)
if (show_killed)
show_killed_files(dir);
}
if (show_cached | show_stage) {
if (show_cached || show_stage) {
for (i = 0; i < active_nr; i++) {
struct cache_entry *ce = active_cache[i];
if ((dir->flags & DIR_SHOW_IGNORED) &&
Expand All @@ -233,7 +233,7 @@ static void show_files(struct dir_struct *dir)
(ce_skip_worktree(ce) ? tag_skip_worktree : tag_cached), ce);
}
}
if (show_deleted | show_modified) {
if (show_deleted || show_modified) {
for (i = 0; i < active_nr; i++) {
struct cache_entry *ce = active_cache[i];
struct stat st;
Expand Down Expand Up @@ -571,8 +571,8 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
die("ls-files --ignored needs some exclude pattern");

/* With no flags, we default to showing the cached files */
if (!(show_stage | show_deleted | show_others | show_unmerged |
show_killed | show_modified | show_resolve_undo))
if (!(show_stage || show_deleted || show_others || show_unmerged ||
show_killed || show_modified || show_resolve_undo))
show_cached = 1;

if (max_prefix)
Expand Down
2 changes: 1 addition & 1 deletion builtin/merge-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, options, merge_base_usage, 0);
if (!octopus && !reduce && argc < 2)
usage_with_options(merge_base_usage, options);
if (is_ancestor && (show_all | octopus | reduce))
if (is_ancestor && (show_all || octopus || reduce))
die("--is-ancestor cannot be used with other options");
if (is_ancestor)
return handle_is_ancestor(argc, argv);
Expand Down

0 comments on commit 02dfccf

Please sign in to comment.