Skip to content

Commit 1cca858

Browse files
authored
Merge pull request DeusData#750 from DeusData/fix/683-cbm-fopen-worktree
fix(discover): use cbm_fopen for worktree gitlink + commondir reads
2 parents abda964 + e82f6da commit 1cca858

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎src/discover/discover.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,9 @@ static bool resolve_git_common_dir(const char *repo_path, char *common_dir, size
778778
return false;
779779
}
780780

781-
/* Linked worktree: parse "gitdir: <path>" from the gitlink file. */
782-
FILE *f = fopen(dot_git, "r");
781+
/* Linked worktree: parse "gitdir: <path>" from the gitlink file.
782+
* cbm_fopen (not raw fopen) so non-ASCII repo paths open on Windows. */
783+
FILE *f = cbm_fopen(dot_git, "r");
783784
if (!f) {
784785
return false;
785786
}
@@ -811,7 +812,7 @@ static bool resolve_git_common_dir(const char *repo_path, char *common_dir, size
811812
* (typically a relative path like "../.."). Absent in single-worktree gitdirs. */
812813
char commondir_path[CBM_SZ_4K];
813814
path_join(commondir_path, sizeof(commondir_path), git_dir, "commondir");
814-
FILE *cf = fopen(commondir_path, "r");
815+
FILE *cf = cbm_fopen(commondir_path, "r");
815816
if (cf) {
816817
char cbuf[CBM_SZ_4K];
817818
bool resolved = false;

0 commit comments

Comments
 (0)