git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bert Wesarg <bert.wesarg@googlemail.com>
To: Trent Piepho <tpiepho@freescale.com>
To: Trent Piepho <tpiepho@freescale.com>
Cc: Robin Rosenberg <robin.rosenberg@dewire.com>,
	git@vger.kernel.org, Bert Wesarg <bert.wesarg@googlemail.com>
Subject: [RFC/PATCH] cvsexportcommit: per branch cvsdir config option
Date: Wed, 21 Apr 2010 02:42:41 +0200	[thread overview]
Message-ID: <1271810562-4196-1-git-send-email-bert.wesarg@googlemail.com> (raw)

This lets the user of git cvsexportcommit specify a cvs working dir on a per
branch basis.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>

---

The config variable name is currently cvsexportcommit.<branch>.cvsdir, but
could also be branch.<branch>.cvsdir. Or whatever is prefereable.


 Documentation/git-cvsexportcommit.txt |    7 ++++++-
 git-cvsexportcommit.perl              |    5 +++++
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-cvsexportcommit.txt b/Documentation/git-cvsexportcommit.txt
index b2696ef..0bc71cf 100644
--- a/Documentation/git-cvsexportcommit.txt
+++ b/Documentation/git-cvsexportcommit.txt
@@ -71,7 +71,8 @@ OPTIONS
 	Specify the location of the CVS checkout to use for the export. This
 	option does not require GIT_DIR to be set before execution if the
 	current directory is within a git repository.  The default is the
-	value of 'cvsexportcommit.cvsdir'.
+	value of `cvsexportcommit.<branch>.cvsdir` or, if this is not set,
+	the value of `cvsexportcommit.cvsdir`.
 
 -W::
 	Tell cvsexportcommit that the current working directory is not only
@@ -83,6 +84,10 @@ OPTIONS
 
 CONFIGURATION
 -------------
+cvsexportcommit.<branch>.cvsdir::
+	The default location for branch `<name>` of the CVS checkout to use
+	for the export.
+
 cvsexportcommit.cvsdir::
 	The default location of the CVS checkout to use for the export.
 
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 59b6722..3e0c284 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -18,6 +18,11 @@ die "Need at least one commit identifier!" unless @ARGV;
 
 # Get git-config settings
 my $repo = Git->repository();
+my $branch_name = $repo->command_oneline('rev-parse', '--abbrev-ref=loose', 'HEAD') unless defined $opt_w;
+if ($branch_name) {
+    my $per_branch_cvsdir = "cvsexportcommit.".$branch_name.".cvsdir";
+    $opt_w = $repo->config($per_branch_cvsdir);
+}
 $opt_w = $repo->config('cvsexportcommit.cvsdir') unless defined $opt_w;
 
 if ($opt_w || $opt_W) {
-- 
tg: (ddd02b7..) bw/per-branch-cvsdir (depends on: master)

             reply	other threads:[~2010-04-21  0:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21  0:42 Bert Wesarg [this message]
2010-04-21  6:32 ` [RFC/PATCH] cvsexportcommit: per branch cvsdir config option Robin Rosenberg
2010-04-22 19:49   ` Bert Wesarg

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=1271810562-4196-1-git-send-email-bert.wesarg@googlemail.com \
    --to=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    --cc=tpiepho@freescale.com \
    /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).