Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Geert Bosch <bosch@gnat.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] create_directories: simplify and avoid repeated copying
Date: Sat, 14 Apr 2007 07:11:14 -0700	[thread overview]
Message-ID: <7vlkgv9hbx.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20070414013003.B0B4C2F1DC3@geert-boschs-computer.local> (Geert Bosch's message of "Thu, 12 Apr 2007 16:29:10 -0400")

Geert Bosch <bosch@gnat.com> writes:

> Signed-off-by: Geert Bosch <bosch@gnat.com>
> ---
> I needed to change the logic of this function a bit for
> doing some local hacks^Wmodifications and thought it might
> be a slight improvement/simplification.
> No change in functionality and passed 'make test'.

I like the removal of repeated copying, but I wonder if the
denser condition is really easier to read.

I tried to like it, but I needed to reindent it first, and then
I needed to read it three times to convince myself that they are
equivalent.

        if (errno != EEXIST
            || ((!force || unlink(buf) || mkdir(buf, 0777))
                && (stat(buf, &st) || !S_ISDIR(st.st_mode))) )
                die("cannot create directory at %s", buf);

In the end, I managed to convince myself that this denser
version is doing the same thing as the original, and it is nicer
to see it in only three lines, I am not sure if it is easier to
read anymore, judging from the time it took me to reach that
conclusion...

      reply	other threads:[~2007-04-14 14:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-12 20:29 [PATCH] create_directories: simplify and avoid repeated copying Geert Bosch
2007-04-14 14:11 ` Junio C Hamano [this message]

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=7vlkgv9hbx.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=bosch@gnat.com \
    --cc=git@vger.kernel.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox