git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
APAndy Parkins <andyparkins@gmail.com>
Date
Dec 20, 2006, 13:47 UTC
Message-ID
<200612201347.13805.andyparkins@gmail.com>
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
Previous: Johannes SixtNext: Jakub Narebski
Message 3 of 14 in “Implement poor-man's submodule support using commit hooks”
  1. Implement poor-man's submodule support using commit hooksAndy Parkins, Dec 20, 2006
  2. Johannes SixtDec 20, 2006
  3. Andy ParkinsDec 20, 2006
  4. Jakub NarebskiDec 20, 2006
  5. Andy ParkinsDec 20, 2006
  6. Rogan DawesDec 20, 2006
  7. Andy ParkinsDec 20, 2006
  8. Randal L. SchwartzDec 20, 2006
  9. Johannes SchindelinDec 20, 2006
  10. Martin WaitzDec 20, 2006
  11. Andy ParkinsDec 20, 2006
  12. Andy ParkinsDec 20, 2006
  13. Martin WaitzDec 20, 2006
  14. Johannes SixtDec 20, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.