git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Marco Costalba" <mcostalba@gmail.com>
To: "Karl Hasselström" <kha@treskal.com>
Cc: "Jan Hudec" <bulb@ucw.cz>, git@vger.kernel.org
Subject: Re: [QGIT RFC] Unit tests for QGit
Date: Thu, 28 Aug 2008 20:54:44 +0200	[thread overview]
Message-ID: <e5bfff550808281154h67392297y3a08d4ed8aea408f@mail.gmail.com> (raw)
In-Reply-To: <20080828153118.GA13169@diana.vm.bytemark.co.uk>

On Thu, Aug 28, 2008 at 5:31 PM, Karl Hasselström <kha@treskal.com> wrote:
>
> StGit has no per-repo data. It's all per-branch. "stg init" operates
> on the current branch, not the whole repo.
>

Ok. Thanks. In this case the check qgit does is broken, and I think
not only that because I never had this point clear while developing
the interface.

>
> Hmm. For me, "stg branch" succeeds even if "stg init" has not yet been
> run (which is arguably as it should be, since it doesn't require that
> stg init has been run in the current branch). "stg series" or
> something is probably better for this purpose.
>

But if I run 'stg branch' in a git-only repo this gives an error. This
conditions, at least until now, has always been working for me.


> Though if you're concerned about speed (as the comment indicates), you
> should probably do something cheaper than running stg, such as
> checking if .git/patches/<branchname> exists.
>

Actually the actual code chunk is:

        // check for a StGIT stack
         QDir d = gitDir;

         if (d.exists("patches")) { // early skip

                 isStGIT = run("stg branch", &stgCurBranch); // slow command

                 stgCurBranch = stgCurBranch.trimmed();
         } else
                 isStGIT = false;



Indeed I need the Stgit current branch name to filter out the refs
found with a following "git show-ref -d" command:

The code chunk is actually

// run the command and save output in runOutpt
if (!run("git show-ref -d", &runOutput))
       return false;

QStringList refsList = runOutput.split('\n', QString::SkipEmptyParts);

FOREACH_SL (it, refsList) {

      QString revSha = (*it).left(40);
      QString refName = (*it).mid(41);

      // save StGIT patch sha, to be used later
      if (refName.startsWith("refs/patches/" + stgCurBranch + "/")) {

              .... we have found a reference to a StGit patch of
current branch ...
      }

......

}



>> So it's not very clear to me what does it mean "switching from
>> non-stgit branch to a stgit one"
>
> Switching from a branch where "stg init" hasn't been run, to one where
> it has.
>

Thanks again. I don't know why but I was somehow sticked to the idea
that 'stg init' was behaving similar to 'git init', i.e. you need to
run it only once per repo.

Marco

  reply	other threads:[~2008-08-28 18:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-08 21:13 [QGIT RFC] Unit tests for QGit Jan Hudec
2008-08-08 23:00 ` Benjamin Sergeant
2008-08-10  7:55   ` Jan Hudec
2008-08-17  8:57 ` Marco Costalba
2008-08-17 14:15   ` Jan Hudec
2008-08-17 15:46 ` Marco Costalba
2008-08-17 19:58   ` Jan Hudec
2008-08-17 20:30     ` Marco Costalba
2008-08-18 18:00       ` Jan Hudec
2008-08-19 14:53         ` Marco Costalba
2008-08-27 20:18           ` Jan Hudec
2008-08-28 11:29             ` Marco Costalba
2008-08-28 15:31               ` Karl Hasselström
2008-08-28 18:54                 ` Marco Costalba [this message]
2008-08-28 22:01                   ` Jan Hudec
2008-08-29  7:01                     ` Marco Costalba
2008-08-28 22:18                   ` Karl Hasselström

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=e5bfff550808281154h67392297y3a08d4ed8aea408f@mail.gmail.com \
    --to=mcostalba@gmail.com \
    --cc=bulb@ucw.cz \
    --cc=git@vger.kernel.org \
    --cc=kha@treskal.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).