{"thread":{"id":"43374","subject":"Re: Possible BUG with git-rev-list --all in a StGit repository","startedAt":"2006-11-26T16:27:27Z","lastAt":"2006-11-28T12:11:30Z","messageCount":10,"participants":["Junio C Hamano","Marco Costalba","Sergey Vlasov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"296159","messageId":"e5bfff550611260827t686a5071w7f050f17f784e5d9@mail.gmail.com","threadId":"43374","inReplyTo":null,"subject":"Possible BUG with git-rev-list --all in a StGit repository","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2006-11-26T16:27:27Z","receivedAt":"2006-11-26T16:27:27Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"In a StGit repository the --all option causes a lot of spurious\nrevisions, possibly stgit related.\n\n$ git branch\n* master\n  origin\n  test\n\n$ git rev-list master origin test -- src/settingsimpl.cpp | wc\n     13      13     533\n\n$ git rev-list --all -- src/settingsimpl.cpp | wc\n     26      26    1066\n\n\nThe extra revisions have shortlogs of the kind of:\n\n push        a3bc76fd0bdd154149c26a3c208f0344e9cd873b\n new e7baf56544cd8b4f8601a35fad274b8de97fd558\nrefresh     8fa01a56a40b04ed9c6d006c669ca9d370176728\n\nFrom qgit these are easily seen from file history tab of a file\nmodified by stgit patches or when filtering in main view on the same\nfile.\n\nShouldn't 'git-rev-list --all'  print  *the same output* of when the\nlist  with all branches is given in command line?\n\nThanks\nMarco\n\nP.S:\n$ git version\ngit version 1.4.4.1.g7002\n$ stg --version\nStacked GIT 0.11\ngit version 1.4.4.1.g7002\nPython version 2.4.3 (#2, Oct  6 2006, 15:32:41)\n"},{"id":"294548","messageId":"7v7ixit13h.fsf@assigned-by-dhcp.cox.net","threadId":"43374","inReplyTo":"e5bfff550611260827t686a5071w7f050f17f784e5d9@mail.gmail.com","subject":"Re: Possible BUG with git-rev-list --all in a StGit repository","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-26T20:16:50Z","receivedAt":"2006-11-26T20:16:50Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Marco Costalba\" <mcostalba@gmail.com> writes:\n\n> In a StGit repository the --all option causes a lot of spurious\n> revisions, possibly stgit related.\n>\n> $ git branch\n> * master\n>  origin\n>  test\n>\n> $ git rev-list master origin test -- src/settingsimpl.cpp | wc\n>     13      13     533\n>\n> $ git rev-list --all -- src/settingsimpl.cpp | wc\n>     26      26    1066\n>\n>\n> The extra revisions have shortlogs of the kind of:\n>\n> push        a3bc76fd0bdd154149c26a3c208f0344e9cd873b\n> new e7baf56544cd8b4f8601a35fad274b8de97fd558\n> refresh     8fa01a56a40b04ed9c6d006c669ca9d370176728\n>\n>>From qgit these are easily seen from file history tab of a file\n> modified by stgit patches or when filtering in main view on the same\n> file.\n>\n> Shouldn't 'git-rev-list --all'  print  *the same output* of when the\n> list  with all branches is given in command line?\n\nShould it?  The \"--all\" option is about \"all refs\", not \"all\nuser branches\" and it has been so from the beginning.  For one\nthing it has to do the reachability thing also for tags\n(otherwise it cannot be used as the upstream for git-repack\npipeline).\n\nYou are looking at .git/refs/bases/ refs that StGIT uses for its\ninternal bookkeeping.\n\n"},{"id":"298504","messageId":"e5bfff550611262231s3eac2d11ke9fcdb0d699093f0@mail.gmail.com","threadId":"43374","inReplyTo":"7v7ixit13h.fsf@assigned-by-dhcp.cox.net","subject":"Re: Possible BUG with git-rev-list --all in a StGit repository","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2006-11-27T06:31:49Z","receivedAt":"2006-11-27T06:31:49Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":">\n> You are looking at .git/refs/bases/ refs that StGIT uses for its\n> internal bookkeeping.\n>\nOk.\n\nAnyway, getting garbage when asking for a git-rev-list --all if in a\nStGit repo at least could be considered a little integration issue.\n\nInternal bookkeeing should be, well,  _internal_  :-)\n\n"},{"id":"295606","messageId":"e5bfff550611262238q60d466a3r230c9c4af283b76b@mail.gmail.com","threadId":"43374","inReplyTo":"e5bfff550611262231s3eac2d11ke9fcdb0d699093f0@mail.gmail.com","subject":"Re: Possible BUG with git-rev-list --all in a StGit repository","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2006-11-27T06:38:30Z","receivedAt":"2006-11-27T06:38:30Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"On 11/27/06, Marco Costalba <mcostalba@gmail.com> wrote:\n> >\n> > You are looking at .git/refs/bases/ refs that StGIT uses for its\n> > internal bookkeeping.\n> >\n> Ok.\n>\n> Anyway, getting garbage when asking for a git-rev-list --all if in a\n> StGit repo at least could be considered a little integration issue.\n>\n> Internal bookkeeing should be, well,  _internal_  :-)\n>\n\n\n"},{"id":"295298","messageId":"7vzmadl5b0.fsf@assigned-by-dhcp.cox.net","threadId":"43374","inReplyTo":"e5bfff550611262238q60d466a3r230c9c4af283b76b@mail.gmail.com","subject":"Re: Possible BUG with git-rev-list --all in a StGit repository","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-27T07:25:23Z","receivedAt":"2006-11-27T07:25:23Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Marco Costalba\" <mcostalba@gmail.com> writes:\n\n> Could a possible '--all-branches' new option come to rescue?\n\nI doubt it.  Next thing people would start talking about is what\nto do with the remote tracking branches, and what we are talking\nabout is rev-list, one of the lower level of plumbing that would\nbe better left without knowing much about the Porcelain's use of\nrefs/ namespaces.\n\nIf you (as a Porcelain) want to get all refs under refs/heads/,\nthere are (unfortunately) two ways to get that list.  I would\nsuggest obtain the refs you want that way, pass them as command\nline arguments to rev-list.\n\n$ git for-each-ref --format='%(refname)' refs/heads\n$ git show-ref --heads | sed -e 's/^[^ ]* //'\n\n"},{"id":"296865","messageId":"11646401513369-git-send-email-vsu@altlinux.ru","threadId":"43374","inReplyTo":"7vzmadl5b0.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] revision traversal: Add --refs=<pattern> option","fromName":"Sergey Vlasov","fromEmail":"vsu@altlinux.ru","sentAt":"2006-11-27T15:09:11Z","receivedAt":"2006-11-27T15:09:11Z","isPatch":true,"sender":{"key":"vsu@altlinux.ru","avatar":"https://avatars.githubusercontent.com/u/616082?v=4"},"body":"Add the --refs=<pattern> option, which can be used to select a\nsubset of refs matching the specified glob pattern.\n\nSigned-off-by: Sergey Vlasov <vsu@altlinux.ru>\n---\n\n If --all-branches is too specific for the mentioned use case,\n what about adding a more general glob pattern match?\n\n Documentation/git-rev-list.txt |    9 +++++++++\n revision.c                     |   21 ++++++++++++++++++---\n 2 files changed, 27 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt\nindex ec43c0b..d5f99ef 100644\n--- a/Documentation/git-rev-list.txt\n+++ b/Documentation/git-rev-list.txt\n@@ -17,6 +17,7 @@ SYNOPSIS\n \t     [ \\--remove-empty ]\n \t     [ \\--not ]\n \t     [ \\--all ]\n+\t     [ \\--refs=<pattern> ]\n \t     [ \\--stdin ]\n \t     [ \\--topo-order ]\n \t     [ \\--parents ]\n@@ -179,6 +180,14 @@ limiting may be applied.\n \tPretend as if all the refs in `$GIT_DIR/refs/` are listed on the\n \tcommand line as '<commit>'.\n \n+--refs='pattern'::\n+\n+\tPretend as if all the refs in `$GIT_DIR/refs/` matching the\n+\tspecified glob pattern are listed on the command line as\n+\t'<commit>'.  The initial `refs/` part is skipped when matching,\n+\tbut the subsequent `heads/`, `tags/` or `remotes/` part is\n+\tincluded in the text to match.\n+\n --stdin::\n \n \tIn addition to the '<commit>' listed on the command\ndiff --git a/revision.c b/revision.c\nindex 993bb66..240ff59 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -7,6 +7,7 @@\n #include \"refs.h\"\n #include \"revision.h\"\n #include <regex.h>\n+#include <fnmatch.h>\n #include \"grep.h\"\n \n static char *path_name(struct name_path *path, const char *name)\n@@ -464,18 +465,28 @@ static void limit_list(struct rev_info *\n \n static int all_flags;\n static struct rev_info *all_revs;\n+static const char *all_pattern;\n \n static int handle_one_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)\n {\n-\tstruct object *object = get_reference(all_revs, path, sha1, all_flags);\n+\tstruct object *object;\n+\n+\tif (all_pattern) {\n+\t\tif (strncmp(path, \"refs/\", 5))\n+\t\t\treturn 0;\n+\t\tif (fnmatch(all_pattern, path + 5, 0))\n+\t\t\treturn 0;\n+\t}\n+\tobject = get_reference(all_revs, path, sha1, all_flags);\n \tadd_pending_object(all_revs, object, \"\");\n \treturn 0;\n }\n \n-static void handle_all(struct rev_info *revs, unsigned flags)\n+static void handle_all(struct rev_info *revs, unsigned flags, const char *pattern)\n {\n \tall_revs = revs;\n \tall_flags = flags;\n+\tall_pattern = pattern;\n \tfor_each_ref(handle_one_ref, NULL);\n }\n \n@@ -800,7 +811,11 @@ int setup_revisions(int argc, const char\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--all\")) {\n-\t\t\t\thandle_all(revs, flags);\n+\t\t\t\thandle_all(revs, flags, NULL);\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tif (!strncmp(arg, \"--refs=\", 7)) {\n+\t\t\t\thandle_all(revs, flags, arg + 7);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--not\")) {\n-- \n1.4.4.1.gb0b0\n"},{"id":"296342","messageId":"7vhcwke90a.fsf@assigned-by-dhcp.cox.net","threadId":"43374","inReplyTo":"11646401513369-git-send-email-vsu@altlinux.ru","subject":"Re: [PATCH] revision traversal: Add --refs=<pattern> option","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-27T23:59:33Z","receivedAt":"2006-11-27T23:59:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Vlasov <vsu@altlinux.ru> writes:\n\n> Add the --refs=<pattern> option, which can be used to select a\n> subset of refs matching the specified glob pattern.\n>\n> Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>\n> ---\n>\n>  If --all-branches is too specific for the mentioned use case,\n>  what about adding a more general glob pattern match?\n\nTraditionally any new option to rev-list must be accompanied\nwith a matching change to rev-parse.  I do not know offhand how\nstrictly we should adhere to this rule these days; it depends on\nhow people's script use rev-list.\n\nBefore revision.c \"revision walking library\" was done, many\nPorcelain-ish commands were implemented as a pipeline that plugs\nrev-list output to diff-tree.  These shell scripts took\nparameters from the command line, and rev-parse was used to\nseparate parameters (both \"flags\" that begin with a dash and\n\"non-flags\" that don't) that should be given to rev-list and the\nother parameters (meant to be used by the shell script itself\nbut often are given straight to the downstream diff-tree).  The\nrev-parse command has even the --sq option to facilitate this\nusage:\n\n\trev_opts=`git rev-parse --sq --default=HEAD --revs \"$@\"`\n\tdiff_opts=`git rev-parse --sq --no-revs \"$@\"`\n        eval \"git-rev-list $rev_opts\" |\n        eval \"git-diff-tree --stdin $diff_opts\"\n\nso that it can even pass -S'I want to find this string' to diff-tree\nwithout worrying about spaces.\n\nI personally feel that part of rev-parse outlived its usefulness\n(--flags, --no-flags, --revs-only, and --no-revs).  It was a\nuseful hack, and served us well, but it was a hack.\n\nIn that sense it probably is Ok to leave it unmaintained, but it\nmight be a good idea to plan deprecating it, given that we have\nbeen talking about UI warts.  If there are pipelines that can be\neasily formed (with the help of rev-parse \"parameter sifter\"),\nbut whose functionality cannot be easily emulated with the\ncurrent crop of Porcelain-ish, we should work on polishing the\nPorcelain-ish to make the pipelines unnecessary.\n\nThe remaining parts of rev-parse (the most important of which is\nthe --verify option) should probably stay.  The original\nquestion of \"list all the branches\" can be done with:\n\n\tgit rev-parse --symbolic --branches\n\n"},{"id":"297309","messageId":"e5bfff550611272357w33756febud0bbbe59e2e1e140@mail.gmail.com","threadId":"43374","inReplyTo":"7vzmadl5b0.fsf@assigned-by-dhcp.cox.net","subject":"Re: Possible BUG with git-rev-list --all in a StGit repository","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2006-11-28T07:57:15Z","receivedAt":"2006-11-28T07:57:15Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"On 11/27/06, Junio C Hamano <junkio@cox.net> wrote:\n> \"Marco Costalba\" <mcostalba@gmail.com> writes:\n>\n> > Could a possible '--all-branches' new option come to rescue?\n>\n> I doubt it.  Next thing people would start talking about is what\n> to do with the remote tracking branches, and what we are talking\n> about is rev-list, one of the lower level of plumbing that would\n> be better left without knowing much about the Porcelain's use of\n> refs/ namespaces.\n>\n> If you (as a Porcelain) want to get all refs under refs/heads/,\n> there are (unfortunately) two ways to get that list.  I would\n> suggest obtain the refs you want that way, pass them as command\n> line arguments to rev-list.\n>\n\nUnfortunatly that does not work in case a branch and a tag have the same name.\n\nI was bitten by this trying to do what you now suggest, there were a\ntag and a branch called 'test', and calling\n\ngit-rev-list master origin test\n\nraised a warning.\n\nOnly among the _same_ 'family' (branches, tags, etc..) unique names\nare enforced.\n\n"},{"id":"295992","messageId":"7vd57855fy.fsf@assigned-by-dhcp.cox.net","threadId":"43374","inReplyTo":"e5bfff550611272357w33756febud0bbbe59e2e1e140@mail.gmail.com","subject":"Re: Possible BUG with git-rev-list --all in a StGit repository","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-28T08:41:21Z","receivedAt":"2006-11-28T08:41:21Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Marco Costalba\" <mcostalba@gmail.com> writes:\n\n>> If you (as a Porcelain) want to get all refs under refs/heads/,\n>> there are (unfortunately) two ways to get that list.  I would\n>> suggest obtain the refs you want that way, pass them as command\n>> line arguments to rev-list.\n>\n> Unfortunatly that does not work in case a branch and a tag have the same name.\n\nI am not quite grokking what the problem you are trying to solve\nis, so this is a shot in the dark, but\n\n\tgit rev-list refs/heads/test refs/tags/test\n\nto disambiguate, perhaps?\n"},{"id":"296425","messageId":"e5bfff550611280411q737fc47s5a221bae078333b5@mail.gmail.com","threadId":"43374","inReplyTo":"7vd57855fy.fsf@assigned-by-dhcp.cox.net","subject":"Re: Possible BUG with git-rev-list --all in a StGit repository","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2006-11-28T12:11:30Z","receivedAt":"2006-11-28T12:11:30Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"On 11/28/06, Junio C Hamano <junkio@cox.net> wrote:\n> \"Marco Costalba\" <mcostalba@gmail.com> writes:\n>\n> >> If you (as a Porcelain) want to get all refs under refs/heads/,\n> >> there are (unfortunately) two ways to get that list.  I would\n> >> suggest obtain the refs you want that way, pass them as command\n> >> line arguments to rev-list.\n> >\n> > Unfortunatly that does not work in case a branch and a tag have the same name.\n>\n> I am not quite grokking what the problem you are trying to solve\n> is, so this is a shot in the dark, but\n>\n>         git rev-list refs/heads/test refs/tags/test\n>\n> to disambiguate, perhaps?\n>\n\nInteresting!\n\nI didn't think about 'full path' explicitation. If the barnches are\nalways and only under refs/heads this should work.\n\nThanks\n"}]}