Skip to contentSkip to conversation

Move test-*.c to test/ subdirectory

PATCH/RFC New Nguyễn Thái Ngọc Duy 8 participants 54 messages Jun 15, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

---
This makes topdir 19 files less and does not seem to break tests. There's only one new test(-mktemp) on pu.

 .gitignore                                       |   19 ------
 Makefile                                         |   71 +++++++++++-----------
 t/test-lib.sh                                    |    6 +-
 test/.gitignore                                  |   19 ++++++
 test-chmtime.c => test/chmtime.c                 |    0
 test-ctype.c => test/ctype.c                     |    0
 test-date.c => test/date.c                       |    0
 test-delta.c => test/delta.c                     |    0
 test-dump-cache-tree.c => test/dump-cache-tree.c |    0
 test-genrandom.c => test/genrandom.c             |    0
 test-index-version.c => test/index-version.c     |    0
 test-line-buffer.c => test/line-buffer.c         |    0
 test-match-trees.c => test/match-trees.c         |    0
 test-obj-pool.c => test/obj-pool.c               |    0
 test-parse-options.c => test/parse-options.c     |    0
 test-path-utils.c => test/path-utils.c           |    0
 test-run-command.c => test/run-command.c         |    0
 test-sha1.c => test/sha1.c                       |    0
 test-sigchain.c => test/sigchain.c               |    0
 test-string-pool.c => test/string-pool.c         |    0
 test-subprocess.c => test/subprocess.c           |    0
 test-svn-fe.c => test/svn-fe.c                   |    0
 test-treap.c => test/treap.c                     |    0
 23 files changed, 58 insertions(+), 57 deletions(-)
 create mode 100644 test/.gitignore
 rename test-chmtime.c => test/chmtime.c (100%)
 rename test-ctype.c => test/ctype.c (100%)
 rename test-date.c => test/date.c (100%)
 rename test-delta.c => test/delta.c (100%)
 rename test-dump-cache-tree.c => test/dump-cache-tree.c (100%)
 rename test-genrandom.c => test/genrandom.c (100%)
 rename test-index-version.c => test/index-version.c (100%)
 rename test-line-buffer.c => test/line-buffer.c (100%)
 rename test-match-trees.c => test/match-trees.c (100%)
 rename test-obj-pool.c => test/obj-pool.c (100%)
 rename test-parse-options.c => test/parse-options.c (100%)
 rename test-path-utils.c => test/path-utils.c (100%)
 rename test-run-command.c => test/run-command.c (100%)
 rename test-sha1.c => test/sha1.c (100%)
 rename test-sigchain.c => test/sigchain.c (100%)
 rename test-string-pool.c => test/string-pool.c (100%)
 rename test-subprocess.c => test/subprocess.c (100%)
 rename test-svn-fe.c => test/svn-fe.c (100%)
 rename test-treap.c => test/treap.c (100%)
.gitignore +0 -19
index 3dd6ef7..a99a216 100644
@@ -161,25 +161,6 @@
 /gitweb/GITWEB-BUILD-OPTIONS
 /gitweb/gitweb.cgi
 /gitweb/static/gitweb.min.*
-/test-chmtime
-/test-ctype
-/test-date
-/test-delta
-/test-dump-cache-tree
-/test-genrandom
-/test-index-version
-/test-line-buffer
-/test-match-trees
-/test-obj-pool
-/test-parse-options
-/test-path-utils
-/test-run-command
-/test-sha1
-/test-sigchain
-/test-string-pool
-/test-subprocess
-/test-svn-fe
-/test-treap
 /common-cmds.h
 *.tar.gz
 *.dsc
Makefile +36 -35

124 lines not on this page · raw message

t/test-lib.sh +3 -3
index 0fdc541..240caec 100644
@@ -984,9 +984,9 @@ then
 	}
 fi
 
-if ! test -x "$GIT_BUILD_DIR"/test-chmtime; then
-	echo >&2 'You need to build test-chmtime:'
-	echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
+if ! test -x "$GIT_BUILD_DIR"/test/chmtime; then
+	echo >&2 'You need to build test/chmtime:'
+	echo >&2 'Run "make test/chmtime" in the source (toplevel) directory'
 	exit 1
 fi
 
test/.gitignore new file +19 -0
new file mode 100644
index 0000000..6e8a2a1
@@ -0,0 +1,19 @@
+/chmtime
+/ctype
+/date
+/delta
+/dump-cache-tree
+/genrandom
+/index-version
+/line-buffer
+/match-trees
+/obj-pool
+/parse-options
+/path-utils
+/run-command
+/sha1
+/sigchain
+/string-pool
+/subprocess
+/svn-fe
+/treap
test/chmtime.c renamed from test-chmtime.c +0 -0
similarity index 100%
rename from test-chmtime.c
rename to test/chmtime.c
test/ctype.c renamed from test-ctype.c +0 -0
similarity index 100%
rename from test-ctype.c
rename to test/ctype.c
test/date.c renamed from test-date.c +0 -0
similarity index 100%
rename from test-date.c
rename to test/date.c
test/delta.c renamed from test-delta.c +0 -0
similarity index 100%
rename from test-delta.c
rename to test/delta.c
test/dump-cache-tree.c renamed from test-dump-cache-tree.c +0 -0
similarity index 100%
rename from test-dump-cache-tree.c
rename to test/dump-cache-tree.c
test/genrandom.c renamed from test-genrandom.c +0 -0
similarity index 100%
rename from test-genrandom.c
rename to test/genrandom.c
test/index-version.c renamed from test-index-version.c +0 -0
similarity index 100%
rename from test-index-version.c
rename to test/index-version.c
test/line-buffer.c renamed from test-line-buffer.c +0 -0
similarity index 100%
rename from test-line-buffer.c
rename to test/line-buffer.c
test/match-trees.c renamed from test-match-trees.c +0 -0
similarity index 100%
rename from test-match-trees.c
rename to test/match-trees.c
test/obj-pool.c renamed from test-obj-pool.c +0 -0
similarity index 100%
rename from test-obj-pool.c
rename to test/obj-pool.c
test/parse-options.c renamed from test-parse-options.c +0 -0
similarity index 100%
rename from test-parse-options.c
rename to test/parse-options.c
test/path-utils.c renamed from test-path-utils.c +0 -0
similarity index 100%
rename from test-path-utils.c
rename to test/path-utils.c
test/run-command.c renamed from test-run-command.c +0 -0
similarity index 100%
rename from test-run-command.c
rename to test/run-command.c
test/sha1.c renamed from test-sha1.c +0 -0
similarity index 100%
rename from test-sha1.c
rename to test/sha1.c
test/sigchain.c renamed from test-sigchain.c +0 -0
similarity index 100%
rename from test-sigchain.c
rename to test/sigchain.c
test/string-pool.c renamed from test-string-pool.c +0 -0
similarity index 100%
rename from test-string-pool.c
rename to test/string-pool.c
test/subprocess.c renamed from test-subprocess.c +0 -0
similarity index 100%
rename from test-subprocess.c
rename to test/subprocess.c
test/svn-fe.c renamed from test-svn-fe.c +0 -0
similarity index 100%
rename from test-svn-fe.c
rename to test/svn-fe.c
test/treap.c renamed from test-treap.c +0 -0
similarity index 100%
rename from test-treap.c
rename to test/treap.c
Signature · 1 line
1.7.4.74.g639db
#1 lore raw
Quoted 1 line · Nguyễn Thái Ngọc Duy

I like the idea of moving test-*.c out of the top-level directory, but at the same time I do not think it is a sane thing to have a new directory called test/ to have only test helper commandlets.

With both t/ and test/ directories present at the top-level, even people with Perl background may spot test/ before they notice t/ and expect to find actual test scripts in test/ directory.

Perhaps move them to t/helper/ directory instead?

#2 lore raw

PATCH 1/1 Move test-* to t/helper/ subdirectory

---
 .gitignore                                         |   19 ------------
 Makefile                                           |   30 ++++++++++----------
 t/helper/.gitignore                                |   19 ++++++++++++
 test-chmtime.c => t/helper/test-chmtime.c          |    0
 test-ctype.c => t/helper/test-ctype.c              |    0
 test-date.c => t/helper/test-date.c                |    0
 test-delta.c => t/helper/test-delta.c              |    0
 .../helper/test-dump-cache-tree.c                  |    0
 test-genrandom.c => t/helper/test-genrandom.c      |    0
 .../helper/test-index-version.c                    |    0
 test-line-buffer.c => t/helper/test-line-buffer.c  |    0
 test-match-trees.c => t/helper/test-match-trees.c  |    0
 test-obj-pool.c => t/helper/test-obj-pool.c        |    0
 .../helper/test-parse-options.c                    |    0
 test-path-utils.c => t/helper/test-path-utils.c    |    0
 test-run-command.c => t/helper/test-run-command.c  |    0
 test-sha1.c => t/helper/test-sha1.c                |    0
 test-sha1.sh => t/helper/test-sha1.sh              |    4 +-
 test-sigchain.c => t/helper/test-sigchain.c        |    0
 test-string-pool.c => t/helper/test-string-pool.c  |    0
 test-subprocess.c => t/helper/test-subprocess.c    |    0
 test-svn-fe.c => t/helper/test-svn-fe.c            |    0
 test-treap.c => t/helper/test-treap.c              |    0
 t/test-lib.sh                                      |    4 +-
 24 files changed, 38 insertions(+), 38 deletions(-)
 create mode 100644 t/helper/.gitignore
 rename test-chmtime.c => t/helper/test-chmtime.c (100%)
 rename test-ctype.c => t/helper/test-ctype.c (100%)
 rename test-date.c => t/helper/test-date.c (100%)
 rename test-delta.c => t/helper/test-delta.c (100%)
 rename test-dump-cache-tree.c => t/helper/test-dump-cache-tree.c (100%)
 rename test-genrandom.c => t/helper/test-genrandom.c (100%)
 rename test-index-version.c => t/helper/test-index-version.c (100%)
 rename test-line-buffer.c => t/helper/test-line-buffer.c (100%)
 rename test-match-trees.c => t/helper/test-match-trees.c (100%)
 rename test-obj-pool.c => t/helper/test-obj-pool.c (100%)
 rename test-parse-options.c => t/helper/test-parse-options.c (100%)
 rename test-path-utils.c => t/helper/test-path-utils.c (100%)
 rename test-run-command.c => t/helper/test-run-command.c (100%)
 rename test-sha1.c => t/helper/test-sha1.c (100%)
 rename test-sha1.sh => t/helper/test-sha1.sh (96%)
 rename test-sigchain.c => t/helper/test-sigchain.c (100%)
 rename test-string-pool.c => t/helper/test-string-pool.c (100%)
 rename test-subprocess.c => t/helper/test-subprocess.c (100%)
 rename test-svn-fe.c => t/helper/test-svn-fe.c (100%)
 rename test-treap.c => t/helper/test-treap.c (100%)
.gitignore +0 -19
index 3dd6ef7..a99a216 100644
@@ -161,25 +161,6 @@
 /gitweb/GITWEB-BUILD-OPTIONS
 /gitweb/gitweb.cgi
 /gitweb/static/gitweb.min.*
-/test-chmtime
-/test-ctype
-/test-date
-/test-delta
-/test-dump-cache-tree
-/test-genrandom
-/test-index-version
-/test-line-buffer
-/test-match-trees
-/test-obj-pool
-/test-parse-options
-/test-path-utils
-/test-run-command
-/test-sha1
-/test-sigchain
-/test-string-pool
-/test-subprocess
-/test-svn-fe
-/test-treap
 /common-cmds.h
 *.tar.gz
 *.dsc
Makefile +15 -15
index 775ee83..e2b3b92 100644
@@ -436,7 +436,7 @@ TEST_PROGRAMS_NEED_X += test-svn-fe
 TEST_PROGRAMS_NEED_X += test-treap
 TEST_PROGRAMS_NEED_X += test-index-version
 
-TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))
+TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
 
 # List built-in command $C whose implementation cmd_$C() is not in
 # builtin/$C.o but is linked in as part of some other command.
@@ -1829,7 +1829,7 @@ git.o git.spec \
 	$(patsubst %.perl,%,$(SCRIPT_PERL)) \
 	: GIT-VERSION-FILE
 
-TEST_OBJS := $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))
+TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS))
 GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
 	git.o
 ifndef NO_CURL
@@ -1963,12 +1963,12 @@ xdiff-interface.o $(XDIFF_OBJS): \
 	xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
 	xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
 
-$(VCSSVN_OBJS) $(VCSSVN_TEST_OBJS): $(LIB_H) \
+$(VCSSVN_OBJS) $(patsubst %,t/helper/%,$(VCSSVN_TEST_OBJS)): $(LIB_H) \
 	vcs-svn/obj_pool.h vcs-svn/trp.h vcs-svn/string_pool.h \
 	vcs-svn/line_buffer.h vcs-svn/repo_tree.h vcs-svn/fast_export.h \
 	vcs-svn/svndump.h
 
-test-svn-fe.o: vcs-svn/svndump.h
+t/helper/test-svn-fe.o: vcs-svn/svndump.h
 endif
 
 exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
@@ -2108,7 +2108,7 @@ bin-wrappers/%: wrap-for-bin.sh
 	@mkdir -p bin-wrappers
 	$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 	     -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
-	     -e 's|@@PROG@@|$(@F)|' < $< > $@ && \
+	     -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))|' < $< > $@ && \
 	chmod +x $@
 
 # GNU make supports exporting all variables by "export" without parameters.
@@ -2122,27 +2122,27 @@ export NO_SVN_TESTS
 test: all
 	$(MAKE) -C t/ all
 
-test-ctype$X: ctype.o
+t/helper/test-ctype$X: ctype.o
 
-test-date$X: date.o ctype.o
+t/helper/test-date$X: date.o ctype.o
 
-test-delta$X: diff-delta.o patch-delta.o
+t/helper/test-delta$X: diff-delta.o patch-delta.o
 
-test-line-buffer$X: vcs-svn/lib.a
+t/helper/test-line-buffer$X: vcs-svn/lib.a
 
-test-parse-options$X: parse-options.o
+t/helper/test-parse-options$X: parse-options.o
 
-test-string-pool$X: vcs-svn/lib.a
+t/helper/test-string-pool$X: vcs-svn/lib.a
 
-test-svn-fe$X: vcs-svn/lib.a
+t/helper/test-svn-fe$X: vcs-svn/lib.a
 
 .PRECIOUS: $(TEST_OBJS)
 
-test-%$X: test-%.o $(GITLIBS)
+t/helper/test-%$X: t/helper/test-%.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
 
-check-sha1:: test-sha1$X
-	./test-sha1.sh
+check-sha1:: t/helper/test-sha1$X
+	t/helper/test-sha1.sh
 
 check: common-cmds.h
 	if sparse; \
t/helper/.gitignore new file +19 -0
new file mode 100644
index 0000000..8f1b042
@@ -0,0 +1,19 @@
+/test-chmtime
+/test-ctype
+/test-date
+/test-delta
+/test-dump-cache-tree
+/test-genrandom
+/test-index-version
+/test-line-buffer
+/test-match-trees
+/test-obj-pool
+/test-parse-options
+/test-path-utils
+/test-run-command
+/test-sha1
+/test-sigchain
+/test-string-pool
+/test-subprocess
+/test-svn-fe
+/test-treap
t/helper/test-chmtime.c renamed from test-chmtime.c +0 -0
similarity index 100%
rename from test-chmtime.c
rename to t/helper/test-chmtime.c
t/helper/test-ctype.c renamed from test-ctype.c +0 -0
similarity index 100%
rename from test-ctype.c
rename to t/helper/test-ctype.c
t/helper/test-date.c renamed from test-date.c +0 -0
similarity index 100%
rename from test-date.c
rename to t/helper/test-date.c
t/helper/test-delta.c renamed from test-delta.c +0 -0
similarity index 100%
rename from test-delta.c
rename to t/helper/test-delta.c
t/helper/test-dump-cache-tree.c renamed from test-dump-cache-tree.c +0 -0
similarity index 100%
rename from test-dump-cache-tree.c
rename to t/helper/test-dump-cache-tree.c
t/helper/test-genrandom.c renamed from test-genrandom.c +0 -0
similarity index 100%
rename from test-genrandom.c
rename to t/helper/test-genrandom.c
t/helper/test-index-version.c renamed from test-index-version.c +0 -0
similarity index 100%
rename from test-index-version.c
rename to t/helper/test-index-version.c
t/helper/test-line-buffer.c renamed from test-line-buffer.c +0 -0
similarity index 100%
rename from test-line-buffer.c
rename to t/helper/test-line-buffer.c
t/helper/test-match-trees.c renamed from test-match-trees.c +0 -0
similarity index 100%
rename from test-match-trees.c
rename to t/helper/test-match-trees.c
t/helper/test-obj-pool.c renamed from test-obj-pool.c +0 -0
similarity index 100%
rename from test-obj-pool.c
rename to t/helper/test-obj-pool.c
t/helper/test-parse-options.c renamed from test-parse-options.c +0 -0
similarity index 100%
rename from test-parse-options.c
rename to t/helper/test-parse-options.c
t/helper/test-path-utils.c renamed from test-path-utils.c +0 -0
similarity index 100%
rename from test-path-utils.c
rename to t/helper/test-path-utils.c
t/helper/test-run-command.c renamed from test-run-command.c +0 -0
similarity index 100%
rename from test-run-command.c
rename to t/helper/test-run-command.c
t/helper/test-sha1.c renamed from test-sha1.c +0 -0
similarity index 100%
rename from test-sha1.c
rename to t/helper/test-sha1.c
t/helper/test-sha1.sh renamed from test-sha1.sh +2 -2
similarity index 96%
rename from test-sha1.sh
rename to t/helper/test-sha1.sh
index 0f0bc5d..4e691d1 100755
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 dd if=/dev/zero bs=1048576 count=100 2>/dev/null |
-/usr/bin/time ./test-sha1 >/dev/null
+/usr/bin/time t/helper/test-sha1 >/dev/null
 
 while read expect cnt pfx
 do
@@ -11,7 +11,7 @@ do
 			test -z "$pfx" || echo "$pfx"
 			dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
 			perl -pe 'y/\000/g/'
