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

[RFC/Patch] Tool rename fallout fix

From
Junio C Hamano <junkio@cox.net>
Date
Sep 9, 2005, 00:58 UTC
Message-ID
<7vll27rr8w.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vr7c02zgg.fsf@assigned-by-dhcp.cox.net>

Immediately after I updated the "master" branch with the tool renames, I got a complaint from somebody telling me that the things do not work anymore without 'make install'.

Strictly speaking, git has never worked fully without installation because 'git' wrapper looked for things in the same directory as it was in, which meant that 'git applymbox' would not have worked anyway (it was coming from tools/applymbox until recently), but on the other hand it certainly is nice if we can run most of the things immediately after building but before installing.

This patch attempts to remedy it. What is helped the most is that test scripts do not have to special case the scripts anymore; obviously we do want to be able to run tests before installing. A downside is that your working tree after a build has a lot more files than before.

As a side effect, you can specify non-standard path your Perl is installed, and you can explicitly say "#!/usr/local/bin/bash".

Comments?

--- cd /opt/packrat/playpen/public/in-place/git/git.junio/ git diff HEAD

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -142,6 +142,13 @@ ifeq ($(shell uname -s),SunOS)
 	PLATFORM_DEFINES += -DNO_GETDOMAINNAME=1
 endif
 
+ifndef SHELL_PATH
+	SHELL_PATH = /bin/sh
+endif
+ifndef PERL_PATH
+	PERL_PATH = /usr/bin/perl
+endif
+
 ifndef NO_OPENSSL
 	LIB_OBJS += epoch.o
 	OPENSSL_LIBSSL = -lssl
@@ -179,21 +186,32 @@ endif
 
 DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
 
-SCRIPTS = $(SCRIPT_SH) $(SCRIPT_PERL) gitk
+SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
+	  $(patsubst %.perl,%,$(SCRIPT_PERL)) gitk
 
 ### Build rules
 
-all: $(PROGRAMS) git.sh
+all: $(PROGRAMS) $(SCRIPTS)
 
 all:
 	$(MAKE) -C templates
 
-git.sh: git.sh.in Makefile
+git: git.sh Makefile
 	rm -f $@+ $@
-	sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.in >$@+
+	sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.sh >$@+
 	chmod +x $@+
 	mv $@+ $@
 
+$(filter-out git,$(patsubst %.sh,%,$(SCRIPT_SH))) : % : %.sh
+	rm -f $@
+	sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' $@.sh >$@
+	chmod +x $@
+
+$(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
+	rm -f $@
+	sed -e '1s|#!.*perl|#!$(PERL_PATH)|' $@.perl >$@
+	chmod +x $@
+
 %.o: %.c
 	$(CC) -o $*.o -c $(ALL_CFLAGS) $<
 %.o: %.S
@@ -250,19 +268,8 @@ check:
 
 install: $(PROGRAMS) $(SCRIPTS)
 	$(INSTALL) -m755 -d $(DESTDIR)$(bindir)
-	$(INSTALL) $(PROGRAMS) $(DESTDIR)$(bindir)
-	@for s in $(SCRIPTS); \
-	do \
-		case "$$s" in \
-		*.*) \
-			e=`expr "$$s" : '\(.*\)\.[^.]*$$'` ;; \
-		*) \
-			e="$$s" ;; \
-		esac && \
-		echo ": install $$s $(DESTDIR)$(bindir)/$$e" && \
-		$(INSTALL) $$s $(DESTDIR)$(bindir)/$$e || exit; \
-	done
-	$(INSTALL) git-revert.sh $(DESTDIR)$(bindir)/git-cherry-pick
+	$(INSTALL) $(PROGRAMS) $(SCRIPTS) $(DESTDIR)$(bindir)
+	$(INSTALL) git-revert $(DESTDIR)$(bindir)/git-cherry-pick
 	sh ./cmd-rename.sh $(DESTDIR)$(bindir)
 	$(MAKE) -C templates install
 
@@ -299,7 +306,8 @@ deb: dist
 
 clean:
 	rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROGRAMS) $(LIB_FILE)
