{"thread":{"id":"13150","subject":"[PATCH] git-branch: add support for --merged and --unmerged","startedAt":"2008-04-17T09:37:03Z","lastAt":"2008-04-17T22:59:54Z","messageCount":8,"participants":["Lars Hjemli","SZEDER Gábor","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"74624","messageId":"12084250231245-git-send-email-hjemli@gmail.com","threadId":"13150","inReplyTo":null,"subject":"[PATCH] git-branch: add support for --merged and --unmerged","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2008-04-17T09:37:03Z","receivedAt":"2008-04-17T09:37:03Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"These options filter the output from git branch to only include branches\nwhose tip is either merged or not merged into HEAD.\n\nThe use-case for these options is when working with integration of branches\nfrom many remotes: `git branch --unmerged -a` will show a nice list of merge\ncandidates while `git branch --merged -a` will show the progress of your\nintegration work.\n\nAlso, a plain `git branch --merged` is a quick way to find local branches\nwhich you might want to delete.\n\nSigned-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n Documentation/git-branch.txt |    4 +++-\n builtin-branch.c             |   29 ++++++++++++++++++++++++++++-\n 2 files changed, 31 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex 6f07a17..2693519 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -8,7 +8,7 @@ git-branch - List, create, or delete branches\n SYNOPSIS\n --------\n [verse]\n-'git-branch' [--color | --no-color] [-r | -a]\n+'git-branch' [--color | --no-color] [-r | -a] [--merged | --unmerged]\n \t   [-v [--abbrev=<length> | --no-abbrev]]\n \t   [--contains <commit>]\n 'git-branch' [--track | --no-track] [-l] [-f] <branchname> [<start-point>]\n@@ -24,6 +24,8 @@ and option `-a` shows both.\n With `--contains <commit>`, shows only the branches that\n contains the named commit (in other words, the branches whose\n tip commits are descendant of the named commit).\n+With `--merged`, only branches merged into HEAD will be listed,\n+and with `--unmerged` only branches not merged into HEAD will be listed.\n \n In its second form, a new branch named <branchname> will be created.\n It will start out with a head equal to the one given as <start-point>.\ndiff --git a/builtin-branch.c b/builtin-branch.c\nindex 5bc4526..7c91ff0 100644\n--- a/builtin-branch.c\n+++ b/builtin-branch.c\n@@ -15,7 +15,7 @@\n #include \"branch.h\"\n \n static const char * const builtin_branch_usage[] = {\n-\t\"git-branch [options] [-r | -a]\",\n+\t\"git-branch [options] [-r | -a] [--merged | --unmerged]\",\n \t\"git-branch [options] [-l] [-f] <branchname> [<start-point>]\",\n \t\"git-branch [options] [-r] (-d | -D) <branchname>\",\n \t\"git-branch [options] (-m | -M) [<oldbranch>] <newbranch>\",\n@@ -30,6 +30,8 @@ static const char * const builtin_branch_usage[] = {\n static const char *head;\n static unsigned char head_sha1[20];\n \n+static int merged, unmerged;\n+\n static int branch_use_color = -1;\n static char branch_colors[][COLOR_MAXLEN] = {\n \t\"\\033[m\",\t/* reset */\n@@ -204,6 +206,22 @@ static int has_commit(const unsigned char *sha1, struct commit_list *with_commit\n \treturn 0;\n }\n \n+static int is_merged(const unsigned char *sha1, const char *refname)\n+{\n+\tstatic struct commit *head_commit;\n+\tstruct commit *branch;\n+\n+\tif (!head_commit) {\n+\t\thead_commit = lookup_commit_reference(head_sha1);\n+\t\tif (!head_commit)\n+\t\t\tdie(\"Unable to lookup HEAD\");\n+\t}\n+\tbranch = lookup_commit_reference(sha1);\n+\tif (!branch)\n+\t\tdie(\"Unable to lookup branch %s\", refname);\n+\treturn in_merge_bases(branch, &head_commit, 1);\n+}\n+\n static int append_ref(const char *refname, const unsigned char *sha1, int flags, void *cb_data)\n {\n \tstruct ref_list *ref_list = (struct ref_list*)(cb_data);\n@@ -231,6 +249,12 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,\n \tif ((kind & ref_list->kinds) == 0)\n \t\treturn 0;\n \n+\tif (unmerged == 1 && is_merged(sha1, refname))\n+\t\treturn 0;\n+\n+\tif (merged == 1 && !is_merged(sha1, refname))\n+\t\treturn 0;\n+\n \t/* Resize buffer */\n \tif (ref_list->index >= ref_list->alloc) {\n \t\tref_list->alloc = alloc_nr(ref_list->alloc);\n@@ -444,6 +468,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tOPT_BIT('M', NULL, &rename, \"move/rename a branch, even if target exists\", 2),\n \t\tOPT_BOOLEAN('l', NULL, &reflog, \"create the branch's reflog\"),\n \t\tOPT_BOOLEAN('f', NULL, &force_create, \"force creation (when already exists)\"),\n+\t\tOPT_BIT(0, \"unmerged\", &unmerged, \"list only unmerged branches\", 1),\n+\t\tOPT_BIT(0, \"merged\", &merged, \"list only merged branches\", 1),\n+\n \t\tOPT_END(),\n \t};\n \n-- \n1.5.3.1.1.g1e61\n"},{"id":"74632","messageId":"1208432040-26271-1-git-send-email-szeder@ira.uka.de","threadId":"13150","inReplyTo":"12084250231245-git-send-email-hjemli@gmail.com","subject":"[PATCH] bash: support branch's new '--merged' and '--unmerged' options","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2008-04-17T11:34:00Z","receivedAt":"2008-04-17T11:34:00Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>\n---\n> These options filter the output from git branch to only include branches\n> whose tip is either merged or not merged into HEAD.\nI really like the idea, thanks!\nHow about making it easier to type?\n\n contrib/completion/git-completion.bash |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 4d81963..c44f9f4 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -543,7 +543,7 @@ _git_branch ()\n \t--*)\n \t\t__gitcomp \"\n \t\t\t--color --no-color --verbose --abbrev= --no-abbrev\n-\t\t\t--track --no-track\n+\t\t\t--track --no-track --merged --unmerged\n \t\t\t\"\n \t\t;;\n \t*)\n-- \n1.5.5.90.g17e355\n"},{"id":"74654","messageId":"1208455637-17457-1-git-send-email-hjemli@gmail.com","threadId":"13150","inReplyTo":"1208432040-26271-1-git-send-email-szeder@ira.uka.de","subject":"[PATCH] git-branch: add support for --merged and --no-merged","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2008-04-17T18:07:17Z","receivedAt":"2008-04-17T18:07:17Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"These options filter the output from git branch to only include branches\nwhose tip is either merged or not merged into HEAD.\n\nThe use-case for these options is when working with integration of branches\nfrom many remotes: `git branch --no-merged -a` will show a nice list of merge\ncandidates while `git branch --merged -a` will show the progress of your\nintegration work.\n\nAlso, a plain `git branch --merged` is a quick way to find local branches\nwhich you might want to delete.\n\nSigned-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n\nThis is an alternative implementation which (ab)uses the option parser to\nachive the same effect as the former patch. I prefer this approach.\n\nSZEDER GÃ¡bor <szeder@ira.uka.de> wrote:\n> How about making it easier to type?\n\nYes, that's nice, thank you. If my latter patch (i.e. this one ;) is accepted,\nwould you mind updating your patch?\n\n\n Documentation/git-branch.txt |    4 +++-\n builtin-branch.c             |   27 ++++++++++++++++++++++++++-\n 2 files changed, 29 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex 6f07a17..95e9d0d 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -8,7 +8,7 @@ git-branch - List, create, or delete branches\n SYNOPSIS\n --------\n [verse]\n-'git-branch' [--color | --no-color] [-r | -a]\n+'git-branch' [--color | --no-color] [-r | -a] [--merged | --no-merged]\n \t   [-v [--abbrev=<length> | --no-abbrev]]\n \t   [--contains <commit>]\n 'git-branch' [--track | --no-track] [-l] [-f] <branchname> [<start-point>]\n@@ -24,6 +24,8 @@ and option `-a` shows both.\n With `--contains <commit>`, shows only the branches that\n contains the named commit (in other words, the branches whose\n tip commits are descendant of the named commit).\n+With `--merged`, only branches merged into HEAD will be listed, and\n+with `--no-merged` only branches not merged into HEAD will be listed.\n \n In its second form, a new branch named <branchname> will be created.\n It will start out with a head equal to the one given as <start-point>.\ndiff --git a/builtin-branch.c b/builtin-branch.c\nindex 5bc4526..2c26d90 100644\n--- a/builtin-branch.c\n+++ b/builtin-branch.c\n@@ -15,7 +15,7 @@\n #include \"branch.h\"\n \n static const char * const builtin_branch_usage[] = {\n-\t\"git-branch [options] [-r | -a]\",\n+\t\"git-branch [options] [-r | -a] [--merged | --no-merged]\",\n \t\"git-branch [options] [-l] [-f] <branchname> [<start-point>]\",\n \t\"git-branch [options] [-r] (-d | -D) <branchname>\",\n \t\"git-branch [options] (-m | -M) [<oldbranch>] <newbranch>\",\n@@ -46,6 +46,8 @@ enum color_branch {\n \tCOLOR_BRANCH_CURRENT = 4,\n };\n \n+static int mergefilter = -1;\n+\n static int parse_branch_color_slot(const char *var, int ofs)\n {\n \tif (!strcasecmp(var+ofs, \"plain\"))\n@@ -204,6 +206,22 @@ static int has_commit(const unsigned char *sha1, struct commit_list *with_commit\n \treturn 0;\n }\n \n+static int is_merged(const unsigned char *sha1, const char *refname)\n+{\n+\tstatic struct commit *head_commit;\n+\tstruct commit *branch;\n+\n+\tif (!head_commit) {\n+\t\thead_commit = lookup_commit_reference(head_sha1);\n+\t\tif (!head_commit)\n+\t\t\tdie(\"Unable to lookup HEAD\");\n+\t}\n+\tbranch = lookup_commit_reference(sha1);\n+\tif (!branch)\n+\t\tdie(\"Unable to lookup branch %s\", refname);\n+\treturn in_merge_bases(branch, &head_commit, 1);\n+}\n+\n static int append_ref(const char *refname, const unsigned char *sha1, int flags, void *cb_data)\n {\n \tstruct ref_list *ref_list = (struct ref_list*)(cb_data);\n@@ -231,6 +249,12 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,\n \tif ((kind & ref_list->kinds) == 0)\n \t\treturn 0;\n \n+\tif (mergefilter == 0 && is_merged(sha1, refname))\n+\t\treturn 0;\n+\n+\tif (mergefilter == 1 && !is_merged(sha1, refname))\n+\t\treturn 0;\n+\n \t/* Resize buffer */\n \tif (ref_list->index >= ref_list->alloc) {\n \t\tref_list->alloc = alloc_nr(ref_list->alloc);\n@@ -444,6 +468,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tOPT_BIT('M', NULL, &rename, \"move/rename a branch, even if target exists\", 2),\n \t\tOPT_BOOLEAN('l', NULL, &reflog, \"create the branch's reflog\"),\n \t\tOPT_BOOLEAN('f', NULL, &force_create, \"force creation (when already exists)\"),\n+\t\tOPT_SET_INT(0, \"merged\", &mergefilter, \"list only merged branches\", 1),\n \t\tOPT_END(),\n \t};\n \n-- \n1.5.5.64.g3e6a\n"},{"id":"74660","messageId":"7vr6d4nvkm.fsf@gitster.siamese.dyndns.org","threadId":"13150","inReplyTo":"12084250231245-git-send-email-hjemli@gmail.com","subject":"Re: [PATCH] git-branch: add support for --merged and --unmerged","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-04-17T19:13:45Z","receivedAt":"2008-04-17T19:13:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"How does --merged compare with existing --contains?\n\nIf the existing --contains implemenation can be extended to allow negative\nselection, we do not have to introduce yet another mechanism that is very\nsimilar.\n"},{"id":"74666","messageId":"1208463890-2870-1-git-send-email-hjemli@gmail.com","threadId":"13150","inReplyTo":"7vr6d4nvkm.fsf@gitster.siamese.dyndns.org","subject":"[PATCH v3] git-branch: add support for --merged and --no-merged","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2008-04-17T20:24:50Z","receivedAt":"2008-04-17T20:24:50Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"These options filter the output from git branch to only include branches\nwhose tip is either merged or not merged into HEAD.\n\nThe use-case for these options is when working with integration of branches\nfrom many remotes: `git branch --no-merged -a` will show a nice list of merge\ncandidates while `git branch --merged -a` will show the progress of your\nintegration work.\n\nAlso, a plain `git branch --merged` is a quick way to find local branches\nwhich you might want to delete.\n\nSigned-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n\nJunio C Hamano wrote:\n> If the existing --contains implemenation can be extended to allow negative\n> selection, we do not have to introduce yet another mechanism that is very\n> similar.\n\nVery true, so here's an updated version which reuses has_commit(). Thanks\nfor the feedback.\n\n\n Documentation/git-branch.txt |    4 +++-\n builtin-branch.c             |   16 +++++++++++++++-\n 2 files changed, 18 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex 6f07a17..95e9d0d 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -8,7 +8,7 @@ git-branch - List, create, or delete branches\n SYNOPSIS\n --------\n [verse]\n-'git-branch' [--color | --no-color] [-r | -a]\n+'git-branch' [--color | --no-color] [-r | -a] [--merged | --no-merged]\n \t   [-v [--abbrev=<length> | --no-abbrev]]\n \t   [--contains <commit>]\n 'git-branch' [--track | --no-track] [-l] [-f] <branchname> [<start-point>]\n@@ -24,6 +24,8 @@ and option `-a` shows both.\n With `--contains <commit>`, shows only the branches that\n contains the named commit (in other words, the branches whose\n tip commits are descendant of the named commit).\n+With `--merged`, only branches merged into HEAD will be listed, and\n+with `--no-merged` only branches not merged into HEAD will be listed.\n \n In its second form, a new branch named <branchname> will be created.\n It will start out with a head equal to the one given as <start-point>.\ndiff --git a/builtin-branch.c b/builtin-branch.c\nindex 5bc4526..eecbcf2 100644\n--- a/builtin-branch.c\n+++ b/builtin-branch.c\n@@ -15,7 +15,7 @@\n #include \"branch.h\"\n \n static const char * const builtin_branch_usage[] = {\n-\t\"git-branch [options] [-r | -a]\",\n+\t\"git-branch [options] [-r | -a] [--merged | --no-merged]\",\n \t\"git-branch [options] [-l] [-f] <branchname> [<start-point>]\",\n \t\"git-branch [options] [-r] (-d | -D) <branchname>\",\n \t\"git-branch [options] (-m | -M) [<oldbranch>] <newbranch>\",\n@@ -46,6 +46,8 @@ enum color_branch {\n \tCOLOR_BRANCH_CURRENT = 4,\n };\n \n+static int mergefilter = -1;\n+\n static int parse_branch_color_slot(const char *var, int ofs)\n {\n \tif (!strcasecmp(var+ofs, \"plain\"))\n@@ -210,6 +212,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,\n \tstruct ref_item *newitem;\n \tint kind = REF_UNKNOWN_TYPE;\n \tint len;\n+\tstatic struct commit_list branch;\n \n \t/* Detect kind */\n \tif (!prefixcmp(refname, \"refs/heads/\")) {\n@@ -231,6 +234,16 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,\n \tif ((kind & ref_list->kinds) == 0)\n \t\treturn 0;\n \n+\tif (mergefilter > -1) {\n+\t\tbranch.item = lookup_commit_reference_gently(sha1, 1);\n+\t\tif (!branch.item)\n+\t\t\tdie(\"Unable to lookup HEAD of branch %s\", refname);\n+\t\tif (mergefilter == 0 && has_commit(head_sha1, &branch))\n+\t\t\treturn 0;\n+\t\tif (mergefilter == 1 && !has_commit(head_sha1, &branch))\n+\t\t\treturn 0;\n+\t}\n+\n \t/* Resize buffer */\n \tif (ref_list->index >= ref_list->alloc) {\n \t\tref_list->alloc = alloc_nr(ref_list->alloc);\n@@ -444,6 +457,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tOPT_BIT('M', NULL, &rename, \"move/rename a branch, even if target exists\", 2),\n \t\tOPT_BOOLEAN('l', NULL, &reflog, \"create the branch's reflog\"),\n \t\tOPT_BOOLEAN('f', NULL, &force_create, \"force creation (when already exists)\"),\n+\t\tOPT_SET_INT(0, \"merged\", &mergefilter, \"list only merged branches\", 1),\n \t\tOPT_END(),\n \t};\n \n-- \n1.5.5.64.gb1a99\n"},{"id":"74673","messageId":"7vzlrsmbqw.fsf@gitster.siamese.dyndns.org","threadId":"13150","inReplyTo":"1208463890-2870-1-git-send-email-hjemli@gmail.com","subject":"Re: [PATCH v3] git-branch: add support for --merged and --no-merged","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-04-17T21:07:19Z","receivedAt":"2008-04-17T21:07:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Lars Hjemli <hjemli@gmail.com> writes:\n\n> Junio C Hamano wrote:\n>> If the existing --contains implemenation can be extended to allow negative\n>> selection, we do not have to introduce yet another mechanism that is very\n>> similar.\n>\n> Very true, so here's an updated version which reuses has_commit(). Thanks\n> for the feedback.\n\n> +\tif (mergefilter > -1) {\n> +\t\tbranch.item = lookup_commit_reference_gently(sha1, 1);\n> +\t\tif (!branch.item)\n> +\t\t\tdie(\"Unable to lookup HEAD of branch %s\", refname);\n> +\t\tif (mergefilter == 0 && has_commit(head_sha1, &branch))\n> +\t\t\treturn 0;\n> +\t\tif (mergefilter == 1 && !has_commit(head_sha1, &branch))\n> +\t\t\treturn 0;\n> +\t}\n\nYou did not answer my question as to how --contains and --merged relate to\neach other.  I'll answer it myself (please add a documentation updates, as\nthis would be confusing).  The output from the former is \"branches I need\nto be careful about, if I were to rewind and rebuild this branch\" (that is\nwhat I invented the option for).  The output from the latter is \"branches\nI can remove with 'git branch -d'\".\n\n * --contains (aka with_commit) gets a single commit; only the branches\n   that are descendant of that named commit will be shown (iow, these\n   branches contain the commit), with the expression:\n\n\t/* Filter with with_commit if specified */\n\tif (!has_commit(sha1, ref_list->with_commit))\n\t\treturn 0;\n\n   where \"sha1\" is the commit at the tip of the branch in question in this\n   round of the loop.\n\n * --merged is the opposite way.  Only the branches whose tips are\n   ancestors of the HEAD will be shown (iow, the HEAD contains these\n   branches), with the expression:\n\n   \tif (has_commit(head_sha1, &branch))\n\n   where \"head_sha1\" is the HEAD, and \"branch\" is the branch in question\n   in this round of the loop.  i.e. it asks the same question as\n   --contains but in the opposite way.\n"},{"id":"74686","messageId":"1208471228-26232-1-git-send-email-hjemli@gmail.com","threadId":"13150","inReplyTo":"7vzlrsmbqw.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] git-branch.txt: compare --contains, --merged and --no-merged","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2008-04-17T22:27:08Z","receivedAt":"2008-04-17T22:27:08Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"Signed-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n\nJunio C Hamano wrote:\n> You did not answer my question as to how --contains and --merged relate to\n> each other.\n\nSorry, I deemed it to be rhetorical.\n\n\n> I'll answer it myself (please add a documentation updates, as\n> this would be confusing).\n\nSomething like this, maybe?\n\n\n Documentation/git-branch.txt |   18 ++++++++++++++++++\n 1 files changed, 18 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex 95e9d0d..7e37497 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -120,6 +120,15 @@ OPTIONS\n --no-track::\n \tIgnore the branch.autosetupmerge configuration variable.\n \n+--contains <commit>::\n+\tOnly list branches which contain the specified commit.\n+\n+--merged::\n+\tOnly list branches which are fully contained by HEAD.\n+\n+--no-merged::\n+\tDo not list branches which are fully contained by HEAD.\n+\n <branchname>::\n \tThe name of the branch to create or delete.\n \tThe new branch name must pass all checks defined by\n@@ -177,6 +186,15 @@ If you are creating a branch that you want to immediately checkout, it's\n easier to use the git checkout command with its `-b` option to create\n a branch and check it out with a single command.\n \n+The options `--contains`, `--merged` and `--no-merged` serves three related\n+but different purposes:\n+<1> `--contains <commit>` is used to find all branches which will need\n+special attention if <commit> were to be rebased or amended, since those\n+branches contain the specified <commit>.\n+<2> `--merged` is used to find all branches which can be safely deleted,\n+since those branches are fully contained by HEAD.\n+<3> `--no-merged` is used to find branches which are candidates for merging\n+into HEAD, since those branches are not fully contained by HEAD.\n \n Author\n ------\n-- \n1.5.5.64.gb1a99\n"},{"id":"74690","messageId":"8c5c35580804171559u87f70b6j59d327ca514da714@mail.gmail.com","threadId":"13150","inReplyTo":"1208463890-2870-1-git-send-email-hjemli@gmail.com","subject":"Re: [PATCH v3] git-branch: add support for --merged and --no-merged","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2008-04-17T22:59:54Z","receivedAt":"2008-04-17T22:59:54Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"On Thu, Apr 17, 2008 at 10:24 PM, Lars Hjemli <hjemli@gmail.com> wrote:\n> These options filter the output from git branch to only include branches\n>  whose tip is either merged or not merged into HEAD.\n\nGaah, I just noticed a slight terminology slip. Could you please apply\nthis on top of [PATCH v3]?\n\n(hopefully not mangled by gmail...)\n\n---\ndiff --git a/builtin-branch.c b/builtin-branch.c\nindex eecbcf2..19c508a 100644\n--- a/builtin-branch.c\n+++ b/builtin-branch.c\n@@ -237,7 +237,7 @@ static int append_ref(const char *refname\n        if (mergefilter > -1) {\n                branch.item = lookup_commit_reference_gently(sha1, 1);\n                if (!branch.item)\n-                       die(\"Unable to lookup HEAD of branch %s\", refname);\n+                       die(\"Unable to lookup tip of branch %s\", refname);\n                if (mergefilter == 0 && has_commit(head_sha1, &branch))\n                        return 0;\n                if (mergefilter == 1 && !has_commit(head_sha1, &branch))\n"}]}