Skip to content

Commit

Permalink
Merge branch 'sv/objfixes'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Junio C Hamano committed Jun 6, 2007
2 parents f07dfba + e2ac7cb commit d44c782
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Documentation/git-unpack-objects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions date.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions git-cvsimport.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -984,7 +984,7 @@ sub commit {
}
foreach my $git_index (values %index) {
if ($git_index ne '.git/index') {
if ($git_index ne "$git_dir/index") {
unlink($git_index);
}
}
Expand Down
3 changes: 3 additions & 0 deletions object.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
7 changes: 6 additions & 1 deletion tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d44c782

Please sign in to comment.