[RFC PATCH 10/15] sparse-repo: Provide a function to record sparse limiting arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Elijah Newren <newren@xxxxxxxxx>
---
 sparse-repo.c |   20 ++++++++++++++++++++
 sparse-repo.h |    1 +
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/sparse-repo.c b/sparse-repo.c
index 18ea976..c983096 100644
--- a/sparse-repo.c
+++ b/sparse-repo.c
@@ -5,6 +5,26 @@
 
 #define SPARSE_FILE "sparse-limits"
 
+void record_sparse_limits(const char *quoted_argv)
+{
+	int fd, len;
+	char *sparse_file = git_path(SPARSE_FILE);
+
+	/* FIXME: sq_quote_argv puts a leading space in front of quoted
+	 * arguments, but sq_dequote_to_argv chokes on it.  Maybe sq_quote_argv
+	 * should be fixed?
+	 */
+	if (*quoted_argv == ' ')
+		quoted_argv++;
+	len = strlen(quoted_argv);
+
+	fd = open(sparse_file, O_WRONLY | O_CREAT, 0666);
+	if (fd < 0 || write_in_full(fd, quoted_argv, len) != len)
+		die_errno("could not write %s", sparse_file);
+	xwrite(fd, "\n", 1);
+	close(fd);
+}
+
 void register_sparse_limits(const char **revlist_argv)
 {
 	if (revlist_argv != git_sparse_limits) {
diff --git a/sparse-repo.h b/sparse-repo.h
index ed9018a..2df175f 100644
--- a/sparse-repo.h
+++ b/sparse-repo.h
@@ -1,3 +1,4 @@
+void record_sparse_limits(const char *quoted_argv);
 void register_sparse_limits(const char **revlist_argv);
 void register_quoted_sparse_limits(char *quoted_argv);
 void check_sparse_repo(void);
-- 
1.7.2.2.140.gd06af

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]