summaryrefslogtreecommitdiffstats
path: root/save-git.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2014-03-07 20:33:51 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-08 07:46:20 -0800
commit6d0011947b0675de21e4010dedb14a94cd7f7873 (patch)
treef5e44dc4d24f10ae07fe775acf0579208248c7c8 /save-git.c
parent5bba84e57f660f8ceddb9d45526f80b0f28b9194 (diff)
downloadsubsurface-6d0011947b0675de21e4010dedb14a94cd7f7873.tar.gz
Use symbolic names for the git file types
Instead of hardcoding the regular file mode (0100644 is the traditional Unix S_IFREG file mode with -rw-r--r-- protections), use GIT_FILEMODE_BLOB (and GIT_FILEMODE_TREE for 040000 - S_IFDIR). The numbers were historically indeed the regular S_IFREG/S_IFDIR values, but since those aren't portable, git ended up defining their own. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-git.c')
-rw-r--r--save-git.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/save-git.c b/save-git.c
index 836b8e0a1..e2950d42c 100644
--- a/save-git.c
+++ b/save-git.c
@@ -464,7 +464,7 @@ static int blob_insert(git_repository *repo, struct dir *tree, struct membuffer
return ret;
VA_BUF(&name, fmt);
- ret = tree_insert(tree->files, mb_cstring(&name), 1, &blob_id, 0100644);
+ ret = tree_insert(tree->files, mb_cstring(&name), 1, &blob_id, GIT_FILEMODE_BLOB);
free_buffer(&name);
return ret;
}
@@ -577,7 +577,7 @@ static int save_trip_description(git_repository *repo, struct dir *dir, dive_tri
free_buffer(&desc);
if (ret)
return report_error("trip blob creation failed");
- ret = tree_insert(dir->files, "00-Trip", 0, &blob_id, 0100644);
+ ret = tree_insert(dir->files, "00-Trip", 0, &blob_id, GIT_FILEMODE_BLOB);
if (ret)
return report_error("trip description tree insert failed");
return 0;
@@ -775,7 +775,7 @@ static int write_git_tree(git_repository *repo, struct dir *tree, git_oid *resul
git_oid id;
if (!write_git_tree(repo, subdir, &id))
- tree_insert(tree->files, subdir->name, subdir->unique, &id, 040000);
+ tree_insert(tree->files, subdir->name, subdir->unique, &id, GIT_FILEMODE_TREE);
tree->subdirs = subdir->sibling;
free(subdir);
};