* [PATCH] Fix bad usage of mkpath in builtin-branch.sh
@ 2006-10-24 1:59 Lars Hjemli
2006-10-24 6:46 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Lars Hjemli @ 2006-10-24 1:59 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
When checking if a branch start point referred to a commit-object,
the result of mkpath() was used as argument to get_sha1(), which
didn't work out as planned.
Now it's xstrdup'd first.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
builtin-branch.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/builtin-branch.c b/builtin-branch.c
index ffc2db0..f86bf68 100755
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -125,6 +125,7 @@ static void create_branch(const char *na
struct ref_lock *lock;
unsigned char sha1[20];
char ref[PATH_MAX], msg[PATH_MAX + 20];
+ const char *commitref;
snprintf(ref, sizeof ref, "refs/heads/%s", name);
if (check_ref_format(ref))
@@ -137,8 +138,10 @@ static void create_branch(const char *na
die("Cannot force update the current branch.");
}
- if (get_sha1(mkpath("%s^0", start), sha1))
+ commitref = xstrdup(mkpath("%s^0", start));
+ if (get_sha1(commitref, sha1))
die("Not a valid branch point: '%s'.", start);
+ free(commitref);
lock = lock_any_ref_for_update(ref, NULL);
if (!lock)
--
1.4.3.1.ga4cc-dirty
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix bad usage of mkpath in builtin-branch.sh
2006-10-24 1:59 [PATCH] Fix bad usage of mkpath in builtin-branch.sh Lars Hjemli
@ 2006-10-24 6:46 ` Junio C Hamano
2006-10-24 11:38 ` Petr Baudis
0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2006-10-24 6:46 UTC (permalink / raw)
To: Lars Hjemli; +Cc: git
Lars Hjemli <hjemli@gmail.com> writes:
> When checking if a branch start point referred to a commit-object,
> the result of mkpath() was used as argument to get_sha1(), which
> didn't work out as planned.
>
> Now it's xstrdup'd first.
>
> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
> ---
> builtin-branch.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/builtin-branch.c b/builtin-branch.c
> index ffc2db0..f86bf68 100755
I've already fixed up this perm-mode breakage (and other
breakages, possibly) so when I am done with these patches
tonight please resync with me.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix bad usage of mkpath in builtin-branch.sh
2006-10-24 6:46 ` Junio C Hamano
@ 2006-10-24 11:38 ` Petr Baudis
2006-10-25 4:00 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Petr Baudis @ 2006-10-24 11:38 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Lars Hjemli, git
Dear diary, on Tue, Oct 24, 2006 at 08:46:49AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Lars Hjemli <hjemli@gmail.com> writes:
>
> > When checking if a branch start point referred to a commit-object,
> > the result of mkpath() was used as argument to get_sha1(), which
> > didn't work out as planned.
> >
> > Now it's xstrdup'd first.
> >
> > Signed-off-by: Lars Hjemli <hjemli@gmail.com>
> > ---
> > builtin-branch.c | 5 ++++-
> > 1 files changed, 4 insertions(+), 1 deletions(-)
> >
> > diff --git a/builtin-branch.c b/builtin-branch.c
> > index ffc2db0..f86bf68 100755
>
> I've already fixed up this perm-mode breakage (and other
> breakages, possibly) so when I am done with these patches
> tonight please resync with me.
I have made my fair share of inadverent mode changes as well (I don't
even know how that *happenned*), and I don't seem to be alone; since
this is something you are doing only rarely anyway, perhaps we should
try to make mode changes more visible?
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: FILE MODE HAS CHANGED!!!!111 pERHAPS A MISTAKE? @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;-))
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix bad usage of mkpath in builtin-branch.sh
2006-10-24 11:38 ` Petr Baudis
@ 2006-10-25 4:00 ` Junio C Hamano
2006-10-25 4:46 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2006-10-25 4:00 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
Petr Baudis <pasky@suse.cz> writes:
> Dear diary, on Tue, Oct 24, 2006 at 08:46:49AM CEST, I got a letter
> where Junio C Hamano <junkio@cox.net> said that...
>> Lars Hjemli <hjemli@gmail.com> writes:
>>
>> > diff --git a/builtin-branch.c b/builtin-branch.c
>> > index ffc2db0..f86bf68 100755
>>
>> I've already fixed up this perm-mode breakage (and other
>> breakages, possibly) so when I am done with these patches
>> tonight please resync with me.
>
> I have made my fair share of inadverent mode changes as well (I don't
> even know how that *happenned*), and I don't seem to be alone; since
> this is something you are doing only rarely anyway, perhaps we should
> try to make mode changes more visible?
Well we already do and that's how I noticed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix bad usage of mkpath in builtin-branch.sh
2006-10-25 4:00 ` Junio C Hamano
@ 2006-10-25 4:46 ` Junio C Hamano
2006-10-25 22:43 ` Petr Baudis
0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2006-10-25 4:46 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
Junio C Hamano <junkio@cox.net> writes:
> Petr Baudis <pasky@suse.cz> writes:
>
>> I have made my fair share of inadverent mode changes as well (I don't
>> even know how that *happenned*), and I don't seem to be alone; since
>> this is something you are doing only rarely anyway, perhaps we should
>> try to make mode changes more visible?
>
> Well we already do and that's how I noticed.
Ah, sorry, I think I misunderstood you.
Did you mean something like this?
diff --git a/git-commit.sh b/git-commit.sh
index 5b1cf85..8bae734 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -629,4 +629,7 @@ if test -x "$GIT_DIR"/hooks/post-commit
then
"$GIT_DIR"/hooks/post-commit
fi
+
+test "$ret" = 0 && git-diff-tree --summary --root --no-commit-id HEAD
+
exit "$ret"
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix bad usage of mkpath in builtin-branch.sh
2006-10-25 4:46 ` Junio C Hamano
@ 2006-10-25 22:43 ` Petr Baudis
2006-10-25 22:51 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Petr Baudis @ 2006-10-25 22:43 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Dear diary, on Wed, Oct 25, 2006 at 06:46:37AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Junio C Hamano <junkio@cox.net> writes:
>
> > Petr Baudis <pasky@suse.cz> writes:
> >
> >> I have made my fair share of inadverent mode changes as well (I don't
> >> even know how that *happenned*), and I don't seem to be alone; since
> >> this is something you are doing only rarely anyway, perhaps we should
> >> try to make mode changes more visible?
> >
> > Well we already do and that's how I noticed.
>
> Ah, sorry, I think I misunderstood you.
> Did you mean something like this?
>
> diff --git a/git-commit.sh b/git-commit.sh
> index 5b1cf85..8bae734 100755
> --- a/git-commit.sh
> +++ b/git-commit.sh
> @@ -629,4 +629,7 @@ if test -x "$GIT_DIR"/hooks/post-commit
> then
> "$GIT_DIR"/hooks/post-commit
> fi
> +
> +test "$ret" = 0 && git-diff-tree --summary --root --no-commit-id HEAD
> +
> exit "$ret"
Yes, this might be a good idea, although after the commit is perhaps too
late.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix bad usage of mkpath in builtin-branch.sh
2006-10-25 22:43 ` Petr Baudis
@ 2006-10-25 22:51 ` Junio C Hamano
0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2006-10-25 22:51 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
Petr Baudis <pasky@suse.cz> writes:
>> +
>> +test "$ret" = 0 && git-diff-tree --summary --root --no-commit-id HEAD
>> +
>> exit "$ret"
>
> Yes, this might be a good idea, although after the commit is perhaps too
> late.
Before the commit I thought we have git-status output in the
commit log buffer.
Ah,...
We had that old issue of "'M foo' cannot tell content or mode
changes (or both)", and people suggested "M+" and such which
were rejected because Porcelains and people's scripts depended
deeply on "diff --name-status" output being stable.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-10-25 22:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-24 1:59 [PATCH] Fix bad usage of mkpath in builtin-branch.sh Lars Hjemli
2006-10-24 6:46 ` Junio C Hamano
2006-10-24 11:38 ` Petr Baudis
2006-10-25 4:00 ` Junio C Hamano
2006-10-25 4:46 ` Junio C Hamano
2006-10-25 22:43 ` Petr Baudis
2006-10-25 22:51 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).