[PATCH] New option (-H) for rpush/rpull to update HEAD

From: Andreas Gal <gal@uci.edu>
Date: 2005-04-25 14:39:02
This patch adds a new option -H to rpush/rpull to update the
HEAD pointer when pushing a new release to a remote repository. 

Signed-off-by: Andreas Gal <gal@uci.edu>

--- c27af2c2464de28732b8ad1fff3ed8a0804250d6/rpull.c
+++ rpull.c
@@ -11,6 +11,7 @@
 static int tree = 0;
 static int commits = 0;
 static int all = 0;
+static int update_head = 0;
 
 static int fd_in;
 static int fd_out;
@@ -104,11 +105,13 @@
 			all = 1;
 			tree = 1;
 			commits = 1;
+		} else if (argv[arg][1] == 'H') {
+			update_head = 1;
 		}
 		arg++;
 	}
 	if (argc < arg + 2) {
-		usage("rpull [-c] [-t] [-a] commit-id url");
+		usage("rpull [-c] [-t] [-a] [-H] commit-id url");
 		return 1;
 	}
 	commit_id = argv[arg];
@@ -123,6 +126,11 @@
 		return 1;
 	if (process_commit(sha1))
 		return 1;
+	if (update_head) {
+		FILE* fp = fopen("HEAD", "w+");
+		fprintf(fp, "%s\n", commit_id);
+		fclose(fp);
+	}
 
 	return 0;
 }
--- 0293a1a46311d7e20b13177143741ab9d6d0d201/rpush.c
+++ rpush.c
@@ -56,7 +56,7 @@
                 arg++;
         }
         if (argc < arg + 2) {
-                usage("rpush [-c] [-t] [-a] commit-id url");
+                usage("rpush [-c] [-t] [-a] [-H] commit-id url");
                 return 1;
         }
 	commit_id = argv[arg];
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Mon Apr 25 14:39:25 2005

This archive was generated by hypermail 2.1.8 : 2005-04-25 14:39:25 EST