From: Wang Hui <Hui.Wang@windriver.com>
To: <gitster@pobox.com>, <git@vger.kernel.org>, <tali@admingilde.org>
Subject: [PATCH v2 2/5] sha1_file: remove a buggy value setting
Date: Tue, 6 Sep 2011 18:24:02 +0800 [thread overview]
Message-ID: <1315304645-12009-3-git-send-email-Hui.Wang@windriver.com> (raw)
In-Reply-To: <1315304645-12009-2-git-send-email-Hui.Wang@windriver.com>
From: Hui Wang <Hui.Wang@windriver.com>
The ent->base[] is a character array, it has pfxlen characters from
position 0 to (pfxlen-1) to contain an alt object dir name, the
position pfxlen should be the string terminating character '\0' and
is deliberately set to '\0' at the previous code line. The position
(pfxlen+1) is given to ent->name.
>From above analysis, there is no reason to set ent->base[pfxlen] to
'/' at the end of this function, first it doesn't make sense to append
a '/' at the end of a dir name, second if you are not lucky that the
ent->base[pfxlen+1] is not 0, you will get a wrong alt object dir
name.
Signed-off-by: Hui Wang <Hui.Wang@windriver.com>
---
sha1_file.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index d12a675..5940d84 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -304,8 +304,6 @@ static int link_alt_odb_entry(const char * entry, int len, const char * relative
/* recursively add alternates */
read_info_alternates(ent->base, depth + 1);
- ent->base[pfxlen] = '/';
-
return 0;
}
--
1.6.3.1
next prev parent reply other threads:[~2011-09-06 10:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-06 10:24 [PATCH v2 0/5] sha1_file: remove only current repository can have relative path limitation Wang Hui
2011-09-06 10:24 ` [PATCH v2 1/5] sha1_file cleanup: remove redundant variable check Wang Hui
2011-09-06 10:24 ` Wang Hui [this message]
2011-09-06 10:24 ` [PATCH v2 3/5] sha1_file: improve directories comparison method Wang Hui
2011-09-06 10:24 ` [PATCH v2 4/5] sha1_file: remove relative entries limitation Wang Hui
2011-09-06 10:24 ` [PATCH v2 5/5] t5710: add testcase for multi-level relative alternates Wang Hui
2011-09-06 16:32 ` [PATCH v2 3/5] sha1_file: improve directories comparison method Junio C Hamano
2011-09-06 16:26 ` [PATCH v2 2/5] sha1_file: remove a buggy value setting Junio C Hamano
2011-09-07 9:55 ` wanghui
2011-09-06 16:59 ` [PATCH v2 1/5] sha1_file cleanup: remove redundant variable check Junio C Hamano
2011-09-07 10:24 ` wanghui
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=1315304645-12009-3-git-send-email-Hui.Wang@windriver.com \
--to=hui.wang@windriver.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=tali@admingilde.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;
as well as URLs for NNTP newsgroup(s).