From: Martin Koegler <mkoegler@auto.tuwien.ac.at>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org, Martin Koegler <mkoegler@auto.tuwien.ac.at>
Subject: [PATCH 4/5] store mode in rev_list, if <tree>:<filename> syntax is used
Date: Sun, 22 Apr 2007 18:43:59 +0200 [thread overview]
Message-ID: <11772602401214-git-send-email-mkoegler@auto.tuwien.ac.at> (raw)
In-Reply-To: <1177260240928-git-send-email-mkoegler@auto.tuwien.ac.at>
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
---
revision.c | 17 ++++++++++++-----
revision.h | 1 +
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/revision.c b/revision.c
index ce70f48..49bd292 100644
--- a/revision.c
+++ b/revision.c
@@ -116,9 +116,14 @@ void mark_parents_uninteresting(struct commit *commit)
void add_pending_object(struct rev_info *revs, struct object *obj, const char *name)
{
+ add_pending_object_with_mode(revs, obj, name, S_IFINVALID);
+}
+
+void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode)
+{
if (revs->no_walk && (obj->flags & UNINTERESTING))
die("object ranges do not make sense when not walking revisions");
- add_object_array(obj, name, &revs->pending);
+ add_object_array_with_mode(obj, name, &revs->pending, mode);
if (revs->reflog_info && obj->type == OBJ_COMMIT)
add_reflog_for_walk(revs->reflog_info,
(struct commit *)obj, name);
@@ -723,6 +728,7 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
int flags,
int cant_be_filename)
{
+ unsigned mode;
char *dotdot;
struct object *object;
unsigned char sha1[20];
@@ -796,12 +802,12 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
local_flags = UNINTERESTING;
arg++;
}
- if (get_sha1(arg, sha1))
+ if (get_sha1_with_mode(arg, sha1, &mode))
return -1;
if (!cant_be_filename)
verify_non_filename(revs->prefix, arg);
object = get_reference(revs, arg, sha1, flags ^ local_flags);
- add_pending_object(revs, object, arg);
+ add_pending_object_with_mode(revs, object, arg, mode);
return 0;
}
@@ -1177,10 +1183,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
if (def && !revs->pending.nr) {
unsigned char sha1[20];
struct object *object;
- if (get_sha1(def, sha1))
+ unsigned mode;
+ if (get_sha1_with_mode(def, sha1, &mode))
die("bad default revision '%s'", def);
object = get_reference(revs, def, sha1, 0);
- add_pending_object(revs, object, def);
+ add_pending_object_with_mode(revs, object, def, mode);
}
if (revs->topo_order)
diff --git a/revision.h b/revision.h
index 8a02618..5b41e2d 100644
--- a/revision.h
+++ b/revision.h
@@ -131,5 +131,6 @@ extern void add_object(struct object *obj,
const char *name);
extern void add_pending_object(struct rev_info *revs, struct object *obj, const char *name);
+extern void add_pending_object_with_mode(struct rev_info *revs, struct object *obj, const char *name, unsigned mode);
#endif
--
1.5.1.1.206.g4a12-dirty
next prev parent reply other threads:[~2007-04-22 16:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-22 16:43 [PATCH 1/5] Add S_IFINVALID mode Martin Koegler
2007-04-22 16:43 ` [PATCH 2/5] add get_sha1_with_mode Martin Koegler
2007-04-22 16:43 ` [PATCH 3/5] add add_object_array_with_mode Martin Koegler
2007-04-22 16:43 ` Martin Koegler [this message]
2007-04-22 16:44 ` [PATCH 5/5] use mode of the tree in git-diff, if <tree>:<file> syntax is used Martin Koegler
2007-04-23 2:33 ` [PATCH 2/5] add get_sha1_with_mode Junio C Hamano
2007-04-22 17:47 ` [PATCH 1/5] Add S_IFINVALID mode 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11772602401214-git-send-email-mkoegler@auto.tuwien.ac.at \
--to=mkoegler@auto.tuwien.ac.at \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/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).