Unix root dir as a work tree

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

 



Hi,

   Sorry if this is a FAQ, but I could not find any reference.

I have been using CVS as a version control system for unix configuration files for a long time. I know it has some limitations, and I know git also has its. But I expect to work around all of them using etckeeper.

The problem is that etckeeper was created with /etc only in mind, and I want to keep track of important files everywhere, not only below /etc (think /opt, /usr/local). The obvious solution appear to create the repository at the system root, and not at /etc, but it did not work. I think, because of a bug.

Now, I have a patch that appears to work, but since I am a beginner to git, I don't know if this is the best way to implement it, if it has any side effects, or even if it works for other operating systems (probably they don't even have the bug). Would any git wizard care to look at it, check if it is ok, and maybe commit in HEAD or give me any advice against my patch?

Please, don't give me any answers like "don't use your root as a repo". I am a system admin for a long time, and I know what I want and what are the risks and benefits involved.

   Thanks in advance,

      Jonny

--- a/setup.c	2010-02-07 22:50:40.000000000 -0200
+++ b/setup.c	2010-02-07 22:51:56.000000000 -0200
@@ -413,7 +413,12 @@
 	inside_git_dir = 0;
 	if (!work_tree_env)
 		inside_work_tree = 1;
-	git_work_tree_cfg = xstrndup(cwd, offset);
+	if ( cwd[0] == '/' && offset == 0 ) {
+		git_work_tree_cfg = xstrndup(cwd, 1);
+	}
+	else {
+		git_work_tree_cfg = xstrndup(cwd, offset);
+	}
 	if (check_repository_format_gently(nongit_ok))
 		return NULL;
 	if (offset == len)

[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]