Merge branch 'bc/more-git-var' into maint-2.42
Fix-up for a topic that already has graduated. * bc/more-git-var: var: avoid a segmentation fault when `HOME` is unset
This commit is contained in:
@ -66,7 +66,7 @@ static char *git_attr_val_system(int ident_flag UNUSED)
|
|||||||
|
|
||||||
static char *git_attr_val_global(int ident_flag UNUSED)
|
static char *git_attr_val_global(int ident_flag UNUSED)
|
||||||
{
|
{
|
||||||
char *file = xstrdup(git_attr_global_file());
|
char *file = xstrdup_or_null(git_attr_global_file());
|
||||||
if (file) {
|
if (file) {
|
||||||
normalize_path_copy(file, file);
|
normalize_path_copy(file, file);
|
||||||
return file;
|
return file;
|
||||||
|
@ -268,4 +268,13 @@ test_expect_success 'listing and asking for variables are exclusive' '
|
|||||||
test_must_fail git var -l GIT_COMMITTER_IDENT
|
test_must_fail git var -l GIT_COMMITTER_IDENT
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success '`git var -l` works even without HOME' '
|
||||||
|
(
|
||||||
|
XDG_CONFIG_HOME= &&
|
||||||
|
export XDG_CONFIG_HOME &&
|
||||||
|
unset HOME &&
|
||||||
|
git var -l
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Reference in New Issue
Block a user