2018-01-20 22:58:10 +01:00
|
|
|
diff -u -r ../git-2.16.0/config.c ./config.c
|
|
|
|
--- ../git-2.16.0/config.c 2018-01-17 22:49:47.000000000 +0000
|
|
|
|
+++ ./config.c 2018-01-20 21:49:42.940523576 +0000
|
2017-10-25 14:29:49 +02:00
|
|
|
@@ -73,6 +73,25 @@
|
|
|
|
static int pack_compression_seen;
|
|
|
|
static int zlib_compression_seen;
|
2016-04-22 01:32:02 +02:00
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * Protecting the project-specific git configuration file (.git/config) is
|
|
|
|
+ * not possible on a shared file system on Android, which on an unpatched
|
|
|
|
+ * git causes operations such as clone to fail with an error message.
|
|
|
|
+ *
|
|
|
|
+ * For the Termux git package we introduce a warning about the configuration
|
|
|
|
+ * file being unprotected, but proceed in order to allow git repositories
|
|
|
|
+ * to be cloned to shared storage accessible to other apps.
|
|
|
|
+ */
|
|
|
|
+static void termux_warn_once_about_lockfile()
|
|
|
|
+{
|
|
|
|
+ static int already_warned;
|
|
|
|
+ if (!already_warned) {
|
|
|
|
+ warning("Cannot protect .git/config on this file system"
|
|
|
|
+ " - do not store sensitive information here.");
|
|
|
|
+ already_warned = 1;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static int config_file_fgetc(struct config_source *conf)
|
|
|
|
{
|
|
|
|
return getc_unlocked(conf->u.file);
|
2018-01-20 22:58:10 +01:00
|
|
|
@@ -2608,9 +2627,13 @@
|
2016-04-22 01:32:02 +02:00
|
|
|
in_fd = -1;
|
|
|
|
|
2017-10-25 14:29:49 +02:00
|
|
|
if (chmod(get_lock_file_path(&lock), st.st_mode & 07777) < 0) {
|
2016-04-22 01:32:02 +02:00
|
|
|
+#ifdef __ANDROID__
|
|
|
|
+ termux_warn_once_about_lockfile();
|
|
|
|
+#else
|
2017-10-25 14:29:49 +02:00
|
|
|
error_errno("chmod on %s failed", get_lock_file_path(&lock));
|
2016-04-22 01:32:02 +02:00
|
|
|
ret = CONFIG_NO_WRITE;
|
|
|
|
goto out_free;
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
if (store.seen == 0)
|
2018-01-20 22:58:10 +01:00
|
|
|
@@ -2810,9 +2833,13 @@
|
2017-10-25 14:29:49 +02:00
|
|
|
}
|
2016-04-22 01:32:02 +02:00
|
|
|
|
2018-01-20 22:58:10 +01:00
|
|
|
if (chmod(get_lock_file_path(&lock), st.st_mode & 07777) < 0) {
|
2016-04-22 01:32:02 +02:00
|
|
|
+#ifdef __ANDROID__
|
|
|
|
+ termux_warn_once_about_lockfile();
|
|
|
|
+#else
|
2016-06-20 11:30:35 +02:00
|
|
|
ret = error_errno("chmod on %s failed",
|
2018-01-20 22:58:10 +01:00
|
|
|
get_lock_file_path(&lock));
|
2016-04-22 01:32:02 +02:00
|
|
|
goto out;
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
while (fgets(buf, sizeof(buf), config_file)) {
|