Re: [RFC/PATCH] Implement poor-man's submodule support using commit hooks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 2006 December 20 13:29, Johannes Sixt wrote:

> > +       cat "$GITMODULES" |
>
> useless-use-of-cat-syndrome

I tried 

 while
 do 
 done < file1 > file1

And that didn't work.  However, it was racy anyway using the same file, so I 
changed to as it is now, but forgot to switch back to input redirection.

diff --git a/git-commit.sh b/git-commit.sh
diff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit
index 7718369..74edfe2 100644
--- a/templates/hooks--pre-commit
+++ b/templates/hooks--pre-commit
@@ -82,7 +82,6 @@ perl -e '
 WORKINGTOP=$(git-rev-parse --show-cdup)
 GITMODULES="${WORKINGTOP}.gitmodules"
 if [ -f "$GITMODULES" ]; then
-   cat "$GITMODULES" |
    while read subdir hash
    do
        # check if the line is a comment and output it anyway
@@ -101,7 +100,7 @@ if [ -f "$GITMODULES" ]; then
        # dirty
 
        echo "$subdir $(GIT_DIR=$WORKINGTOP$subdir/.git git-rev-parse HEAD)"
-   done > newgitmodules
+   done < "$GITMODULES" > newgitmodules
    # Update
    mv newgitmodules "$GITMODULES"

> > +       while read subdir hash
>
> Wouldn't it be better to have the order of subdir and hash swapped? That
> way subdir may contain blanks, and it gives nicer alignment in the file
> because of the constant length of the hashes.

Unfortunately, it is the hash that is optional.  When you create the file, you 
don't list the hashes, you list the subdirectories.  I suppose I could make 
it so you have to give "000000" or something first?



Andy

-- 
Dr Andy Parkins, M Eng (hons), MIEE
andyparkins@xxxxxxxxx
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]