From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: [PATCH 1/4] Fix tree-walking compare_entry() in the presense of --prefix
Date: Thu, 6 Mar 2008 15:44:48 -0800 [thread overview]
Message-ID: <76edcf443909a95e2c391e23390a963f9a417dee.1204856187.git.torvalds@linux-foundation.org> (raw)
In-Reply-To: <cover.1204856187.git.torvalds@linux-foundation.org>
When we make the "root" tree-walk info entry have a pathname in it, we
need to have a ->prev pointer so that compare_entry will actually notice
and traverse into the root.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
tree-walk.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/tree-walk.c b/tree-walk.c
index 842cb6a..02e2aed 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -107,6 +107,7 @@ int tree_entry(struct tree_desc *desc, struct name_entry *entry)
void setup_traverse_info(struct traverse_info *info, const char *base)
{
int pathlen = strlen(base);
+ static struct traverse_info dummy;
memset(info, 0, sizeof(*info));
if (pathlen && base[pathlen-1] == '/')
@@ -114,6 +115,8 @@ void setup_traverse_info(struct traverse_info *info, const char *base)
info->pathlen = pathlen ? pathlen + 1 : 0;
info->name.path = base;
info->name.sha1 = (void *)(base + pathlen + 1);
+ if (pathlen)
+ info->prev = &dummy;
}
char *make_traverse_path(char *path, const struct traverse_info *info, const struct name_entry *n)
--
1.5.4.3.452.g67136
next prev parent reply other threads:[~2008-03-07 2:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-07 2:16 [PATCH 0/4] Make unpack_trees() do separate source and destination indexes Linus Torvalds
2008-03-06 20:26 ` [PATCH 3/4] Make 'unpack_trees()' take the index to work on as an argument Linus Torvalds
2008-03-06 20:46 ` [PATCH 2/4] Add 'const' where appropriate to index handling functions Linus Torvalds
2008-03-06 23:44 ` Linus Torvalds [this message]
2008-03-07 2:12 ` [PATCH 4/4] Make 'unpack_trees()' have a separate source and destination index Linus Torvalds
2008-03-07 14:13 ` Johannes Schindelin
2008-03-07 17:32 ` Linus Torvalds
2008-03-07 21:11 ` Daniel Barkalow
2008-03-07 21:48 ` Linus Torvalds
2008-03-07 5:45 ` [PATCH 0/4] Make unpack_trees() do separate source and destination indexes Junio C Hamano
2008-03-07 17:46 ` Linus Torvalds
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=76edcf443909a95e2c391e23390a963f9a417dee.1204856187.git.torvalds@linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
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).