From: Jay Soffian <jaysoffian@gmail.com>
To: git@vger.kernel.org
Cc: Jay Soffian <jaysoffian@gmail.com>
Subject: [RFC PATCH 1/2] git-branch: allow --track to work w/local branches
Date: Fri, 15 Feb 2008 22:45:56 -0500 [thread overview]
Message-ID: <1203133557-50013-1-git-send-email-jaysoffian@gmail.com> (raw)
When given --track (or if branch.autosetupmerge is true) and basing off
a local branch, set branch.<newbranch>.remote to "." and
branch.<newbranch>.merge to the local branch. This allows us to use "git
pull" (w/o options) on the new branch.
Previously --track was silently ignored when basing off a local branch.
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
---
builtin-branch.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/builtin-branch.c b/builtin-branch.c
index e414c88..94ab195 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -402,6 +402,16 @@ static int setup_tracking(const char *new_ref, const char *orig_ref)
return error("Tracking not set up: name too long: %s",
new_ref);
+ if (!prefixcmp(orig_ref, "refs/heads/")) {
+ sprintf(key, "branch.%s.remote", new_ref);
+ git_config_set(key, ".");
+ sprintf(key, "branch.%s.merge", new_ref);
+ git_config_set(key, orig_ref);
+ printf("Branch %s set up to track local branch %s.\n",
+ new_ref, orig_ref);
+ return 0;
+ }
+
memset(&tracking, 0, sizeof(tracking));
tracking.spec.dst = (char *)orig_ref;
if (for_each_remote(find_tracked_branch, &tracking) ||
--
1.5.4.1.1281.g75df
next reply other threads:[~2008-02-16 3:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-16 3:45 Jay Soffian [this message]
2008-02-16 3:45 ` [RFC PATCH 2/2] new --rebase option to set branch.*.rebase for new branches Jay Soffian
2008-02-16 5:10 ` [RFC PATCH 1/2] git-branch: allow --track to work w/local branches Junio C Hamano
2008-02-16 7:07 ` Jay Soffian
2008-02-16 11:45 ` Johannes Schindelin
2008-02-17 18:05 ` Jay Soffian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1203133557-50013-1-git-send-email-jaysoffian@gmail.com \
--to=jaysoffian@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).