commit 5daf5c53287d227ebc29ad1b0d934b4731ad5990 from: Stefan Sperling via: Thomas Adam date: Sat Jul 23 14:38:45 2022 UTC add a way to ignore author and remote repository info found in Git config files ok op@ commit - 1684783ba639c742760dd97cd87213e89189c7dd commit + 5daf5c53287d227ebc29ad1b0d934b4731ad5990 blob - ea412540fd202511367fedfbeaa5f864e0051758 blob + d97716d4af2c458376bb73bebfca2e1ff3725410 --- got/got.1 +++ got/got.1 @@ -2750,7 +2750,7 @@ argument corresponds to the work tree's root directory for all tracked files. .El .Sh ENVIRONMENT -.Bl -tag -width GOT_AUTHOR +.Bl -tag -width GOT_IGNORE_GITCONFIG .It Ev GOT_AUTHOR The author's name and email address, such as .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org . @@ -2806,6 +2806,9 @@ The default limit on the number of commits traversed b .Cm got log . If set to zero, the limit is unbounded. This variable will be silently ignored if it is set to a non-numeric value. +.It Ev GOT_IGNORE_GITCONFIG +If this variable is set then any remote repository definitions or author +information found in Git configuration files will be ignored. .El .Sh FILES .Bl -tag -width packed-refs -compact blob - 31656dd0f5f80306da9be9a214fd7681951dbd09 blob + 6a9c889ab6090565aaf97656e4066e53010a84a7 --- lib/repository.c +++ lib/repository.c @@ -673,6 +673,23 @@ read_gitconfig(struct got_repository *repo, const char repo_gitconfig_path); if (err) goto done; + + if (getenv("GOT_IGNORE_GITCONFIG") != NULL) { + int i; + + for (i = 0; i < repo->ngitconfig_remotes; i++) { + got_repo_free_remote_repo_data( + &repo->gitconfig_remotes[i]); + } + free(repo->gitconfig_remotes); + repo->ngitconfig_remotes = 0; + + free(repo->gitconfig_author_name); + repo->gitconfig_author_name = NULL; + free(repo->gitconfig_author_email); + repo->gitconfig_author_email = NULL; + } + done: free(repo_gitconfig_path); return err;