read_gitfile_gently(): rename misnamed function to read_gitfile()
The function was not gentle at all to the callers and died without giving them a chance to deal with possible errors. Rename it to read_gitfile(), and update all the callers. As no existing caller needs a true "gently" variant, we do not bother adding one at this point. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Aug 22, 2011 at 14:04 UTC
13d6ec913330ba90fb1a67ec5789e437f8ac4193
7 files changed
+11
-11
builtin/init-db.c
+1
-1
@@ -347,7 +347,7 @@ static void separate_git_dir(const char *git_dir)
347
const char *src;
348
349
if (S_ISREG(st.st_mode))
350
- src = read_gitfile_gently(git_link);
350
+ src = read_gitfile(git_link);
351
else if (S_ISDIR(st.st_mode))
352
src = git_link;
353
else
cache.h
+1
-1
@@ -420,7 +420,7 @@ extern char *get_index_file(void);
420
extern char *get_graft_file(void);
421
extern int set_git_dir(const char *path);
422
extern const char *get_git_work_tree(void);
423
-extern const char *read_gitfile_gently(const char *path);
423
+extern const char *read_gitfile(const char *path);
424
extern void set_git_work_tree(const char *tree);
425
426
#define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"
environment.c
+1
-1
@@ -91,7 +91,7 @@ static void setup_git_env(void)
91
git_dir = getenv(GIT_DIR_ENVIRONMENT);
92
git_dir = git_dir ? xstrdup(git_dir) : NULL;
93
if (!git_dir) {
94
- git_dir = read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);
94
+ git_dir = read_gitfile(DEFAULT_GIT_DIR_ENVIRONMENT);
95
git_dir = git_dir ? xstrdup(git_dir) : NULL;
96
}
97
if (!git_dir)
path.c
+1
-1
@@ -139,7 +139,7 @@ char *git_path_submodule(const char *path, const char *fmt, ...)
139
strbuf_addch(&buf, '/');
140
strbuf_addstr(&buf, ".git");
141
142
- git_dir = read_gitfile_gently(buf.buf);
142
+ git_dir = read_gitfile(buf.buf);
143
if (git_dir) {
144
strbuf_reset(&buf);
145
strbuf_addstr(&buf, git_dir);
refs.c
+1
-1
@@ -451,7 +451,7 @@ int resolve_gitlink_ref(const char *path, const char *refname, unsigned char *re
451
memcpy(gitdir + len, "/.git", 6);
452
len += 5;
453
454
- tmp = read_gitfile_gently(gitdir);
454
+ tmp = read_gitfile(gitdir);
455
if (tmp) {
456
free(gitdir);
457
len = strlen(tmp);
setup.c
+3
-3
@@ -375,7 +375,7 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok)
375
* Try to read the location of the git directory from the .git file,
376
* return path to git directory if found.
377
*/
378
-const char *read_gitfile_gently(const char *path)
378
+const char *read_gitfile(const char *path)
379
{
380
char *buf;
381
char *dir;
@@ -437,7 +437,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,
437
if (PATH_MAX - 40 < strlen(gitdirenv))
438
die("'$%s' too big", GIT_DIR_ENVIRONMENT);
439
440
- gitfile = (char*)read_gitfile_gently(gitdirenv);
440
+ gitfile = (char*)read_gitfile(gitdirenv);
441
if (gitfile) {
442
gitfile = xstrdup(gitfile);
443
gitdirenv = gitfile;
@@ -661,7 +661,7 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
661
if (one_filesystem)
662
current_device = get_device_or_die(".", NULL);
663
for (;;) {
664
- gitfile = (char*)read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);
664
+ gitfile = (char*)read_gitfile(DEFAULT_GIT_DIR_ENVIRONMENT);
665
if (gitfile)
666
gitdirenv = gitfile = xstrdup(gitfile);
667
else {
submodule.c
+3
-3
@@ -32,7 +32,7 @@ static int add_submodule_odb(const char *path)
32
const char *git_dir;
33
34
strbuf_addf(&objects_directory, "%s/.git", path);
35
- git_dir = read_gitfile_gently(objects_directory.buf);
35
+ git_dir = read_gitfile(objects_directory.buf);
36
if (git_dir) {
37
strbuf_reset(&objects_directory);
38
strbuf_addstr(&objects_directory, git_dir);
@@ -478,7 +478,7 @@ int fetch_populated_submodules(int num_options, const char **options,
478
strbuf_addf(&submodule_path, "%s/%s", work_tree, ce->name);
479
strbuf_addf(&submodule_git_dir, "%s/.git", submodule_path.buf);
480
strbuf_addf(&submodule_prefix, "%s%s/", prefix, ce->name);
481
- git_dir = read_gitfile_gently(submodule_git_dir.buf);
481
+ git_dir = read_gitfile(submodule_git_dir.buf);
482
if (!git_dir)
483
git_dir = submodule_git_dir.buf;
484
if (is_directory(git_dir)) {
@@ -516,7 +516,7 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked)
516
const char *git_dir;
517
518
strbuf_addf(&buf, "%s/.git", path);
519
- git_dir = read_gitfile_gently(buf.buf);
519
+ git_dir = read_gitfile(buf.buf);
520
if (!git_dir)
521
git_dir = buf.buf;
522
if (!is_directory(git_dir)) {