-		} | ./test-sha1 $cnt
+		} | t/helper/test-sha1 $cnt
 	`
 	if test "$expect" = "$actual"
 	then
t/helper/test-sigchain.c renamed from test-sigchain.c +0 -0
similarity index 100%
rename from test-sigchain.c
rename to t/helper/test-sigchain.c
t/helper/test-string-pool.c renamed from test-string-pool.c +0 -0
similarity index 100%
rename from test-string-pool.c
rename to t/helper/test-string-pool.c
t/helper/test-subprocess.c renamed from test-subprocess.c +0 -0
similarity index 100%
rename from test-subprocess.c
rename to t/helper/test-subprocess.c
t/helper/test-svn-fe.c renamed from test-svn-fe.c +0 -0
similarity index 100%
rename from test-svn-fe.c
rename to t/helper/test-svn-fe.c
t/helper/test-treap.c renamed from test-treap.c +0 -0
similarity index 100%
rename from test-treap.c
rename to t/helper/test-treap.c
t/test-lib.sh +2 -2
index 0fdc541..eebf7a8 100644
@@ -984,9 +984,9 @@ then
 	}
 fi
 
-if ! test -x "$GIT_BUILD_DIR"/test-chmtime; then
+if ! test -x "$GIT_BUILD_DIR"/t/helper/test-chmtime; then
 	echo >&2 'You need to build test-chmtime:'
-	echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
+	echo >&2 'Run "make t/helper/test-chmtime" in the source (toplevel) directory'
 	exit 1
 fi
 
Signature · 1 line
1.7.4.74.g639db
#53 lore raw
In reply to Nguyễn Thái Ngọc Duy

2011/2/9 Nguyễn Thái Ngọc Duy <[email protected]>:

Quoted 4 lines

---
 This makes topdir 19 files less and does not seem to break tests.

except this because test-sha1.sh wasn't moved.

Quoted 4 lines
Makefile +2 -2
-check-sha1:: test-sha1$X
-       ./test-sha1.sh
+check-sha1:: test/sha1$X
+       ./test/sha1.sh
Signature · 1 line
Duy
#3 lore raw

cover Thinning the git toplevel directory

In reply to Nguyễn Thái Ngọc Duy

Hi,

Quoted 3 lines · Nguyễn Thái Ngọc Duy
 .gitignore                                         |   19 ------------
 Makefile                                           |   30 ++++++++++----------
 t/helper/.gitignore                                |   19 ++++++++++++

[...]

Quoted 1 line
 24 files changed, 38 insertions(+), 38 deletions(-)

Here's a variation on the theme that just moves source and .o files (leaving questions about how to cope with breaking muscle memory for the resulting executables for later). What do you think?

Patch 1 moves the sources for libgit.a to a subdirectory. This seems appealing anyway, to encourage people to start thinking about how to make it into a standalone and reusable library.

Patch 2 moves source for test programs like test-sha1 to a subdirectory.

Patch 3 dumps header files into an include/ subdirectory. I'm not thrilled with it but it does make the toplevel directory listing shorter.

After this series:

 $ ls | wc -l
 86

which fits nicely on a 113x31 terminal (but certainly not an 80x24 one).

The change descriptions need work. Help would be appreciated.

Thoughts?
Jonathan Nieder (3):
Move libgit.a sources into a libgit/ subdirectory Move test-* into a test-programs/ subdirectory Move header files into a include/ subdirectory

 Makefile                                           |  418 ++++++++++----------
 [plus a bunch of renames]
 208 files changed, 212 insertions(+), 206 deletions(-)
#4 lore raw

PATCH 1/3 Move libgit.a sources into a libgit/ subdirectory

Move sources for libgit.a to a libgit/ subdirectory. This way, a person wanting to tackle the reusable part of git will know where to look, and those looking to work on individual commands know to look elsewhere.

Perhaps some day the libgit/ subdirectory can be managed as an independent subproject (for example if it gets merged with libgit2).

---
 Makefile                                        |  281 ++++++++++++-----------
 abspath.c => libgit/abspath.c                   |    0
 [ etc etc etc ]
 zlib.c => libgit/zlib.c                         |    0
 117 files changed, 142 insertions(+), 139 deletions(-)
 rename abspath.c => libgit/abspath.c (100%)
 [ etc ]
 rename zlib.c => libgit/zlib.c (100%)
Makefile +142 -139
index ade7923..b812c1e 100644
@@ -561,121 +561,121 @@ LIB_H += utf8.h
 LIB_H += xdiff-interface.h
 LIB_H += xdiff/xdiff.h
 
-LIB_OBJS += abspath.o
-LIB_OBJS += advice.o
-LIB_OBJS += alias.o
-LIB_OBJS += alloc.o
-LIB_OBJS += archive.o
-LIB_OBJS += archive-tar.o
-LIB_OBJS += archive-zip.o
-LIB_OBJS += attr.o
-LIB_OBJS += base85.o
-LIB_OBJS += bisect.o
-LIB_OBJS += blob.o
-LIB_OBJS += branch.o
-LIB_OBJS += bundle.o
-LIB_OBJS += cache-tree.o
-LIB_OBJS += color.o
-LIB_OBJS += combine-diff.o
-LIB_OBJS += commit.o
-LIB_OBJS += config.o
-LIB_OBJS += connect.o
-LIB_OBJS += convert.o
-LIB_OBJS += copy.o
-LIB_OBJS += csum-file.o
-LIB_OBJS += ctype.o
-LIB_OBJS += date.o
-LIB_OBJS += decorate.o
-LIB_OBJS += diffcore-break.o
-LIB_OBJS += diffcore-delta.o
-LIB_OBJS += diffcore-order.o
-LIB_OBJS += diffcore-pickaxe.o
-LIB_OBJS += diffcore-rename.o
-LIB_OBJS += diff-delta.o
-LIB_OBJS += diff-lib.o
-LIB_OBJS += diff-no-index.o
-LIB_OBJS += diff.o
-LIB_OBJS += dir.o
-LIB_OBJS += editor.o
-LIB_OBJS += entry.o
-LIB_OBJS += environment.o
-LIB_OBJS += exec_cmd.o
-LIB_OBJS += fsck.o
-LIB_OBJS += graph.o
-LIB_OBJS += grep.o
-LIB_OBJS += hash.o
-LIB_OBJS += help.o
-LIB_OBJS += hex.o
-LIB_OBJS += ident.o
-LIB_OBJS += levenshtein.o
-LIB_OBJS += list-objects.o
-LIB_OBJS += ll-merge.o
-LIB_OBJS += lockfile.o
-LIB_OBJS += log-tree.o
-LIB_OBJS += mailmap.o
-LIB_OBJS += match-trees.o
-LIB_OBJS += merge-file.o
-LIB_OBJS += merge-recursive.o
-LIB_OBJS += name-hash.o
-LIB_OBJS += notes.o
-LIB_OBJS += notes-cache.o
-LIB_OBJS += notes-merge.o
-LIB_OBJS += object.o
-LIB_OBJS += pack-check.o
-LIB_OBJS += pack-refs.o
-LIB_OBJS += pack-revindex.o
-LIB_OBJS += pack-write.o
-LIB_OBJS += pager.o
-LIB_OBJS += parse-options.o
-LIB_OBJS += patch-delta.o
-LIB_OBJS += patch-ids.o
-LIB_OBJS += path.o
-LIB_OBJS += pkt-line.o
-LIB_OBJS += preload-index.o
-LIB_OBJS += pretty.o
-LIB_OBJS += progress.o
-LIB_OBJS += quote.o
-LIB_OBJS += reachable.o
-LIB_OBJS += read-cache.o
-LIB_OBJS += reflog-walk.o
-LIB_OBJS += refs.o
-LIB_OBJS += remote.o
-LIB_OBJS += replace_object.o
-LIB_OBJS += rerere.o
-LIB_OBJS += resolve-undo.o
-LIB_OBJS += revision.o
-LIB_OBJS += run-command.o
-LIB_OBJS += server-info.o
-LIB_OBJS += setup.o
-LIB_OBJS += sha1-lookup.o
-LIB_OBJS += sha1_file.o
-LIB_OBJS += sha1_name.o
-LIB_OBJS += shallow.o
-LIB_OBJS += sideband.o
-LIB_OBJS += sigchain.o
-LIB_OBJS += strbuf.o
-LIB_OBJS += string-list.o
-LIB_OBJS += submodule.o
-LIB_OBJS += symlinks.o
-LIB_OBJS += tag.o
-LIB_OBJS += trace.o
-LIB_OBJS += transport.o
-LIB_OBJS += transport-helper.o
-LIB_OBJS += tree-diff.o
-LIB_OBJS += tree.o
-LIB_OBJS += tree-walk.o
-LIB_OBJS += unpack-trees.o
-LIB_OBJS += url.o
-LIB_OBJS += usage.o
-LIB_OBJS += userdiff.o
-LIB_OBJS += utf8.o
-LIB_OBJS += walker.o
-LIB_OBJS += wrapper.o
-LIB_OBJS += write_or_die.o
-LIB_OBJS += ws.o
-LIB_OBJS += wt-status.o
-LIB_OBJS += xdiff-interface.o
-LIB_OBJS += zlib.o
+LIB_OBJS += libgit/abspath.o
+LIB_OBJS += libgit/advice.o
+LIB_OBJS += libgit/alias.o
+LIB_OBJS += libgit/alloc.o
+LIB_OBJS += libgit/archive.o
+LIB_OBJS += libgit/archive-tar.o
+LIB_OBJS += libgit/archive-zip.o
+LIB_OBJS += libgit/attr.o
+LIB_OBJS += libgit/base85.o
+LIB_OBJS += libgit/bisect.o
+LIB_OBJS += libgit/blob.o
+LIB_OBJS += libgit/branch.o
+LIB_OBJS += libgit/bundle.o
+LIB_OBJS += libgit/cache-tree.o
+LIB_OBJS += libgit/color.o
+LIB_OBJS += libgit/combine-diff.o
+LIB_OBJS += libgit/commit.o
+LIB_OBJS += libgit/config.o
+LIB_OBJS += libgit/connect.o
+LIB_OBJS += libgit/convert.o
+LIB_OBJS += libgit/copy.o
+LIB_OBJS += libgit/csum-file.o
+LIB_OBJS += libgit/ctype.o
+LIB_OBJS += libgit/date.o
+LIB_OBJS += libgit/decorate.o
+LIB_OBJS += libgit/diffcore-break.o
+LIB_OBJS += libgit/diffcore-delta.o
+LIB_OBJS += libgit/diffcore-order.o
+LIB_OBJS += libgit/diffcore-pickaxe.o
+LIB_OBJS += libgit/diffcore-rename.o
+LIB_OBJS += libgit/diff-delta.o
+LIB_OBJS += libgit/diff-lib.o
+LIB_OBJS += libgit/diff-no-index.o
+LIB_OBJS += libgit/diff.o
+LIB_OBJS += libgit/dir.o
+LIB_OBJS += libgit/editor.o
+LIB_OBJS += libgit/entry.o
+LIB_OBJS += libgit/environment.o
+LIB_OBJS += libgit/exec_cmd.o
+LIB_OBJS += libgit/fsck.o
+LIB_OBJS += libgit/graph.o
+LIB_OBJS += libgit/grep.o
+LIB_OBJS += libgit/hash.o
+LIB_OBJS += libgit/help.o
+LIB_OBJS += libgit/hex.o
+LIB_OBJS += libgit/ident.o
+LIB_OBJS += libgit/levenshtein.o
+LIB_OBJS += libgit/list-objects.o
+LIB_OBJS += libgit/ll-merge.o
+LIB_OBJS += libgit/lockfile.o
+LIB_OBJS += libgit/log-tree.o
+LIB_OBJS += libgit/mailmap.o
+LIB_OBJS += libgit/match-trees.o
+LIB_OBJS += libgit/merge-file.o
+LIB_OBJS += libgit/merge-recursive.o
+LIB_OBJS += libgit/name-hash.o
+LIB_OBJS += libgit/notes.o
+LIB_OBJS += libgit/notes-cache.o
+LIB_OBJS += libgit/notes-merge.o
+LIB_OBJS += libgit/object.o
+LIB_OBJS += libgit/pack-check.o
+LIB_OBJS += libgit/pack-refs.o
+LIB_OBJS += libgit/pack-revindex.o
+LIB_OBJS += libgit/pack-write.o
+LIB_OBJS += libgit/pager.o
+LIB_OBJS += libgit/parse-options.o
+LIB_OBJS += libgit/patch-delta.o
+LIB_OBJS += libgit/patch-ids.o
+LIB_OBJS += libgit/path.o
+LIB_OBJS += libgit/pkt-line.o
+LIB_OBJS += libgit/preload-index.o
+LIB_OBJS += libgit/pretty.o
+LIB_OBJS += libgit/progress.o
+LIB_OBJS += libgit/quote.o
+LIB_OBJS += libgit/reachable.o
+LIB_OBJS += libgit/read-cache.o
+LIB_OBJS += libgit/reflog-walk.o
+LIB_OBJS += libgit/refs.o
+LIB_OBJS += libgit/remote.o
+LIB_OBJS += libgit/replace_object.o
+LIB_OBJS += libgit/rerere.o
+LIB_OBJS += libgit/resolve-undo.o
+LIB_OBJS += libgit/revision.o
+LIB_OBJS += libgit/run-command.o
+LIB_OBJS += libgit/server-info.o
+LIB_OBJS += libgit/setup.o
+LIB_OBJS += libgit/sha1-lookup.o
+LIB_OBJS += libgit/sha1_file.o
+LIB_OBJS += libgit/sha1_name.o
+LIB_OBJS += libgit/shallow.o
+LIB_OBJS += libgit/sideband.o
+LIB_OBJS += libgit/sigchain.o
+LIB_OBJS += libgit/strbuf.o
+LIB_OBJS += libgit/string-list.o
+LIB_OBJS += libgit/submodule.o
+LIB_OBJS += libgit/symlinks.o
+LIB_OBJS += libgit/tag.o
+LIB_OBJS += libgit/trace.o
+LIB_OBJS += libgit/transport.o
+LIB_OBJS += libgit/transport-helper.o
+LIB_OBJS += libgit/tree-diff.o
+LIB_OBJS += libgit/tree.o
+LIB_OBJS += libgit/tree-walk.o
+LIB_OBJS += libgit/unpack-trees.o
+LIB_OBJS += libgit/url.o
+LIB_OBJS += libgit/usage.o
+LIB_OBJS += libgit/userdiff.o
+LIB_OBJS += libgit/utf8.o
+LIB_OBJS += libgit/walker.o
+LIB_OBJS += libgit/wrapper.o
+LIB_OBJS += libgit/write_or_die.o
+LIB_OBJS += libgit/ws.o
+LIB_OBJS += libgit/wt-status.o
+LIB_OBJS += libgit/xdiff-interface.o
+LIB_OBJS += libgit/zlib.o
 
 BUILTIN_OBJS += builtin/add.o
 BUILTIN_OBJS += builtin/annotate.o
@@ -1524,7 +1524,7 @@ ifdef NO_PTHREADS
 else
 	BASIC_CFLAGS += $(PTHREAD_CFLAGS)
 	EXTLIBS += $(PTHREAD_LIBS)
-	LIB_OBJS += thread-utils.o
+	LIB_OBJS += libgit/thread-utils.o
 endif
 
 ifdef HAVE_PATHS_H
@@ -1683,7 +1683,7 @@ git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
 		$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
 
-help.o: common-cmds.h
+libgit/help.o: common-cmds.h
 
 builtin/help.o: common-cmds.h
 builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
@@ -1946,21 +1946,22 @@ else
 # gcc detects!
 
 $(GIT_OBJS): $(LIB_H)
-builtin/branch.o builtin/checkout.o builtin/clone.o builtin/reset.o branch.o transport.o: branch.h
-builtin/bundle.o bundle.o transport.o: bundle.h
-builtin/bisect--helper.o builtin/rev-list.o bisect.o: bisect.h
-builtin/clone.o builtin/fetch-pack.o transport.o: fetch-pack.h
-builtin/grep.o builtin/pack-objects.o transport-helper.o: thread-utils.h
-builtin/send-pack.o transport.o: send-pack.h
+builtin/branch.o builtin/checkout.o builtin/clone.o builtin/reset.o: branch.h
+libgit/branch.o libgit/transport.o: branch.h
+builtin/bundle.o libgit/bundle.o libgit/transport.o: bundle.h
+builtin/bisect--helper.o builtin/rev-list.o libgit/bisect.o: bisect.h
+builtin/clone.o builtin/fetch-pack.o libgit/transport.o: fetch-pack.h
+builtin/grep.o builtin/pack-objects.o libgit/transport-helper.o: thread-utils.h
+builtin/send-pack.o libgit/transport.o: send-pack.h
 builtin/log.o builtin/shortlog.o: shortlog.h
-builtin/prune.o builtin/reflog.o reachable.o: reachable.h
-builtin/commit.o builtin/revert.o wt-status.o: wt-status.h
-builtin/tar-tree.o archive-tar.o: tar.h
-connect.o transport.o http-backend.o: url.h
-http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
+builtin/prune.o builtin/reflog.o libgit/reachable.o: reachable.h
+builtin/commit.o builtin/revert.o libgit/wt-status.o: wt-status.h
+builtin/tar-tree.o libgit/archive-tar.o: tar.h
+libgit/connect.o libgit/transport.o http-backend.o: url.h
+http-fetch.o http-walker.o remote-curl.o libgit/transport.o libgit/walker.o: walker.h
 http.o http-walker.o http-push.o http-fetch.o remote-curl.o: http.h url.h
 
-xdiff-interface.o $(XDIFF_OBJS): \
+libgit/xdiff-interface.o $(XDIFF_OBJS): \
 	xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
 	xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
 
@@ -1972,7 +1973,7 @@ $(VCSSVN_OBJS) $(VCSSVN_TEST_OBJS): $(LIB_H) \
 test-svn-fe.o: vcs-svn/svndump.h
 endif
 
-exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
+libgit/exec_cmd.s libgit/exec_cmd.o: EXTRA_CPPFLAGS = \
 	'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
 	'-DBINDIR="$(bindir_relative_SQ)"' \
 	'-DPREFIX="$(prefix_SQ)"'
@@ -1980,9 +1981,11 @@ exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
 builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
 	-DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
 
-config.s config.o: EXTRA_CPPFLAGS = -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
+libgit/config.s libgit/config.o: EXTRA_CPPFLAGS = \
+	-DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
 
-attr.s attr.o: EXTRA_CPPFLAGS = -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
+libgit/attr.s libgit/attr.o: EXTRA_CPPFLAGS = \
+	-DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
 
 http.s http.o: EXTRA_CPPFLAGS = -DGIT_HTTP_USER_AGENT='"git/$(GIT_VERSION)"'
 
@@ -2006,10 +2009,10 @@ git-imap-send$X: imap-send.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
 
-git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o $(GITLIBS)
+git-http-fetch$X: libgit/revision.o http.o http-walker.o http-fetch.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL)
-git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
+git-http-push$X: libgit/revision.o http.o http-push.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
 
@@ -2123,15 +2126,15 @@ export NO_SVN_TESTS
 test: all
 	$(MAKE) -C t/ all
 
-test-ctype$X: ctype.o
+test-ctype$X: libgit/ctype.o
 
-test-date$X: date.o ctype.o
+test-date$X: libgit/date.o libgit/ctype.o
 
-test-delta$X: diff-delta.o patch-delta.o
+test-delta$X: libgit/diff-delta.o libgit/patch-delta.o
 
 test-line-buffer$X: vcs-svn/lib.a
 
-test-parse-options$X: parse-options.o
+test-parse-options$X: libgit/parse-options.o
 
 test-string-pool$X: vcs-svn/lib.a
 
@@ -2316,7 +2319,7 @@ distclean: clean
 
 clean:
 	$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
-		builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
+		libgit/*.o builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
 	$(RM) $(TEST_PROGRAMS)
 	$(RM) -r bin-wrappers
libgit/abspath.c renamed from abspath.c +0 -0
similarity index 100%
rename from abspath.c
rename to libgit/abspath.c
libgit/advice.c renamed from advice.c +0 -0
similarity index 100%
rename from advice.c
rename to libgit/advice.c
libgit/alias.c renamed from alias.c +0 -0
similarity index 100%
rename from alias.c
rename to libgit/alias.c
libgit/alloc.c renamed from alloc.c +0 -0
similarity index 100%
rename from alloc.c
rename to libgit/alloc.c
libgit/archive-tar.c renamed from archive-tar.c +0 -0
similarity index 100%
rename from archive-tar.c
rename to libgit/archive-tar.c
libgit/archive-zip.c renamed from archive-zip.c +0 -0
similarity index 100%
rename from archive-zip.c
rename to libgit/archive-zip.c
libgit/archive.c renamed from archive.c +0 -0
similarity index 100%
rename from archive.c
rename to libgit/archive.c
libgit/attr.c renamed from attr.c +0 -0
similarity index 100%
rename from attr.c
rename to libgit/attr.c
libgit/base85.c renamed from base85.c +0 -0
similarity index 100%
rename from base85.c
rename to libgit/base85.c
libgit/bisect.c renamed from bisect.c +0 -0
similarity index 100%
rename from bisect.c
rename to libgit/bisect.c
libgit/blob.c renamed from blob.c +0 -0
similarity index 100%
rename from blob.c
rename to libgit/blob.c
libgit/branch.c renamed from branch.c +0 -0
similarity index 100%
rename from branch.c
rename to libgit/branch.c
libgit/bundle.c renamed from bundle.c +0 -0
similarity index 100%
rename from bundle.c
rename to libgit/bundle.c
libgit/cache-tree.c renamed from cache-tree.c +0 -0
similarity index 100%
rename from cache-tree.c
rename to libgit/cache-tree.c
libgit/color.c renamed from color.c +0 -0
similarity index 100%
rename from color.c
rename to libgit/color.c
libgit/combine-diff.c renamed from combine-diff.c +0 -0
similarity index 100%
rename from combine-diff.c
rename to libgit/combine-diff.c
libgit/commit.c renamed from commit.c +0 -0
similarity index 100%
rename from commit.c
rename to libgit/commit.c
libgit/config.c renamed from config.c +0 -0
similarity index 100%
rename from config.c
rename to libgit/config.c
libgit/connect.c renamed from connect.c +0 -0
similarity index 100%
rename from connect.c
rename to libgit/connect.c
libgit/convert.c renamed from convert.c +0 -0
similarity index 100%
rename from convert.c
rename to libgit/convert.c
libgit/copy.c renamed from copy.c +0 -0
similarity index 100%
rename from copy.c
rename to libgit/copy.c
libgit/csum-file.c renamed from csum-file.c +0 -0
similarity index 100%
rename from csum-file.c
rename to libgit/csum-file.c
libgit/ctype.c renamed from ctype.c +0 -0
similarity index 100%
rename from ctype.c
rename to libgit/ctype.c
libgit/date.c renamed from date.c +0 -0
similarity index 100%
rename from date.c
rename to libgit/date.c
libgit/decorate.c renamed from decorate.c +0 -0
similarity index 100%
rename from decorate.c
rename to libgit/decorate.c
libgit/diff-delta.c renamed from diff-delta.c +0 -0
similarity index 100%
rename from diff-delta.c
rename to libgit/diff-delta.c
libgit/diff-lib.c renamed from diff-lib.c +0 -0
similarity index 100%
rename from diff-lib.c
rename to libgit/diff-lib.c
libgit/diff-no-index.c renamed from diff-no-index.c +0 -0
similarity index 100%
rename from diff-no-index.c
rename to libgit/diff-no-index.c
libgit/diff.c renamed from diff.c +0 -0
similarity index 100%
rename from diff.c
rename to libgit/diff.c
libgit/diffcore-break.c renamed from diffcore-break.c +0 -0
similarity index 100%
rename from diffcore-break.c
rename to libgit/diffcore-break.c
libgit/diffcore-delta.c renamed from diffcore-delta.c +0 -0
similarity index 100%
rename from diffcore-delta.c
rename to libgit/diffcore-delta.c
libgit/diffcore-order.c renamed from diffcore-order.c +0 -0
similarity index 100%
rename from diffcore-order.c
rename to libgit/diffcore-order.c
libgit/diffcore-pickaxe.c renamed from diffcore-pickaxe.c +0 -0
similarity index 100%
rename from diffcore-pickaxe.c
rename to libgit/diffcore-pickaxe.c
libgit/diffcore-rename.c renamed from diffcore-rename.c +0 -0
similarity index 100%
rename from diffcore-rename.c
rename to libgit/diffcore-rename.c
libgit/dir.c renamed from dir.c +0 -0
similarity index 100%
rename from dir.c
rename to libgit/dir.c
libgit/editor.c renamed from editor.c +0 -0
similarity index 100%
rename from editor.c
rename to libgit/editor.c
libgit/entry.c renamed from entry.c +0 -0
similarity index 100%
rename from entry.c
rename to libgit/entry.c
libgit/environment.c renamed from environment.c +0 -0
similarity index 100%
rename from environment.c
rename to libgit/environment.c
libgit/exec_cmd.c renamed from exec_cmd.c +0 -0
similarity index 100%
rename from exec_cmd.c
rename to libgit/exec_cmd.c
libgit/fsck.c renamed from fsck.c +0 -0
similarity index 100%
rename from fsck.c
rename to libgit/fsck.c
libgit/graph.c renamed from graph.c +0 -0
similarity index 100%
rename from graph.c
rename to libgit/graph.c
libgit/grep.c renamed from grep.c +0 -0
similarity index 100%
rename from grep.c
rename to libgit/grep.c
libgit/hash.c renamed from hash.c +0 -0
similarity index 100%
rename from hash.c
rename to libgit/hash.c
libgit/help.c renamed from help.c +0 -0
similarity index 100%
rename from help.c
rename to libgit/help.c
libgit/hex.c renamed from hex.c +0 -0
similarity index 100%
rename from hex.c
rename to libgit/hex.c
libgit/ident.c renamed from ident.c +0 -0
similarity index 100%
rename from ident.c
rename to libgit/ident.c
libgit/levenshtein.c renamed from levenshtein.c +0 -0
similarity index 100%
rename from levenshtein.c
rename to libgit/levenshtein.c
libgit/list-objects.c renamed from list-objects.c +0 -0
similarity index 100%
rename from list-objects.c
rename to libgit/list-objects.c
libgit/ll-merge.c renamed from ll-merge.c +0 -0
similarity index 100%
rename from ll-merge.c
rename to libgit/ll-merge.c
libgit/lockfile.c renamed from lockfile.c +0 -0
similarity index 100%
rename from lockfile.c
rename to libgit/lockfile.c
libgit/log-tree.c renamed from log-tree.c +0 -0
similarity index 100%
rename from log-tree.c
rename to libgit/log-tree.c
libgit/mailmap.c renamed from mailmap.c +0 -0
similarity index 100%
rename from mailmap.c
rename to libgit/mailmap.c
libgit/match-trees.c renamed from match-trees.c +0 -0
similarity index 100%
rename from match-trees.c
rename to libgit/match-trees.c
libgit/merge-file.c renamed from merge-file.c +0 -0
similarity index 100%
rename from merge-file.c
rename to libgit/merge-file.c
libgit/merge-recursive.c renamed from merge-recursive.c +0 -0
similarity index 100%
rename from merge-recursive.c
rename to libgit/merge-recursive.c
libgit/name-hash.c renamed from name-hash.c +0 -0
similarity index 100%
rename from name-hash.c
rename to libgit/name-hash.c
libgit/notes-cache.c renamed from notes-cache.c +0 -0
similarity index 100%
rename from notes-cache.c
rename to libgit/notes-cache.c
libgit/notes-merge.c renamed from notes-merge.c +0 -0
similarity index 100%
rename from notes-merge.c
rename to libgit/notes-merge.c
libgit/notes.c renamed from notes.c +0 -0
similarity index 100%
rename from notes.c
rename to libgit/notes.c
libgit/object.c renamed from object.c +0 -0
similarity index 100%
rename from object.c
rename to libgit/object.c
libgit/pack-check.c renamed from pack-check.c +0 -0
similarity index 100%
rename from pack-check.c
rename to libgit/pack-check.c
libgit/pack-refs.c renamed from pack-refs.c +0 -0
similarity index 100%
rename from pack-refs.c
rename to libgit/pack-refs.c
libgit/pack-revindex.c renamed from pack-revindex.c +0 -0
similarity index 100%
rename from pack-revindex.c
rename to libgit/pack-revindex.c
libgit/pack-write.c renamed from pack-write.c +0 -0
similarity index 100%
rename from pack-write.c
rename to libgit/pack-write.c
libgit/pager.c renamed from pager.c +0 -0
similarity index 100%
rename from pager.c
rename to libgit/pager.c
libgit/parse-options.c renamed from parse-options.c +0 -0
similarity index 100%
rename from parse-options.c
rename to libgit/parse-options.c
libgit/patch-delta.c renamed from patch-delta.c +0 -0
similarity index 100%
rename from patch-delta.c
rename to libgit/patch-delta.c
libgit/patch-ids.c renamed from patch-ids.c +0 -0
similarity index 100%
rename from patch-ids.c
rename to libgit/patch-ids.c
libgit/path.c renamed from path.c +0 -0
similarity index 100%
rename from path.c
rename to libgit/path.c
libgit/pkt-line.c renamed from pkt-line.c +0 -0
similarity index 100%
rename from pkt-line.c
rename to libgit/pkt-line.c
libgit/preload-index.c renamed from preload-index.c +0 -0
similarity index 100%
rename from preload-index.c
rename to libgit/preload-index.c
libgit/pretty.c renamed from pretty.c +0 -0
similarity index 100%
rename from pretty.c
rename to libgit/pretty.c
libgit/progress.c renamed from progress.c +0 -0
similarity index 100%
rename from progress.c
rename to libgit/progress.c
libgit/quote.c renamed from quote.c +0 -0
similarity index 100%
rename from quote.c
rename to libgit/quote.c
libgit/reachable.c renamed from reachable.c +0 -0
similarity index 100%
rename from reachable.c
rename to libgit/reachable.c
libgit/read-cache.c renamed from read-cache.c +0 -0
similarity index 100%
rename from read-cache.c
rename to libgit/read-cache.c
libgit/reflog-walk.c renamed from reflog-walk.c +0 -0
similarity index 100%
rename from reflog-walk.c
rename to libgit/reflog-walk.c
libgit/refs.c renamed from refs.c +0 -0
similarity index 100%
rename from refs.c
rename to libgit/refs.c
libgit/remote.c renamed from remote.c +0 -0
similarity index 100%
rename from remote.c
rename to libgit/remote.c
libgit/replace_object.c renamed from replace_object.c +0 -0
similarity index 100%
rename from replace_object.c
rename to libgit/replace_object.c
libgit/rerere.c renamed from rerere.c +0 -0
similarity index 100%
rename from rerere.c
rename to libgit/rerere.c
libgit/resolve-undo.c renamed from resolve-undo.c +0 -0
similarity index 100%
rename from resolve-undo.c
rename to libgit/resolve-undo.c
libgit/revision.c renamed from revision.c +0 -0
similarity index 100%
rename from revision.c
rename to libgit/revision.c
libgit/run-command.c renamed from run-command.c +0 -0
similarity index 100%
rename from run-command.c
rename to libgit/run-command.c
libgit/server-info.c renamed from server-info.c +0 -0
similarity index 100%
rename from server-info.c
rename to libgit/server-info.c
libgit/setup.c renamed from setup.c +0 -0
similarity index 100%
rename from setup.c
rename to libgit/setup.c
libgit/sha1-lookup.c renamed from sha1-lookup.c +0 -0
similarity index 100%
rename from sha1-lookup.c
rename to libgit/sha1-lookup.c
libgit/sha1_file.c renamed from sha1_file.c +0 -0
similarity index 100%
rename from sha1_file.c
rename to libgit/sha1_file.c
libgit/sha1_name.c renamed from sha1_name.c +0 -0
similarity index 100%
rename from sha1_name.c
rename to libgit/sha1_name.c
libgit/shallow.c renamed from shallow.c +0 -0
similarity index 100%
rename from shallow.c
rename to libgit/shallow.c
libgit/sideband.c renamed from sideband.c +0 -0
similarity index 100%
rename from sideband.c
rename to libgit/sideband.c
libgit/sigchain.c renamed from sigchain.c +0 -0
similarity index 100%
rename from sigchain.c
rename to libgit/sigchain.c
libgit/strbuf.c renamed from strbuf.c +0 -0
similarity index 100%
rename from strbuf.c
rename to libgit/strbuf.c
libgit/string-list.c renamed from string-list.c +0 -0
similarity index 100%
rename from string-list.c
rename to libgit/string-list.c
libgit/submodule.c renamed from submodule.c +0 -0
similarity index 100%
rename from submodule.c
rename to libgit/submodule.c
libgit/symlinks.c renamed from symlinks.c +0 -0
similarity index 100%
rename from symlinks.c
rename to libgit/symlinks.c
libgit/tag.c renamed from tag.c +0 -0
similarity index 100%
rename from tag.c
rename to libgit/tag.c
libgit/thread-utils.c renamed from thread-utils.c +0 -0
similarity index 100%
rename from thread-utils.c
rename to libgit/thread-utils.c
libgit/trace.c renamed from trace.c +0 -0
similarity index 100%
rename from trace.c
rename to libgit/trace.c
libgit/transport-helper.c renamed from transport-helper.c +0 -0
similarity index 100%
rename from transport-helper.c
rename to libgit/transport-helper.c
libgit/transport.c renamed from transport.c +0 -0
similarity index 100%
rename from transport.c
rename to libgit/transport.c
libgit/tree-diff.c renamed from tree-diff.c +0 -0
similarity index 100%
rename from tree-diff.c
rename to libgit/tree-diff.c
libgit/tree-walk.c renamed from tree-walk.c +0 -0
similarity index 100%
rename from tree-walk.c
rename to libgit/tree-walk.c
libgit/tree.c renamed from tree.c +0 -0
similarity index 100%
rename from tree.c
rename to libgit/tree.c
libgit/unpack-trees.c renamed from unpack-trees.c +0 -0
similarity index 100%
rename from unpack-trees.c
rename to libgit/unpack-trees.c
libgit/url.c renamed from url.c +0 -0
similarity index 100%
rename from url.c
rename to libgit/url.c
libgit/usage.c renamed from usage.c +0 -0
similarity index 100%
rename from usage.c
rename to libgit/usage.c
libgit/userdiff.c renamed from userdiff.c +0 -0
similarity index 100%
rename from userdiff.c
rename to libgit/userdiff.c
libgit/utf8.c renamed from utf8.c +0 -0
similarity index 100%
rename from utf8.c
rename to libgit/utf8.c
libgit/walker.c renamed from walker.c +0 -0
similarity index 100%
rename from walker.c
rename to libgit/walker.c
libgit/wrapper.c renamed from wrapper.c +0 -0
similarity index 100%
rename from wrapper.c
rename to libgit/wrapper.c
libgit/write_or_die.c renamed from write_or_die.c +0 -0
similarity index 100%
rename from write_or_die.c
rename to libgit/write_or_die.c
libgit/ws.c renamed from ws.c +0 -0
similarity index 100%
rename from ws.c
rename to libgit/ws.c
libgit/wt-status.c renamed from wt-status.c +0 -0
similarity index 100%
rename from wt-status.c
rename to libgit/wt-status.c
libgit/xdiff-interface.c renamed from xdiff-interface.c +0 -0
similarity index 100%
rename from xdiff-interface.c
rename to libgit/xdiff-interface.c
libgit/zlib.c renamed from zlib.c +0 -0
similarity index 100%
rename from zlib.c
rename to libgit/zlib.c
Signature · 1 line
1.7.4.1
#5 lore raw

Re: [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory

2011/2/18 Jonathan Nieder <[email protected]>:

Quoted 4 lines

Move sources for libgit.a to a libgit/ subdirectory.  This way, a person wanting to tackle the reusable part of git will know where to look, and those looking to work on individual commands know to look elsewhere.

You missed a few (on purpose?): block-sha1, ppc and compat.

libgit.a is produced at toplevel so I need a few more keystrokes to reach files inside libgit. Maybe move libgit.a to libgit too?

Quoted 2 lines

Perhaps some day the libgit/ subdirectory can be managed as an independent subproject (for example if it gets merged with libgit2).

With die() all over the place in libgit.a, I doubt it would become an independent project. Although this certainly makes it easier to reimplement libgit as a thin wrapper around libgit2.

Quoted 1 line
Signature · 1 line
Duy
#6 lore raw

Re: [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory

Quoted 8 lines · Nguyen Thai Ngoc Duy

2011/2/18 Jonathan Nieder <[email protected]>:

Quoted 4 lines

Move sources for libgit.a to a libgit/ subdirectory.  This way, a person wanting to tackle the reusable part of git will know where to look, and those looking to work on individual commands know to look elsewhere.

You missed a few (on purpose?): block-sha1, ppc and compat.

Yes, on purpose. They're separately reusable.

Quoted 2 lines

libgit.a is produced at toplevel so I need a few more keystrokes to reach files inside libgit. Maybe move libgit.a to libgit too?

Mm, good idea.

Quoted 3 lines

With die() all over the place in libgit.a, I doubt it would become an independent project. Although this certainly makes it easier to reimplement libgit as a thin wrapper around libgit2.

I think it's more realistic to replace functions in libgit one by one with reentrant versions.

Jonathan

-- 8< --
Subject: Rename libgit.a to libgit/lib.a

This makes the libgit files easier to reach through tab completion.

cgit uses "make -C git libgit.a" in its build process. Make sure that continues to work by installing a symlink libgit.a -> libgit/lib.a on request.

---
 Makefile                |    5 ++++-
 contrib/svn-fe/Makefile |    6 +++---
 2 files changed, 7 insertions(+), 4 deletions(-)
Makefile +4 -1
index b812c1e..3d701d2 100644
@@ -487,7 +487,7 @@ endif
 export PERL_PATH
 export PYTHON_PATH
 
-LIB_FILE=libgit.a
+LIB_FILE=libgit/lib.a
 XDIFF_LIB=xdiff/lib.a
 VCSSVN_LIB=vcs-svn/lib.a
 
@@ -2029,6 +2029,9 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(GITLIBS)
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
 
+libgit.a: $(LIB_FILE)
+	ln -sf $(LIB_FILE) $@
+
 $(XDIFF_LIB): $(XDIFF_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
 
contrib/svn-fe/Makefile +3 -3
index 360d8da..9dcad63 100644
@@ -10,7 +10,7 @@ ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
 EXTLIBS =
 
-GIT_LIB = ../../libgit.a
+GIT_LIB = ../../libgit/lib.a
 VCSSVN_LIB = ../../vcs-svn/lib.a
 LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(EXTLIBS)
 
@@ -54,8 +54,8 @@ svn-fe.1: svn-fe.txt
 ../../vcs-svn/lib.a: FORCE
 	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) vcs-svn/lib.a
 
-../../libgit.a: FORCE
-	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
+../../libgit/lib.a: FORCE
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit/lib.a
 
 clean:
 	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
Signature · 1 line
1.7.4.1
#7 lore raw

Re: [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory

Quoted 11 lines · Jonathan Nieder
Quoted 8 lines · Nguyen Thai Ngoc Duy

2011/2/18 Jonathan Nieder <[email protected]>:

Quoted 4 lines

Move sources for libgit.a to a libgit/ subdirectory.  This way, a person wanting to tackle the reusable part of git will know where to look, and those looking to work on individual commands know to look elsewhere.

You missed a few (on purpose?): block-sha1, ppc and compat.

Yes, on purpose. They're separately reusable.

I wonder if there should perhaps be lib/, with all of the libgit.a sources in it, and then lib/block-sha1, lib/ppc, lib/compat, etc. Those things do end up inside libgit.a, don't they?

-Peff

#8 lore raw

Re: [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory

Quoted 3 lines · Jeff King

I wonder if there should perhaps be lib/, with all of the libgit.a sources in it, and then lib/block-sha1, lib/ppc, lib/compat, etc. Those things do end up inside libgit.a, don't they?

Hmph. Let's see:

- our xdiff changes ought to move upstream so other projects can use them. That is, xdiff ought to be installable as a shared library. So maybe that can stay out of libgit/.

- block-sha1/ and ppc/ are just alternatives to openssl sha1, which can be installed as a system library. Maybe keeping block-sha1 out of libgit/ would provide an incentive to make block-sha1 usable as a system library for other projects to try out, too.

- most of compat/ is needed if Windows and old Unixen are to be able to build libgit/. So it probably should be part of libgit.

- compat/bswap.h is needed for libgit.

- compat/strlcpy.c is part of libbsd, so if such dependencies are ok it could stay out.

I really didn't want too many extra levels of hierarchy, so except for bswap.h I think this is okay for until libgit grows a Makefile. I might be overlooking some glibc-only functions, though.

#9 lore raw

Re: [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory

In reply to Jonathan Nieder

2011/2/18 Jonathan Nieder <[email protected]>:

Quoted 2 lines

Perhaps some day the libgit/ subdirectory can be managed as an independent subproject (for example if it gets merged with libgit2).

Another note. The boundary between libgit and "git" binary is not perfectly clear. For example transport.c can make fetch_pack() call, which resides in builtin/fetch-pack.c. But this is a good move anyway. We can gradually move all shared functionalities to libgit.

Signature · 1 line
Duy
#10 lore raw

PATCH 2/3 Move test-* into a test-programs/ subdirectory

In reply to Jonathan Nieder

Move the source to test programs such as test-sha1 to a subdirectory where they will distract people working on git proper.

The test programs themselves will still go to the top level when built, so experimenters do not have to hunt around for them.

---
 Makefile                                           |   15 +++++++++------
 test-chmtime.c => test-programs/test-chmtime.c     |    0
 [ etc etc ]
 .../test-string-pool.c                             |    0
 .../test-subprocess.c                              |    0
 test-svn-fe.c => test-programs/test-svn-fe.c       |    0
 test-treap.c => test-programs/test-treap.c         |    0
 21 files changed, 9 insertions(+), 6 deletions(-)
 rename test-chmtime.c => test-programs/test-chmtime.c (100%)
 [...]
 rename test-treap.c => test-programs/test-treap.c (100%)
Makefile +9 -6
index b812c1e..f458f65 100644
@@ -1830,7 +1830,7 @@ git.o git.spec \
 	$(patsubst %.perl,%,$(SCRIPT_PERL)) \
 	: GIT-VERSION-FILE
 
-TEST_OBJS := $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))
+TEST_OBJS := $(patsubst test-%$X,test-programs/test-%.o,$(TEST_PROGRAMS))
 GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
 	git.o
 ifndef NO_CURL
@@ -1840,8 +1840,11 @@ XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
 	xdiff/xmerge.o xdiff/xpatience.o
 VCSSVN_OBJS = vcs-svn/string_pool.o vcs-svn/line_buffer.o \
 	vcs-svn/repo_tree.o vcs-svn/fast_export.o vcs-svn/svndump.o
-VCSSVN_TEST_OBJS = test-obj-pool.o test-string-pool.o \
-	test-line-buffer.o test-treap.o
+VCSSVN_TEST_OBJS =
+VCSSVN_TEST_OBJS += test-programs/test-obj-pool.o
+VCSSVN_TEST_OBJS += test-programs/test-string-pool.o
+VCSSVN_TEST_OBJS += test-programs/test-line-buffer.o
+VCSSVN_TEST_OBJS += test-programs/test-treap.o
 OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS) $(VCSSVN_OBJS)
 
 dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
@@ -1970,7 +1973,7 @@ $(VCSSVN_OBJS) $(VCSSVN_TEST_OBJS): $(LIB_H) \
 	vcs-svn/line_buffer.h vcs-svn/repo_tree.h vcs-svn/fast_export.h \
 	vcs-svn/svndump.h
 
-test-svn-fe.o: vcs-svn/svndump.h
+test-programs/test-svn-fe.o: vcs-svn/svndump.h
 endif
 
 libgit/exec_cmd.s libgit/exec_cmd.o: EXTRA_CPPFLAGS = \
@@ -2142,7 +2145,7 @@ test-svn-fe$X: vcs-svn/lib.a
 
 .PRECIOUS: $(TEST_OBJS)
 
-test-%$X: test-%.o $(GITLIBS)
+test-%$X: test-programs/test-%.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
 
 check-sha1:: test-sha1$X
@@ -2321,7 +2324,7 @@ clean:
 	$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
 		libgit/*.o builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
-	$(RM) $(TEST_PROGRAMS)
+	$(RM) test-programs/*.o $(TEST_PROGRAMS)
 	$(RM) -r bin-wrappers
 	$(RM) -r $(dep_dirs)
 	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h $(ETAGS_TARGET) tags cscope*
test-programs/test-chmtime.c renamed from test-chmtime.c +0 -0
similarity index 100%
rename from test-chmtime.c
rename to test-programs/test-chmtime.c
test-programs/test-ctype.c renamed from test-ctype.c +0 -0
similarity index 100%
rename from test-ctype.c
rename to test-programs/test-ctype.c
test-programs/test-date.c renamed from test-date.c +0 -0
similarity index 100%
rename from test-date.c
rename to test-programs/test-date.c
test-programs/test-delta.c renamed from test-delta.c +0 -0
similarity index 100%
rename from test-delta.c
rename to test-programs/test-delta.c
test-programs/test-dump-cache-tree.c renamed from test-dump-cache-tree.c +0 -0
similarity index 100%
rename from test-dump-cache-tree.c
rename to test-programs/test-dump-cache-tree.c
test-programs/test-genrandom.c renamed from test-genrandom.c +0 -0
similarity index 100%
rename from test-genrandom.c
rename to test-programs/test-genrandom.c
test-programs/test-index-version.c renamed from test-index-version.c +0 -0
similarity index 100%
rename from test-index-version.c
rename to test-programs/test-index-version.c
test-programs/test-line-buffer.c renamed from test-line-buffer.c +0 -0
similarity index 100%
rename from test-line-buffer.c
rename to test-programs/test-line-buffer.c
test-programs/test-match-trees.c renamed from test-match-trees.c +0 -0
similarity index 100%
rename from test-match-trees.c
rename to test-programs/test-match-trees.c
test-programs/test-mktemp.c renamed from test-mktemp.c +0 -0
similarity index 100%
rename from test-mktemp.c
rename to test-programs/test-mktemp.c
test-programs/test-obj-pool.c renamed from test-obj-pool.c +0 -0
similarity index 100%
rename from test-obj-pool.c
rename to test-programs/test-obj-pool.c
test-programs/test-parse-options.c renamed from test-parse-options.c +0 -0
similarity index 100%
rename from test-parse-options.c
rename to test-programs/test-parse-options.c
test-programs/test-path-utils.c renamed from test-path-utils.c +0 -0
similarity index 100%
rename from test-path-utils.c
rename to test-programs/test-path-utils.c
test-programs/test-run-command.c renamed from test-run-command.c +0 -0
similarity index 100%
rename from test-run-command.c
rename to test-programs/test-run-command.c
test-programs/test-sha1.c renamed from test-sha1.c +0 -0
similarity index 100%
rename from test-sha1.c
rename to test-programs/test-sha1.c
test-programs/test-sigchain.c renamed from test-sigchain.c +0 -0
similarity index 100%
rename from test-sigchain.c
rename to test-programs/test-sigchain.c
test-programs/test-string-pool.c renamed from test-string-pool.c +0 -0
similarity index 100%
rename from test-string-pool.c
rename to test-programs/test-string-pool.c
test-programs/test-subprocess.c renamed from test-subprocess.c +0 -0
similarity index 100%
rename from test-subprocess.c
rename to test-programs/test-subprocess.c
test-programs/test-svn-fe.c renamed from test-svn-fe.c +0 -0
similarity index 100%
rename from test-svn-fe.c
rename to test-programs/test-svn-fe.c
test-programs/test-treap.c renamed from test-treap.c +0 -0
similarity index 100%
rename from test-treap.c
rename to test-programs/test-treap.c
Signature · 1 line
1.7.4.1
#11 lore raw

PATCH 3/3 Move header files into a include/ subdirectory

In reply to Jonathan Nieder

Move most of git's header files to an include/ subdirectory. This leaves us with 71 fewer files in the toplevel directory, making the high-level structure of the codebase a little easier to see.

Three headers stay behind, at least for now: git-compat-util.h, strbuf.h, and cache.h are referred to by some system-specific code (in compat/) using paths starting with "..". Making these three core headers especially visible doesn't seem like a bad idea, anyway.

---
 Makefile                                       |  146 ++++++++++++------------
 advice.h => include/advice.h                   |    0
 [ etc etc ]
 72 files changed, 73 insertions(+), 73 deletions(-)
Makefile +73 -73
index f458f65..1e96504 100644
@@ -333,7 +333,7 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
 # Those must not be GNU-specific; they are shared with perl/ which may
 # be built by a different compiler. (Note that this is an artifact now
 # but it still might be nice to keep that distinction.)
-BASIC_CFLAGS = -I.
+BASIC_CFLAGS = -I. -Iinclude
 BASIC_LDFLAGS =
 
 # Guard against environment variables
@@ -491,15 +491,15 @@ LIB_FILE=libgit.a
 XDIFF_LIB=xdiff/lib.a
 VCSSVN_LIB=vcs-svn/lib.a
 
-LIB_H += advice.h
-LIB_H += archive.h
-LIB_H += attr.h
-LIB_H += blob.h
-LIB_H += builtin.h
+LIB_H += include/advice.h
+LIB_H += include/archive.h
+LIB_H += include/attr.h
+LIB_H += include/blob.h
+LIB_H += include/builtin.h
 LIB_H += cache.h
-LIB_H += cache-tree.h
-LIB_H += color.h
-LIB_H += commit.h
+LIB_H += include/cache-tree.h
+LIB_H += include/color.h
+LIB_H += include/commit.h
 LIB_H += compat/bswap.h
 LIB_H += compat/cygwin.h
 LIB_H += compat/mingw.h
@@ -507,58 +507,58 @@ LIB_H += compat/win32/pthread.h
 LIB_H += compat/win32/syslog.h
 LIB_H += compat/win32/sys/poll.h
 LIB_H += compat/win32/dirent.h
-LIB_H += csum-file.h
-LIB_H += decorate.h
-LIB_H += delta.h
-LIB_H += diffcore.h
-LIB_H += diff.h
-LIB_H += dir.h
-LIB_H += exec_cmd.h
-LIB_H += fsck.h
+LIB_H += include/csum-file.h
+LIB_H += include/decorate.h
+LIB_H += include/delta.h
+LIB_H += include/diffcore.h
+LIB_H += include/diff.h
+LIB_H += include/dir.h
+LIB_H += include/exec_cmd.h
+LIB_H += include/fsck.h
 LIB_H += git-compat-util.h
-LIB_H += graph.h
-LIB_H += grep.h
-LIB_H += hash.h
-LIB_H += help.h
-LIB_H += levenshtein.h
-LIB_H += list-objects.h
-LIB_H += ll-merge.h
-LIB_H += log-tree.h
-LIB_H += mailmap.h
-LIB_H += merge-recursive.h
-LIB_H += notes.h
-LIB_H += notes-cache.h
-LIB_H += notes-merge.h
-LIB_H += object.h
-LIB_H += pack.h
-LIB_H += pack-refs.h
-LIB_H += pack-revindex.h
-LIB_H += parse-options.h
-LIB_H += patch-ids.h
-LIB_H += pkt-line.h
-LIB_H += progress.h
-LIB_H += quote.h
-LIB_H += reflog-walk.h
-LIB_H += refs.h
-LIB_H += remote.h
-LIB_H += rerere.h
-LIB_H += resolve-undo.h
-LIB_H += revision.h
-LIB_H += run-command.h
-LIB_H += sha1-lookup.h
-LIB_H += sideband.h
-LIB_H += sigchain.h
+LIB_H += include/graph.h
+LIB_H += include/grep.h
+LIB_H += include/hash.h
+LIB_H += include/help.h
+LIB_H += include/levenshtein.h
+LIB_H += include/list-objects.h
+LIB_H += include/ll-merge.h
+LIB_H += include/log-tree.h
+LIB_H += include/mailmap.h
+LIB_H += include/merge-recursive.h
+LIB_H += include/notes.h
+LIB_H += include/notes-cache.h
+LIB_H += include/notes-merge.h
+LIB_H += include/object.h
+LIB_H += include/pack.h
+LIB_H += include/pack-refs.h
+LIB_H += include/pack-revindex.h
+LIB_H += include/parse-options.h
+LIB_H += include/patch-ids.h
+LIB_H += include/pkt-line.h
+LIB_H += include/progress.h
+LIB_H += include/quote.h
+LIB_H += include/reflog-walk.h
+LIB_H += include/refs.h
+LIB_H += include/remote.h
+LIB_H += include/rerere.h
+LIB_H += include/resolve-undo.h
+LIB_H += include/revision.h
+LIB_H += include/run-command.h
+LIB_H += include/sha1-lookup.h
+LIB_H += include/sideband.h
+LIB_H += include/sigchain.h
 LIB_H += strbuf.h
-LIB_H += string-list.h
-LIB_H += submodule.h
-LIB_H += tag.h
-LIB_H += transport.h
-LIB_H += tree.h
-LIB_H += tree-walk.h
-LIB_H += unpack-trees.h
-LIB_H += userdiff.h
-LIB_H += utf8.h
-LIB_H += xdiff-interface.h
+LIB_H += include/string-list.h
+LIB_H += include/submodule.h
+LIB_H += include/tag.h
+LIB_H += include/transport.h
+LIB_H += include/tree.h
+LIB_H += include/tree-walk.h
+LIB_H += include/unpack-trees.h
+LIB_H += include/userdiff.h
+LIB_H += include/utf8.h
+LIB_H += include/xdiff-interface.h
 LIB_H += xdiff/xdiff.h
 
 LIB_OBJS += libgit/abspath.o
@@ -1949,20 +1949,20 @@ else
 # gcc detects!
 
 $(GIT_OBJS): $(LIB_H)
-builtin/branch.o builtin/checkout.o builtin/clone.o builtin/reset.o: branch.h
-libgit/branch.o libgit/transport.o: branch.h
-builtin/bundle.o libgit/bundle.o libgit/transport.o: bundle.h
-builtin/bisect--helper.o builtin/rev-list.o libgit/bisect.o: bisect.h
-builtin/clone.o builtin/fetch-pack.o libgit/transport.o: fetch-pack.h
-builtin/grep.o builtin/pack-objects.o libgit/transport-helper.o: thread-utils.h
-builtin/send-pack.o libgit/transport.o: send-pack.h
-builtin/log.o builtin/shortlog.o: shortlog.h
-builtin/prune.o builtin/reflog.o libgit/reachable.o: reachable.h
-builtin/commit.o builtin/revert.o libgit/wt-status.o: wt-status.h
-builtin/tar-tree.o libgit/archive-tar.o: tar.h
-libgit/connect.o libgit/transport.o http-backend.o: url.h
-http-fetch.o http-walker.o remote-curl.o libgit/transport.o libgit/walker.o: walker.h
-http.o http-walker.o http-push.o http-fetch.o remote-curl.o: http.h url.h
+builtin/branch.o builtin/checkout.o builtin/clone.o builtin/reset.o: include/branch.h
+libgit/branch.o libgit/transport.o: include/branch.h
+builtin/bundle.o libgit/bundle.o libgit/transport.o: include/bundle.h
+builtin/bisect--helper.o builtin/rev-list.o libgit/bisect.o: include/bisect.h
+builtin/clone.o builtin/fetch-pack.o libgit/transport.o: include/fetch-pack.h
+builtin/grep.o builtin/pack-objects.o libgit/transport-helper.o: include/thread-utils.h
+builtin/send-pack.o libgit/transport.o: include/send-pack.h
+builtin/log.o builtin/shortlog.o: include/shortlog.h
+builtin/prune.o builtin/reflog.o libgit/reachable.o: include/reachable.h
+builtin/commit.o builtin/revert.o libgit/wt-status.o: include/wt-status.h
+builtin/tar-tree.o libgit/archive-tar.o: include/tar.h
+libgit/connect.o libgit/transport.o http-backend.o: include/url.h
+http-fetch.o http-walker.o remote-curl.o libgit/transport.o libgit/walker.o: include/walker.h
+http.o http-walker.o http-push.o http-fetch.o remote-curl.o: include/http.h include/url.h
 
 libgit/xdiff-interface.o $(XDIFF_OBJS): \
 	xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
include/advice.h renamed from advice.h +0 -0
similarity index 100%
rename from advice.h
rename to include/advice.h
include/archive.h renamed from archive.h +0 -0
similarity index 100%
rename from archive.h
rename to include/archive.h
include/attr.h renamed from attr.h +0 -0
similarity index 100%
rename from attr.h
rename to include/attr.h
include/bisect.h renamed from bisect.h +0 -0
similarity index 100%
rename from bisect.h
rename to include/bisect.h
include/blob.h renamed from blob.h +0 -0
similarity index 100%
rename from blob.h
rename to include/blob.h
include/branch.h renamed from branch.h +0 -0
similarity index 100%
rename from branch.h
rename to include/branch.h
include/builtin.h renamed from builtin.h +0 -0
similarity index 100%
rename from builtin.h
rename to include/builtin.h
include/bundle.h renamed from bundle.h +0 -0
similarity index 100%
rename from bundle.h
rename to include/bundle.h
include/cache-tree.h renamed from cache-tree.h +0 -0
similarity index 100%
rename from cache-tree.h
rename to include/cache-tree.h
include/color.h renamed from color.h +0 -0
similarity index 100%
rename from color.h
rename to include/color.h
include/commit.h renamed from commit.h +0 -0
similarity index 100%
rename from commit.h
rename to include/commit.h
include/csum-file.h renamed from csum-file.h +0 -0
similarity index 100%
rename from csum-file.h
rename to include/csum-file.h
include/decorate.h renamed from decorate.h +0 -0
similarity index 100%
rename from decorate.h
rename to include/decorate.h
include/delta.h renamed from delta.h +0 -0
similarity index 100%
rename from delta.h
rename to include/delta.h
include/diff.h renamed from diff.h +0 -0
similarity index 100%
rename from diff.h
rename to include/diff.h
include/diffcore.h renamed from diffcore.h +0 -0
similarity index 100%
rename from diffcore.h
rename to include/diffcore.h
include/dir.h renamed from dir.h +0 -0
similarity index 100%
rename from dir.h
rename to include/dir.h
include/exec_cmd.h renamed from exec_cmd.h +0 -0
similarity index 100%
rename from exec_cmd.h
rename to include/exec_cmd.h
include/fetch-pack.h renamed from fetch-pack.h +0 -0
similarity index 100%
rename from fetch-pack.h
rename to include/fetch-pack.h
include/fsck.h renamed from fsck.h +0 -0
similarity index 100%
rename from fsck.h
rename to include/fsck.h
include/graph.h renamed from graph.h +0 -0
similarity index 100%
rename from graph.h
rename to include/graph.h
include/grep.h renamed from grep.h +0 -0
similarity index 100%
rename from grep.h
rename to include/grep.h
include/hash.h renamed from hash.h +0 -0
similarity index 100%
rename from hash.h
rename to include/hash.h
include/help.h renamed from help.h +0 -0
similarity index 100%
rename from help.h
rename to include/help.h
include/http.h renamed from http.h +0 -0
similarity index 100%
rename from http.h
rename to include/http.h
include/levenshtein.h renamed from levenshtein.h +0 -0
similarity index 100%
rename from levenshtein.h
rename to include/levenshtein.h
include/list-objects.h renamed from list-objects.h +0 -0
similarity index 100%
rename from list-objects.h
rename to include/list-objects.h
include/ll-merge.h renamed from ll-merge.h +0 -0
similarity index 100%
rename from ll-merge.h
rename to include/ll-merge.h
include/log-tree.h renamed from log-tree.h +0 -0
similarity index 100%
rename from log-tree.h
rename to include/log-tree.h
include/mailmap.h renamed from mailmap.h +0 -0
similarity index 100%
rename from mailmap.h
rename to include/mailmap.h
include/merge-recursive.h renamed from merge-recursive.h +0 -0
similarity index 100%
rename from merge-recursive.h
rename to include/merge-recursive.h
include/notes-cache.h renamed from notes-cache.h +0 -0
similarity index 100%
rename from notes-cache.h
rename to include/notes-cache.h
include/notes-merge.h renamed from notes-merge.h +0 -0
similarity index 100%
rename from notes-merge.h
rename to include/notes-merge.h
include/notes.h renamed from notes.h +0 -0
similarity index 100%
rename from notes.h
rename to include/notes.h
include/object.h renamed from object.h +0 -0
similarity index 100%
rename from object.h
rename to include/object.h
include/pack-refs.h renamed from pack-refs.h +0 -0
similarity index 100%
rename from pack-refs.h
rename to include/pack-refs.h
include/pack-revindex.h renamed from pack-revindex.h +0 -0
similarity index 100%
rename from pack-revindex.h
rename to include/pack-revindex.h
include/pack.h renamed from pack.h +0 -0
similarity index 100%
rename from pack.h
rename to include/pack.h
include/parse-options.h renamed from parse-options.h +0 -0
similarity index 100%
rename from parse-options.h
rename to include/parse-options.h
include/patch-ids.h renamed from patch-ids.h +0 -0
similarity index 100%
rename from patch-ids.h
rename to include/patch-ids.h
include/pkt-line.h renamed from pkt-line.h +0 -0
similarity index 100%
rename from pkt-line.h
rename to include/pkt-line.h
include/progress.h renamed from progress.h +0 -0
similarity index 100%
rename from progress.h
rename to include/progress.h
include/quote.h renamed from quote.h +0 -0
similarity index 100%
rename from quote.h
rename to include/quote.h
include/reachable.h renamed from reachable.h +0 -0
similarity index 100%
rename from reachable.h
rename to include/reachable.h
include/reflog-walk.h renamed from reflog-walk.h +0 -0
similarity index 100%
rename from reflog-walk.h
rename to include/reflog-walk.h
include/refs.h renamed from refs.h +0 -0
similarity index 100%
rename from refs.h
rename to include/refs.h
include/remote.h renamed from remote.h +0 -0
similarity index 100%
rename from remote.h
rename to include/remote.h
include/rerere.h renamed from rerere.h +0 -0
similarity index 100%
rename from rerere.h
rename to include/rerere.h
include/resolve-undo.h renamed from resolve-undo.h +0 -0
similarity index 100%
rename from resolve-undo.h
rename to include/resolve-undo.h
include/revision.h renamed from revision.h +0 -0
similarity index 100%
rename from revision.h
rename to include/revision.h
include/run-command.h renamed from run-command.h +0 -0
similarity index 100%
rename from run-command.h
rename to include/run-command.h
include/send-pack.h renamed from send-pack.h +0 -0
similarity index 100%
rename from send-pack.h
rename to include/send-pack.h
include/sha1-lookup.h renamed from sha1-lookup.h +0 -0
similarity index 100%
rename from sha1-lookup.h
rename to include/sha1-lookup.h
include/shortlog.h renamed from shortlog.h +0 -0
similarity index 100%
rename from shortlog.h
rename to include/shortlog.h
include/sideband.h renamed from sideband.h +0 -0
similarity index 100%
rename from sideband.h
rename to include/sideband.h
include/sigchain.h renamed from sigchain.h +0 -0
similarity index 100%
rename from sigchain.h
rename to include/sigchain.h
include/string-list.h renamed from string-list.h +0 -0
similarity index 100%
rename from string-list.h
rename to include/string-list.h
include/submodule.h renamed from submodule.h +0 -0
similarity index 100%
rename from submodule.h
rename to include/submodule.h
include/tag.h renamed from tag.h +0 -0
similarity index 100%
rename from tag.h
rename to include/tag.h
include/tar.h renamed from tar.h +0 -0
similarity index 100%
rename from tar.h
rename to include/tar.h
include/thread-utils.h renamed from thread-utils.h +0 -0
similarity index 100%
rename from thread-utils.h
rename to include/thread-utils.h
include/transport.h renamed from transport.h +0 -0
similarity index 100%
rename from transport.h
rename to include/transport.h
include/tree-walk.h renamed from tree-walk.h +0 -0
similarity index 100%
rename from tree-walk.h
rename to include/tree-walk.h
include/tree.h renamed from tree.h +0 -0
similarity index 100%
rename from tree.h
rename to include/tree.h
include/unpack-trees.h renamed from unpack-trees.h +0 -0
similarity index 100%
rename from unpack-trees.h
rename to include/unpack-trees.h
include/url.h renamed from url.h +0 -0
similarity index 100%
rename from url.h
rename to include/url.h
include/userdiff.h renamed from userdiff.h +0 -0
similarity index 100%
rename from userdiff.h
rename to include/userdiff.h
include/utf8.h renamed from utf8.h +0 -0
similarity index 100%
rename from utf8.h
rename to include/utf8.h
include/walker.h renamed from walker.h +0 -0
similarity index 100%
rename from walker.h
rename to include/walker.h
include/wt-status.h renamed from wt-status.h +0 -0
similarity index 100%
rename from wt-status.h
rename to include/wt-status.h
include/xdiff-interface.h renamed from xdiff-interface.h +0 -0
similarity index 100%
rename from xdiff-interface.h
rename to include/xdiff-interface.h
Signature · 1 line
1.7.4.1
#12 lore raw

Re: [PATCH 3/3] Move header files into a include/ subdirectory

2011/2/18 Jonathan Nieder <[email protected]>:

Quoted 9 lines

Move most of git's header files to an include/ subdirectory. This leaves us with 71 fewer files in the toplevel directory, making the high-level structure of the codebase a little easier to see.

Three headers stay behind, at least for now: git-compat-util.h, strbuf.h, and cache.h are referred to by some system-specific code (in compat/) using paths starting with "..".  Making these three core headers especially visible doesn't seem like a bad idea, anyway.

Perhaps it's time to split a large portion of cache.h to libgit.h and make cache.h include libgit.h.

cache.h and git-compat-util.h at topdir is ok to me. strbuf.h should go to libgit though, imo.

Quoted 1 line
Signature · 1 line
Duy
#13 lore raw

[RFC/PATCH 4 to 6/3] Move remaining header files into a include/ subdirectory

Quoted 2 lines · Nguyen Thai Ngoc Duy

Perhaps it's time to split a large portion of cache.h to libgit.h and make cache.h include libgit.h.

Interesting idea. Is this a sneaky way of renaming cache.h to git.h? Which translation units could include libgit.h without cache.h?

Quoted 2 lines

cache.h and git-compat-util.h at topdir is ok to me. strbuf.h should go to libgit though, imo.

If libgit is to be self-contained, they all should be in libgit. Not sure how I feel about that.

Here's a series to move those three headers to include/.

Jonathan Nieder (3):
compat: do not use relative paths for git-compat-util.h et al
block-sha1: do not use relative path for git-compat-util.h Move git-compat-util.h et al to include/

 Makefile                                       |    6 +++---
 block-sha1/sha1.c                              |    2 +-
 compat/basename.c                              |    2 +-
 compat/cygwin.c                                |    4 ++--
 compat/fopen.c                                 |    2 +-
 compat/inet_ntop.c                             |    2 +-
 compat/inet_pton.c                             |    2 +-
 compat/memmem.c                                |    2 +-
 compat/mingw.c                                 |    4 ++--
 compat/mkdtemp.c                               |    2 +-
 compat/mmap.c                                  |    2 +-
 compat/msvc.c                                  |    4 ++--
 compat/pread.c                                 |    2 +-
 compat/qsort.c                                 |    2 +-
 compat/setenv.c                                |    2 +-
 compat/snprintf.c                              |    2 +-
 compat/strcasestr.c                            |    2 +-
 compat/strlcpy.c                               |    2 +-
 compat/strtok_r.c                              |    2 +-
 compat/strtoumax.c                             |    2 +-
 compat/unsetenv.c                              |    2 +-
 compat/win32/dirent.c                          |    2 +-
 compat/win32/pthread.c                         |    2 +-
 compat/win32/syslog.c                          |    4 ++--
 compat/win32mmap.c                             |    2 +-
 compat/winansi.c                               |    2 +-
 cache.h => include/cache.h                     |    0
 git-compat-util.h => include/git-compat-util.h |    0
 strbuf.h => include/strbuf.h                   |    0
 29 files changed, 32 insertions(+), 32 deletions(-)
 rename cache.h => include/cache.h (100%)
 rename git-compat-util.h => include/git-compat-util.h (100%)
 rename strbuf.h => include/strbuf.h (100%)
Signature · 1 line
1.7.4.1
#14 lore raw

[PATCH 4/3] compat: do not use relative paths to refer to git-compat-util.h et al

Constructs like '#include "../cache.h"' referring to the toplevel of the git sources from a subdirectory make it hard to move files around. Luckily "cache.h" works from any directory because the Makefile supplies -I. in BASIC_CFLAGS explicitly.

---
 compat/basename.c      |    2 +-
 compat/cygwin.c        |    4 ++--
 compat/fopen.c         |    2 +-
 compat/inet_ntop.c     |    2 +-
 compat/inet_pton.c     |    2 +-
 compat/memmem.c        |    2 +-
 compat/mingw.c         |    4 ++--
 compat/mkdtemp.c       |    2 +-
 compat/mmap.c          |    2 +-
 compat/msvc.c          |    4 ++--
 compat/pread.c         |    2 +-
 compat/qsort.c         |    2 +-
 compat/setenv.c        |    2 +-
 compat/snprintf.c      |    2 +-
 compat/strcasestr.c    |    2 +-
 compat/strlcpy.c       |    2 +-
 compat/strtok_r.c      |    2 +-
 compat/strtoumax.c     |    2 +-
 compat/unsetenv.c      |    2 +-
 compat/win32/dirent.c  |    2 +-
 compat/win32/pthread.c |    2 +-
 compat/win32/syslog.c  |    4 ++--
 compat/win32mmap.c     |    2 +-
 compat/winansi.c       |    2 +-
 24 files changed, 28 insertions(+), 28 deletions(-)
compat/basename.c +1 -1
index d8f8a3c..4382378 100644
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /* Adapted from libiberty's basename.c.  */
 char *gitbasename (char *path)
compat/cygwin.c +2 -2
index b4a51b9..23c5138 100644
@@ -1,7 +1,7 @@
 #define WIN32_LEAN_AND_MEAN
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
+#include "cache.h" /* to read configuration */
 #include "win32.h"
-#include "../cache.h" /* to read configuration */
 
 static inline void filetime_to_timespec(const FILETIME *ft, struct timespec *ts)
 {
compat/fopen.c +1 -1
index b5ca142..e777c44 100644
@@ -9,7 +9,7 @@
  *  fopen after including git-compat-util.h is inadequate in this case.
  */
 #undef FREAD_READS_DIRECTORIES
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 FILE *git_fopen(const char *path, const char *mode)
 {
compat/inet_ntop.c +1 -1
index ea249c6..d2c2b48 100644
@@ -18,7 +18,7 @@
 #include <errno.h>
 #include <sys/types.h>
 
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 #include <stdio.h>
 #include <string.h>
compat/inet_pton.c +1 -1
index 2ec995e..8ff1d9d 100644
@@ -18,7 +18,7 @@
 #include <errno.h>
 #include <sys/types.h>
 
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 #include <stdio.h>
 #include <string.h>
compat/memmem.c +1 -1
index 56bcb42..2df3e7b 100644
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 void *gitmemmem(const void *haystack, size_t haystack_len,
                 const void *needle, size_t needle_len)
compat/mingw.c +2 -2
index bee6054..e43bba3 100644
@@ -1,7 +1,7 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
+#include "strbuf.h"
 #include "win32.h"
 #include <conio.h>
-#include "../strbuf.h"
 
 int err_win_to_posix(DWORD winerr)
 {
compat/mkdtemp.c +1 -1
index 1136119..4349e15 100644
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 char *gitmkdtemp(char *template)
 {
compat/mmap.c +1 -1
index c9d46d1..a62533e 100644
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
 {
compat/msvc.c +2 -2
index 71843d7..e55b546 100644
@@ -1,6 +1,6 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
+#include "strbuf.h"
 #include "win32.h"
 #include <conio.h>
-#include "../strbuf.h"
 
 #include "mingw.c"
compat/pread.c +1 -1
index 978cac4..429f7dd 100644
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 ssize_t git_pread(int fd, void *buf, size_t count, off_t offset)
 {
compat/qsort.c +1 -1
index d93dce2..a490959 100644
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /*
  * A merge sort implementation, simplified from the qsort implementation
compat/setenv.c +1 -1
index 3a22ea7..bf1016f 100644
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 int gitsetenv(const char *name, const char *value, int replace)
 {
compat/snprintf.c +1 -1
index e1e0e75..376eeff 100644
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /*
  * The size parameter specifies the available space, i.e. includes
compat/strcasestr.c +1 -1
index 26896de..d666093 100644
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 char *gitstrcasestr(const char *haystack, const char *needle)
 {
compat/strlcpy.c +1 -1
index 4024c36..780b39f 100644
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 size_t gitstrlcpy(char *dest, const char *src, size_t size)
 {
compat/strtok_r.c +1 -1
index 7b5d568..6eec7f8 100644
@@ -17,7 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /* Parse S into tokens separated by characters in DELIM.
    If S is NULL, the saved pointer in SAVE_PTR is used as
compat/strtoumax.c +1 -1
index 5541353..50fe26d 100644
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 uintmax_t gitstrtoumax (const char *nptr, char **endptr, int base)
 {
compat/unsetenv.c +1 -1
index eb29f5e..8f38d37 100644
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 void gitunsetenv (const char *name)
 {
compat/win32/dirent.c +1 -1
index 7a0debe..038188e 100644
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 #include "dirent.h"
 
 struct DIR {
compat/win32/pthread.c +1 -1
index 010e875..3b1f381 100644
@@ -7,7 +7,7 @@
  * no need for double-checking.
  */
 
-#include "../../git-compat-util.h"
+#include "git-compat-util.h"
 #include "pthread.h"
 
 #include <errno.h>
compat/win32/syslog.c +2 -2
index 42b95a9..9c4c8e2 100644
@@ -1,5 +1,5 @@
-#include "../../git-compat-util.h"
-#include "../../strbuf.h"
+#include "git-compat-util.h"
+#include "strbuf.h"
 
 static HANDLE ms_eventlog;
 
compat/win32mmap.c +1 -1
index b58aa69..756fe8a 100644
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
 {
compat/winansi.c +1 -1
index dedce21..82a5d9c 100644
@@ -2,7 +2,7 @@
  * Copyright 2008 Peter Harris <[email protected]>
  */
 
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /*
  Functions to be wrapped:
Signature · 1 line
1.7.4.1
#15 lore raw

[PATCH 5/3] block-sha1: do not use relative path for git-compat-util.h

In reply to Jonathan Nieder

Rely on the includepath instead of specifying a path to git-compat-util.h explicitly. This way, git-compat-util.h can move more easily.

---
 block-sha1/sha1.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
block-sha1/sha1.c +1 -1
index c0054a0..71464fa 100644
@@ -7,7 +7,7 @@
  */
 
 /* this is only to get definitions for memcpy(), ntohl() and htonl() */
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 #include "sha1.h"
 
Signature · 1 line
1.7.4.1
#16 lore raw

[PATCH 6/3] Move git-compat-util.h, strbuf.h, and cache.h to include/

In reply to Jonathan Nieder

Having one directory for all core headers except a few and another directory for the most important ones is too confusing.

---
 Makefile                                       |    6 +++---
 cache.h => include/cache.h                     |    0
 git-compat-util.h => include/git-compat-util.h |    0
 strbuf.h => include/strbuf.h                   |    0
 4 files changed, 3 insertions(+), 3 deletions(-)
 rename cache.h => include/cache.h (100%)
 rename git-compat-util.h => include/git-compat-util.h (100%)
 rename strbuf.h => include/strbuf.h (100%)
Makefile +3 -3
index 1e96504..9ce9ccd 100644
@@ -496,7 +496,7 @@ LIB_H += include/archive.h
 LIB_H += include/attr.h
 LIB_H += include/blob.h
 LIB_H += include/builtin.h
-LIB_H += cache.h
+LIB_H += include/cache.h
 LIB_H += include/cache-tree.h
 LIB_H += include/color.h
 LIB_H += include/commit.h
@@ -515,7 +515,7 @@ LIB_H += include/diff.h
 LIB_H += include/dir.h
 LIB_H += include/exec_cmd.h
 LIB_H += include/fsck.h
-LIB_H += git-compat-util.h
+LIB_H += include/git-compat-util.h
 LIB_H += include/graph.h
 LIB_H += include/grep.h
 LIB_H += include/hash.h
@@ -548,7 +548,7 @@ LIB_H += include/run-command.h
 LIB_H += include/sha1-lookup.h
 LIB_H += include/sideband.h
 LIB_H += include/sigchain.h
-LIB_H += strbuf.h
+LIB_H += include/strbuf.h
 LIB_H += include/string-list.h
 LIB_H += include/submodule.h
 LIB_H += include/tag.h
include/cache.h renamed from cache.h +0 -0
similarity index 100%
rename from cache.h
rename to include/cache.h
include/git-compat-util.h renamed from git-compat-util.h +0 -0
similarity index 100%
rename from git-compat-util.h
rename to include/git-compat-util.h
include/strbuf.h renamed from strbuf.h +0 -0
similarity index 100%
rename from strbuf.h
rename to include/strbuf.h
Signature · 1 line
1.7.4.1
#17 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

In reply to Jonathan Nieder

2011/2/18 Jonathan Nieder <[email protected]>:

Quoted 7 lines

Hi,

Quoted 3 lines · Nguyễn Thái Ngọc Duy

 .gitignore                                         |   19 ------------ Makefile                                           |   30 ++++++++++---------- t/helper/.gitignore                                |   19 ++++++++++++

Quoted 6 lines

[...]

Quoted 1 line
 24 files changed, 38 insertions(+), 38 deletions(-)

Here's a variation on the theme that just moves source and .o files (leaving questions about how to cope with breaking muscle memory for the resulting executables for later).  What do you think?

External commands are now more visible. Nice.

Signature · 1 line
Duy
#18 lore raw

[RFC/PATCH 7 - 9/3] Thinning the git toplevel directory

Quoted 1 line · Nguyen Thai Ngoc Duy

External commands are now more visible. Nice.

Here's a series to make them more visible, by putting them in a "nonbuiltin/" subdirectory. The name is a placeholder, of course.

Without a good name for the directory, this just makes things _harder_ to find, but maybe you can fix that.

Jonathan Nieder (3):
Move test-sha1.sh to test-programs/
Move build helpers to scripts/ subdirectory
Move non-builtin git commands and script libraries to a subdirectory

 Makefile                                           |  157 ++++++++++----------
 .../add--interactive.perl                          |    0
 git-am.sh => nonbuiltin/am.sh                      |    0
 git-archimport.perl => nonbuiltin/archimport.perl  |    0
 git-bisect.sh => nonbuiltin/bisect.sh              |    0
 check-racy.c => nonbuiltin/check-racy.c            |    0
 .../cvsexportcommit.perl                           |    0
 git-cvsimport.perl => nonbuiltin/cvsimport.perl    |    0
 git-cvsserver.perl => nonbuiltin/cvsserver.perl    |    0
 daemon.c => nonbuiltin/daemon.c                    |    0
 .../difftool--helper.sh                            |    0
 git-difftool.perl => nonbuiltin/difftool.perl      |    0
 fast-import.c => nonbuiltin/fast-import.c          |    0
 .../filter-branch.sh                               |    0
 http-backend.c => nonbuiltin/http-backend.c        |    0
 http-fetch.c => nonbuiltin/http-fetch.c            |    0
 http-push.c => nonbuiltin/http-push.c              |    0
 imap-send.c => nonbuiltin/imap-send.c              |    0
 git-instaweb.sh => nonbuiltin/instaweb.sh          |    0
 git-lost-found.sh => nonbuiltin/lost-found.sh      |    0
 .../merge-octopus.sh                               |    0
 .../merge-one-file.sh                              |    0
 .../merge-resolve.sh                               |    0
 .../mergetool--lib.sh                              |    0
 git-mergetool.sh => nonbuiltin/mergetool.sh        |    0
 git-parse-remote.sh => nonbuiltin/parse-remote.sh  |    0
 git-pull.sh => nonbuiltin/pull.sh                  |    0
 git-quiltimport.sh => nonbuiltin/quiltimport.sh    |    0
 .../rebase--interactive.sh                         |    0
 git-rebase.sh => nonbuiltin/rebase.sh              |    0
 git-relink.perl => nonbuiltin/relink.perl          |    0
 remote-curl.c => nonbuiltin/remote-curl.c          |    0
 .../remote-testgit.py                              |    0
 git-repack.sh => nonbuiltin/repack.sh              |    0
 git-request-pull.sh => nonbuiltin/request-pull.sh  |    0
 git-send-email.perl => nonbuiltin/send-email.perl  |    0
 git-sh-setup.sh => nonbuiltin/sh-setup.sh          |    0
 shell.c => nonbuiltin/shell.c                      |    0
 show-index.c => nonbuiltin/show-index.c            |    0
 git-stash.sh => nonbuiltin/stash.sh                |    0
 git-submodule.sh => nonbuiltin/submodule.sh        |    0
 git-svn.perl => nonbuiltin/svn.perl                |    0
 upload-pack.c => nonbuiltin/upload-pack.c          |    0
 git-web--browse.sh => nonbuiltin/web--browse.sh    |    0
 GIT-VERSION-GEN => scripts/GIT-VERSION-GEN         |    0
 check_bindir => scripts/check-bindir.sh            |    0
 check-builtins.sh => scripts/check-builtins.sh     |    0
 fixup-builtins => scripts/fixup-builtins.sh        |    0
 generate-cmdlist.sh => scripts/generate-cmdlist.sh |    0
 unimplemented.sh => scripts/unimplemented.sh       |    0
 wrap-for-bin.sh => scripts/wrap-for-bin.sh         |    0
 test-sha1.sh => test-programs/test-sha1.sh         |    0
 52 files changed, 80 insertions(+), 77 deletions(-)
 rename git-add--interactive.perl => nonbuiltin/add--interactive.perl (100%)
 rename git-am.sh => nonbuiltin/am.sh (100%)
 rename git-archimport.perl => nonbuiltin/archimport.perl (100%)
 rename git-bisect.sh => nonbuiltin/bisect.sh (100%)
 rename check-racy.c => nonbuiltin/check-racy.c (100%)
 rename git-cvsexportcommit.perl => nonbuiltin/cvsexportcommit.perl (100%)
 rename git-cvsimport.perl => nonbuiltin/cvsimport.perl (100%)
 rename git-cvsserver.perl => nonbuiltin/cvsserver.perl (100%)
 rename daemon.c => nonbuiltin/daemon.c (100%)
 rename git-difftool--helper.sh => nonbuiltin/difftool--helper.sh (100%)
 rename git-difftool.perl => nonbuiltin/difftool.perl (100%)
 rename fast-import.c => nonbuiltin/fast-import.c (100%)
 rename git-filter-branch.sh => nonbuiltin/filter-branch.sh (100%)
 rename http-backend.c => nonbuiltin/http-backend.c (100%)
 rename http-fetch.c => nonbuiltin/http-fetch.c (100%)
 rename http-push.c => nonbuiltin/http-push.c (100%)
 rename imap-send.c => nonbuiltin/imap-send.c (100%)
 rename git-instaweb.sh => nonbuiltin/instaweb.sh (100%)
 rename git-lost-found.sh => nonbuiltin/lost-found.sh (100%)
 rename git-merge-octopus.sh => nonbuiltin/merge-octopus.sh (100%)
 rename git-merge-one-file.sh => nonbuiltin/merge-one-file.sh (100%)
 rename git-merge-resolve.sh => nonbuiltin/merge-resolve.sh (100%)
 rename git-mergetool--lib.sh => nonbuiltin/mergetool--lib.sh (100%)
 rename git-mergetool.sh => nonbuiltin/mergetool.sh (100%)
 rename git-parse-remote.sh => nonbuiltin/parse-remote.sh (100%)
 rename git-pull.sh => nonbuiltin/pull.sh (100%)
 rename git-quiltimport.sh => nonbuiltin/quiltimport.sh (100%)
 rename git-rebase--interactive.sh => nonbuiltin/rebase--interactive.sh (100%)
 rename git-rebase.sh => nonbuiltin/rebase.sh (100%)
 rename git-relink.perl => nonbuiltin/relink.perl (100%)
 rename remote-curl.c => nonbuiltin/remote-curl.c (100%)
 rename git-remote-testgit.py => nonbuiltin/remote-testgit.py (100%)
 rename git-repack.sh => nonbuiltin/repack.sh (100%)
 rename git-request-pull.sh => nonbuiltin/request-pull.sh (100%)
 rename git-send-email.perl => nonbuiltin/send-email.perl (100%)
 rename git-sh-setup.sh => nonbuiltin/sh-setup.sh (100%)
 rename shell.c => nonbuiltin/shell.c (100%)
 rename show-index.c => nonbuiltin/show-index.c (100%)
 rename git-stash.sh => nonbuiltin/stash.sh (100%)
 rename git-submodule.sh => nonbuiltin/submodule.sh (100%)
 rename git-svn.perl => nonbuiltin/svn.perl (100%)
 rename upload-pack.c => nonbuiltin/upload-pack.c (100%)
 rename git-web--browse.sh => nonbuiltin/web--browse.sh (100%)
 rename GIT-VERSION-GEN => scripts/GIT-VERSION-GEN (100%)
 rename check_bindir => scripts/check-bindir.sh (100%)
 rename check-builtins.sh => scripts/check-builtins.sh (100%)
 rename fixup-builtins => scripts/fixup-builtins.sh (100%)
 rename generate-cmdlist.sh => scripts/generate-cmdlist.sh (100%)
 rename unimplemented.sh => scripts/unimplemented.sh (100%)
 rename wrap-for-bin.sh => scripts/wrap-for-bin.sh (100%)
 rename test-sha1.sh => test-programs/test-sha1.sh (100%)
#19 lore raw

[PATCH 7/3] Move test-sha1.sh to test-programs/

Probably it should go in t/ as a new test but I am lazy.

---
 Makefile                                   |    2 +-
 test-sha1.sh => test-programs/test-sha1.sh |    0
 2 files changed, 1 insertions(+), 1 deletions(-)
 rename test-sha1.sh => test-programs/test-sha1.sh (100%)
Makefile +1 -1
index 9ce9ccd..61981e5 100644
@@ -2149,7 +2149,7 @@ test-%$X: test-programs/test-%.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
 
 check-sha1:: test-sha1$X
-	./test-sha1.sh
+	test-programs/test-sha1.sh
 
 check: common-cmds.h
 	if sparse; \
test-programs/test-sha1.sh renamed from test-sha1.sh +0 -0
similarity index 100%
rename from test-sha1.sh
rename to test-programs/test-sha1.sh
Signature · 1 line
1.7.4.1
#20 lore raw

[PATCH 8/3] Move build helpers to scripts/ subdirectory

In reply to Jonathan Nieder

So the toplevel directory can be less cluttered and new build system hackers can know where to look to get acquainted with it.

While we're renaming things, make the names of these scripts follow a more consistent scheme (using dashes rather than underscores to separate words and including a .sh suffix).

---
I think I'd prefer to omit the .sh suffix for helpers like generate-cmdlist but this way follows the prevailing style.

 Makefile                                           |   22 ++++++++++----------
 GIT-VERSION-GEN => scripts/GIT-VERSION-GEN         |    0
 check_bindir => scripts/check-bindir.sh            |    0
 check-builtins.sh => scripts/check-builtins.sh     |    0
 fixup-builtins => scripts/fixup-builtins.sh        |    0
 generate-cmdlist.sh => scripts/generate-cmdlist.sh |    0
 unimplemented.sh => scripts/unimplemented.sh       |    0
 wrap-for-bin.sh => scripts/wrap-for-bin.sh         |    0
 8 files changed, 11 insertions(+), 11 deletions(-)
 rename GIT-VERSION-GEN => scripts/GIT-VERSION-GEN (100%)
 rename check_bindir => scripts/check-bindir.sh (100%)
 rename check-builtins.sh => scripts/check-builtins.sh (100%)
 rename fixup-builtins => scripts/fixup-builtins.sh (100%)
 rename generate-cmdlist.sh => scripts/generate-cmdlist.sh (100%)
 rename unimplemented.sh => scripts/unimplemented.sh (100%)
 rename wrap-for-bin.sh => scripts/wrap-for-bin.sh (100%)
Makefile +11 -11
index 61981e5..1c10e29 100644
@@ -244,7 +244,7 @@ all::
 # Define NATIVE_CRLF if your platform uses CRLF for line endings.
 
 GIT-VERSION-FILE: FORCE
-	@$(SHELL_PATH) ./GIT-VERSION-GEN
+	@$(SHELL_PATH) scripts/GIT-VERSION-GEN
 -include GIT-VERSION-FILE
 
 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
@@ -1697,10 +1697,10 @@ $(BUILT_INS): git$X
 	ln -s git$X $@ 2>/dev/null || \
 	cp git$X $@
 
-common-cmds.h: ./generate-cmdlist.sh command-list.txt
+common-cmds.h: scripts/generate-cmdlist.sh command-list.txt
 
 common-cmds.h: $(wildcard Documentation/git-*.txt)
-	$(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
+	$(QUIET_GEN)scripts/generate-cmdlist.sh > $@+ && mv $@+ $@
 
 define cmd_munge_script
 $(RM) $@ $@+ && \
@@ -1785,11 +1785,11 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/
 	chmod +x $@+ && \
 	mv $@+ $@
 else # NO_PERL
-$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh
+$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : scripts/unimplemented.sh
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 	    -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
-	    unimplemented.sh >$@+ && \
+	    $< >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
 endif # NO_PERL
@@ -1808,11 +1808,11 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py
 	chmod +x $@+ && \
 	mv $@+ $@
 else # NO_PYTHON
-$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : unimplemented.sh
+$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : scripts/unimplemented.sh
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 	    -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
-	    unimplemented.sh >$@+ && \
+	    $< >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
 endif # NO_PYTHON
@@ -2111,7 +2111,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
 
 all:: $(TEST_PROGRAMS) $(test_bindir_programs)
 
-bin-wrappers/%: wrap-for-bin.sh
+bin-wrappers/%: scripts/wrap-for-bin.sh
 	@mkdir -p bin-wrappers
 	$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 	     -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
@@ -2164,7 +2164,7 @@ check: common-cmds.h
 	fi
 
 remove-dashes:
-	./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS)
+	scripts/fixup-builtins.sh $(BUILT_INS) $(PROGRAMS) $(SCRIPTS)
 
 ### Installation rules
 
@@ -2236,7 +2236,7 @@ endif
 		ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
 		cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
 	done && \
-	./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
+	scripts/check-bindir.sh "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
 
 install-gitweb:
 	$(MAKE) -C gitweb install
@@ -2415,7 +2415,7 @@ check-docs::
 ### Make sure built-ins do not have dups and listed in git.c
 #
 check-builtins::
-	./check-builtins.sh
+	scripts/check-builtins.sh
 
 ### Test suite coverage testing
 #
scripts/GIT-VERSION-GEN renamed from GIT-VERSION-GEN +0 -0
similarity index 100%
rename from GIT-VERSION-GEN
rename to scripts/GIT-VERSION-GEN
scripts/check-bindir.sh renamed from check_bindir +0 -0
similarity index 100%
rename from check_bindir
rename to scripts/check-bindir.sh
scripts/check-builtins.sh renamed from check-builtins.sh +0 -0
similarity index 100%
rename from check-builtins.sh
rename to scripts/check-builtins.sh
scripts/fixup-builtins.sh renamed from fixup-builtins +0 -0
similarity index 100%
rename from fixup-builtins
rename to scripts/fixup-builtins.sh
scripts/generate-cmdlist.sh renamed from generate-cmdlist.sh +0 -0
similarity index 100%
rename from generate-cmdlist.sh
rename to scripts/generate-cmdlist.sh
scripts/unimplemented.sh renamed from unimplemented.sh +0 -0
similarity index 100%
rename from unimplemented.sh
rename to scripts/unimplemented.sh
scripts/wrap-for-bin.sh renamed from wrap-for-bin.sh +0 -0
similarity index 100%
rename from wrap-for-bin.sh
rename to scripts/wrap-for-bin.sh
Signature · 1 line
1.7.4.1
#21 lore raw

[PATCH 9/3] Move non-builtin git commands and script libraries to a subdirectory

In reply to Jonathan Nieder

Create a nonbuiltin/ directory for the standalone programs, scripts, and script libraries that are installed in gitexecdir and implement non-builtin git commands.

So now each file git-subcommand in /usr/libexec/git-core is a hard link to git, a copy of scripts/unimplemented.sh, or builtin from a file named nonbuiltin/subcommand.<something>, where <something> is c, sh, or perl.

---
The patch would probably be cleaner if

	BUILT_SCRIPT_SH := $(patsubst %.sh,%,$(SCRIPT_SH))

et al were factored out first.

 Makefile                                           |  137 ++++++++++----------
 [ ... and a bunch of renames ... ]
 44 files changed, 70 insertions(+), 67 deletions(-)
Makefile +70 -67
index 1c10e29..6f8a11c 100644
@@ -358,44 +358,44 @@ TEST_PROGRAMS_NEED_X =
 # interactive shell sessions without exporting it.
 unexport CDPATH
 
-SCRIPT_SH += git-am.sh
-SCRIPT_SH += git-bisect.sh
-SCRIPT_SH += git-difftool--helper.sh
-SCRIPT_SH += git-filter-branch.sh
-SCRIPT_SH += git-lost-found.sh
-SCRIPT_SH += git-merge-octopus.sh
-SCRIPT_SH += git-merge-one-file.sh
-SCRIPT_SH += git-merge-resolve.sh
-SCRIPT_SH += git-mergetool.sh
-SCRIPT_SH += git-pull.sh
-SCRIPT_SH += git-quiltimport.sh
-SCRIPT_SH += git-rebase--interactive.sh
-SCRIPT_SH += git-rebase.sh
-SCRIPT_SH += git-repack.sh
-SCRIPT_SH += git-request-pull.sh
-SCRIPT_SH += git-stash.sh
-SCRIPT_SH += git-submodule.sh
-SCRIPT_SH += git-web--browse.sh
+SCRIPT_SH += nonbuiltin/am.sh
+SCRIPT_SH += nonbuiltin/bisect.sh
+SCRIPT_SH += nonbuiltin/difftool--helper.sh
+SCRIPT_SH += nonbuiltin/filter-branch.sh
+SCRIPT_SH += nonbuiltin/lost-found.sh
+SCRIPT_SH += nonbuiltin/merge-octopus.sh
+SCRIPT_SH += nonbuiltin/merge-one-file.sh
+SCRIPT_SH += nonbuiltin/merge-resolve.sh
+SCRIPT_SH += nonbuiltin/mergetool.sh
+SCRIPT_SH += nonbuiltin/pull.sh
+SCRIPT_SH += nonbuiltin/quiltimport.sh
+SCRIPT_SH += nonbuiltin/rebase--interactive.sh
+SCRIPT_SH += nonbuiltin/rebase.sh
+SCRIPT_SH += nonbuiltin/repack.sh
+SCRIPT_SH += nonbuiltin/request-pull.sh
+SCRIPT_SH += nonbuiltin/stash.sh
+SCRIPT_SH += nonbuiltin/submodule.sh
+SCRIPT_SH += nonbuiltin/web--browse.sh
 
 SCRIPT_LIB += git-mergetool--lib
 SCRIPT_LIB += git-parse-remote
 SCRIPT_LIB += git-sh-setup
 
-SCRIPT_PERL += git-add--interactive.perl
-SCRIPT_PERL += git-difftool.perl
-SCRIPT_PERL += git-archimport.perl
-SCRIPT_PERL += git-cvsexportcommit.perl
-SCRIPT_PERL += git-cvsimport.perl
-SCRIPT_PERL += git-cvsserver.perl
-SCRIPT_PERL += git-relink.perl
-SCRIPT_PERL += git-send-email.perl
-SCRIPT_PERL += git-svn.perl
+SCRIPT_PERL += nonbuiltin/add--interactive.perl
+SCRIPT_PERL += nonbuiltin/difftool.perl
+SCRIPT_PERL += nonbuiltin/archimport.perl
+SCRIPT_PERL += nonbuiltin/cvsexportcommit.perl
+SCRIPT_PERL += nonbuiltin/cvsimport.perl
+SCRIPT_PERL += nonbuiltin/cvsserver.perl
+SCRIPT_PERL += nonbuiltin/relink.perl
+SCRIPT_PERL += nonbuiltin/send-email.perl
+SCRIPT_PERL += nonbuiltin/svn.perl
 
-SCRIPT_PYTHON += git-remote-testgit.py
+SCRIPT_PYTHON += nonbuiltin/remote-testgit.py
 
-SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
-	  $(patsubst %.perl,%,$(SCRIPT_PERL)) \
-	  $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
+SCRIPTS = $(patsubst nonbuiltin/%.sh,git-%,$(SCRIPT_SH)) \
+	  $(patsubst nonbuiltin/%.perl,git-%,$(SCRIPT_PERL)) \
+	  $(patsubst nonbuiltin/%.py,git-%,$(SCRIPT_PYTHON)) \
 	  git-instaweb
 
 ETAGS_TARGET = TAGS
@@ -406,15 +406,15 @@ EXTRA_PROGRAMS =
 # ... and all the rest that could be moved out of bindir to gitexecdir
 PROGRAMS += $(EXTRA_PROGRAMS)
 
-PROGRAM_OBJS += daemon.o
-PROGRAM_OBJS += fast-import.o
-PROGRAM_OBJS += imap-send.o
-PROGRAM_OBJS += shell.o
-PROGRAM_OBJS += show-index.o
-PROGRAM_OBJS += upload-pack.o
-PROGRAM_OBJS += http-backend.o
+PROGRAM_OBJS += nonbuiltin/daemon.o
+PROGRAM_OBJS += nonbuiltin/fast-import.o
+PROGRAM_OBJS += nonbuiltin/imap-send.o
+PROGRAM_OBJS += nonbuiltin/shell.o
+PROGRAM_OBJS += nonbuiltin/show-index.o
+PROGRAM_OBJS += nonbuiltin/upload-pack.o
+PROGRAM_OBJS += nonbuiltin/http-backend.o
 
-PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
+PROGRAMS += $(patsubst nonbuiltin/%.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_PROGRAMS_NEED_X += test-chmtime
 TEST_PROGRAMS_NEED_X += test-ctype
@@ -1267,12 +1267,12 @@ else
 	REMOTE_CURL_PRIMARY = git-remote-http$X
 	REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
 	REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
-	PROGRAM_OBJS += http-fetch.o
+	PROGRAM_OBJS += nonbuiltin/http-fetch.o
 	PROGRAMS += $(REMOTE_CURL_NAMES)
 	curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
 	ifeq "$(curl_check)" "070908"
 		ifndef NO_EXPAT
-			PROGRAM_OBJS += http-push.o
+			PROGRAM_OBJS += nonbuiltin/http-push.o
 		endif
 	endif
 	ifndef NO_EXPAT
@@ -1710,25 +1710,25 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
     -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
     -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
     -e $(BROKEN_PATH_FIX) \
-    [email protected] >$@+
+    $< >$@+
 endef
 
-$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
+$(patsubst nonbuiltin/%.sh,git-%,$(SCRIPT_SH)) : git-% : nonbuiltin/%.sh
 	$(QUIET_GEN)$(cmd_munge_script) && \
 	chmod +x $@+ && \
 	mv $@+ $@
 
-$(SCRIPT_LIB) : % : %.sh
+$(SCRIPT_LIB) : git-% : nonbuiltin/%.sh
 	$(QUIET_GEN)$(cmd_munge_script) && \
 	mv $@+ $@
 
 ifndef NO_PERL
-$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
+$(patsubst nonbuiltin/%.perl,git-%,$(SCRIPT_PERL)): perl/perl.mak
 
 perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL
 	$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
 
-$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
+$(patsubst nonbuiltin/%.perl,git-%,$(SCRIPT_PERL)): git-% : nonbuiltin/%.perl
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
 	sed -e '1{' \
@@ -1739,7 +1739,7 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
 	    -e '	x' \
 	    -e '}' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-	    [email protected] >$@+ && \
+	    $< >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
 
@@ -1774,18 +1774,18 @@ gitweb/static/gitweb.min.css: gitweb/static/gitweb.css
 endif # CSSMIN
 
 
-git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/static/gitweb.js
+git-instaweb: nonbuiltin/instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/static/gitweb.js
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
 	    -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
 	    -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
-	    [email protected] > $@+ && \
+	    $< >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
 else # NO_PERL
-$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : scripts/unimplemented.sh
+$(patsubst nonbuiltin/%.perl,git-%,$(SCRIPT_PERL)) git-instaweb: git-% : scripts/unimplemented.sh
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 	    -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
@@ -1795,8 +1795,8 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : scripts/unimplemented.sh
 endif # NO_PERL
 
 ifndef NO_PYTHON
-$(patsubst %.py,%,$(SCRIPT_PYTHON)): GIT-CFLAGS
-$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py
+$(patsubst nonbuiltin/%.py,git-%,$(SCRIPT_PYTHON)): GIT-CFLAGS
+$(patsubst nonbuiltin/%.py,git-%,$(SCRIPT_PYTHON)): git-% : nonbuiltin/%.py
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \
 		--no-print-directory prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' \
@@ -1804,11 +1804,11 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py
 	sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
 	    -e 's|\(os\.getenv("GITPYTHONLIB"\)[^)]*)|\1,"@@INSTLIBDIR@@")|' \
 	    -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
-	    [email protected] >$@+ && \
+	    $< >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
 else # NO_PYTHON
-$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : scripts/unimplemented.sh
+$(patsubst nonbuiltin/%.py,git-%,$(SCRIPT_PYTHON)): git-% : scripts/unimplemented.sh
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 	    -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
@@ -1826,15 +1826,15 @@ configure: configure.ac
 
 # These can record GIT_VERSION
 git.o git.spec \
-	$(patsubst %.sh,%,$(SCRIPT_SH)) \
-	$(patsubst %.perl,%,$(SCRIPT_PERL)) \
+	$(patsubst nonbuiltin/%.sh,git-%,$(SCRIPT_SH)) \
+	$(patsubst nonbuiltin/%.perl,git-%,$(SCRIPT_PERL)) \
 	: GIT-VERSION-FILE
 
 TEST_OBJS := $(patsubst test-%$X,test-programs/test-%.o,$(TEST_PROGRAMS))
 GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
 	git.o
 ifndef NO_CURL
-	GIT_OBJS += http.o http-walker.o remote-curl.o
+	GIT_OBJS += http.o http-walker.o nonbuiltin/remote-curl.o
 endif
 XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
 	xdiff/xmerge.o xdiff/xpatience.o
@@ -1960,9 +1960,11 @@ builtin/log.o builtin/shortlog.o: include/shortlog.h
 builtin/prune.o builtin/reflog.o libgit/reachable.o: include/reachable.h
 builtin/commit.o builtin/revert.o libgit/wt-status.o: include/wt-status.h
 builtin/tar-tree.o libgit/archive-tar.o: include/tar.h
-libgit/connect.o libgit/transport.o http-backend.o: include/url.h
-http-fetch.o http-walker.o remote-curl.o libgit/transport.o libgit/walker.o: include/walker.h
-http.o http-walker.o http-push.o http-fetch.o remote-curl.o: include/http.h include/url.h
+libgit/connect.o libgit/transport.o nonbuiltin/http-backend.o: include/url.h
+nonbuiltin/http-fetch.o nonbuiltin/remote-curl.o http-walker.o: include/walker.h
+libgit/transport.o libgit/walker.o: include/walker.h
+nonbuiltin/http-push.o nonbuiltin/http-fetch.o: include/http.h include/url.h
+nonbuiltin/remote-curl.o http.o http-walker.o: include/http.h include/url.h
 
 libgit/xdiff-interface.o $(XDIFF_OBJS): \
 	xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
@@ -2005,17 +2007,17 @@ compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
 	-DNDEBUG -DOVERRIDE_STRDUP -DREPLACE_SYSTEM_ALLOCATOR
 endif
 
-git-%$X: %.o $(GITLIBS)
+git-%$X: nonbuiltin/%.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
 
-git-imap-send$X: imap-send.o $(GITLIBS)
+git-imap-send$X: nonbuiltin/imap-send.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
 
-git-http-fetch$X: libgit/revision.o http.o http-walker.o http-fetch.o $(GITLIBS)
+git-http-fetch$X: libgit/revision.o http.o http-walker.o nonbuiltin/http-fetch.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL)
-git-http-push$X: libgit/revision.o http.o http-push.o $(GITLIBS)
+git-http-push$X: libgit/revision.o http.o nonbuiltin/http-push.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
 
@@ -2025,7 +2027,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
 	ln -s $< $@ 2>/dev/null || \
 	cp $< $@
 
-$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(GITLIBS)
+$(REMOTE_CURL_PRIMARY): nonbuiltin/remote-curl.o http.o http-walker.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
 
@@ -2321,8 +2323,9 @@ distclean: clean
 	$(RM) configure
 
 clean:
-	$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
-		libgit/*.o builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
+	$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o
+	$(RM) libgit/*.o builtin/*.o nonbuiltin/*.o
+	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
 	$(RM) test-programs/*.o $(TEST_PROGRAMS)
 	$(RM) -r bin-wrappers
nonbuiltin/add--interactive.perl renamed from git-add--interactive.perl +0 -0
similarity index 100%
rename from git-add--interactive.perl
rename to nonbuiltin/add--interactive.perl
nonbuiltin/am.sh renamed from git-am.sh +0 -0
similarity index 100%
rename from git-am.sh
rename to nonbuiltin/am.sh
nonbuiltin/archimport.perl renamed from git-archimport.perl +0 -0
similarity index 100%
rename from git-archimport.perl
rename to nonbuiltin/archimport.perl
nonbuiltin/bisect.sh renamed from git-bisect.sh +0 -0
similarity index 100%
rename from git-bisect.sh
rename to nonbuiltin/bisect.sh
nonbuiltin/check-racy.c renamed from check-racy.c +0 -0
similarity index 100%
rename from check-racy.c
rename to nonbuiltin/check-racy.c
nonbuiltin/cvsexportcommit.perl renamed from git-cvsexportcommit.perl +0 -0
similarity index 100%
rename from git-cvsexportcommit.perl
rename to nonbuiltin/cvsexportcommit.perl
nonbuiltin/cvsimport.perl renamed from git-cvsimport.perl +0 -0
similarity index 100%
rename from git-cvsimport.perl
rename to nonbuiltin/cvsimport.perl
nonbuiltin/cvsserver.perl renamed from git-cvsserver.perl +0 -0
similarity index 100%
rename from git-cvsserver.perl
rename to nonbuiltin/cvsserver.perl
nonbuiltin/daemon.c renamed from daemon.c +0 -0
similarity index 100%
rename from daemon.c
rename to nonbuiltin/daemon.c
nonbuiltin/difftool--helper.sh renamed from git-difftool--helper.sh +0 -0
similarity index 100%
rename from git-difftool--helper.sh
rename to nonbuiltin/difftool--helper.sh
nonbuiltin/difftool.perl renamed from git-difftool.perl +0 -0
similarity index 100%
rename from git-difftool.perl
rename to nonbuiltin/difftool.perl
nonbuiltin/fast-import.c renamed from fast-import.c +0 -0
similarity index 100%
rename from fast-import.c
rename to nonbuiltin/fast-import.c
nonbuiltin/filter-branch.sh renamed from git-filter-branch.sh +0 -0
similarity index 100%
rename from git-filter-branch.sh
rename to nonbuiltin/filter-branch.sh
nonbuiltin/http-backend.c renamed from http-backend.c +0 -0
similarity index 100%
rename from http-backend.c
rename to nonbuiltin/http-backend.c
nonbuiltin/http-fetch.c renamed from http-fetch.c +0 -0
similarity index 100%
rename from http-fetch.c
rename to nonbuiltin/http-fetch.c
nonbuiltin/http-push.c renamed from http-push.c +0 -0
similarity index 100%
rename from http-push.c
rename to nonbuiltin/http-push.c
nonbuiltin/imap-send.c renamed from imap-send.c +0 -0
similarity index 100%
rename from imap-send.c
rename to nonbuiltin/imap-send.c
nonbuiltin/instaweb.sh renamed from git-instaweb.sh +0 -0
similarity index 100%
rename from git-instaweb.sh
rename to nonbuiltin/instaweb.sh
nonbuiltin/lost-found.sh renamed from git-lost-found.sh +0 -0
similarity index 100%
rename from git-lost-found.sh
rename to nonbuiltin/lost-found.sh
nonbuiltin/merge-octopus.sh renamed from git-merge-octopus.sh +0 -0
similarity index 100%
rename from git-merge-octopus.sh
rename to nonbuiltin/merge-octopus.sh
nonbuiltin/merge-one-file.sh renamed from git-merge-one-file.sh +0 -0
similarity index 100%
rename from git-merge-one-file.sh
rename to nonbuiltin/merge-one-file.sh
nonbuiltin/merge-resolve.sh renamed from git-merge-resolve.sh +0 -0
similarity index 100%
rename from git-merge-resolve.sh
rename to nonbuiltin/merge-resolve.sh
nonbuiltin/mergetool--lib.sh renamed from git-mergetool--lib.sh +0 -0
similarity index 100%
rename from git-mergetool--lib.sh
rename to nonbuiltin/mergetool--lib.sh
nonbuiltin/mergetool.sh renamed from git-mergetool.sh +0 -0
similarity index 100%
rename from git-mergetool.sh
rename to nonbuiltin/mergetool.sh
nonbuiltin/parse-remote.sh renamed from git-parse-remote.sh +0 -0
similarity index 100%
rename from git-parse-remote.sh
rename to nonbuiltin/parse-remote.sh
nonbuiltin/pull.sh renamed from git-pull.sh +0 -0
similarity index 100%
rename from git-pull.sh
rename to nonbuiltin/pull.sh
nonbuiltin/quiltimport.sh renamed from git-quiltimport.sh +0 -0
similarity index 100%
rename from git-quiltimport.sh
rename to nonbuiltin/quiltimport.sh
nonbuiltin/rebase--interactive.sh renamed from git-rebase--interactive.sh +0 -0
similarity index 100%
rename from git-rebase--interactive.sh
rename to nonbuiltin/rebase--interactive.sh
nonbuiltin/rebase.sh renamed from git-rebase.sh +0 -0
similarity index 100%
rename from git-rebase.sh
rename to nonbuiltin/rebase.sh
nonbuiltin/relink.perl renamed from git-relink.perl +0 -0
similarity index 100%
rename from git-relink.perl
rename to nonbuiltin/relink.perl
nonbuiltin/remote-curl.c renamed from remote-curl.c +0 -0
similarity index 100%
rename from remote-curl.c
rename to nonbuiltin/remote-curl.c
nonbuiltin/remote-testgit.py renamed from git-remote-testgit.py +0 -0
similarity index 100%
rename from git-remote-testgit.py
rename to nonbuiltin/remote-testgit.py
nonbuiltin/repack.sh renamed from git-repack.sh +0 -0
similarity index 100%
rename from git-repack.sh
rename to nonbuiltin/repack.sh
nonbuiltin/request-pull.sh renamed from git-request-pull.sh +0 -0
similarity index 100%
rename from git-request-pull.sh
rename to nonbuiltin/request-pull.sh
nonbuiltin/send-email.perl renamed from git-send-email.perl +0 -0
similarity index 100%
rename from git-send-email.perl
rename to nonbuiltin/send-email.perl
nonbuiltin/sh-setup.sh renamed from git-sh-setup.sh +0 -0
similarity index 100%
rename from git-sh-setup.sh
rename to nonbuiltin/sh-setup.sh
nonbuiltin/shell.c renamed from shell.c +0 -0
similarity index 100%
rename from shell.c
rename to nonbuiltin/shell.c
nonbuiltin/show-index.c renamed from show-index.c +0 -0
similarity index 100%
rename from show-index.c
rename to nonbuiltin/show-index.c
nonbuiltin/stash.sh renamed from git-stash.sh +0 -0
similarity index 100%
rename from git-stash.sh
rename to nonbuiltin/stash.sh
nonbuiltin/submodule.sh renamed from git-submodule.sh +0 -0
similarity index 100%
rename from git-submodule.sh
rename to nonbuiltin/submodule.sh
nonbuiltin/svn.perl renamed from git-svn.perl +0 -0
similarity index 100%
rename from git-svn.perl
rename to nonbuiltin/svn.perl
nonbuiltin/upload-pack.c renamed from upload-pack.c +0 -0
similarity index 100%
rename from upload-pack.c
rename to nonbuiltin/upload-pack.c
nonbuiltin/web--browse.sh renamed from git-web--browse.sh +0 -0
similarity index 100%
rename from git-web--browse.sh
rename to nonbuiltin/web--browse.sh
Signature · 1 line
1.7.4.1
#22 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

In reply to Nguyen Thai Ngoc Duy
Quoted 7 lines · Nguyen Thai Ngoc Duy

2011/2/18 Jonathan Nieder <[email protected]>:

Quoted 3 lines

Here's a variation on the theme that just moves source and .o files (leaving questions about how to cope with breaking muscle memory for the resulting executables for later).  What do you think?

External commands are now more visible. Nice.

Thanks again for both of your help. I've put up an updated series at

git://repo.or.cz/git/jrn.git flatten-source

Changes since the series sent to the list:

- put headers in libgit/ with the source files. I don't know what I was thinking before.

- renamed nonbuiltin/ to commands/. Names like commands/add--interactive.perl even seem to make a kind of sense.

- moved the http support mini-library to http/.

- renamed git_remote_helpers to python/, though I'm not very happy about that.

This is all very off-the-cuff. I'd be happy for others to pick this up and remold it to their taste (after all, I'm too used to the current layout to remember what matters). It doesn't feel cooked yet.

#23 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Quoted 3 lines · Jonathan Nieder

Thanks again for both of your help. I've put up an updated series at

git://repo.or.cz/git/jrn.git flatten-source

s/flatten/un&/

Quoted 4 lines

Changes since the series sent to the list:

- put headers in libgit/ with the source files. I don't know what I was thinking before.

That is much nicer, I think.

Quoted 2 lines

- renamed nonbuiltin/ to commands/. Names like commands/add--interactive.perl even seem to make a kind of sense.

Definitely a better name.

Quoted 1 line

- moved the http support mini-library to http/.

Seems like a weird one-off to me, as it only has two files.

Quoted 2 lines

- renamed git_remote_helpers to python/, though I'm not very happy about that.

I think this has been discussed a couple of times, and there was some confusion about what the directory means. It is "this is a python library called git_remote_helpers". It is not "this is generic python code for git", nor is it "this is generic remote helper code". So I think python/git_remote_helpers would probably be a more appropriate name in case we ever grow more python code.

Quoted 3 lines

This is all very off-the-cuff. I'd be happy for others to pick this up and remold it to their taste (after all, I'm too used to the current layout to remember what matters). It doesn't feel cooked yet.

Two overall comments that are vague and you can feel free to ignore:

1. I was one of the initial complainers of a source reorganization. But my complaint was mainly "let's only do it if there is some real benefit". Unlike simply shoving everything most of what's in the top-level into a src/ directory, I think this is shaping up to be a real reorganization, and the structure is easier to look at.

2. I found it most instructive to actually checkout the result and look at the organization from a new user perspective. Here are my impressions:

- There are a still a lot of directories. I wonder if we should be going deeper. Like commands/builtin. Or lib/*.

- Some names seem funny. Like "gitk-git", which really should just be "gitk". But I think that is a limitation of the subtree merge. Maybe it's time for us to eat our own submodules dogfood? :)

- Before build, "ls | wc -l" reports 35 entries. Afterwards, it reports 213, and any structure you uncovered in reorganization is lost. Maybe that doesn't matter, since the clean tree is what people will see first when they are getting their bearings. Or maybe not, since maybe they build first, then hack. I dunno. I'm not sure what the solution is. There are some obvious things, like throwing the test-* built executables into test-programs (which will require some magic in test-lib.sh to find them). Maybe git-* should stay in commands. I dunno.

-Peff

#24 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Quoted 5 lines · Jeff King
Quoted 1 line · Jonathan Nieder

- moved the http support mini-library to http/.

Seems like a weird one-off to me, as it only has two files.

That was just to get the files out of the toplevel. I suspect the reason they are not part of libgit is to isolate the expat and curl linkage.

Hmm, maybe an http/README explaining that would be nice.

Quoted 3 lines

So I
think python/git_remote_helpers would probably be a more appropriate name in case we ever grow more python code.

Good idea. So the layout would be:

python/

	Makefile
	git_remote_helpers/
		...
Quoted 2 lines

- There are a still a lot of directories. I wonder if we should be going deeper. Like commands/builtin. Or lib/*.

For reference:

Documentation/
block-sha1/ fast, portable sha1 routine

 builtin/   	built-in (busybox style) commands
 commands/  	stand-alone commands
 compat/    	compatibility replacements, platform-specific code
 contrib/   	contributed software
 gitk-git/  	gitk
 gitweb/    	web interface
 git-gui/   	gui
 http/      	code for use in HTTP support commands (wraps curl and expat)
 libgit/    	code for use in multiple commands
 perl/      	Git.pm
 ppc/       	fast sha1 routine in powerpc assembler
 python/    	python-fastimport + a remote-helper protocol helper
 scripts/   	build scripts
 t/         	tests

templates/ repository skeleton
test-programs/ sample programs to exercise libgit, vcs-svn, and the sha1 lib
xdiff/ diff generator
vcs-svn/ svn interop

To give an extreme example :), this could be pruned to

Documentation/
commands/
contrib/
libgit/
scripts/
templates/
testsuite/
xdiff/

by

- not distinguishing builtins from non-builtins by filename
- dropping gitk, git gui, and gitweb from the tree
- moving test programs into the testsuite
- moving sha1 implementations and compatibility code under libgit
- including http support files in libgit/ even though they are not part of libgit.a
- moving perl and python libraries under libgit

Quoted 2 lines

- Some names seem funny. Like "gitk-git", which really should just be "gitk".

I think it was originally to make the transition from file to directory smoother.

Quoted 2 lines

But I think that is a limitation of the subtree
merge.

Should work fine, no? Since / in common ancestor matches gitk/ in HEAD, that would be the detected shift. (Caveat: I haven't tried it.)

Quoted 3 lines

- Before build, "ls | wc -l" reports 35 entries. Afterwards, it reports 213, and any structure you uncovered in reorganization is lost.

I think the best way to fix this is to provide support[1] for

make O=build/

for those who want to maintain a clean source tree.

Thanks for some good ideas.
Jonathan

[1] There's a skeleton of such support here:
http://thread.gmane.org/gmane.comp.version-control.git/165720/focus=165850
I don't think I'm the right one to take it further, though, since I don't really like to use "make O=elsewhere".

#25 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

In reply to Jonathan Nieder
Quoted 4 lines · Jonathan Nieder

Changes since the series sent to the list:
...
 - renamed nonbuiltin/ to commands/.  Names like commands/add--interactive.perl even seem to make a kind of sense.

I suggest cmds/ to avoid tab-completion conflict with compat.

Quoted 1 line

 - moved the http support mini-library to http/.

Move them to commands/ as well?

Quoted 2 lines

 - renamed git_remote_helpers to python/, though I'm not very happy about that.

It don't like having "perl" and "python" directories (makes me thing what if another language appears). If they are just bindings (python dir may not be), how about "bindings" directory and throw them all flat in there?

Quoted 3 lines

This is all very off-the-cuff.  I'd be happy for others to pick this up and remold it to their taste (after all, I'm too used to the current layout to remember what matters).  It doesn't feel cooked yet.

A few more things:

- I like the fact that you leave only git.c in topdir. Straight entry
point for newcomers.
- On the same topic of newcomers, should we pull
Documentation/technical out to topdir? A symlink is OK.
- test-programs should be still in t/ though. I'm not an advocate for
deep layout, but it makes sense to me to keep test programs close to test scripts.
- perhaps we can merge block-sha1 and ppc into one? We can rename
ppc/sha1.* to sha1/ppc-sha1.*
- I agree with Jeff that generated files should stay in the same
place with source files. Although I tend to use "git ls", untracked files do not bother me much ;-)

Signature · 1 line
Duy
#26 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

In reply to Jonathan Nieder

W dniu 18.02.2011 10:25, Jonathan Nieder pisze:

Quoted 3 lines

Thanks again for both of your help. I've put up an updated series at

git://repo.or.cz/git/jrn.git flatten-source

Thanks, I like the idea of cleaning the working tree.

I'm not really happy with current layout. In general it is hard to find anything. Usually I can do "grep term category". In this case it's not possible because there are no categories. Sources, tests, build scripts, objects, user and tech docs are all mixed with each other and placed in (almost) random locations.

My suggestions - put each category in their own dir/name space:

- sources - developer related files you can hack

- technical/developer documentation like format descriptions, coding guidelines etc.

- end user documentation like command documentation, howtos, faqs etc

- build result - objects, final binaries, generated documentation etc The advantage besides unclutterting is possibility to have sources on read-only medium.

- test sources, probably with test scripts

- build scripts where possible, for example cat-texi.perl, install-doc-quick.sh etc

- leave important documentation in top level:
* "readme" - introduction/index of repository
* "install" - installation instructions,
* "news" - what's new in this release
* license etc

The categories may be split into more subdirs if needed. Some other top directories are of course also needed.

Quoted 4 lines

Changes since the series sent to the list:

- put headers in libgit/ with the source files. I don't know what I was thinking before.

I'd either keep all headers with sources, or put all headers in a separate directory structure.

As for other changes in jrn.git:

- no need for git.c in top dir - if one wants to hack git then git.c is not enough, and the other people don't need it.

- using links is not portable, not all file systems support them (the RelNotes link)

Just my .02c

Signature · 1 line
Piotr Krukowiecki
#27 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Quoted 8 lines · Piotr Krukowiecki

My suggestions - put each category in their own dir/name space:

- sources - developer related files you can hack

- technical/developer documentation like format descriptions, coding guidelines etc.

- end user documentation like command documentation, howtos, faqs etc

Mild nak. We are talking about a source tree; there is no end-user documentation. Only the sources to it.

Quoted 3 lines

- build result - objects, final binaries, generated documentation etc The advantage besides unclutterting is possibility to have sources on read-only medium.

This is somewhere between a meh to mild nak. "git grep" knows to ignore untracked cruft, so this does not help nor hinder "finding" at all. Even though I personally tend to value seeing frotz.o sitting immediately next to frotz.c, some people may value read-only source tree more than that.

#28 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Quoted 10 lines · Junio C Hamano
Quoted 3 lines · Piotr Krukowiecki

- build result - objects, final binaries, generated documentation etc The advantage besides unclutterting is possibility to have sources on read-only medium.

This is somewhere between a meh to mild nak. "git grep" knows to ignore untracked cruft, so this does not help nor hinder "finding" at all. Even though I personally tend to value seeing frotz.o sitting immediately next to frotz.c, some people may value read-only source tree more than that.

At the risk of becoming repetitive: it is quite possible for make to take an O=elsewhere/ parameter to support both types.

I am also in the camp of preferring to see frotz.o next to frotz.c. After editing frotz.c, I can do "make frotz.o" to make sure it still compiles.

#29 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

W dniu 19.02.2011 01:50, Jonathan Nieder pisze:

Quoted 2 lines

At the risk of becoming repetitive: it is quite possible for make to take an O=elsewhere/ parameter to support both types.

I'm ok with O=elsewhere

Quoted 3 lines

I am also in the camp of preferring to see frotz.o next to frotz.c. After editing frotz.c, I can do "make frotz.o" to make sure it still compiles.

"make frotz.o" has nothing to do with where the objects are generated, IMO.

Is this the only reason you prefer having objects with sources?

Signature · 1 line
Piotr Krukowiecki
#30 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

In reply to Junio C Hamano
Quoted 6 lines · Junio C Hamano
Quoted 4 lines · Piotr Krukowiecki

My suggestions - put each category in their own dir/name space:

- sources - developer related files you can hack

Quoted 7 lines
Quoted 4 lines

- technical/developer documentation like format descriptions, coding guidelines etc.

- end user documentation like command documentation, howtos, faqs etc

Mild nak.  We are talking about a source tree; there is no end-user documentation.  Only the sources to it.

That's what I was talking about. Examples of what I consider "end user docs":

- git-add.txt, git-bisect.txt etc - probably for all commands in
command-list.txt.
Not sure about porcelain vs plumbing, but since division is not
clear I'd put
them all together.

Note that not everyone compiles docs into man pages - for example I don't have needed tools on my laptop and it's not that fast too. I just
have to use
raw .txt files instead.

- config.txt, probably some of howto/*

Examples of "devel docs": howto/maintain-git.txt, technical/*, CodingGuidelines

Quoted 6 lines
Quoted 3 lines

- build result - objects, final binaries, generated documentation etc The advantage besides unclutterting is possibility to have sources on read-only medium.

This is somewhere between a meh to mild nak.  "git grep" knows to ignore untracked cruft, so this does not help nor hinder "finding" at all. Even

It requires me to use git-grep. I might be used to plain "grep". I might not have
git installed yet. I might use some other tool for browsing/searching the source.

Having "cruft" mixed with sources gives you restrictions without giving any advantages (at least I don't see any - if you do please tell me) .

Signature · 1 line
Piotrek
#31 lore raw

Advertising the prebuilt htmldocs and manpages

Quoted 4 lines · Piotr Krukowiecki
Quoted 2 lines · Junio C Hamano

We are talking about a source tree; there is no end-user documentation.  Only the sources to it.

[...]

Quoted 4 lines

Note that not everyone compiles docs into man pages - for example I don't have needed tools on my laptop and it's not that fast too. I just
have to use
raw .txt files instead.

The INSTALL file explains:

Alternatively, pre-formatted documentation is available in "html" and "man" branches of the git repository itself. For example, you could:
[...]
There are also "make quick-install-doc", "make quick-install-man" and "make quick-install-html" which install preformatted man pages and html documentation.

It does not explain that http://www.kernel.org/pub/software/scm/git/
contains git-manpages-* and git-htmldocs-* tarballs for people who do not have git yet, though.

The README file says:

Many Git online resources are accessible from http://git-scm.com/
including full documentation and Git related tools.

Maybe this (especially quick-install-doc) can be made more discoverable somehow.

#34 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

In reply to Jonathan Nieder
Quoted 3 lines · Jonathan Nieder

Thanks again for both of your help. I've put up an updated series at

git://repo.or.cz/git/jrn.git flatten-source

Huh? Did you mean deepen or unflatten?

Quoted 4 lines

Changes since the series sent to the list:

- put headers in libgit/ with the source files. I don't know what I was thinking before.

Nicer; I liked Jeff's "lib/" even better, though.

Quoted 2 lines

- renamed nonbuiltin/ to commands/. Names like commands/add--interactive.perl even seem to make a kind of sense.

Yes. "nonbuiltin/" made me stop reading the patches ;-).

Quoted 1 line

- moved the http support mini-library to http/.

I don't understand the motivation behind this---wouldn't it belong to "libgit/" and if not why not?

Quoted 2 lines

- renamed git_remote_helpers to python/, though I'm not very happy about that.

I am not fond of naming a directory after a language _unless_ the contents of the directory is _all_ about laying the foundation of something else that happens to be implemented in that language. Existing "perl/" is all about providing the Git.pm module to be used by Perl scripts that live outside the directory and is a very good example of naming the directory after the language. Does the contents of the new "python/" directory satisfy that criteria? If so, then it is fine. If we plan to add more remote-helpers and if we plan to allow these helpers written in other languages, you might need to resurrect a separate "remote-helpers/" directory, move some parts of the files you placed in "python/" that are not "foundations for talking to git from Python" but are about "being a remote-helper" to a subdirectory of it, so that new helper implementations written in other languages can live next to that subdirectory.

For exactly the same reason "scripts/" is a name I am not entirely happy about in your tree. "test-programs/" is a very good name, but "scripts/" only tells us that the contents _happen to be_ done as scripts, and does not tell us _what they are for_; perhaps "build-helpers/" might be more understandable.

Thanks.

#35 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Quoted 5 lines · Junio C Hamano
Quoted 1 line · Jonathan Nieder

git://repo.or.cz/git/jrn.git flatten-source

Huh? Did you mean deepen or unflatten?

The branch name was unflatten-source. Sorry about that.

I've pushed some more simple tweaks.

- remove the ".sh" suffix from most build helpers
- rename scripts/ to build-helpers/. Much nicer.
- rename libgit/ to lib/. The shorter pathnames this allows are much nicer.
- move compat/ under the lib/ umbrella
- merge builtins/ with commands/. It never was clear to me why making a command builtin should require changing its filename.
- rename gitk-git/ to gitk/
- rename t/ to tests/, to get a sense for what that feels like

Some remaining details:

Quoted 4 lines
Quoted 1 line

- moved the http support mini-library to http/.

I don't understand the motivation behind this---wouldn't it belong to "libgit/" and if not why not?

They are not linked into the main git binary, to avoid a dependency on libcurl and libexpat. So it might (or might not) be useful to keep them in a subdir to avoid tempting people to use those functions when not appropriate.

lib/http/, with a README explaining their special status?

Quoted 6 lines
Quoted 2 lines

- renamed git_remote_helpers to python/, though I'm not very happy about that.

I am not fond of naming a directory after a language _unless_ the contents of the directory is _all_ about laying the foundation of something else that happens to be implemented in that language.

"git remote-testgit" uses it for
- basic utility functions (die, debug, warn)
- accessing a git repository and listing its branches (GitRepo)
- running git fast-export (GitExporter) and keeping a marks file between runs
- running git fast-import (GitImporter) and keeping a marks file between runs
- maintaining a mirror of a non-local git repo (NonLocalGit) to be able to run fast-export from it

I am guessing a longer term plan is for it to acquire subpackages with analagous functionality accessing other version control systems. It would be tempting to do

other-vcs/
bazaar/
git/
mercurial/
subversion/

(intermixing C and Python code) but that doesn't work because it does not match the structure of the git_remote_helpers package.

Side note: I am not sure I like the git_remote_helpers name. Wouldn't a good goal be for these modules to be usable by other VCSes' import/export scripts, too?

Thanks for the comments.

#32 lore raw

Re: Advertising the prebuilt htmldocs and manpages

In reply to Jonathan Nieder
Quoted 6 lines · Jonathan Nieder

The INSTALL file explains:
...
The README file says:
...
Maybe this (especially quick-install-doc) can be made more discoverable somehow.

If all-caps INSTALL and README are not discoverable, there is not much hope that anything can be made more discoverable, is there?

#33 lore raw

Re: Advertising the prebuilt htmldocs and manpages

Quoted 2 lines · Junio C Hamano

If all-caps INSTALL and README are not discoverable, there is not much hope that anything can be made more discoverable, is there?

I dunno. Something like the following could work, but I don't think it's worth it.

Documentation/Makefile +16 -1
index 36989b7..9217c05 100644
@@ -161,7 +161,22 @@ html: $(DOC_HTML)
 
 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
 
-man: man1 man5 man7
+man_toolchain_test:
+	@$(ASCIIDOC) --version >/dev/null && \
+	xmlto --version >/dev/null || \
+	{ \
+		printf '%s\n' \
+		'' \
+		'Building the manpages requires asciidoc and xmlto.' \
+		'Alternatively, pre-formatted documentation is' \
+		'available in the "man" branch of the git repository itself.' \
+		'See the INSTALL file for details.' \
+		'' && \
+		false; \
+	}
+.PHONY: man_toolchain_chest
+
+man: man_toolchain_test man1 man5 man7
 man1: $(DOC_MAN1)
 man5: $(DOC_MAN5)
 man7: $(DOC_MAN7)
#36 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

In reply to Jonathan Nieder
Quoted 2 lines · Jonathan Nieder

- merge builtins/ with commands/. It never was clear to me why making a command builtin should require changing its filename.

This may be a bit too radical, but maybe the Makefile should use this structure to save maintenance effort. In other words, is there any reason not to just have:

  BUILTIN_SOURCES = $(wildcard builtin/*.c)
  BUILTIN_OBJS = $(patsubst builtin/%.c, builtin/%.o, $(BUILTIN_SOURCES))

and similar for LIB_OBJS and LIB_H?

It is one less thing to need to do when writing new code, and one less thing to have silly textual conflicts on. It probably doesn't matter that much, though; we don't actually add new files or commands all that often.

Speaking of Makefiles, one downside to all of this directory segmentation is that you can't run "make" from the subdirectories. I don't know how much we care. Certainly we could put a dummy Makefile in each subdir that just goes to the toplevel and runs make.

-Peff

#51 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

In reply to Jonathan Nieder

Heya,

Quoted 3 lines · Jonathan Nieder

Side note: I am not sure I like the git_remote_helpers name.  Wouldn't a good goal be for these modules to be usable by other VCSes' import/export scripts, too?

The reusable code (the fast-import library) is already living in it's own library on pypi, I don't think there's much other code that is reusable accross VCSes?

Signature · 3 lines
Cheers,

Sverre Rabbelier
#52 lore raw

The git_remote_helpers package (Re: [RFC/PATCH 0/3] Thinning the git toplevel directory)

Quoted 9 lines · Sverre Rabbelier
Quoted 3 lines · Jonathan Nieder

Side note: I am not sure I like the git_remote_helpers name.  Wouldn't a good goal be for these modules to be usable by other VCSes' import/export scripts, too?

The reusable code (the fast-import library) is already living in it's own library on pypi, I don't think there's much other code that is reusable accross VCSes?

Sorry for the thinko. I see your point.

My thinking before was that if we have packages like

git_remote_helpers.git
git_remote_helpers.hg

to take care of such things as cloning remote repos in preparation fro running fast-export from them, then other VCSes (e.g., bazaar) might want to use these packages in their foreign VCS support, too. But that is probably too theoretical and it is always easy to expose what others actually need when the time comes.

Thanks,
Jonathan

#37 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

In reply to Jeff King
Quoted 5 lines · Jeff King
Quoted 2 lines · Jonathan Nieder

- merge builtins/ with commands/. It never was clear to me why making a command builtin should require changing its filename.

Quoted 8 lines

This may be a bit too radical, but maybe the Makefile should use this structure to save maintenance effort. In other words, is there any reason not to just have:

  BUILTIN_SOURCES = $(wildcard builtin/*.c)
  BUILTIN_OBJS = $(patsubst builtin/%.c, builtin/%.o, $(BUILTIN_SOURCES))

and similar for LIB_OBJS and LIB_H?

The developers would have to be careful not to put a throw-away test programs written in C (especially the ones that has its own "main()") in builtin/ (or lib/) directories if we go that route. This obviously cuts both ways; it sometimes is handy.

Quoted 4 lines

It is one less thing to need to do when writing new code, and one less thing to have silly textual conflicts on. It probably doesn't matter that much, though; we don't actually add new files or commands all that often.

Yeah, you would need to add an entry to the builtin command list yourself anyway, until we also autogenerate it, which I doubt will ever happen nor is necessarily a good idea.

Quoted 2 lines

Speaking of Makefiles, one downside to all of this directory segmentation is that you can't run "make" from the subdirectories.

I had an impression that "make -C lib/" would be one of the goals, iow, when we split the directory structure, the next step would be to split the top-level Makefile so that each directory is covered by its own Makefile, just like Documentation/ is already usable that way.

Not that libgit.a in its current shape is very useful outside the context of the git.git proper, though.

#38 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Heya,

Quoted 2 lines · Junio C Hamano

Not that libgit.a in its current shape is very useful outside the context of the git.git proper, though.

Which is where libgit2 comes in right? ;)

Signature · 3 lines
Cheers,

Sverre Rabbelier
#39 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

In reply to Junio C Hamano
Quoted 8 lines · Junio C Hamano
Quoted 4 lines

It is one less thing to need to do when writing new code, and one less thing to have silly textual conflicts on. It probably doesn't matter that much, though; we don't actually add new files or commands all that often.

Yeah, you would need to add an entry to the builtin command list yourself anyway, until we also autogenerate it, which I doubt will ever happen nor is necessarily a good idea.

You also have to add the declaration to builtin.h. It is kind of a hassle to have to add it in three places (Makefile, command list, and declaration) in addition to the actual code. But again, it's not like we do this that often.

Quoted 7 lines
Quoted 2 lines

Speaking of Makefiles, one downside to all of this directory segmentation is that you can't run "make" from the subdirectories.

I had an impression that "make -C lib/" would be one of the goals, iow, when we split the directory structure, the next step would be to split the top-level Makefile so that each directory is covered by its own Makefile, just like Documentation/ is already usable that way.

Ugh. I am not thrilled at the prospect of more recursive make. As it is now, we have already dealt with bugs from the little bit of recursion there is (e.g., propagating information between Makefiles) and weird heisenbugs (I still occasionally get build failures on recursing into the perl subdir during a parallel make). And then of course it's easy to misuse; running "make" in t/ is not necessarily testing the latest version. In my experience recursive make always comes with this sort of flakiness.

Right now the actual C build process is entirely in the top-level Makefile. I really like that I can trust it to handle dependencies correctly, because it means I can bisect without resorting to "make clean" for each step.

-Peff

#40 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Quoted 8 lines · Jeff King
Quoted 4 lines · Junio C Hamano

I had an impression that "make -C lib/" would be one of the goals, iow, when we split the directory structure, the next step would be to split the top-level Makefile so that each directory is covered by its own Makefile, just like Documentation/ is already usable that way.

Ugh.

Two half-baked ideas:

A. top-level Makefile generates GIT-BUILD-OPTIONS and does not do
any work itself --- it just calls "make" in subdirectories to do the real work. Other Makefiles slurp in

- GIT-BUILD-OPTIONS, to get the build options
- build-helpers/Makefile, for some pattern rules describing how to build things

Benefit:

GIT-BUILD-OPTIONS becomes the normal way to pass build options, so it is well tested and robust.

Downsides:

If the project grows too much, all those "make" calls start to take time. It is possible for parallel "make" invocations to trample on each other's work if they are not well coordinated.

B. top-level Makefile slurps in Makefiles from subdirs. Other
Makefiles would

- check if basic rules (pattern rules and GIT-BUILD-OPTIONS generation) have been slurped in yet, and if not, include them;
- check if build options have been slurped in yet, and if not, include GIT-BUILD-OPTIONS;
- keep careful track of what directory "make" was run from; [*]
- define variables listing targets to be built in this directory and rules describing how to build them.

Benefit:

GIT-BUILD-OPTIONS becomes the normal [...]. Single "make" process, fast and predictable. "make" still works from subdirectories.

Downside:

[*] is a little hazy and sounds hackish.

I admit that I have some irrational excitement about a lib/ that could eventually be built and used separately from git. Mostly because I think it could encourage people to make lib/ code comprehensible and hard to misuse and to keep commands/ code minimal.

Quoted 3 lines

I really like that I can trust it to handle dependencies
correctly, because it means I can bisect without resorting to "make clean" for each step.

Cross-directory dependencies have to be declared just as carefully as dependencies within a directory. I wonder if there is any reason not to make "make" under t/ imply "make -C .. all".

Sleepily,
Jonathan

#41 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Quoted 3 lines · Jonathan Nieder

If the project grows too much, all those "make" calls start to take time. It is possible for parallel "make" invocations to trample on each other's work if they are not well coordinated.

Aren't there cases where no amount of coordination will help? E.g., let's say I have two subdirs, lib/ and cmds/. From the top-level I do "make -j". This invokes two recursive sub-makes, one per directory. The make in cmds/ sees that we haven't built stuff in lib/ yet. So it invokes a recursive make in lib/. Now we have two parallel makes running in lib/, stomping on each other. The problem is that no single make was allowed to see the whole dependency tree.

I know GNU make does have some magic for communicating between recursive makes. Does it handle this situation?

You can fix this with a rule like "only invoke recursive makes on directories _below_ you, never above or to the side". But then you can't run "make" from inside cmds/.

You could have a dependency in the top-level that says recursing into cmds/ depends on having finished recursing into libs/. But that's not strictly correct. You want to be working on part of what's in cmds/ (building .o files) in parallel with what's going on in lib/, and then wait on lib/ only for the linking portion.

Those are all things that are trivial to handle in a single Makefile.

Quoted 2 lines

B. top-level Makefile slurps in Makefiles from subdirs. Other
Makefiles would

I like this better, but...

Quoted 3 lines

- keep careful track of what directory "make" was run from; [*]
[...]
[*] is a little hazy and sounds hackish.

Yeah, you have to be careful with paths. I think a more sane way would be a single top-level Makefile that either contains everything, or sources tidbits from subdirectories. But in either case, assumes it's running from the top-level.

A dummy Makefile in each subdir that cd's to the toplevel and runs a specific target. So from the top-level, "make" would build everything, "make lib" would build stuff in the lib directory, and the Makefile in lib/ would just do "cd .. && make lib".

It's not perfect, but it's simple and predictable.

-Peff

#42 lore raw

Recursive make and variations on the theme

Quoted 9 lines · Jeff King

The problem is that no single make was
allowed to see the whole dependency tree.

I know GNU make does have some magic for communicating between recursive makes. Does it handle this situation?

You can fix this with a rule like "only invoke recursive makes on directories _below_ you, never above or to the side". But then you can't run "make" from inside cmds/.

In that story, commands/Makefile would make commands/built-in.a and various commands/foo.o. The toplevel makefile would pass "make -C commands" a long list of targets to build, presumably deduced from $(MAKECMDGOALS). Not pleasant, I agree.

Quoted 5 lines
Quoted 3 lines

- keep careful track of what directory "make" was run from; [*]
[...]
[*] is a little hazy and sounds hackish.

Yeah, you have to be careful with paths.

It could be pretty simple by maintaining a $(prefix_) variable representing the path from the cwd to the directory containing the makefile. Might try it out.

Quoted 2 lines

I think a more sane way would
be a single top-level Makefile that [...] contains everything

That sounds best to me in the short term, too.

Quoted 4 lines

A dummy Makefile in each subdir that cd's to the toplevel and runs a specific target. So from the top-level, "make" would build everything, "make lib" would build stuff in the lib directory, and the Makefile in lib/ would just do "cd .. && make lib".

Yes, reasonable.

Ciao,
Jonathan

#43 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

In reply to Jeff King
Quoted 11 lines · Jeff King
Quoted 7 lines · Junio C Hamano
Quoted 2 lines

Speaking of Makefiles, one downside to all of this directory segmentation is that you can't run "make" from the subdirectories.

I had an impression that "make -C lib/" would be one of the goals, iow, when we split the directory structure, the next step would be to split the top-level Makefile so that each directory is covered by its own Makefile, just like Documentation/ is already usable that way.

Ugh. I am not thrilled at the prospect of more recursive make.

Likewise. Notice that I have consistently been unthrilled when people started talking about splitting the source code tree?

#44 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Quoted 12 lines · Junio C Hamano
Quoted 10 lines · Jeff King
Quoted 7 lines · Junio C Hamano
Quoted 2 lines

Speaking of Makefiles, one downside to all of this directory segmentation is that you can't run "make" from the subdirectories.

I had an impression that "make -C lib/" would be one of the goals, iow, when we split the directory structure, the next step would be to split the top-level Makefile so that each directory is covered by its own Makefile, just like Documentation/ is already usable that way.

Quoted 4 lines
Quoted 1 line

Ugh. I am not thrilled at the prospect of more recursive make.

Likewise. Notice that I have consistently been unthrilled when people started talking about splitting the source code tree?

Maybe that would be wiser to consider an initial set of patches as those which were proposed to only do the simple file move first, then wait for the dust to settle before doing more changes. Doing too much in one go is inevitably going to bounce against the human tendency to resist any kind of change, good or bad.

Nicolas

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#45 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Quoted 19 lines · Nicolas Pitre
Quoted 12 lines · Junio C Hamano
Quoted 10 lines · Jeff King
Quoted 7 lines · Junio C Hamano
Quoted 2 lines

Speaking of Makefiles, one downside to all of this directory segmentation is that you can't run "make" from the subdirectories.

I had an impression that "make -C lib/" would be one of the goals, iow, when we split the directory structure, the next step would be to split the top-level Makefile so that each directory is covered by its own Makefile, just like Documentation/ is already usable that way.

Quoted 4 lines
Quoted 1 line

Ugh. I am not thrilled at the prospect of more recursive make.

Likewise. Notice that I have consistently been unthrilled when people started talking about splitting the source code tree?

Quoted 7 lines

Maybe that would be wiser to consider an initial set of patches as those which were proposed to only do the simple file move first, then wait for the dust to settle before doing more changes. Doing too much in one go is inevitably going to bounce against the human tendency to resist any kind of change, good or bad.

Nicolas

Nicolas,
They are doing it this way because change is not the objective. A possible better way of managing the codebase is. Perhaps it isn't the right way to go--and we won't know that until we've explored all of the side-effects, advantages, disadvantages, etc.

Besides, if we move anything around into a deeper directory structure we are inevitably going to have to deal with more recursive make problems. We can't just commit to master a tree that has everything moved about and get around to dealing with the Makefiles later.

Signature · 4 lines
-Drew Northup
________________________________________________
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59
#46 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Quoted 27 lines · Drew Northup
Quoted 24 lines · Nicolas Pitre
Quoted 12 lines · Junio C Hamano
Quoted 10 lines · Jeff King
Quoted 7 lines · Junio C Hamano
Quoted 2 lines

Speaking of Makefiles, one downside to all of this directory segmentation is that you can't run "make" from the subdirectories.

I had an impression that "make -C lib/" would be one of the goals, iow, when we split the directory structure, the next step would be to split the top-level Makefile so that each directory is covered by its own Makefile, just like Documentation/ is already usable that way.

Quoted 4 lines
Quoted 1 line

Ugh. I am not thrilled at the prospect of more recursive make.

Likewise. Notice that I have consistently been unthrilled when people started talking about splitting the source code tree?

Maybe that would be wiser to consider an initial set of patches as those which were proposed to only do the simple file move first, then wait for the dust to settle before doing more changes. Doing too much in one go is inevitably going to bounce against the human tendency to resist any kind of change, good or bad.

Quoted 5 lines
Quoted 1 line

Nicolas

Nicolas,
They are doing it this way because change is not the objective. A possible better way of managing the codebase is.

Incidentally I know that (guess whom this proposal came from initially). ;-)

Quoted 8 lines

Perhaps it isn't the
right way to go--and we won't know that until we've explored all of the side-effects, advantages, disadvantages, etc.

Besides, if we move anything around into a deeper directory structure we are inevitably going to have to deal with more recursive make problems. We can't just commit to master a tree that has everything moved about and get around to dealing with the Makefiles later.

The initial set of patches simply moved files into subdirectories and made the corresponding renames within the Makefile.

Reorganizing the Makefile into a better Makefile or sub-makefiles can be done subsequently. That's my point.

Nicolas

#47 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Quoted 46 lines · Nicolas Pitre
Quoted 27 lines · Drew Northup
Quoted 24 lines · Nicolas Pitre
Quoted 12 lines · Junio C Hamano
Quoted 10 lines · Jeff King
Quoted 7 lines · Junio C Hamano
Quoted 2 lines

Speaking of Makefiles, one downside to all of this directory segmentation is that you can't run "make" from the subdirectories.

I had an impression that "make -C lib/" would be one of the goals, iow, when we split the directory structure, the next step would be to split the top-level Makefile so that each directory is covered by its own Makefile, just like Documentation/ is already usable that way.

Quoted 4 lines
Quoted 1 line

Ugh. I am not thrilled at the prospect of more recursive make.

Likewise. Notice that I have consistently been unthrilled when people started talking about splitting the source code tree?

Maybe that would be wiser to consider an initial set of patches as those which were proposed to only do the simple file move first, then wait for the dust to settle before doing more changes. Doing too much in one go is inevitably going to bounce against the human tendency to resist any kind of change, good or bad.

Quoted 5 lines
Quoted 1 line

Nicolas

Nicolas,
They are doing it this way because change is not the objective. A possible better way of managing the codebase is.

Incidentally I know that (guess whom this proposal came from initially). ;-)

Quoted 8 lines

Perhaps it isn't the
right way to go--and we won't know that until we've explored all of the side-effects, advantages, disadvantages, etc.

Besides, if we move anything around into a deeper directory structure we are inevitably going to have to deal with more recursive make problems. We can't just commit to master a tree that has everything moved about and get around to dealing with the Makefiles later.

Quoted 5 lines

The initial set of patches simply moved files into subdirectories and made the corresponding renames within the Makefile.

Reorganizing the Makefile into a better Makefile or sub-makefiles can be done subsequently. That's my point.

It can be done as a separate patch, but it should all be done in the public branch (pu?) as atomically as possible (one merge from Junio's workspace). In other words, the public branch should never fail to build because of this work. That's what I meant by "later" in my comment (as it apparently wasn't obvious from context alone). This is especially important for gaining the accession of the rest of the developer community. Jeff (Peff) and Junio are both apparently quite well aware of this--and I happen to agree with Jeff's way of approaching this type of change.

As for making an authoritative publicly available branch containing this reorganization work (due solely to the extreme effect it will have on other development), I will leave it an open question as to whether this belongs in pu while a 1.7.5 release is still a possibility. It looks like a headache either way.

Signature · 4 lines
-Drew Northup
________________________________________________
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59
#48 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Quoted 12 lines · Drew Northup
Quoted 10 lines · Nicolas Pitre
Quoted 4 lines · Drew Northup

Besides, if we move anything around into a deeper directory structure we are inevitably going to have to deal with more recursive make problems. We can't just commit to master a tree that has everything moved about and get around to dealing with the Makefiles later.

The initial set of patches simply moved files into subdirectories and made the corresponding renames within the Makefile.

Quoted 7 lines
Quoted 2 lines

Reorganizing the Makefile into a better Makefile or sub-makefiles can be done subsequently. That's my point.

It can be done as a separate patch, but it should all be done in the public branch (pu?) as atomically as possible (one merge from Junio's workspace). In other words, the public branch should never fail to build because of this work.

Who said this would fail to compile?

If you move bar.c into the foo directory, then in the existing Makefile you simply have to make a mechanical rename of bar.c to foo/bar.c. Restructuring the Makefile can be done separately from the file move without ever breaking the build (except for unintentional mistakes of course).

Quoted 5 lines

As for making an authoritative publicly available branch containing this reorganization work (due solely to the extreme effect it will have on other development), I will leave it an open question as to whether this belongs in pu while a 1.7.5 release is still a possibility. It looks like a headache either way.

Oh sure. But if we the developers of Git can't deal with that ourselves then it is a really good sign that our own tool is crappy in that area and probably needs to be improved. Such a tree reorganization is something that happens in other projects as well, so it is a good opportunity to improve Git to cope well with such a situation if it isn't up to it yet.

Nicolas

#49 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Quoted 5 lines · Nicolas Pitre
Quoted 4 lines

It can be done as a separate patch, but it should all be done in the public branch (pu?) as atomically as possible (one merge from Junio's workspace). In other words, the public branch should never fail to build because of this work.

Quoted 7 lines

Who said this would fail to compile?

If you move bar.c into the foo directory, then in the existing Makefile you simply have to make a mechanical rename of bar.c to foo/bar.c. Restructuring the Makefile can be done separately from the file move without ever breaking the build (except for unintentional mistakes of course).

Exactly. Maybe it wasn't clear in the previous bits of the thread, but Makefile reorganization is a totally optional thing that can come on top of file movement if we choose. I just brought it up with file movement because having a bunch of subdirs is going to probably make us _want_ to do something with Makefiles.

In the interim it may not work to run make from the "cmds" subdirectory, but that is not a "fail to build" breakage. As long as we build via "make" from the root, then there is no regression. Adding extra make fluff on top of that is feature work, not a bug fix.

-Peff

#50 lore raw

Re: [RFC/PATCH 0/3] Thinning the git toplevel directory

Quoted 21 lines · Jeff King
Quoted 5 lines · Nicolas Pitre
Quoted 4 lines

It can be done as a separate patch, but it should all be done in the public branch (pu?) as atomically as possible (one merge from Junio's workspace). In other words, the public branch should never fail to build because of this work.

Quoted 7 lines

Who said this would fail to compile?

If you move bar.c into the foo directory, then in the existing Makefile you simply have to make a mechanical rename of bar.c to foo/bar.c. Restructuring the Makefile can be done separately from the file move without ever breaking the build (except for unintentional mistakes of course).

Exactly. Maybe it wasn't clear in the previous bits of the thread, but Makefile reorganization is a totally optional thing that can come on top of file movement if we choose. I just brought it up with file movement because having a bunch of subdirs is going to probably make us _want_ to do something with Makefiles.

Quoted 6 lines

In the interim it may not work to run make from the "cmds" subdirectory, but that is not a "fail to build" breakage. As long as we build via "make" from the root, then there is no regression. Adding extra make fluff on top of that is feature work, not a bug fix.

-Peff

I am glad to hear that is the case here. Pretty much everything else I've ever worked on absolutely breaks if files are moved around and Makefiles are not updated to suit.

Signature · 4 lines
-Drew Northup
________________________________________________
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59