{"thread":{"id":"28322","subject":"Git without morning coffee","startedAt":"2011-09-07T07:48:51Z","lastAt":"2011-09-07T20:59:08Z","messageCount":8,"participants":["Michael J Gruber","Junio C Hamano","Michael Witten"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"174983","messageId":"4E6721E3.7000207@drmicha.warpmail.net","threadId":"28322","inReplyTo":null,"subject":"Git without morning coffee","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-09-07T07:48:51Z","receivedAt":"2011-09-07T07:48:51Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Is this my lack of morning coffee, or git's:\n\ngit rev-parse origin/next origin/pu\n7931f38a2fd882b0f75a4d6f0eb60c3b1b094178\nedf014b39ded8ee8a67f2a0cd8d7926b33f3d578\n# OK\n\ngit checkout origin/next\nHEAD is now at 7931f38... Merge branch 'master' into next\n# OK\n\ngit log --oneline --no-walk \":/Merge branch 'jk/generation-numbers' into pu\"\n0ac76f9 Merge branch 'jk/generation-numbers' into pu\n# Sure it is.\n\ngit merge \":/Merge branch 'jk/generation-numbers' into pu\"\nfatal: ':/Merge branch 'jk/generation-numbers' into pu' does not point\nto a commit\n# Huh?\n\ngit rev-parse \":/Merge branch 'jk/generation-numbers' into pu\"\n0ac76f96a94a46bce7ec9dcc6c67abcf9d36adac\n# It does point to a commit!\n\ngit merge $(git rev-parse \":/Merge branch 'jk/generation-numbers' into pu\")\nerror: addinfo_cache failed for path 't/t7810-grep.sh'\nPerforming inexact rename detection: 100% (91476/91476), done.\nerror: addinfo_cache failed for path 't/t7810-grep.sh'\nerror: addinfo_cache failed for path 'gitweb/static/gitweb.js'\nerror: addinfo_cache failed for path 'gitweb/static/gitweb.css'\n\n## hundreds more\n\nerror: addinfo_cache failed for path 't/t7810-grep.sh'\nerror: addinfo_cache failed for path 'gitweb/static/js/blame_incremental.js'\nAuto-merging cache.h\nMerge made by the 'recursive' strategy.\n\n\nDouble Huh? Finally, the merge succeeds, despite thy myriad of errors.\n\nI mean, I'm merging a commit from origin/pu to origin/next when the\nlatter is basically contained in the former (except for some merge\ncommits). And what are these addinfo_cache errors?\n\ngit --version\ngit version 1.7.7.rc0.328.g9d6c7\n\nwhich is last week's next with a few additions which I've been carrying\nalong for weeks. Stumped.\n\nMichael\n"},{"id":"174993","messageId":"7vehzs47we.fsf@alter.siamese.dyndns.org","threadId":"28322","inReplyTo":"4E6721E3.7000207@drmicha.warpmail.net","subject":"Re: Git without morning coffee","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-09-07T16:46:57Z","receivedAt":"2011-09-07T16:46:57Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> git merge \":/Merge branch 'jk/generation-numbers' into pu\"\n> fatal: ':/Merge branch 'jk/generation-numbers' into pu' does not point\n> to a commit\n> # Huh?\n\nInteresting.\n\n> git merge $(git rev-parse \":/Merge branch 'jk/generation-numbers' into pu\")\n> error: addinfo_cache failed for path 't/t7810-grep.sh'\n> Performing inexact rename detection: 100% (91476/91476), done.\n> error: addinfo_cache failed for path 't/t7810-grep.sh'\n\nSmells like another case where merge-recursive is looking at the work tree\nwhen it shouldn't inside an inner merge or something.\n\n> I mean, I'm merging a commit from origin/pu to origin/next when the\n> latter is basically contained in the former (except for some merge\n> commits).\n\nThis falls into the \"side note\" category, but these days 'next' and 'pu'\ndo not share any history beyond the tip of 'master'. Every time I update\nthe 'pu' branch, it is rebuilt directly on top of 'master' from scratch by\nmerging the topics in 'next' (and at this point I make sure its tree\nmatches that of 'next') and then merging remaining topics on top of the\nresult. A topic often goes through multiple iterations of fix-ups while in\n'next', and these fix-ups result in multiple incremental merges of the\nsame topic into 'next'; I do not want to see an incorrect merge when such\na topic is merged in a single-step into 'master', and it is one way to\nensure the health of the merge fixup machinery (including the rerere\ndatabase) to attempt from-scratch-the-whole-topic-at-once merges and\nverify the result.\n\nThe merge you attempted will have a lot of \"the history leading to the\ncurrent commit added/modified in a certain way and the history being\nmerged did the same modification independently\" kind of conflicts that\nshould resolve to no-op.\n"},{"id":"175005","messageId":"CAMOZ1BstyMteutmK7tst=3t9djavY9_4vBKJgdj7rhUnE1Wr7w@mail.gmail.com","threadId":"28322","inReplyTo":"7vehzs47we.fsf@alter.siamese.dyndns.org","subject":"Re: Git without morning coffee","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-09-07T17:23:10Z","receivedAt":"2011-09-07T17:23:10Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"[Sorry for the repeat, Junio]\n\nOn Wed, Sep 7, 2011 at 16:46, Junio C Hamano <gitster@pobox.com> wrote:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n>\n>> git merge \":/Merge branch 'jk/generation-numbers' into pu\"\n>> fatal: ':/Merge branch 'jk/generation-numbers' into pu' does not point\n>> to a commit\n>> # Huh?\n>\n> Interesting.\n>\n>> git merge $(git rev-parse \":/Merge branch 'jk/generation-numbers' into pu\")\n>> error: addinfo_cache failed for path 't/t7810-grep.sh'\n>> Performing inexact rename detection: 100% (91476/91476), done.\n>> error: addinfo_cache failed for path 't/t7810-grep.sh'\n>\n> Smells like another case where merge-recursive is looking at the work tree\n> when it shouldn't inside an inner merge or something.\n>\n>> I mean, I'm merging a commit from origin/pu to origin/next when the\n>> latter is basically contained in the former (except for some merge\n>> commits).\n>\n> This falls into the \"side note\" category, but these days 'next' and 'pu'\n> do not share any history beyond the tip of 'master'. Every time I update\n> the 'pu' branch, it is rebuilt directly on top of 'master' from scratch by\n> merging the topics in 'next' (and at this point I make sure its tree\n> matches that of 'next') and then merging remaining topics on top of the\n> result. A topic often goes through multiple iterations of fix-ups while in\n> 'next', and these fix-ups result in multiple incremental merges of the\n> same topic into 'next'; I do not want to see an incorrect merge when such\n> a topic is merged in a single-step into 'master', and it is one way to\n> ensure the health of the merge fixup machinery (including the rerere\n> database) to attempt from-scratch-the-whole-topic-at-once merges and\n> verify the result.\n>\n> The merge you attempted will have a lot of \"the history leading to the\n> current commit added/modified in a certain way and the history being\n> merged did the same modification independently\" kind of conflicts that\n> should resolve to no-op.\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n\nI think it would be great if at some point you could write a detailed\ntutorial of how you maintain git (using example topics, example patch\nseries and pull requests, and follow-along command sequences, etc.).\nMost importantly, it would be nice to see an explicit description of\nthe maintenance properties you are trying to achieve with your\nworkflow.\n"},{"id":"175007","messageId":"7v62l445nw.fsf@alter.siamese.dyndns.org","threadId":"28322","inReplyTo":"7vehzs47we.fsf@alter.siamese.dyndns.org","subject":"Re: Git without morning coffee","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-09-07T17:35:15Z","receivedAt":"2011-09-07T17:35:15Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n>\n>> git merge \":/Merge branch 'jk/generation-numbers' into pu\"\n>> fatal: ':/Merge branch 'jk/generation-numbers' into pu' does not point\n>> to a commit\n>> # Huh?\n>\n> Interesting.\n\nThis is because 1c7b76b (Build in merge, 2008-07-07) grabs the name of the\ncommit to be merged using peel_to_type(), which was defined in 8177631\n(expose a helper function peel_to_type()., 2007-12-24) in terms of\nget_sha1_1(). It understands $commit~$n, $commit^$n and $ref@{$nth}, but\ndoes not understand :/$str, $treeish:$path, and :$stage:$path.\n"},{"id":"175015","messageId":"7vy5y02qf4.fsf@alter.siamese.dyndns.org","threadId":"28322","inReplyTo":"CAMOZ1BstyMteutmK7tst=3t9djavY9_4vBKJgdj7rhUnE1Wr7w@mail.gmail.com","subject":"Re: Git without morning coffee","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-09-07T17:49:51Z","receivedAt":"2011-09-07T17:49:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Witten <mfwitten@gmail.com> writes:\n\n> I think it would be great if at some point you could write a detailed\n> tutorial of how you maintain git...\n\nIs MaintNotes[*1*] taken together with Documentation/howto/maintain-git.txt\ninsufficient?\n\n[Reference]\n*1* http://git-blame.blogspot.com/p/note-from-maintainer.html\n"},{"id":"175017","messageId":"7vty8o2p7g.fsf_-_@alter.siamese.dyndns.org","threadId":"28322","inReplyTo":"7v62l445nw.fsf@alter.siamese.dyndns.org","subject":"Re* Git without morning coffee","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-09-07T18:16:03Z","receivedAt":"2011-09-07T18:16:03Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Michael J Gruber <git@drmicha.warpmail.net> writes:\n>>\n>>> git merge \":/Merge branch 'jk/generation-numbers' into pu\"\n>>> fatal: ':/Merge branch 'jk/generation-numbers' into pu' does not point\n>>> to a commit\n>>> # Huh?\n>>\n>> Interesting.\n>\n> This is because 1c7b76b (Build in merge, 2008-07-07) grabs the name of the\n> commit to be merged using peel_to_type(), which was defined in 8177631\n> (expose a helper function peel_to_type()., 2007-12-24) in terms of\n> get_sha1_1(). It understands $commit~$n, $commit^$n and $ref@{$nth}, but\n> does not understand :/$str, $treeish:$path, and :$stage:$path.\n\n-- >8 --\nSubject: Allow git merge \":/<pattern>\"\n\nIt probably is not such a good idea to use \":/<pattern>\" to specify which\ncommit to merge, as \":/<pattern>\" can often hit unexpected commits, but\nsomebody tried it and got a nonsense error message:\n\n\tfatal: ':/Foo bar' does not point to a commit\n\nSo here is a for-the-sake-of-consistency update that is fairly useless\nthat allows users to carefully try not shooting in the foot.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/merge.c |   19 ++++++++++++++-----\n sha1_name.c     |    6 ------\n 2 files changed, 14 insertions(+), 11 deletions(-)\n\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex ab4077f..ee56974 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -403,6 +403,16 @@ static void finish(const unsigned char *new_head, const char *msg)\n \tstrbuf_release(&reflog_message);\n }\n \n+static struct object *want_commit(const char *name)\n+{\n+\tstruct object *obj;\n+\tunsigned char sha1[20];\n+\tif (get_sha1(name, sha1))\n+\t\treturn NULL;\n+\tobj = parse_object(sha1);\n+\treturn peel_to_type(name, 0, obj, OBJ_COMMIT);\n+}\n+\n /* Get the name for the merge commit's message. */\n static void merge_name(const char *remote, struct strbuf *msg)\n {\n@@ -418,7 +428,7 @@ static void merge_name(const char *remote, struct strbuf *msg)\n \tremote = bname.buf;\n \n \tmemset(branch_head, 0, sizeof(branch_head));\n-\tremote_head = peel_to_type(remote, 0, NULL, OBJ_COMMIT);\n+\tremote_head = want_commit(remote);\n \tif (!remote_head)\n \t\tdie(_(\"'%s' does not point to a commit\"), remote);\n \n@@ -1124,7 +1134,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\tif (!allow_fast_forward)\n \t\t\tdie(_(\"Non-fast-forward commit does not make sense into \"\n \t\t\t    \"an empty head\"));\n-\t\tremote_head = peel_to_type(argv[0], 0, NULL, OBJ_COMMIT);\n+\t\tremote_head = want_commit(argv[0]);\n \t\tif (!remote_head)\n \t\t\tdie(_(\"%s - not something we can merge\"), argv[0]);\n \t\tread_empty(remote_head->sha1, 0);\n@@ -1170,7 +1180,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\tstruct object *o;\n \t\tstruct commit *commit;\n \n-\t\to = peel_to_type(argv[i], 0, NULL, OBJ_COMMIT);\n+\t\to = want_commit(argv[i]);\n \t\tif (!o)\n \t\t\tdie(_(\"%s - not something we can merge\"), argv[i]);\n \t\tcommit = lookup_commit(o->sha1);\n@@ -1238,8 +1248,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\tif (have_message)\n \t\t\tstrbuf_addstr(&msg,\n \t\t\t\t\" (no commit created; -m option ignored)\");\n-\t\to = peel_to_type(sha1_to_hex(remoteheads->item->object.sha1),\n-\t\t\t0, NULL, OBJ_COMMIT);\n+\t\to = want_commit(sha1_to_hex(remoteheads->item->object.sha1));\n \t\tif (!o)\n \t\t\treturn 1;\n \ndiff --git a/sha1_name.c b/sha1_name.c\nindex ff5992a..653b065 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -501,12 +501,6 @@ struct object *peel_to_type(const char *name, int namelen,\n {\n \tif (name && !namelen)\n \t\tnamelen = strlen(name);\n-\tif (!o) {\n-\t\tunsigned char sha1[20];\n-\t\tif (get_sha1_1(name, namelen, sha1))\n-\t\t\treturn NULL;\n-\t\to = parse_object(sha1);\n-\t}\n \twhile (1) {\n \t\tif (!o || (!o->parsed && !parse_object(o->sha1)))\n \t\t\treturn NULL;\n"},{"id":"175019","messageId":"4E67B72B.4090504@drmicha.warpmail.net","threadId":"28322","inReplyTo":"7vty8o2p7g.fsf_-_@alter.siamese.dyndns.org","subject":"Re: Re* Git without morning coffee","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-09-07T18:25:47Z","receivedAt":"2011-09-07T18:25:47Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 07.09.2011 20:16:\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n>> Junio C Hamano <gitster@pobox.com> writes:\n>>\n>>> Michael J Gruber <git@drmicha.warpmail.net> writes:\n>>>\n>>>> git merge \":/Merge branch 'jk/generation-numbers' into pu\"\n>>>> fatal: ':/Merge branch 'jk/generation-numbers' into pu' does not point\n>>>> to a commit\n>>>> # Huh?\n>>>\n>>> Interesting.\n>>\n>> This is because 1c7b76b (Build in merge, 2008-07-07) grabs the name of the\n>> commit to be merged using peel_to_type(), which was defined in 8177631\n>> (expose a helper function peel_to_type()., 2007-12-24) in terms of\n>> get_sha1_1(). It understands $commit~$n, $commit^$n and $ref@{$nth}, but\n>> does not understand :/$str, $treeish:$path, and :$stage:$path.\n> \n> -- >8 --\n> Subject: Allow git merge \":/<pattern>\"\n> \n> It probably is not such a good idea to use \":/<pattern>\" to specify which\n> commit to merge, as \":/<pattern>\" can often hit unexpected commits, but\n> somebody tried it and got a nonsense error message:\n> \n> \tfatal: ':/Foo bar' does not point to a commit\n> \n> So here is a for-the-sake-of-consistency update that is fairly useless\n> that allows users to carefully try not shooting in the foot.\n\nShooting in the foot can be a good thing, depending on the feet...\n\nMy concern is: If a command expects a commit(tish), a user expects to be\nable to specify it in any way which git rev-parse can parse. I had no\nidea we distinguish even further then what the command itself requires\n(\"branch\" needs a branch refname, diff-tree a treeish etc.).\n\nSo, for systematic reasons I think the below is an improvement.\n\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  builtin/merge.c |   19 ++++++++++++++-----\n>  sha1_name.c     |    6 ------\n>  2 files changed, 14 insertions(+), 11 deletions(-)\n> \n> diff --git a/builtin/merge.c b/builtin/merge.c\n> index ab4077f..ee56974 100644\n> --- a/builtin/merge.c\n> +++ b/builtin/merge.c\n> @@ -403,6 +403,16 @@ static void finish(const unsigned char *new_head, const char *msg)\n>  \tstrbuf_release(&reflog_message);\n>  }\n>  \n> +static struct object *want_commit(const char *name)\n> +{\n> +\tstruct object *obj;\n> +\tunsigned char sha1[20];\n> +\tif (get_sha1(name, sha1))\n> +\t\treturn NULL;\n> +\tobj = parse_object(sha1);\n> +\treturn peel_to_type(name, 0, obj, OBJ_COMMIT);\n> +}\n> +\n>  /* Get the name for the merge commit's message. */\n>  static void merge_name(const char *remote, struct strbuf *msg)\n>  {\n> @@ -418,7 +428,7 @@ static void merge_name(const char *remote, struct strbuf *msg)\n>  \tremote = bname.buf;\n>  \n>  \tmemset(branch_head, 0, sizeof(branch_head));\n> -\tremote_head = peel_to_type(remote, 0, NULL, OBJ_COMMIT);\n> +\tremote_head = want_commit(remote);\n>  \tif (!remote_head)\n>  \t\tdie(_(\"'%s' does not point to a commit\"), remote);\n>  \n> @@ -1124,7 +1134,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n>  \t\tif (!allow_fast_forward)\n>  \t\t\tdie(_(\"Non-fast-forward commit does not make sense into \"\n>  \t\t\t    \"an empty head\"));\n> -\t\tremote_head = peel_to_type(argv[0], 0, NULL, OBJ_COMMIT);\n> +\t\tremote_head = want_commit(argv[0]);\n>  \t\tif (!remote_head)\n>  \t\t\tdie(_(\"%s - not something we can merge\"), argv[0]);\n>  \t\tread_empty(remote_head->sha1, 0);\n> @@ -1170,7 +1180,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n>  \t\tstruct object *o;\n>  \t\tstruct commit *commit;\n>  \n> -\t\to = peel_to_type(argv[i], 0, NULL, OBJ_COMMIT);\n> +\t\to = want_commit(argv[i]);\n>  \t\tif (!o)\n>  \t\t\tdie(_(\"%s - not something we can merge\"), argv[i]);\n>  \t\tcommit = lookup_commit(o->sha1);\n> @@ -1238,8 +1248,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n>  \t\tif (have_message)\n>  \t\t\tstrbuf_addstr(&msg,\n>  \t\t\t\t\" (no commit created; -m option ignored)\");\n> -\t\to = peel_to_type(sha1_to_hex(remoteheads->item->object.sha1),\n> -\t\t\t0, NULL, OBJ_COMMIT);\n> +\t\to = want_commit(sha1_to_hex(remoteheads->item->object.sha1));\n>  \t\tif (!o)\n>  \t\t\treturn 1;\n>  \n> diff --git a/sha1_name.c b/sha1_name.c\n> index ff5992a..653b065 100644\n> --- a/sha1_name.c\n> +++ b/sha1_name.c\n> @@ -501,12 +501,6 @@ struct object *peel_to_type(const char *name, int namelen,\n>  {\n>  \tif (name && !namelen)\n>  \t\tnamelen = strlen(name);\n> -\tif (!o) {\n> -\t\tunsigned char sha1[20];\n> -\t\tif (get_sha1_1(name, namelen, sha1))\n> -\t\t\treturn NULL;\n> -\t\to = parse_object(sha1);\n> -\t}\n>  \twhile (1) {\n>  \t\tif (!o || (!o->parsed && !parse_object(o->sha1)))\n>  \t\t\treturn NULL;\n"},{"id":"175032","messageId":"CAMOZ1Bv1+OA77htE6DVFUGGdKvtB48ostGVHW0K-aKUZC4PmQQ@mail.gmail.com","threadId":"28322","inReplyTo":"7vy5y02qf4.fsf@alter.siamese.dyndns.org","subject":"Re: Git without morning coffee","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-09-07T20:59:08Z","receivedAt":"2011-09-07T20:59:08Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Wed, Sep 7, 2011 at 17:49, Junio C Hamano <gitster@pobox.com> wrote:\n> Michael Witten <mfwitten@gmail.com> writes:\n>\n>> I think it would be great if at some point you could write a detailed\n>> tutorial of how you maintain git...\n>\n> Is MaintNotes[*1*] taken together with Documentation/howto/maintain-git.txt\n> insufficient?\n>\n> [Reference]\n> *1* http://git-blame.blogspot.com/p/note-from-maintainer.html\n\nI was unaware of the `howto'; I look forward to reading it.\n"}]}