git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Parkins <andyparkins@gmail.com>
To: git@vger.kernel.org
Subject: Re: [RFC/PATCH] Implement poor-man's submodule support using commit  hooks
Date: Wed, 20 Dec 2006 13:47:05 +0000	[thread overview]
Message-ID: <200612201347.13805.andyparkins@gmail.com> (raw)
In-Reply-To: <45893AC6.910D5748@eudaptics.com>

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

  reply	other threads:[~2006-12-20 13:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-20 13:09 [RFC/PATCH] Implement poor-man's submodule support using commit hooks Andy Parkins
2006-12-20 13:29 ` Johannes Sixt
2006-12-20 13:47   ` Andy Parkins [this message]
2006-12-20 14:07     ` Jakub Narebski
2006-12-20 14:20       ` Andy Parkins
2006-12-20 14:33     ` Rogan Dawes
2006-12-20 14:40       ` Andy Parkins
2006-12-20 15:42         ` Randal L. Schwartz
2006-12-20 16:09         ` Johannes Schindelin
2006-12-20 13:36 ` Martin Waitz
2006-12-20 13:48   ` Andy Parkins
2006-12-20 14:35   ` Andy Parkins
2006-12-20 15:44     ` Martin Waitz
2006-12-20 14:18 ` Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200612201347.13805.andyparkins@gmail.com \
    --to=andyparkins@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).