Merge of http://members.cox.net/junkio/git-jc.git
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 6 May 2005 01:30:18 +0000 (18:30 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 6 May 2005 01:30:18 +0000 (18:30 -0700)
cache.h
checkout-cache.c
fsck-cache.c
git-resolve-script
tree.c
tree.h

diff --git a/cache.h b/cache.h
index e6ce731..80f9967 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -89,11 +89,9 @@ struct cache_entry {
 #define ce_permissions(mode) (((mode) & 0100) ? 0755 : 0644)
 static inline unsigned int create_ce_mode(unsigned int mode)
 {
-       if (S_ISREG(mode))
-               return htonl(S_IFREG | ce_permissions(mode));
        if (S_ISLNK(mode))
                return htonl(S_IFLNK);
-       return htonl(mode);
+       return htonl(S_IFREG | ce_permissions(mode));
 }
 
 #define cache_entry_size(len) ((offsetof(struct cache_entry,name) + (len) + 8) & ~7)
index 367b9c7..244ebd1 100644 (file)
@@ -96,6 +96,7 @@ static int write_entry(struct cache_entry *ce, const char *path)
        case S_IFLNK:
                memcpy(target, new, size);
                target[size] = '\0';
+               create_directories(path);
                if (symlink(target, path)) {
                        free(new);
                        return error("checkout-cache: unable to create symlink %s (%s)",
index 301cc67..abdec92 100644 (file)
@@ -100,6 +100,28 @@ static int fsck_tree(struct tree *item)
                if (strchr(entry->name, '/'))
                        has_full_path = 1;
 
+               switch (entry->mode) {
+               /*
+                * Standard modes.. 
+                */
+               case S_IFREG | 0755:
+               case S_IFREG | 0644:
+               case S_IFLNK:
+               case S_IFDIR:
+                       break;
+               /*
+                * This is nonstandard, but we had a few of these
+                * early on when we honored the full set of mode
+                * bits..
+                */
+               case S_IFREG | 0664:
+                       break;
+               default:
+                       printf("tree %s has entry %o %s\n",
+                               sha1_to_hex(item->object.sha1),
+                               entry->mode, entry->name);
+               }
+
                if (last) {
                        if (verify_ordered(last, entry) < 0) {
                                fprintf(stderr, "tree %s not ordered\n",
index c04c030..c2f7a6e 100644 (file)
@@ -49,7 +49,7 @@ if [ $? -ne 0 ]; then
        merge_msg="Automatic merge of $merge_repo"
        result_tree=$(git-write-tree) || exit 1
 fi
-result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree -p $head -p $merge_head)
+result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree -p $head -p $merge)
 echo "Committed merge $result_commit"
 echo $result_commit > .git/HEAD
 git-checkout-cache -f -a && git-update-cache --refresh
diff --git a/tree.c b/tree.c
index 4a26603..468f99e 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -122,8 +122,10 @@ int parse_tree(struct tree *item)
 
                entry = xmalloc(sizeof(struct tree_entry_list));
                entry->name = strdup(path + 1);
-               entry->directory = S_ISDIR(mode);
-               entry->executable = mode & S_IXUSR;
+               entry->directory = S_ISDIR(mode) != 0;
+               entry->executable = (mode & S_IXUSR) != 0;
+               entry->symlink = S_ISLNK(mode) != 0;
+               entry->mode = mode;
                entry->next = NULL;
 
                bufptr += len + 20;
diff --git a/tree.h b/tree.h
index 96cf429..e1c94c0 100644 (file)
--- a/tree.h
+++ b/tree.h
@@ -9,6 +9,8 @@ struct tree_entry_list {
        struct tree_entry_list *next;
        unsigned directory : 1;
        unsigned executable : 1;
+       unsigned symlink : 1;
+       unsigned int mode;
        char *name;
        union {
                struct tree *tree;