summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 386cb77)
raw | patch | inline | side by side (parent: 386cb77)
author | Junio C Hamano <gitster@pobox.com> | |
Sat, 28 Feb 2009 08:00:21 +0000 (00:00 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 28 Feb 2009 09:06:06 +0000 (01:06 -0800) |
This removes --unpacked=<packfile> parameter from the revision parser, and
rewrites its use in git-repack to pass a single --kept-pack-only option
instead.
The new --kept-pack-only option means just that. When this option is
given, is_kept_pack() that used to say "not on the --unpacked=<packfile>
list" now says "the packfile has corresponding .keep file".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
rewrites its use in git-repack to pass a single --kept-pack-only option
instead.
The new --kept-pack-only option means just that. When this option is
given, is_kept_pack() that used to say "not on the --unpacked=<packfile>
list" now says "the packfile has corresponding .keep file".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-pack-objects.c | patch | blob | history | |
git-repack.sh | 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 7e7719b832208b86115310da782e199daae4dc59..150258b6290e55abfefd2b56ab012a2e2c20ae30 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
const unsigned char *sha1;
struct object *o;
- if (is_kept_pack(p, revs))
+ if (is_kept_pack(p))
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, revs))
+ if (is_kept_pack(p))
continue;
if (open_pack_index(p))
continue;
}
if (!strcmp("--unpacked", arg) ||
- !prefixcmp(arg, "--unpacked=") ||
+ !strcmp("--kept-pack-only", arg) ||
!strcmp("--reflog", arg) ||
!strcmp("--all", arg)) {
use_internal_rev_list = 1;
diff --git a/git-repack.sh b/git-repack.sh
index 86000151ccbe259132c6cf25d6c23e3f763aba06..a736009c67ec938485c16aa1760b4e56d2e4cc6f 100755 (executable)
--- a/git-repack.sh
+++ b/git-repack.sh
if [ -e "$PACKDIR/$e.keep" ]; then
: keep
else
- args="$args --unpacked=$e.pack"
existing="$existing $e"
fi
done
+ if test -n "$existing"
+ then
+ args="--kept-pack-only"
+ fi
if test -n "$args" -a -n "$unpack_unreachable" -a \
-n "$remove_redundant"
then
diff --git a/revision.c b/revision.c
index 795e0c03fef4c95cc0d45cb1515f38d8db8211eb..3cfd6539aba3baa35375690d3cb723c1ba7a0fcf 100644 (file)
--- a/revision.c
+++ b/revision.c
add_grep(revs, pattern, GREP_PATTERN_BODY);
}
-static void add_ignore_packed(struct rev_info *revs, const char *name)
-{
- int num = ++revs->num_ignore_packed;
-
- revs->ignore_packed = xrealloc(revs->ignore_packed,
- sizeof(const char *) * (num + 1));
- revs->ignore_packed[num-1] = name;
- revs->ignore_packed[num] = NULL;
-}
-
static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv,
int *unkc, const char **unkv)
{
@@ -1072,12 +1062,12 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
revs->edge_hint = 1;
} else if (!strcmp(arg, "--unpacked")) {
revs->unpacked = 1;
- free(revs->ignore_packed);
- revs->ignore_packed = NULL;
- revs->num_ignore_packed = 0;
- } else if (!prefixcmp(arg, "--unpacked=")) {
+ revs->kept_pack_only = 0;
+ } else if (!strcmp(arg, "--kept-pack-only")) {
revs->unpacked = 1;
- add_ignore_packed(revs, arg+11);
+ revs->kept_pack_only = 1;
+ } else if (!prefixcmp(arg, "--unpacked=")) {
+ die("--unpacked=<packfile> no longer supported.");
} else if (!strcmp(arg, "-r")) {
revs->diff = 1;
DIFF_OPT_SET(&revs->diffopt, RECURSIVE);
diff --git a/revision.h b/revision.h
index af414e5d949626cd109db95076f59b16f93af7c4..f63596ff45a120f38abfdb3d6ac2e84691b8ddc3 100644 (file)
--- a/revision.h
+++ b/revision.h
blob_objects:1,
edge_hint:1,
limited:1,
- unpacked:1, /* see also ignore_packed below */
+ unpacked:1,
+ kept_pack_only:1,
boundary:2,
left_right:1,
rewrite_parents:1,
missing_newline:1;
enum date_mode date_mode;
- const char **ignore_packed; /* pretend objects in these are unpacked */
- int num_ignore_packed;
-
unsigned int abbrev;
enum cmit_fmt commit_format;
struct log_info *loginfo;
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 *, 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 6e0a462f101329c0bae175c7f8e4d282d0ba5401..e8a9517d01d3ff671c4c72215d64153fb9098e8a 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
return 0;
}
-static int matches_pack_name(const struct packed_git *p, const char *name)
+int is_kept_pack(const struct packed_git *p)
{
- const char *last_c, *c;
-
- if (!strcmp(p->pack_name, name))
- return 1;
-
- for (c = p->pack_name, last_c = c; *c;)
- if (*c == '/')
- last_c = ++c;
- else
- ++c;
- if (!strcmp(last_c, name))
- return 1;
-
- return 0;
-}
-
-int is_kept_pack(const struct packed_git *p, const struct rev_info *revs)
-{
- int i;
-
- for (i = 0; i < revs->num_ignore_packed; i++) {
- if (matches_pack_name(p, revs->ignore_packed[i]))
- return 0;
- }
- return 1;
+ return p->pack_keep;
}
static int find_pack_ent(const unsigned char *sha1, struct pack_entry *e,
p = (last_found == (void *)1) ? packed_git : last_found;
do {
- if (revs->ignore_packed && !is_kept_pack(p, revs))
+ if (revs->kept_pack_only && !is_kept_pack(p))
goto next;
if (p->num_bad_objects) {
unsigned i;