[PATCH] New option (-H) for rpush/rpull to update HEAD
- From
- Andreas Gal <gal@uci.edu>
- Date
- Apr 25, 2005, 04:39 UTC
- Message-ID
- <Pine.LNX.4.58.0504242132280.5064@sam.ics.uci.edu>
- In-Reply-To
- <Pine.LNX.4.62.0504250443380.14200@sheen.jakma.org>
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];