From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Gal Subject: [PATCH] New option (-H) for rpush/rpull to update HEAD Date: Sun, 24 Apr 2005 21:39:02 -0700 (PDT) Message-ID: References: <200504210422.j3L4Mo8L021495@hera.kernel.org> <42674724.90005@ppp0.net> <20050422002922.GB6829@kroah.com> <426A4669.7080500@ppp0.net> <1114266083.3419.40.camel@localhost.localdomain> <426A5BFC.1020507@ppp0.net> <1114266907.3419.43.camel@localhost.localdomain> <20050423175422.GA7100@cip.informatik.uni-erlangen.de> <2911.10.10.10.24.1114279589.squirrel@linux1> <426C4168.6030008@dwheeler.com> <426C5F43.8010705@dwheeler.com> Received: from vger.kernel.org ([12.107.209.244]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DPvIb-0002Fh-5w for gcvg-git@gmane.org; Mon, 25 Apr 2005 06:34:21 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262531AbVDYEjJ (ORCPT ); Mon, 25 Apr 2005 00:39:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262532AbVDYEjJ (ORCPT ); Mon, 25 Apr 2005 00:39:09 -0400 Received: from sam.ics.uci.edu ([128.195.38.141]:14253 "EHLO sam.ics.uci.edu") by vger.kernel.org with ESMTP id S262531AbVDYEjD (ORCPT ); Mon, 25 Apr 2005 00:39:03 -0400 Received: from sam.ics.uci.edu (localhost.localdomain [127.0.0.1]) by sam.ics.uci.edu (8.12.11/8.12.11) with ESMTP id j3P4d22h005078 for ; Sun, 24 Apr 2005 21:39:02 -0700 Received: from localhost (gal@localhost) by sam.ics.uci.edu (8.12.11/8.12.8/Submit) with ESMTP id j3P4d2Of005074 for ; Sun, 24 Apr 2005 21:39:02 -0700 X-Authentication-Warning: sam.ics.uci.edu: gal owned process doing -bs X-X-Sender: gal@sam.ics.uci.edu To: Git Mailing List In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.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 --- 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];