rename variable gotpath to path_got
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
diff --git a/lib/worktree.c b/lib/worktree.c
index 39e5396..ae61678 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -33,7 +33,7 @@
#include "got_path_priv.h"
static const struct got_error *
-create_meta_file(const char *gotpath, const char *name, const char *content)
+create_meta_file(const char *path_got, const char *name, const char *content)
{
const struct got_error *err = NULL;
char *path;
@@ -41,7 +41,7 @@ create_meta_file(const char *gotpath, const char *name, const char *content)
char buf[4];
ssize_t n;
- if (asprintf(&path, "%s/%s", gotpath, name) == -1) {
+ if (asprintf(&path, "%s/%s", path_got, name) == -1) {
err = got_error(GOT_ERR_NO_MEM);
path = NULL;
goto done;
@@ -78,7 +78,7 @@ done:
}
static const struct got_error *
-read_meta_file(char **content, const char *gotpath, const char *name)
+read_meta_file(char **content, const char *path_got, const char *name)
{
const struct got_error *err = NULL;
char *path;
@@ -88,7 +88,7 @@ read_meta_file(char **content, const char *gotpath, const char *name)
*content = NULL;
- if (asprintf(&path, "%s/%s", gotpath, name) == -1) {
+ if (asprintf(&path, "%s/%s", path_got, name) == -1) {
err = got_error(GOT_ERR_NO_MEM);
path = NULL;
goto done;
@@ -139,7 +139,7 @@ got_worktree_init(const char *path, struct got_reference *head_ref,
const char *prefix, struct got_repository *repo)
{
const struct got_error *err = NULL;
- char *gotpath = NULL;
+ char *path_got = NULL;
char *refstr = NULL;
char *path_repos = NULL;
char *formatstr = NULL;
@@ -154,27 +154,27 @@ got_worktree_init(const char *path, struct got_reference *head_ref,
}
/* Create .got directory (may already exist). */
- if (asprintf(&gotpath, "%s/%s", path, GOT_WORKTREE_GOT_DIR) == -1) {
+ if (asprintf(&path_got, "%s/%s", path, GOT_WORKTREE_GOT_DIR) == -1) {
err = got_error(GOT_ERR_NO_MEM);
goto done;
}
- if (mkdir(gotpath, GOT_DEFAULT_DIR_MODE) == -1 && errno != EEXIST) {
+ if (mkdir(path_got, GOT_DEFAULT_DIR_MODE) == -1 && errno != EEXIST) {
err = got_error_from_errno();
goto done;
}
/* Create an empty lock file. */
- err = create_meta_file(gotpath, GOT_WORKTREE_LOCK, NULL);
+ err = create_meta_file(path_got, GOT_WORKTREE_LOCK, NULL);
if (err)
goto done;
/* Create an empty file index. */
- err = create_meta_file(gotpath, GOT_WORKTREE_FILE_INDEX, NULL);
+ err = create_meta_file(path_got, GOT_WORKTREE_FILE_INDEX, NULL);
if (err)
goto done;
/* Set base commit to empty. */
- err = create_meta_file(gotpath, GOT_WORKTREE_BASE_COMMIT, NULL);
+ err = create_meta_file(path_got, GOT_WORKTREE_BASE_COMMIT, NULL);
if (err)
goto done;
@@ -184,7 +184,7 @@ got_worktree_init(const char *path, struct got_reference *head_ref,
err = got_error(GOT_ERR_NO_MEM);
goto done;
}
- err = create_meta_file(gotpath, GOT_WORKTREE_HEAD, refstr);
+ err = create_meta_file(path_got, GOT_WORKTREE_HEAD, refstr);
if (err)
goto done;
@@ -194,12 +194,12 @@ got_worktree_init(const char *path, struct got_reference *head_ref,
err = got_error(GOT_ERR_NO_MEM);
goto done;
}
- err = create_meta_file(gotpath, GOT_WORKTREE_REPOSITORY, path_repos);
+ err = create_meta_file(path_got, GOT_WORKTREE_REPOSITORY, path_repos);
if (err)
goto done;
/* Store in-repository path prefix. */
- err = create_meta_file(gotpath, GOT_WORKTREE_PATH_PREFIX, prefix);
+ err = create_meta_file(path_got, GOT_WORKTREE_PATH_PREFIX, prefix);
if (err)
goto done;
@@ -208,12 +208,12 @@ got_worktree_init(const char *path, struct got_reference *head_ref,
err = got_error(GOT_ERR_NO_MEM);
goto done;
}
- err = create_meta_file(gotpath, GOT_WORKTREE_FORMAT, formatstr);
+ err = create_meta_file(path_got, GOT_WORKTREE_FORMAT, formatstr);
if (err)
goto done;
done:
- free(gotpath);
+ free(path_got);
free(formatstr);
free(refstr);
free(path_repos);
@@ -224,7 +224,7 @@ const struct got_error *
got_worktree_open(struct got_worktree **worktree, const char *path)
{
const struct got_error *err = NULL;
- char *gotpath;
+ char *path_got;
char *refstr = NULL;
char *path_repos = NULL;
char *formatstr = NULL;
@@ -234,13 +234,13 @@ got_worktree_open(struct got_worktree **worktree, const char *path)
*worktree = NULL;
- if (asprintf(&gotpath, "%s/%s", path, GOT_WORKTREE_GOT_DIR) == -1) {
+ if (asprintf(&path_got, "%s/%s", path, GOT_WORKTREE_GOT_DIR) == -1) {
err = got_error(GOT_ERR_NO_MEM);
- gotpath = NULL;
+ path_got = NULL;
goto done;
}
- if (asprintf(&path_lock, "%s/%s", gotpath, GOT_WORKTREE_LOCK) == -1) {
+ if (asprintf(&path_lock, "%s/%s", path_got, GOT_WORKTREE_LOCK) == -1) {
err = got_error(GOT_ERR_NO_MEM);
path_lock = NULL;
goto done;
@@ -253,7 +253,7 @@ got_worktree_open(struct got_worktree **worktree, const char *path)
goto done;
}
- err = read_meta_file(&formatstr, gotpath, GOT_WORKTREE_FORMAT);
+ err = read_meta_file(&formatstr, path_got, GOT_WORKTREE_FORMAT);
if (err)
goto done;
@@ -279,16 +279,16 @@ got_worktree_open(struct got_worktree **worktree, const char *path)
err = got_error(GOT_ERR_NO_MEM);
goto done;
}
- err = read_meta_file(&(*worktree)->path_repo, gotpath,
+ err = read_meta_file(&(*worktree)->path_repo, path_got,
GOT_WORKTREE_REPOSITORY);
if (err)
goto done;
- err = read_meta_file(&(*worktree)->path_prefix, gotpath,
+ err = read_meta_file(&(*worktree)->path_prefix, path_got,
GOT_WORKTREE_PATH_PREFIX);
goto done;
done:
- free(gotpath);
+ free(path_got);
free(path_lock);
if (err) {
if (fd != -1)