mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cloud-storage: simplify creation of git authorship
While having the local user information in the repo on Linux seemed clever when we implemented it, it's inconsistent with all the other platforms. Let's just not do that unless the user has indeed set a global name/email pair for git. Instead indicate if this was Subsurface or Subsurface-mobile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
67a717dc05
commit
7a238b6146
7 changed files with 7 additions and 65 deletions
30
core/unix.c
30
core/unix.c
|
|
@ -34,36 +34,6 @@ bool subsurface_ignore_font(const char *font)
|
|||
return false;
|
||||
}
|
||||
|
||||
void subsurface_user_info(struct user_info *user)
|
||||
{
|
||||
struct passwd *pwd = getpwuid(getuid());
|
||||
const char *username = getenv("USER");
|
||||
|
||||
if (pwd) {
|
||||
if (!empty_string(pwd->pw_gecos)) {
|
||||
user->name = strdup(pwd->pw_gecos);
|
||||
// We only want the name, not the office or phone number
|
||||
char *c = user->name;
|
||||
while (*c) {
|
||||
if (*c == ',') {
|
||||
*c = '\0';
|
||||
break;
|
||||
}
|
||||
++c;
|
||||
}
|
||||
}
|
||||
if (!username)
|
||||
username = pwd->pw_name;
|
||||
}
|
||||
if (!empty_string(username)) {
|
||||
char hostname[64];
|
||||
struct membuffer mb = {};
|
||||
gethostname(hostname, sizeof(hostname));
|
||||
put_format(&mb, "%s@%s", username, hostname);
|
||||
user->email = detach_cstring(&mb);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *system_default_path_append(const char *append)
|
||||
{
|
||||
const char *home = getenv("HOME");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue