From: Jeff King <peff@peff.net>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Stefan Beller <sbeller@google.com>,
Junio C Hamano <gitster@pobox.com>,
Git List <git@vger.kernel.org>,
Jonathan Nieder <jrnieder@gmail.com>,
Johannes Schindelin <johannes.schindelin@gmail.com>,
Jens Lehmann <Jens.Lehmann@web.de>
Subject: Re: [PATCHv4 3/3] submodule: implement `clone` as a builtin helper
Date: Tue, 1 Sep 2015 15:05:06 -0400 [thread overview]
Message-ID: <20150901190506.GA8254@sigill.intra.peff.net> (raw)
In-Reply-To: <CAPig+cRxQdquKZXdmpiZjj8JFB2wdCE4UcbW6qYUwvtZsVw=ug@mail.gmail.com>
On Tue, Sep 01, 2015 at 02:52:54PM -0400, Eric Sunshine wrote:
> > + /* Redirect the worktree of the submodule in the superproject's config */
> > + if (strbuf_getcwd(&sb))
> > + die_errno(_("unable to get current working directory"));
> > +
> > + if (!is_absolute_path(sm_gitdir)) {
> > + if (strbuf_getcwd(&sb))
> > + die_errno(_("unable to get current working directory"));
>
> Why does this need to call getcwd() on 'sb' when it was called
> immediately above the conditional and its value hasn't changed?
Even weirder, the next code is:
>
> > + strbuf_addf(&sb, "/%s", sm_gitdir);
> > + free(sm_gitdir);
> > + sm_gitdir = strbuf_detach(&sb, NULL);
> > + }
> > +
> > +
> > + strbuf_addf(&sb, "/%s", path);
So if it _was_ an absolute path, we are adding "/$path" to nothing
(having just detached the strbuf in the conditional above). That seems
weird.
-Peff
next prev parent reply other threads:[~2015-09-01 19:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-01 18:24 [PATCHv4 0/3] submodule--helper: Have some refactoring only patches first Stefan Beller
2015-09-01 18:24 ` [PATCHv4 1/3] submodule: implement `list` as a builtin helper Stefan Beller
2015-09-01 19:55 ` Junio C Hamano
2015-09-02 7:20 ` Junio C Hamano
2015-09-01 23:17 ` Eric Sunshine
2015-09-01 18:24 ` [PATCHv4 2/3] submodule: implement `name` " Stefan Beller
2015-09-01 19:01 ` Eric Sunshine
2015-09-01 18:24 ` [PATCHv4 3/3] submodule: implement `clone` " Stefan Beller
2015-09-01 18:52 ` Eric Sunshine
2015-09-01 19:05 ` Jeff King [this message]
2015-09-01 19:15 ` Eric Sunshine
2015-09-01 19:13 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150901190506.GA8254@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmail.com \
--cc=jrnieder@gmail.com \
--cc=sbeller@google.com \
--cc=sunshine@sunshineco.com \
/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://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).