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 e6ce7312c1f84490e6e3518e9c71047cd2806d05..80f9967053b2c91feeeabf951dd9d1e5fc37a827 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 367b9c7991f7e78954805e526d785b715446f1a9..244ebd122601883e15e8aefea33c7daf8249d862 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 301cc67b76e36b47f6d35be62334fb0e5acda677..abdec92ffcf3d85d7307c972e74cc2c69037bb77 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 c04c0307b2b7c2b83c7707c90b844aa958a6c407..c2f7a6e240fb9efad97b00595bd1d5ed3829a8b8 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 4a26603f6e32866c0db8a01ac1c228be801f76c6..468f99e4944b139450ed5b1d2f84e6ef0b303e84 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 96cf4291d11453b4489d2bf5234938054fe6b7bd..e1c94c090c8d73268176e8f1ca97f4949cb537df 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;