From: Junio C Hamano <junkio@cox.net>
To: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Cc: Jakub Narebski <jnareb@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH 1/4] add mode parameter to get_sha1
Date: Sat, 21 Apr 2007 11:42:15 -0700 [thread overview]
Message-ID: <7vps5xtvqw.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: 1177158380197-git-send-email-mkoegler@auto.tuwien.ac.at
Martin Koegler <mkoegler@auto.tuwien.ac.at> writes:
> If the mode parameter is not NULL, get_sha1 will store
> the mode of the object in it.
Most existing callers pass NULL to this. Wouldn't it be cleaner
to have a new get_sha1_with_mode() function, and convert the
callers that care about mode to use it, like this?
int get_sha1(const char *str, unsigned char sha1[20]) {
unsigned discard;
return get_sha1_with_mode(str, sha1, &discard);
}
That way, your patch would be much easier to review and would
have less chance of getting it wrong. I wonder if [2/4] can be
made less impact using a similar trick. Most of the existing
callers that place objects in object_array do not know the mode.
Only some do.
+/* unknown mode */
+#define S_IFINVALID 0320000
+
This hunk does not belong to [1/4]; it is part of [2/4].
Typically S_IF$TYPE macros are masked with S_IFMT (0170000)
before being used, so the above value is *obviously* invalid,
but it also risks our code would treat it as a symlink, we do
the masking before comparison. I wonder if defining it to
S_IFMT mask itself might be a safer option.
next prev parent reply other threads:[~2007-04-21 18:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-21 12:26 [PATCH 1/4] add mode parameter to get_sha1 Martin Koegler
2007-04-21 12:26 ` [PATCH 2/4] add support for storing the mode in object_array Martin Koegler
2007-04-21 12:26 ` [PATCH 3/4] add mode to add_pending_object Martin Koegler
2007-04-21 12:26 ` [PATCH 4/4] use the mode information of the tree, if <SHA1>:file name syntax is used Martin Koegler
2007-04-21 18:42 ` Junio C Hamano [this message]
2007-04-21 20:02 ` [PATCH 1/4] add mode parameter to get_sha1 Alex Riesen
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=7vps5xtvqw.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
--cc=mkoegler@auto.tuwien.ac.at \
/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;
as well as URLs for NNTP newsgroup(s).