* [PATCH] Use dashless git commands in setgitperms.perl
@ 2008-09-19 23:42 Todd Zullinger
2008-09-20 0:02 ` Jakub Narebski
0 siblings, 1 reply; 5+ messages in thread
From: Todd Zullinger @ 2008-09-19 23:42 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Josh England, git
Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
contrib/hooks/setgitperms.perl | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/contrib/hooks/setgitperms.perl b/contrib/hooks/setgitperms.perl
index dab7c8e..5c1fa91 100644
--- a/contrib/hooks/setgitperms.perl
+++ b/contrib/hooks/setgitperms.perl
@@ -8,14 +8,14 @@
# To save permissions/ownership data, place this script in your .git/hooks
# directory and enable a `pre-commit` hook with the following lines:
# #!/bin/sh
-# SUBDIRECTORY_OK=1 . git-sh-setup
+# SUBDIRECTORY_OK=1 . git sh-setup
# $GIT_DIR/hooks/setgitperms.perl -r
#
# To restore permissions/ownership data, place this script in your .git/hooks
# directory and enable a `post-merge` and `post-checkout` hook with the
# following lines:
# #!/bin/sh
-# SUBDIRECTORY_OK=1 . git-sh-setup
+# SUBDIRECTORY_OK=1 . git sh-setup
# $GIT_DIR/hooks/setgitperms.perl -w
#
use strict;
@@ -50,7 +50,7 @@ if ((@ARGV < 0) || !GetOptions(
)) { die $usage; }
die $usage unless ($read_mode xor $write_mode);
-my $topdir = `git-rev-parse --show-cdup` or die "\n"; chomp $topdir;
+my $topdir = `git rev-parse --show-cdup` or die "\n"; chomp $topdir;
my $gitdir = $topdir . '.git';
my $gitmeta = $topdir . '.gitmeta';
@@ -155,7 +155,7 @@ elsif ($read_mode) {
open (OUT, ">$gitmeta.tmp") or die "Could not open $gitmeta.tmp for writing: $!\n";
}
- my @files = `git-ls-files`;
+ my @files = `git ls-files`;
my %dirs;
foreach my $path (@files) {
--
1.6.0.2
--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What a terrible thing to have lost one's mind. Or not to have a mind
at all. How true that is.
-- Dan Quayle, speaking to the United Negro College Fund
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Use dashless git commands in setgitperms.perl
2008-09-19 23:42 [PATCH] Use dashless git commands in setgitperms.perl Todd Zullinger
@ 2008-09-20 0:02 ` Jakub Narebski
2008-09-20 0:48 ` Todd Zullinger
0 siblings, 1 reply; 5+ messages in thread
From: Jakub Narebski @ 2008-09-20 0:02 UTC (permalink / raw)
To: git
Todd Zullinger wrote:
> # To save permissions/ownership data, place this script in your .git/hooks
> # directory and enable a `pre-commit` hook with the following lines:
> # #!/bin/sh
> -# SUBDIRECTORY_OK=1 . git-sh-setup
> +# SUBDIRECTORY_OK=1 . git sh-setup
> # $GIT_DIR/hooks/setgitperms.perl -r
> #
> # To restore permissions/ownership data, place this script in your .git/hooks
> # directory and enable a `post-merge` and `post-checkout` hook with the
> # following lines:
> # #!/bin/sh
> -# SUBDIRECTORY_OK=1 . git-sh-setup
> +# SUBDIRECTORY_OK=1 . git sh-setup
> # $GIT_DIR/hooks/setgitperms.perl -w
> #
The rest is probably O.K., but I don't think this change is good one.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Use dashless git commands in setgitperms.perl
2008-09-20 0:02 ` Jakub Narebski
@ 2008-09-20 0:48 ` Todd Zullinger
2008-09-20 1:27 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Todd Zullinger @ 2008-09-20 0:48 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]
Jakub Narebski wrote:
> Todd Zullinger wrote:
>
>> # To save permissions/ownership data, place this script in your .git/hooks
>> # directory and enable a `pre-commit` hook with the following lines:
>> # #!/bin/sh
>> -# SUBDIRECTORY_OK=1 . git-sh-setup
>> +# SUBDIRECTORY_OK=1 . git sh-setup
>> # $GIT_DIR/hooks/setgitperms.perl -r
>> #
>> # To restore permissions/ownership data, place this script in your .git/hooks
>> # directory and enable a `post-merge` and `post-checkout` hook with the
>> # following lines:
>> # #!/bin/sh
>> -# SUBDIRECTORY_OK=1 . git-sh-setup
>> +# SUBDIRECTORY_OK=1 . git sh-setup
>> # $GIT_DIR/hooks/setgitperms.perl -w
>> #
>
> The rest is probably O.K., but I don't think this change is good one.
I don't see git-sh-setup in /usr/bin with a default install of git
1.6, so without this change, wouldn't the comments be suggesting a
potentially broken hook configuration?
--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppose I were a member of Congress, and suppose I were an idiot. But,
I repeat myself.
-- Mark Twain
[-- Attachment #2: Type: application/pgp-signature, Size: 542 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Use dashless git commands in setgitperms.perl
2008-09-20 0:48 ` Todd Zullinger
@ 2008-09-20 1:27 ` Junio C Hamano
2008-09-22 11:30 ` Todd Zullinger
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2008-09-20 1:27 UTC (permalink / raw)
To: Todd Zullinger; +Cc: Jakub Narebski, git
Todd Zullinger <tmz@pobox.com> writes:
> Jakub Narebski wrote:
>> Todd Zullinger wrote:
>>
>>> # To save permissions/ownership data, place this script in your .git/hooks
>>> # directory and enable a `pre-commit` hook with the following lines:
>>> # #!/bin/sh
>>> -# SUBDIRECTORY_OK=1 . git-sh-setup
>>> +# SUBDIRECTORY_OK=1 . git sh-setup
>>> # $GIT_DIR/hooks/setgitperms.perl -r
>>> #
>>> # To restore permissions/ownership data, place this script in your .git/hooks
>>> # directory and enable a `post-merge` and `post-checkout` hook with the
>>> # following lines:
>>> # #!/bin/sh
>>> -# SUBDIRECTORY_OK=1 . git-sh-setup
>>> +# SUBDIRECTORY_OK=1 . git sh-setup
>>> # $GIT_DIR/hooks/setgitperms.perl -w
>>> #
>>
>> The rest is probably O.K., but I don't think this change is good one.
>
> I don't see git-sh-setup in /usr/bin with a default install of git
> 1.6, so without this change, wouldn't the comments be suggesting a
> potentially broken hook configuration?
The patch is wrong on one point, and should be unnecessary.
First of all, you do not understand what "." does in shell ;-) That is
the "wrong" part.
About the "unnecessary" part, a hook should run under an environment where
exec-path is already added to the $PATH, so it should be able to find
git-sh-setup just fine without your change.
But I think the politically correct way would be:
#!/bin/sh
PATH=$(git --exec-path):$PATH
SUBDIRECTORY_OK=1 . git-sh-setup
$GIT_DIR/hooks/setgitperms.perl -r
especially if we envision that somebody may run the script by itself, not
from the hook.
The change to the perl script should not be strictly necessary (because
this is expected to be run from a hook), but to set a better example, I
think it is a good idea to do these s/git-/git / substitutions.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Use dashless git commands in setgitperms.perl
2008-09-20 1:27 ` Junio C Hamano
@ 2008-09-22 11:30 ` Todd Zullinger
0 siblings, 0 replies; 5+ messages in thread
From: Todd Zullinger @ 2008-09-22 11:30 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jakub Narebski, git
Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
contrib/hooks/setgitperms.perl | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Junio C Hamano wrote:
> The patch is wrong on one point, and should be unnecessary.
>
> First of all, you do not understand what "." does in shell ;-)
> That is the "wrong" part.
Ugh, that was embarrassing to miss (bad enough to miss it on my own,
but worse to not notice it after Jakub questioned it).
> About the "unnecessary" part, a hook should run under an environment
> where exec-path is already added to the $PATH, so it should be able
> to find git-sh-setup just fine without your change.
>
> But I think the politically correct way would be:
>
> #!/bin/sh
> PATH=$(git --exec-path):$PATH
> SUBDIRECTORY_OK=1 . git-sh-setup
> $GIT_DIR/hooks/setgitperms.perl -r
>
> especially if we envision that somebody may run the script by
> itself, not from the hook.
Since that chunk is only in a comment explaining what to add to the
hook the user wants to run this script from, it seems like that really
is unnecessary.
I was in fact running .git/hooks/setgitperms.perl directly (to create
an initial .gitmeta file) which is why I noticed it used git-*
commands and was failing. Using "git " makes that work for me.
> The change to the perl script should not be strictly necessary
> (because this is expected to be run from a hook), but to set a
> better example, I think it is a good idea to do these s/git-/git /
> substitutions.
Sounds good. Here is a patch with just those changes.
diff --git a/contrib/hooks/setgitperms.perl b/contrib/hooks/setgitperms.perl
index dab7c8e..a577ad0 100644
--- a/contrib/hooks/setgitperms.perl
+++ b/contrib/hooks/setgitperms.perl
@@ -50,7 +50,7 @@ if ((@ARGV < 0) || !GetOptions(
)) { die $usage; }
die $usage unless ($read_mode xor $write_mode);
-my $topdir = `git-rev-parse --show-cdup` or die "\n"; chomp $topdir;
+my $topdir = `git rev-parse --show-cdup` or die "\n"; chomp $topdir;
my $gitdir = $topdir . '.git';
my $gitmeta = $topdir . '.gitmeta';
@@ -155,7 +155,7 @@ elsif ($read_mode) {
open (OUT, ">$gitmeta.tmp") or die "Could not open $gitmeta.tmp for writing: $!\n";
}
- my @files = `git-ls-files`;
+ my @files = `git ls-files`;
my %dirs;
foreach my $path (@files) {
--
1.6.0.2
--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Careful. We don't want to learn from this.
-- Calvin
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-09-22 11:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-19 23:42 [PATCH] Use dashless git commands in setgitperms.perl Todd Zullinger
2008-09-20 0:02 ` Jakub Narebski
2008-09-20 0:48 ` Todd Zullinger
2008-09-20 1:27 ` Junio C Hamano
2008-09-22 11:30 ` Todd Zullinger
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).