Skip to content

Commit 13d6ec9

Browse files
committed
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 <[email protected]>
1 parent f696543 commit 13d6ec9

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

builtin/init-db.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static void separate_git_dir(const char *git_dir)
347347
const char *src;
348348

349349
if (S_ISREG(st.st_mode))
350-
src = read_gitfile_gently(git_link);
350+
src = read_gitfile(git_link);
351351
else if (S_ISDIR(st.st_mode))
352352
src = git_link;
353353
else

cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ extern char *get_index_file(void);
420420
extern char *get_graft_file(void);
421421
extern int set_git_dir(const char *path);
422422
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);
424424
extern void set_git_work_tree(const char *tree);
425425

426426
#define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"

environment.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static void setup_git_env(void)
9191
git_dir = getenv(GIT_DIR_ENVIRONMENT);
9292
git_dir = git_dir ? xstrdup(git_dir) : NULL;
9393
if (!git_dir) {
94-
git_dir = read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);
94+
git_dir = read_gitfile(DEFAULT_GIT_DIR_ENVIRONMENT);
9595
git_dir = git_dir ? xstrdup(git_dir) : NULL;
9696
}
9797
if (!git_dir)

path.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ char *git_path_submodule(const char *path, const char *fmt, ...)
139139
strbuf_addch(&buf, '/');
140140
strbuf_addstr(&buf, ".git");
141141

142-
git_dir = read_gitfile_gently(buf.buf);
142+
git_dir = read_gitfile(buf.buf);
143143
if (git_dir) {
144144
strbuf_reset(&buf);
145145
strbuf_addstr(&buf, git_dir);

refs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ int resolve_gitlink_ref(const char *path, const char *refname, unsigned char *re
451451
memcpy(gitdir + len, "/.git", 6);
452452
len += 5;
453453

454-
tmp = read_gitfile_gently(gitdir);
454+
tmp = read_gitfile(gitdir);
455455
if (tmp) {
456456
free(gitdir);
457457
len = strlen(tmp);

setup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok)
375375
* Try to read the location of the git directory from the .git file,
376376
* return path to git directory if found.
377377
*/
378-
const char *read_gitfile_gently(const char *path)
378+
const char *read_gitfile(const char *path)
379379
{
380380
char *buf;
381381
char *dir;
@@ -437,7 +437,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,
437437
if (PATH_MAX - 40 < strlen(gitdirenv))
438438
die("'$%s' too big", GIT_DIR_ENVIRONMENT);
439439

440-
gitfile = (char*)read_gitfile_gently(gitdirenv);
440+
gitfile = (char*)read_gitfile(gitdirenv);
441441
if (gitfile) {
442442
gitfile = xstrdup(gitfile);
443443
gitdirenv = gitfile;
@@ -661,7 +661,7 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
661661
if (one_filesystem)
662662
current_device = get_device_or_die(".", NULL);
663663
for (;;) {
664-
gitfile = (char*)read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);
664+
gitfile = (char*)read_gitfile(DEFAULT_GIT_DIR_ENVIRONMENT);
665665
if (gitfile)
666666
gitdirenv = gitfile = xstrdup(gitfile);
667667
else {

submodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static int add_submodule_odb(const char *path)
3232
const char *git_dir;
3333

3434
strbuf_addf(&objects_directory, "%s/.git", path);
35-
git_dir = read_gitfile_gently(objects_directory.buf);
35+
git_dir = read_gitfile(objects_directory.buf);
3636
if (git_dir) {
3737
strbuf_reset(&objects_directory);
3838
strbuf_addstr(&objects_directory, git_dir);
@@ -478,7 +478,7 @@ int fetch_populated_submodules(int num_options, const char **options,
478478
strbuf_addf(&submodule_path, "%s/%s", work_tree, ce->name);
479479
strbuf_addf(&submodule_git_dir, "%s/.git", submodule_path.buf);
480480
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);
482482
if (!git_dir)
483483
git_dir = submodule_git_dir.buf;
484484
if (is_directory(git_dir)) {
@@ -516,7 +516,7 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked)
516516
const char *git_dir;
517517

518518
strbuf_addf(&buf, "%s/.git", path);
519-
git_dir = read_gitfile_gently(buf.buf);
519+
git_dir = read_gitfile(buf.buf);
520520
if (!git_dir)
521521
git_dir = buf.buf;
522522
if (!is_directory(git_dir)) {

0 commit comments

Comments
 (0)