git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [QGIT RFC] Unit tests for QGit

From
MCMarco Costalba <mcostalba@gmail.com>
Date
Aug 28, 2008, 18:54 UTC
Message-ID
<e5bfff550808281154h67392297y3a08d4ed8aea408f@mail.gmail.com>
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.

Show 6 quoted lines
>
> 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 ...
      }
......
}
Show 6 quoted lines
>> 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
Previous: Karl HasselströmNext: Jan Hudec
Message 14 of 17 in “[QGIT RFC] Unit tests for QGit”
  1. Jan HudecAug 8, 2008
  2. Benjamin SergeantAug 8, 2008
  3. Jan HudecAug 10, 2008
  4. Marco CostalbaAug 17, 2008
  5. Jan HudecAug 17, 2008
  6. Marco CostalbaAug 17, 2008
  7. Jan HudecAug 17, 2008
  8. Marco CostalbaAug 17, 2008
  9. Jan HudecAug 18, 2008
  10. Marco CostalbaAug 19, 2008
  11. Jan HudecAug 27, 2008
  12. Marco CostalbaAug 28, 2008
  13. Karl HasselströmAug 28, 2008
  14. Marco CostalbaAug 28, 2008
  15. Jan HudecAug 28, 2008
  16. Marco CostalbaAug 29, 2008
  17. Karl HasselströmAug 28, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.