From: Andreas Gal Date: Mon, 25 Apr 2005 04:39:02 GMT Subject: [PATCH] New option (-H) for rpush/rpull to update HEAD Message-ID: In-Reply-To: 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 --- 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];