{"thread":{"id":"6025","subject":"[PATCH] Fix bad usage of mkpath in builtin-branch.sh","startedAt":"2006-10-24T01:59:36Z","lastAt":"2006-10-25T22:51:32Z","messageCount":7,"participants":["Lars Hjemli","Junio C Hamano","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"29796","messageId":"1161655176461-git-send-email-hjemli@gmail.com","threadId":"6025","inReplyTo":null,"subject":"[PATCH] Fix bad usage of mkpath in builtin-branch.sh","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2006-10-24T01:59:36Z","receivedAt":"2006-10-24T01:59:36Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"When checking if a branch start point referred to a commit-object,\nthe result of mkpath() was used as argument to get_sha1(), which\ndidn't work out as planned.\n\nNow it's xstrdup'd first.\n\nSigned-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n builtin-branch.c |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-branch.c b/builtin-branch.c\nindex ffc2db0..f86bf68 100755\n--- a/builtin-branch.c\n+++ b/builtin-branch.c\n@@ -125,6 +125,7 @@ static void create_branch(const char *na\n \tstruct ref_lock *lock;\n \tunsigned char sha1[20];\n \tchar ref[PATH_MAX], msg[PATH_MAX + 20];\n+\tconst char *commitref;\n \n \tsnprintf(ref, sizeof ref, \"refs/heads/%s\", name);\n \tif (check_ref_format(ref))\n@@ -137,8 +138,10 @@ static void create_branch(const char *na\n \t\t\tdie(\"Cannot force update the current branch.\");\n \t}\n \n-\tif (get_sha1(mkpath(\"%s^0\", start), sha1))\n+\tcommitref = xstrdup(mkpath(\"%s^0\", start));\n+\tif (get_sha1(commitref, sha1))\n \t\tdie(\"Not a valid branch point: '%s'.\", start);\n+\tfree(commitref);\n \n \tlock = lock_any_ref_for_update(ref, NULL);\n \tif (!lock)\n-- \n1.4.3.1.ga4cc-dirty\n"},{"id":"29820","messageId":"7vlkn6qkh2.fsf@assigned-by-dhcp.cox.net","threadId":"6025","inReplyTo":"1161655176461-git-send-email-hjemli@gmail.com","subject":"Re: [PATCH] Fix bad usage of mkpath in builtin-branch.sh","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-24T06:46:49Z","receivedAt":"2006-10-24T06:46:49Z","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> When checking if a branch start point referred to a commit-object,\n> the result of mkpath() was used as argument to get_sha1(), which\n> didn't work out as planned.\n>\n> Now it's xstrdup'd first.\n>\n> Signed-off-by: Lars Hjemli <hjemli@gmail.com>\n> ---\n>  builtin-branch.c |    5 ++++-\n>  1 files changed, 4 insertions(+), 1 deletions(-)\n>\n> diff --git a/builtin-branch.c b/builtin-branch.c\n> index ffc2db0..f86bf68 100755\n\nI've already fixed up this perm-mode breakage (and other\nbreakages, possibly) so when I am done with these patches\ntonight please resync with me.\n"},{"id":"29850","messageId":"20061024113806.GB20017@pasky.or.cz","threadId":"6025","inReplyTo":"7vlkn6qkh2.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Fix bad usage of mkpath in builtin-branch.sh","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-10-24T11:38:06Z","receivedAt":"2006-10-24T11:38:06Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, Oct 24, 2006 at 08:46:49AM CEST, I got a letter\nwhere Junio C Hamano <junkio@cox.net> said that...\n> Lars Hjemli <hjemli@gmail.com> writes:\n> \n> > When checking if a branch start point referred to a commit-object,\n> > the result of mkpath() was used as argument to get_sha1(), which\n> > didn't work out as planned.\n> >\n> > Now it's xstrdup'd first.\n> >\n> > Signed-off-by: Lars Hjemli <hjemli@gmail.com>\n> > ---\n> >  builtin-branch.c |    5 ++++-\n> >  1 files changed, 4 insertions(+), 1 deletions(-)\n> >\n> > diff --git a/builtin-branch.c b/builtin-branch.c\n> > index ffc2db0..f86bf68 100755\n> \n> I've already fixed up this perm-mode breakage (and other\n> breakages, possibly) so when I am done with these patches\n> tonight please resync with me.\n\nI have made my fair share of inadverent mode changes as well (I don't\neven know how that *happenned*), and I don't seem to be alone; since\nthis is something you are doing only rarely anyway, perhaps we should\ntry to make mode changes more visible?\n\n\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n\t@ WARNING: FILE MODE HAS CHANGED!!!!111 pERHAPS A MISTAKE? @\n\t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n\n;-))\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\nlK[d2%Sa2/d0$^Ixp\"|dc`;s/\\W//g;$_=pack('H*',/((..)*)$/)\n"},{"id":"296852","messageId":"7vac3lf3jl.fsf@assigned-by-dhcp.cox.net","threadId":"6025","inReplyTo":"20061024113806.GB20017@pasky.or.cz","subject":"Re: [PATCH] Fix bad usage of mkpath in builtin-branch.sh","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-25T04:00:14Z","receivedAt":"2006-10-25T04:00:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> Dear diary, on Tue, Oct 24, 2006 at 08:46:49AM CEST, I got a letter\n> where Junio C Hamano <junkio@cox.net> said that...\n>> Lars Hjemli <hjemli@gmail.com> writes:\n>> \n>> > diff --git a/builtin-branch.c b/builtin-branch.c\n>> > index ffc2db0..f86bf68 100755\n>> \n>> I've already fixed up this perm-mode breakage (and other\n>> breakages, possibly) so when I am done with these patches\n>> tonight please resync with me.\n>\n> I have made my fair share of inadverent mode changes as well (I don't\n> even know how that *happenned*), and I don't seem to be alone; since\n> this is something you are doing only rarely anyway, perhaps we should\n> try to make mode changes more visible?\n\nWell we already do and that's how I noticed.\n"},{"id":"298396","messageId":"7vslhddmtu.fsf@assigned-by-dhcp.cox.net","threadId":"6025","inReplyTo":"7vac3lf3jl.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Fix bad usage of mkpath in builtin-branch.sh","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-25T04:46:37Z","receivedAt":"2006-10-25T04:46:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> Petr Baudis <pasky@suse.cz> writes:\n>\n>> I have made my fair share of inadverent mode changes as well (I don't\n>> even know how that *happenned*), and I don't seem to be alone; since\n>> this is something you are doing only rarely anyway, perhaps we should\n>> try to make mode changes more visible?\n>\n> Well we already do and that's how I noticed.\n\nAh, sorry, I think I misunderstood you.\nDid you mean something like this?\n\ndiff --git a/git-commit.sh b/git-commit.sh\nindex 5b1cf85..8bae734 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -629,4 +629,7 @@ if test -x \"$GIT_DIR\"/hooks/post-commit\n then\n \t\"$GIT_DIR\"/hooks/post-commit\n fi\n+\n+test \"$ret\" = 0 && git-diff-tree --summary --root --no-commit-id HEAD\n+\n exit \"$ret\"\n"},{"id":"294302","messageId":"20061025224313.GM20017@pasky.or.cz","threadId":"6025","inReplyTo":"7vslhddmtu.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Fix bad usage of mkpath in builtin-branch.sh","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-10-25T22:43:13Z","receivedAt":"2006-10-25T22:43:13Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Wed, Oct 25, 2006 at 06:46:37AM CEST, I got a letter\nwhere Junio C Hamano <junkio@cox.net> said that...\n> Junio C Hamano <junkio@cox.net> writes:\n> \n> > Petr Baudis <pasky@suse.cz> writes:\n> >\n> >> I have made my fair share of inadverent mode changes as well (I don't\n> >> even know how that *happenned*), and I don't seem to be alone; since\n> >> this is something you are doing only rarely anyway, perhaps we should\n> >> try to make mode changes more visible?\n> >\n> > Well we already do and that's how I noticed.\n> \n> Ah, sorry, I think I misunderstood you.\n> Did you mean something like this?\n> \n> diff --git a/git-commit.sh b/git-commit.sh\n> index 5b1cf85..8bae734 100755\n> --- a/git-commit.sh\n> +++ b/git-commit.sh\n> @@ -629,4 +629,7 @@ if test -x \"$GIT_DIR\"/hooks/post-commit\n>  then\n>  \t\"$GIT_DIR\"/hooks/post-commit\n>  fi\n> +\n> +test \"$ret\" = 0 && git-diff-tree --summary --root --no-commit-id HEAD\n> +\n>  exit \"$ret\"\n\nYes, this might be a good idea, although after the commit is perhaps too\nlate.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\n"},{"id":"294367","messageId":"7v3b9cko0b.fsf@assigned-by-dhcp.cox.net","threadId":"6025","inReplyTo":"20061025224313.GM20017@pasky.or.cz","subject":"Re: [PATCH] Fix bad usage of mkpath in builtin-branch.sh","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-25T22:51:32Z","receivedAt":"2006-10-25T22:51:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n>> +\n>> +test \"$ret\" = 0 && git-diff-tree --summary --root --no-commit-id HEAD\n>> +\n>>  exit \"$ret\"\n>\n> Yes, this might be a good idea, although after the commit is perhaps too\n> late.\n\nBefore the commit I thought we have git-status output in the\ncommit log buffer.\n\nAh,...\n\nWe had that old issue of \"'M foo' cannot tell content or mode\nchanges (or both)\", and people suggested \"M+\" and such which\nwere rejected because Porcelains and people's scripts depended\ndeeply on \"diff --name-status\" output being stable.\n"}]}