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

Re: [PATCH] Invoke git-repo-config directly.

From
Junio C Hamano <junkio@cox.net>
Date
Mar 16, 2006, 08:26 UTC
Message-ID
<7v64mebxsu.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20060316075324.GA19650@pfit.vm.bytemark.co.uk>
Qingning Huo <qhuo@mayhq.org> writes:
> So we recognize the full path approach is desired,

I said "if you can work problems your environment has _without_ doing the full path thing, then it would be ideal".

I never said full path is desired -- I despise full path, in fact. It makes certain things very inconvenient.

> ...but because of
> technique reasons (building and testing), it is not applied.

There were not even a patch. I suspect people involved in the discussion realized that approach was unworkably cumbersome.

In our Makefile, we have sed script mechanism to replace tokens so we _could_ change our sources to do something like this:

        diff --git a/git-commit.sh b/git-commit.sh
        index 330a434..10835c6 100755
        --- a/git-commit.sh
        +++ b/git-commit.sh
	...
        @@ -115,7 +115,7 @@ run_status () {
                    echo '#
         # Initial commit
         #'
        -	    git-ls-files |
        +	    @@GIT_PATH@@git-ls-files |
                    sed -e '
                            s/\\/\\\\/g
                            s/ /\\ /g
        @@ -126,7 +126,7 @@ run_status () {
                    committable="$?"
                fi
        -	git-diff-files --name-status |
        +	@@GIT_PATH@@git-diff-files --name-status |
                sed -e '
                        s/\\/\\\\/g
                        s/ /\\ /g
	...
and sed it out with 's/@@GIT_PATH@@/$(gitexecdir_SQ)/g'.

However, you have to realize that I often want to try things out *without* running "make", let alone installing. The current way things are set up lets me say:

	$ GIT_EXEC_PATH=$my_git_source \
          sh -x $my_git_source/git-commit.sh

to see where things break. Changing things the way I quoted above would make things _extremely_ inconvenient for me.

And it is ugly. "Making things ugly and inconvenient for what purpose?" is the question I have to ask myself at this point.

And if the answer is "to support unusual configuration which, quite frankly, I think is broken", then...

We could probably define a shell function that looks like:
        git_exec () {
                cmd="$1"
                shift
                case "${GIT_EXEC_PATH+set}" in
                set) ;;
                *) GIT_EXEC_PATH='@@GIT_EXEC_PATH@@' ;;
                esac
                "$GIT_EXEC_PATH/git-$cmd" "$@"
        }

in git-sh-setup [*1*], and then rewrite the above to something like this instead:

        diff --git a/git-commit.sh b/git-commit.sh
        index 330a434..8a73420 100755
        --- a/git-commit.sh
        +++ b/git-commit.sh
        ...
        @@ -115,7 +115,7 @@ run_status () {
                    echo '#
         # Initial commit
         #'
        -	    git-ls-files |
        +	    git_exec ls-files |
                    sed -e '
                            s/\\/\\\\/g
                            s/ /\\ /g
        @@ -126,7 +126,7 @@ run_status () {
                    committable="$?"
                fi
        -	git-diff-files  --name-status |
        +	git_exec diff-files  --name-status |
                sed -e '
                        s/\\/\\\\/g
                        s/ /\\ /g
        ...

But that does not cover Perl nor Python scripts, and does not address the ugliness either.

[Footnote]

*1* BTW, I just noticed that git-sh-setup needs to be on user's PATH, so we probably have to inline and duplicate the git_exec() shell function definition at the beginning of each script after all, when we make the initial ". git-sh-setup" inclusion to honor GIT_EXEC_PATH without munging the user's PATH.

Which is not a big deal by itself, since we preprocess *.{sh,perl,py} files anyway, but still it leaves a _big_ ugliness factor.

Previous: Junio C HamanoNext: Mark Wooding
Message 15 of 27 in “Invoke git-repo-config directly.”
  1. Invoke git-repo-config directly.Qingning Huo, Mar 14, 2006
  2. Johannes SchindelinMar 14, 2006
  3. Qingning HuoMar 14, 2006
  4. Linus TorvaldsMar 14, 2006
  5. Qingning HuoMar 14, 2006
  6. Linus TorvaldsMar 14, 2006
  7. Qingning HuoMar 15, 2006
  8. Junio C HamanoMar 15, 2006
  9. Junio C HamanoMar 15, 2006
  10. Qingning HuoMar 15, 2006
  11. Linus TorvaldsMar 15, 2006
  12. Junio C HamanoMar 15, 2006
  13. Qingning HuoMar 16, 2006
  14. Junio C HamanoMar 16, 2006
  15. Junio C HamanoMar 16, 2006
  16. Mark WoodingMar 16, 2006
  17. Andreas EricssonMar 16, 2006
  18. Junio C HamanoMar 17, 2006
  19. Mark WoodingMar 17, 2006
  20. Timo HirvonenMar 16, 2006
  21. Andreas EricssonMar 16, 2006
  22. Qingning HuoMar 16, 2006
  23. Junio C HamanoMar 16, 2006
  24. Andreas EricssonMar 16, 2006
  25. Jon LoeligerMar 16, 2006
  26. Jon LoeligerMar 16, 2006
  27. Junio C HamanoMar 16, 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.