zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Cc: Doron Behar <doron.behar@gmail.com>
Subject: Re: [PATCH 1/1] Squashed commit of the following:
Date: Thu, 07 Jun 2018 17:59:59 +0200	[thread overview]
Message-ID: <18086.1528387199@thecus> (raw)
In-Reply-To: <20180605154121.tfrw6oheq3ce6qkr@NUC.doronbehar.com>

Doron Behar wrote:
> The idea with the 1st condition that tests the existence of the
> manifests files, is that if non of them exists (which usually never
> happens if luarocks is installed properly), is that only one of them is
> needed for continuing with the modification date of them vs the cache
> file..

Okay, that makes sense.

> 	local cache_status=1
> 	if [[ -f ${cache_file} ]]; then
> 	  if [[ -f ${user_manifest_file} ]]; then
> 	    if [[ ${user_manifest_file} -nt ${cache_file} ]]; then
> 	      cache_status=0
> 	    fi
> 	  fi
> 	  if [[ -f ${system_manifest_file} ]]; then
> 	    if [[ ${system_manifest_file} -nt ${cache_file} ]]; then
> 	      cache_status=0
> 	    else
> 	      cache_status=1

As you've initialised cache_status to 1, this else branch is
superfluous.

> 	    fi
> 	  fi
> 	fi
> 	return cache_status
>
> Better?

Yes. Much more readable.

I look forward to the final function.

Oliver


  reply	other threads:[~2018-06-07 16:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-26 16:14 [PATCH 0/1] *** Add luarocks completion *** doron.behar
2018-05-26 16:14 ` [PATCH 1/1] Squashed commit of the following: doron.behar
2018-05-28 10:48   ` Oliver Kiddle
2018-05-29 15:38     ` Doron Behar
2018-05-29 22:00       ` Oliver Kiddle
2018-05-30 12:47         ` Doron Behar
2018-05-30 15:43           ` Oliver Kiddle
2018-06-01  7:18             ` Doron Behar
2018-06-01 13:30               ` Doron Behar
2018-06-01 22:45                 ` Oliver Kiddle
2018-06-03 21:46                   ` Daniel Shahaf
2018-06-05 15:41                   ` Doron Behar
2018-06-07 15:59                     ` Oliver Kiddle [this message]
2018-06-07 16:20                       ` Doron Behar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18086.1528387199@thecus \
    --to=okiddle@yahoo.co.uk \
    --cc=doron.behar@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).