From: Jared Hance <jaredhance@gmail•com>
To: git@vger•kernel.org
Subject: Re: [PATCH 1/3] Use startup_info->prefix rather than prefix.
Date: Sat, 3 Mar 2012 23:23:09 +0000 (UTC) [thread overview]
Message-ID: <loom.20120304T002121-25@post.gmane.org> (raw)
In-Reply-To: 7vbood742a.fsf@alter.siamese.dyndns.org
Junio C Hamano <gitster <at> pobox.com> writes:
> Hrm, that explanation is understandable, but it strongly makes me suspect
> that this change is making the code _more_ error prone in the longer term.
>
> When somebody wants to add a new caller to a non-builtin, they need to
> think about what prefix to pass, and would realize that they need to call
> setup_git_directory() to get it. With the updated code, they can totally
> forget and call it without any initialized startup_info.
>
> Adding a totally new command is rare, new non-builtin is rarer, and adding
> trace to it is even more so, so it may not be worth worrying about, but I
> wonder if there is a cheap way to check such a programming mistake.
>
Well, there are really four options:
- Old code, where user must pass in prefix
- New code, where user must call setup_git_directory()
- Have the function deliver a nice diagnostic error message if startup_info
hasn't been initialized
- Have the function call setup_git_directory() if startup_info hasn't been
initialized
I think one of the latter two is the most sane here.
next prev parent reply other threads:[~2012-03-03 23:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-03 2:31 [PATCH 0/3] Fix some documented fixmes Jared Hance
2012-03-03 2:31 ` [PATCH 1/3] Use startup_info->prefix rather than prefix Jared Hance
2012-03-03 7:30 ` Junio C Hamano
2012-03-03 9:50 ` Nguyen Thai Ngoc Duy
2012-03-03 21:44 ` Junio C Hamano
2012-03-03 23:23 ` Jared Hance [this message]
2012-03-03 2:31 ` [PATCH 2/3] Fix memory leak in apply_patch in apply.c Jared Hance
2012-03-03 7:41 ` Junio C Hamano
2012-03-03 2:31 ` [PATCH 3/3] Add threaded versions of functions in symlinks.c Jared Hance
2012-03-03 7:55 ` Junio C Hamano
2012-03-03 14:40 ` [PATCH v2 0/3] Fix a few documents fixmes Jared Hance
2012-03-03 14:40 ` [PATCH v2 1/3] Use startup_info->prefix rather than prefix Jared Hance
2012-03-03 14:47 ` Jeff Epler
2012-03-03 14:40 ` [PATCH v2 2/3] Fix memory leak in apply_patch in apply.c Jared Hance
2012-03-03 15:05 ` Jared Hance
2012-03-03 21:51 ` Junio C Hamano
2012-03-03 14:40 ` [PATCH v2 3/3] Add threaded versions of functions in symlinks.c Jared Hance
2012-03-05 11:00 ` Thomas Rast
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=loom.20120304T002121-25@post.gmane.org \
--to=jaredhance@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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