-	rm -f git-core.spec git.sh
+	rm -f $(filter-out gitk,$(SCRIPTS))
+	rm -f git-core.spec
 	rm -rf $(GIT_TARNAME)
 	rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
 	rm -f git-core_$(GIT_VERSION)-*.deb git-core_$(GIT_VERSION)-*.dsc
diff --git a/git.sh.in b/git.sh
similarity index 100%
rename from git.sh.in
rename to git.sh
diff --git a/t/t1005-read-tree-m-2way-emu23.sh b/t/t1005-read-tree-m-2way-emu23.sh
--- a/t/t1005-read-tree-m-2way-emu23.sh
+++ b/t/t1005-read-tree-m-2way-emu23.sh
@@ -25,7 +25,7 @@ In the test, these paths are used:
 read_tree_twoway () {
     git-read-tree --emu23 "$1" "$2" &&
     git-ls-files --stage &&
-    git-merge-index ../../git-merge-one-file.sh -a &&
+    git-merge-index git-merge-one-file -a &&
     git-ls-files --stage
 }
 
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -13,12 +13,12 @@ handled.  Specifically, that a bogus bra
 test_expect_success \
     'prepare an trivial repository' \
     'echo Hello > A &&
-     ../../git-update-index --add A &&
-     ../../git-commit.sh -m "Initial commit."'
+     git-update-index --add A &&
+     git-commit -m "Initial commit."'
 
 test_expect_failure \
     'git branch --help should return error code' \
-    '../../git-branch.sh --help'
+    'git-branch --help'
 
 test_expect_failure \
     'git branch --help should not have created a bogus branch' \
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -21,9 +21,9 @@ test_expect_success setup '
 	    parent=$commit || return 1
 	done &&
 	echo "$commit" >.git/HEAD &&
-	git-clone.sh -l ./. victim &&
+	git-clone -l ./. victim &&
 	cd victim &&
-	git-log.sh &&
+	git-log &&
 	cd .. &&
 	echo $zero >.git/HEAD &&
 	parent=$zero &&
@@ -35,7 +35,7 @@ test_expect_success setup '
 	done &&
 	echo "$commit" >.git/HEAD &&
 	echo Rebase &&
-	git-log.sh'
+	git-log'
 
 test_expect_success \
         'pushing rewound head should not barf but require --force' ' 
Previous: Yasushi SHOJINext: Junio C Hamano
Message 8 of 28 in “GIT 0.99.6”
  1. Junio C HamanoSep 8, 2005
  2. Tool renames and 'ls-files -t' outputJunio C Hamano, Sep 8, 2005
  3. Post 0.99.7 preperation patchesJunio C Hamano, Sep 9, 2005
  4. Petr BaudisSep 12, 2005
  5. RFC: s/git-merge-base/git-find-common-ancestor/gYasushi SHOJI, Sep 11, 2005
  6. Junio C HamanoSep 11, 2005
  7. Rename git-merge-base to git-find-merge-baseYasushi SHOJI, Sep 11, 2005
  8. Tool rename fallout fixJunio C Hamano, Sep 9, 2005
  9. No GIT 0.99.7 todayJunio C Hamano, Sep 17, 2005
  10. [ANNOUNCE] GIT 0.99.7Junio C Hamano, Sep 18, 2005
  11. What to expect after GIT 0.99.7Junio C Hamano, Sep 18, 2005
  12. Linus TorvaldsSep 19, 2005
  13. Linus TorvaldsSep 19, 2005
  14. Johannes SchindelinSep 19, 2005
  15. Joachim B HagaSep 19, 2005
  16. Linus TorvaldsSep 19, 2005
  17. Anton AltaparmakovSep 19, 2005
  18. Matthias UrlichsSep 19, 2005
  19. Junio C HamanoSep 19, 2005
  20. Petr BaudisSep 19, 2005
  21. Linus TorvaldsSep 19, 2005
  22. [ANNOUNCE] Cogito-0.15Petr Baudis, Sep 19, 2005
  23. Pavel MachekSep 19, 2005
  24. Petr BaudisSep 20, 2005
  25. Linus TorvaldsSep 20, 2005
  26. Nigel CunninghamSep 19, 2005
  27. Chris WhiteSep 19, 2005
  28. Alan ChandlerSep 19, 2005

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.