]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'sv/objfixes'
authorJunio C Hamano <gitster@pobox.com>
Wed, 6 Jun 2007 22:43:24 +0000 (15:43 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Jun 2007 22:43:24 +0000 (15:43 -0700)
* sv/objfixes:
  Don't assume tree entries that are not dirs are blobs
  git-cvsimport: Make sure to use $git_dir always instead of .git sometimes
  fix documentation of unpack-objects -n
  Accept dates before 2000/01/01 when specified as seconds since the epoch

Documentation/git-unpack-objects.txt
date.c
git-cvsimport.perl
object.c
tree.c

index ff6184b0f7498a44995fe4c55dab49c5517ec458..b1b3ec9772b7e689a4a3d42e78be68df34de40ac 100644 (file)
@@ -27,8 +27,8 @@ new packs and replace existing ones.
 OPTIONS
 -------
 -n::
-        Only list the objects that would be unpacked, don't actually unpack
-        them.
+        Dry run.  Check the pack file without actually unpacking
+       the objects.
 
 -q::
        The command usually shows percentage progress.  This
diff --git a/date.c b/date.c
index a9b59a289e7b22f34958ccc7b80b02a01cf793c6..4690371e5559f72b7755b3cc92ae85843098d285 100644 (file)
--- a/date.c
+++ b/date.c
@@ -414,9 +414,11 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
        num = strtoul(date, &end, 10);
 
        /*
-        * Seconds since 1970? We trigger on that for anything after Jan 1, 2000
+        * Seconds since 1970? We trigger on that for any numbers with
+        * more than 8 digits. This is because we don't want to rule out
+        * numbers like 20070606 as a YYYYMMDD date.
         */
-       if (num > 946684800) {
+       if (num >= 100000000) {
                time_t time = num;
                if (gmtime_r(&time, tm)) {
                        *tm_gmt = 1;
index f68afe78a0a0ea4997b8988f241cd3a675d785f9..4e6c9c6cc7c1fbbf69c455d6095cc8d18c81de16 100755 (executable)
@@ -692,8 +692,8 @@ sub commit {
        if ($branch eq $opt_o && !$index{branch} && !get_headref($branch, $git_dir)) {
            # looks like an initial commit
            # use the index primed by git-init
-           $ENV{GIT_INDEX_FILE} = '.git/index';
-           $index{$branch} = '.git/index';
+           $ENV{GIT_INDEX_FILE} = "$git_dir/index";
+           $index{$branch} = "$git_dir/index";
        } else {
            # use an index per branch to speed up
            # imports of projects with many branches
@@ -984,7 +984,7 @@ if ($line =~ /^(\d+) objects, (\d+) kilobytes$/) {
 }
 
 foreach my $git_index (values %index) {
-    if ($git_index ne '.git/index') {
+    if ($git_index ne "$git_dir/index") {
        unlink($git_index);
     }
 }
index cfc4969ed9ba0ccfdba8f97637bac20be31d1eba..16793d9958a57664233b9e4468e112dfa1a8a915 100644 (file)
--- a/object.c
+++ b/object.c
@@ -160,8 +160,11 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
                parse_tag_buffer(tag, buffer, size);
                obj = &tag->object;
        } else {
+               warning("object %s has unknown type id %d\n", sha1_to_hex(sha1), type);
                obj = NULL;
        }
+       if (obj && obj->type == OBJ_NONE)
+               obj->type = type;
        *eaten_p = eaten;
        return obj;
 }
diff --git a/tree.c b/tree.c
index a3728270b4027cd56e09e1a56ec17e177d0a6998..04fe653a8e25feb0fc15f76ba487d0f8dbd52f82 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -173,8 +173,13 @@ static void track_tree_refs(struct tree *item)
                        continue;
                if (S_ISDIR(entry.mode))
                        obj = &lookup_tree(entry.sha1)->object;
-               else
+               else if (S_ISREG(entry.mode) || S_ISLNK(entry.mode))
                        obj = &lookup_blob(entry.sha1)->object;
+               else {
+                       warning("in tree %s: entry %s has bad mode %.6o\n",
+                            sha1_to_hex(item->object.sha1), entry.path, entry.mode);
+                       obj = lookup_unknown_object(entry.sha1);
+               }
                refs->ref[i++] = obj;
        }
        set_object_refs(&item->object, refs);