summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 03a9683)
raw | patch | inline | side by side (parent: 03a9683)
author | Junio C Hamano <gitster@pobox.com> | |
Sat, 28 Feb 2009 08:37:19 +0000 (00:37 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 28 Feb 2009 09:06:06 +0000 (01:06 -0800) |
Now is_kept_pack() is just a member lookup into a structure, we can write
it as such.
Also rewrite the sole caller of has_sha1_kept_pack() to switch on the
criteria the callee uses (namely, revs->kept_pack_only) between calling
has_sha1_kept_pack() and has_sha1_pack(), so that these two callees do not
have to take a pointer to struct rev_info as an argument.
This removes the header file dependency issue temporarily introduced by
the earlier commit, so we revert changes associated to that as well.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
it as such.
Also rewrite the sole caller of has_sha1_kept_pack() to switch on the
criteria the callee uses (namely, revs->kept_pack_only) between calling
has_sha1_kept_pack() and has_sha1_pack(), so that these two callees do not
have to take a pointer to struct rev_info as an argument.
This removes the header file dependency issue temporarily introduced by
the earlier commit, so we revert changes associated to that as well.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-pack-objects.c | patch | blob | history | |
cache.h | patch | blob | history | |
revision.c | patch | blob | history | |
revision.h | patch | blob | history | |
sha1_file.c | patch | blob | history |
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 150258b6290e55abfefd2b56ab012a2e2c20ae30..b2e46264ee432764a10c19f7624c8fe6d02a54e5 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
const unsigned char *sha1;
struct object *o;
- if (is_kept_pack(p))
+ if (p->pack_keep)
continue;
if (open_pack_index(p))
die("cannot open pack index");
const unsigned char *sha1;
for (p = packed_git; p; p = p->next) {
- if (is_kept_pack(p))
+ if (p->pack_keep)
continue;
if (open_pack_index(p))
index 23c16d0d99777cc9a6f23c6b23fb16d837b1742c..0a3d523d26fb802a512a32d5f6067c2140879693 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -566,6 +566,7 @@ extern int check_sha1_signature(const unsigned char *sha1, void *buf, unsigned l
extern int move_temp_to_file(const char *tmpfile, const char *filename);
extern int has_sha1_pack(const unsigned char *sha1);
+extern int has_sha1_kept_pack(const unsigned char *sha1);
extern int has_sha1_file(const unsigned char *sha1);
extern int has_loose_object_nonlocal(const unsigned char *sha1);
diff --git a/revision.c b/revision.c
index 3cfd6539aba3baa35375690d3cb723c1ba7a0fcf..6d8ac460817d3eef5019f9f27fc8b9ebc04322a2 100644 (file)
--- a/revision.c
+++ b/revision.c
@@ -1476,7 +1476,9 @@ enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit)
if (commit->object.flags & SHOWN)
return commit_ignore;
if (revs->unpacked &&
- has_sha1_kept_pack(commit->object.sha1, revs))
+ (revs->kept_pack_only
+ ? has_sha1_kept_pack(commit->object.sha1)
+ : has_sha1_pack(commit->object.sha1)))
return commit_ignore;
if (revs->show_all)
return commit_show;
diff --git a/revision.h b/revision.h
index f63596ff45a120f38abfdb3d6ac2e84691b8ddc3..b9fa9c2a67d56355fcd8cc9d471d70767473760c 100644 (file)
--- a/revision.h
+++ b/revision.h
extern enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit);
-extern int has_sha1_kept_pack(const unsigned char *sha1, const struct rev_info *);
-extern int is_kept_pack(const struct packed_git *);
-
#endif
diff --git a/sha1_file.c b/sha1_file.c
index e8a9517d01d3ff671c4c72215d64153fb9098e8a..7ead56cc3ef8e96e2ddda1dc77cc83cb6946e7fc 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
#include "refs.h"
#include "pack-revindex.h"
#include "sha1-lookup.h"
-#include "diff.h"
-#include "revision.h"
#ifndef O_NOATIME
#if defined(__linux__) && (defined(__i386__) || defined(__PPC__))
return 0;
}
-int is_kept_pack(const struct packed_git *p)
-{
- return p->pack_keep;
-}
-
static int find_pack_ent(const unsigned char *sha1, struct pack_entry *e,
- const struct rev_info *revs)
+ int kept_pack_only)
{
static struct packed_git *last_found = (void *)1;
struct packed_git *p;
p = (last_found == (void *)1) ? packed_git : last_found;
do {
- if (revs->kept_pack_only && !is_kept_pack(p))
+ if (kept_pack_only && !p->pack_keep)
goto next;
if (p->num_bad_objects) {
unsigned i;
static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)
{
- return find_pack_ent(sha1, e, NULL);
+ return find_pack_ent(sha1, e, 0);
}
-static int find_kept_pack_entry(const unsigned char *sha1, struct pack_entry *e,
- const struct rev_info *revs)
+static int find_kept_pack_entry(const unsigned char *sha1, struct pack_entry *e)
{
- return find_pack_ent(sha1, e, revs);
+ return find_pack_ent(sha1, e, 1);
}
struct packed_git *find_sha1_pack(const unsigned char *sha1,
return find_pack_entry(sha1, &e);
}
-int has_sha1_kept_pack(const unsigned char *sha1, const struct rev_info *revs)
+int has_sha1_kept_pack(const unsigned char *sha1)
{
struct pack_entry e;
- return find_kept_pack_entry(sha1, &e, revs);
+ return find_kept_pack_entry(sha1, &e);
}
int has_sha1_file(const unsigned char *sha1)