threads / rfc / 26454

RFC patchMove test-*.c to test/ subdirectory

Subject: [PATCH/RFC] Move test-*.c to test/ subdirectory

## tl;dr

54 messages between Feb 9, 2011 and Feb 24, 2011. Diffs are folded; open one to read it.

replies: 53people: 8as markdown or json

Nguyễn Thái Ngọc Duy· Feb 9, 2011, 15:14 UTC · lore
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 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%)
Show changes to 23 files +58 −57

.gitignore, Makefile, t/test-lib.sh, test/.gitignore, test-chmtime.c, test-ctype.c, test-date.c, test-delta.c, test-dump-cache-tree.c, test-genrandom.c, test-index-version.c, test-line-buffer.c, test-match-trees.c, test-obj-pool.c, test-parse-options.c, test-path-utils.c, test-run-command.c, test-sha1.c, test-sigchain.c, test-string-pool.c, test-subprocess.c, test-svn-fe.c, test-treap.c

diff --git a/.gitignore b/.gitignore
index 3dd6ef7..a99a216 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/Makefile b/Makefile
index 775ee83..617f910 100644
--- a/Makefile
+++ b/Makefile
@@ -416,25 +416,25 @@ PROGRAM_OBJS += http-backend.o
 
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
-TEST_PROGRAMS_NEED_X += test-chmtime
-TEST_PROGRAMS_NEED_X += test-ctype
-TEST_PROGRAMS_NEED_X += test-date
-TEST_PROGRAMS_NEED_X += test-delta
-TEST_PROGRAMS_NEED_X += test-dump-cache-tree
-TEST_PROGRAMS_NEED_X += test-genrandom
-TEST_PROGRAMS_NEED_X += test-line-buffer
-TEST_PROGRAMS_NEED_X += test-match-trees
-TEST_PROGRAMS_NEED_X += test-obj-pool
-TEST_PROGRAMS_NEED_X += test-parse-options
-TEST_PROGRAMS_NEED_X += test-path-utils
-TEST_PROGRAMS_NEED_X += test-run-command
-TEST_PROGRAMS_NEED_X += test-sha1
-TEST_PROGRAMS_NEED_X += test-sigchain
-TEST_PROGRAMS_NEED_X += test-string-pool
-TEST_PROGRAMS_NEED_X += test-subprocess
-TEST_PROGRAMS_NEED_X += test-svn-fe
-TEST_PROGRAMS_NEED_X += test-treap
-TEST_PROGRAMS_NEED_X += test-index-version
+TEST_PROGRAMS_NEED_X += test/chmtime
+TEST_PROGRAMS_NEED_X += test/ctype
+TEST_PROGRAMS_NEED_X += test/date
+TEST_PROGRAMS_NEED_X += test/delta
+TEST_PROGRAMS_NEED_X += test/dump-cache-tree
+TEST_PROGRAMS_NEED_X += test/genrandom
+TEST_PROGRAMS_NEED_X += test/line-buffer
+TEST_PROGRAMS_NEED_X += test/match-trees
+TEST_PROGRAMS_NEED_X += test/obj-pool
+TEST_PROGRAMS_NEED_X += test/parse-options
+TEST_PROGRAMS_NEED_X += test/path-utils
+TEST_PROGRAMS_NEED_X += test/run-command
+TEST_PROGRAMS_NEED_X += test/sha1
+TEST_PROGRAMS_NEED_X += test/sigchain
+TEST_PROGRAMS_NEED_X += test/string-pool
+TEST_PROGRAMS_NEED_X += test/subprocess
+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))
 
@@ -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 test/%$X,test/%.o,$(TEST_PROGRAMS))
 GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
 	git.o
 ifndef NO_CURL
@@ -1839,8 +1839,8 @@ 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 = test/obj-pool.o test/string-pool.o \
+	test/line-buffer.o test/treap.o
 OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS) $(VCSSVN_OBJS)
 
 dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
@@ -1968,7 +1968,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/svn-fe.o: vcs-svn/svndump.h
 endif
 
 exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
@@ -2100,7 +2100,8 @@ GIT-GUI-VARS: FORCE
             fi
 endif
 
-test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
+test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X))
+test_bindir_programs += $(patsubst test/%,bin-wrappers/test-%,$(TEST_PROGRAMS_NEED_X))
 
 all:: $(TEST_PROGRAMS) $(test_bindir_programs)
 
@@ -2108,7 +2109,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-%,test/%,$(@F))|' < $< > $@ && \
 	chmod +x $@
 
 # GNU make supports exporting all variables by "export" without parameters.
@@ -2122,27 +2123,27 @@ export NO_SVN_TESTS
 test: all
 	$(MAKE) -C t/ all
 
-test-ctype$X: ctype.o
+test/ctype$X: ctype.o
 
-test-date$X: date.o ctype.o
+test/date$X: date.o ctype.o
 
-test-delta$X: diff-delta.o patch-delta.o
+test/delta$X: diff-delta.o patch-delta.o
 
-test-line-buffer$X: vcs-svn/lib.a
+test/line-buffer$X: vcs-svn/lib.a
 
-test-parse-options$X: parse-options.o
+test/parse-options$X: parse-options.o
 
-test-string-pool$X: vcs-svn/lib.a
+test/string-pool$X: vcs-svn/lib.a
 
-test-svn-fe$X: vcs-svn/lib.a
+test/svn-fe$X: vcs-svn/lib.a
 
 .PRECIOUS: $(TEST_OBJS)
 
-test-%$X: test-%.o $(GITLIBS)
+test/%$X: 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:: test/sha1$X
+	./test/sha1.sh
 
 check: common-cmds.h
 	if sparse; \
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 0fdc541..240caec 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -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
 
diff --git a/test/.gitignore b/test/.gitignore
new file mode 100644
index 0000000..6e8a2a1
--- /dev/null
+++ b/test/.gitignore
@@ -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
diff --git a/test-chmtime.c b/test/chmtime.c
similarity index 100%
rename from test-chmtime.c
rename to test/chmtime.c
diff --git a/test-ctype.c b/test/ctype.c
similarity index 100%
rename from test-ctype.c
rename to test/ctype.c
diff --git a/test-date.c b/test/date.c
similarity index 100%
rename from test-date.c
rename to test/date.c
diff --git a/test-delta.c b/test/delta.c
similarity index 100%
rename from test-delta.c
rename to test/delta.c
diff --git a/test-dump-cache-tree.c b/test/dump-cache-tree.c
similarity index 100%
rename from test-dump-cache-tree.c
rename to test/dump-cache-tree.c
diff --git a/test-genrandom.c b/test/genrandom.c
similarity index 100%
rename from test-genrandom.c
rename to test/genrandom.c
diff --git a/test-index-version.c b/test/index-version.c
similarity index 100%
rename from test-index-version.c
rename to test/index-version.c
diff --git a/test-line-buffer.c b/test/line-buffer.c
similarity index 100%
rename from test-line-buffer.c
rename to test/line-buffer.c
diff --git a/test-match-trees.c b/test/match-trees.c
similarity index 100%
rename from test-match-trees.c
rename to test/match-trees.c
diff --git a/test-obj-pool.c b/test/obj-pool.c
similarity index 100%
rename from test-obj-pool.c
rename to test/obj-pool.c
diff --git a/test-parse-options.c b/test/parse-options.c
similarity index 100%
rename from test-parse-options.c
rename to test/parse-options.c
diff --git a/test-path-utils.c b/test/path-utils.c
similarity index 100%
rename from test-path-utils.c
rename to test/path-utils.c
diff --git a/test-run-command.c b/test/run-command.c
similarity index 100%
rename from test-run-command.c
rename to test/run-command.c
diff --git a/test-sha1.c b/test/sha1.c
similarity index 100%
rename from test-sha1.c
rename to test/sha1.c
diff --git a/test-sigchain.c b/test/sigchain.c
similarity index 100%
rename from test-sigchain.c
rename to test/sigchain.c
diff --git a/test-string-pool.c b/test/string-pool.c
similarity index 100%
rename from test-string-pool.c
rename to test/string-pool.c
diff --git a/test-subprocess.c b/test/subprocess.c
similarity index 100%
rename from test-subprocess.c
rename to test/subprocess.c
diff --git a/test-svn-fe.c b/test/svn-fe.c
similarity index 100%
rename from test-svn-fe.c
rename to test/svn-fe.c
diff --git a/test-treap.c b/test/treap.c
similarity index 100%
rename from test-treap.c
rename to test/treap.c
-- 
1.7.4.74.g639db
Nguyen Thai Ngoc Duy· Feb 9, 2011, 15:23 UTC · re: Nguyễn Thái Ngọc Duy · lore

Re: [PATCH/RFC] Move test-*.c to test/ subdirectory

2011/2/9 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  This makes topdir 19 files less and does not seem to break tests.
except this because test-sha1.sh wasn't moved.
> -check-sha1:: test-sha1$X
> -       ./test-sha1.sh
> +check-sha1:: test/sha1$X
> +       ./test/sha1.sh
-- 
Duy
Junio C Hamano· Feb 9, 2011, 22:15 UTC · re: Nguyễn Thái Ngọc Duy · lore

Re: [PATCH/RFC] Move test-*.c to test/ subdirectory

Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>

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?
Nguyễn Thái Ngọc Duy· Feb 10, 2011, 02:14 UTC · re: Junio C Hamano · lore

[PATCH] Move test-* to t/helper/ subdirectory

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 .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%)
Show changes to 25 files +38 −38

.gitignore, Makefile, t/helper/.gitignore, test-chmtime.c, test-ctype.c, test-date.c, test-delta.c, test-dump-cache-tree.c, test-genrandom.c, test-index-version.c, test-line-buffer.c, test-match-trees.c, test-obj-pool.c, test-parse-options.c, test-path-utils.c, test-run-command.c, test-sha1.c, test-sha1.sh, t/helper/test-sha1.sh, test-sigchain.c, test-string-pool.c, test-subprocess.c, test-svn-fe.c, test-treap.c, t/test-lib.sh

diff --git a/.gitignore b/.gitignore
index 3dd6ef7..a99a216 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/Makefile b/Makefile
index 775ee83..e2b3b92 100644
--- a/Makefile
+++ b/Makefile
@@ -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; \
diff --git a/t/helper/.gitignore b/t/helper/.gitignore
new file mode 100644
index 0000000..8f1b042
--- /dev/null
+++ b/t/helper/.gitignore
@@ -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
diff --git a/test-chmtime.c b/t/helper/test-chmtime.c
similarity index 100%
rename from test-chmtime.c
rename to t/helper/test-chmtime.c
diff --git a/test-ctype.c b/t/helper/test-ctype.c
similarity index 100%
rename from test-ctype.c
rename to t/helper/test-ctype.c
diff --git a/test-date.c b/t/helper/test-date.c
similarity index 100%
rename from test-date.c
rename to t/helper/test-date.c
diff --git a/test-delta.c b/t/helper/test-delta.c
similarity index 100%
rename from test-delta.c
rename to t/helper/test-delta.c
diff --git a/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c
similarity index 100%
rename from test-dump-cache-tree.c
rename to t/helper/test-dump-cache-tree.c
diff --git a/test-genrandom.c b/t/helper/test-genrandom.c
similarity index 100%
rename from test-genrandom.c
rename to t/helper/test-genrandom.c
diff --git a/test-index-version.c b/t/helper/test-index-version.c
similarity index 100%
rename from test-index-version.c
rename to t/helper/test-index-version.c
diff --git a/test-line-buffer.c b/t/helper/test-line-buffer.c
similarity index 100%
rename from test-line-buffer.c
rename to t/helper/test-line-buffer.c
diff --git a/test-match-trees.c b/t/helper/test-match-trees.c
similarity index 100%
rename from test-match-trees.c
rename to t/helper/test-match-trees.c
diff --git a/test-obj-pool.c b/t/helper/test-obj-pool.c
similarity index 100%
rename from test-obj-pool.c
rename to t/helper/test-obj-pool.c
diff --git a/test-parse-options.c b/t/helper/test-parse-options.c
similarity index 100%
rename from test-parse-options.c
rename to t/helper/test-parse-options.c
diff --git a/test-path-utils.c b/t/helper/test-path-utils.c
similarity index 100%
rename from test-path-utils.c
rename to t/helper/test-path-utils.c
diff --git a/test-run-command.c b/t/helper/test-run-command.c
similarity index 100%
rename from test-run-command.c
rename to t/helper/test-run-command.c
diff --git a/test-sha1.c b/t/helper/test-sha1.c
similarity index 100%
rename from test-sha1.c
rename to t/helper/test-sha1.c
diff --git a/test-sha1.sh b/t/helper/test-sha1.sh
similarity index 96%
rename from test-sha1.sh
rename to t/helper/test-sha1.sh
index 0f0bc5d..4e691d1 100755
--- a/test-sha1.sh
+++ b/t/helper/test-sha1.sh
@@ -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
diff --git a/test-sigchain.c b/t/helper/test-sigchain.c
similarity index 100%
rename from test-sigchain.c
rename to t/helper/test-sigchain.c
diff --git a/test-string-pool.c b/t/helper/test-string-pool.c
similarity index 100%
rename from test-string-pool.c
rename to t/helper/test-string-pool.c
diff --git a/test-subprocess.c b/t/helper/test-subprocess.c
similarity index 100%
rename from test-subprocess.c
rename to t/helper/test-subprocess.c
diff --git a/test-svn-fe.c b/t/helper/test-svn-fe.c
similarity index 100%
rename from test-svn-fe.c
rename to t/helper/test-svn-fe.c
diff --git a/test-treap.c b/t/helper/test-treap.c
similarity index 100%
rename from test-treap.c
rename to t/helper/test-treap.c
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 0fdc541..eebf7a8 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -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
 
-- 
1.7.4.74.g639db
Jonathan Nieder· Feb 18, 2011, 02:27 UTC · re: Nguyễn Thái Ngọc Duy · lore

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

Hi,
Nguyễn Thái Ngọc Duy wrote:
>  .gitignore                                         |   19 ------------
>  Makefile                                           |   30 ++++++++++----------
>  t/helper/.gitignore                                |   19 ++++++++++++
[...]
>  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(-)
Jonathan Nieder· Feb 18, 2011, 02:31 UTC · re: Jonathan Nieder · lore

[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).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 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%)
Show changes to 117 files +142 −139

Makefile, abspath.c, advice.c, alias.c, alloc.c, archive-tar.c, archive-zip.c, archive.c, attr.c, base85.c, bisect.c, blob.c, branch.c, bundle.c, cache-tree.c, color.c, combine-diff.c, commit.c, config.c, connect.c, convert.c, copy.c, csum-file.c, ctype.c, date.c, decorate.c, diff-delta.c, diff-lib.c, diff-no-index.c, diff.c, diffcore-break.c, diffcore-delta.c, diffcore-order.c, diffcore-pickaxe.c, diffcore-rename.c, dir.c, editor.c, entry.c, environment.c, exec_cmd.c, fsck.c, graph.c, grep.c, hash.c, help.c, hex.c, ident.c, levenshtein.c, list-objects.c, ll-merge.c, lockfile.c, log-tree.c, mailmap.c, match-trees.c, merge-file.c, merge-recursive.c, name-hash.c, notes-cache.c, notes-merge.c, notes.c, object.c, pack-check.c, pack-refs.c, pack-revindex.c, pack-write.c, pager.c, parse-options.c, patch-delta.c, patch-ids.c, path.c, pkt-line.c, preload-index.c, pretty.c, progress.c, quote.c, reachable.c, read-cache.c, reflog-walk.c, refs.c, remote.c, replace_object.c, rerere.c, resolve-undo.c, revision.c, run-command.c, server-info.c, setup.c, sha1-lookup.c, sha1_file.c, sha1_name.c, shallow.c, sideband.c, sigchain.c, strbuf.c, string-list.c, submodule.c, symlinks.c, tag.c, thread-utils.c, trace.c, transport-helper.c, transport.c, tree-diff.c, tree-walk.c, tree.c, unpack-trees.c, url.c, usage.c, userdiff.c, utf8.c, walker.c, wrapper.c, write_or_die.c, ws.c, wt-status.c, xdiff-interface.c, zlib.c

diff --git a/Makefile b/Makefile
index ade7923..b812c1e 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/abspath.c b/libgit/abspath.c
similarity index 100%
rename from abspath.c
rename to libgit/abspath.c
diff --git a/advice.c b/libgit/advice.c
similarity index 100%
rename from advice.c
rename to libgit/advice.c
diff --git a/alias.c b/libgit/alias.c
similarity index 100%
rename from alias.c
rename to libgit/alias.c
diff --git a/alloc.c b/libgit/alloc.c
similarity index 100%
rename from alloc.c
rename to libgit/alloc.c
diff --git a/archive-tar.c b/libgit/archive-tar.c
similarity index 100%
rename from archive-tar.c
rename to libgit/archive-tar.c
diff --git a/archive-zip.c b/libgit/archive-zip.c
similarity index 100%
rename from archive-zip.c
rename to libgit/archive-zip.c
diff --git a/archive.c b/libgit/archive.c
similarity index 100%
rename from archive.c
rename to libgit/archive.c
diff --git a/attr.c b/libgit/attr.c
similarity index 100%
rename from attr.c
rename to libgit/attr.c
diff --git a/base85.c b/libgit/base85.c
similarity index 100%
rename from base85.c
rename to libgit/base85.c
diff --git a/bisect.c b/libgit/bisect.c
similarity index 100%
rename from bisect.c
rename to libgit/bisect.c
diff --git a/blob.c b/libgit/blob.c
similarity index 100%
rename from blob.c
rename to libgit/blob.c
diff --git a/branch.c b/libgit/branch.c
similarity index 100%
rename from branch.c
rename to libgit/branch.c
diff --git a/bundle.c b/libgit/bundle.c
similarity index 100%
rename from bundle.c
rename to libgit/bundle.c
diff --git a/cache-tree.c b/libgit/cache-tree.c
similarity index 100%
rename from cache-tree.c
rename to libgit/cache-tree.c
diff --git a/color.c b/libgit/color.c
similarity index 100%
rename from color.c
rename to libgit/color.c
diff --git a/combine-diff.c b/libgit/combine-diff.c
similarity index 100%
rename from combine-diff.c
rename to libgit/combine-diff.c
diff --git a/commit.c b/libgit/commit.c
similarity index 100%
rename from commit.c
rename to libgit/commit.c
diff --git a/config.c b/libgit/config.c
similarity index 100%
rename from config.c
rename to libgit/config.c
diff --git a/connect.c b/libgit/connect.c
similarity index 100%
rename from connect.c
rename to libgit/connect.c
diff --git a/convert.c b/libgit/convert.c
similarity index 100%
rename from convert.c
rename to libgit/convert.c
diff --git a/copy.c b/libgit/copy.c
similarity index 100%
rename from copy.c
rename to libgit/copy.c
diff --git a/csum-file.c b/libgit/csum-file.c
similarity index 100%
rename from csum-file.c
rename to libgit/csum-file.c
diff --git a/ctype.c b/libgit/ctype.c
similarity index 100%
rename from ctype.c
rename to libgit/ctype.c
diff --git a/date.c b/libgit/date.c
similarity index 100%
rename from date.c
rename to libgit/date.c
diff --git a/decorate.c b/libgit/decorate.c
similarity index 100%
rename from decorate.c
rename to libgit/decorate.c
diff --git a/diff-delta.c b/libgit/diff-delta.c
similarity index 100%
rename from diff-delta.c
rename to libgit/diff-delta.c
diff --git a/diff-lib.c b/libgit/diff-lib.c
similarity index 100%
rename from diff-lib.c
rename to libgit/diff-lib.c
diff --git a/diff-no-index.c b/libgit/diff-no-index.c
similarity index 100%
rename from diff-no-index.c
rename to libgit/diff-no-index.c
diff --git a/diff.c b/libgit/diff.c
similarity index 100%
rename from diff.c
rename to libgit/diff.c
diff --git a/diffcore-break.c b/libgit/diffcore-break.c
similarity index 100%
rename from diffcore-break.c
rename to libgit/diffcore-break.c
diff --git a/diffcore-delta.c b/libgit/diffcore-delta.c
similarity index 100%
rename from diffcore-delta.c
rename to libgit/diffcore-delta.c
diff --git a/diffcore-order.c b/libgit/diffcore-order.c
similarity index 100%
rename from diffcore-order.c
rename to libgit/diffcore-order.c
diff --git a/diffcore-pickaxe.c b/libgit/diffcore-pickaxe.c
similarity index 100%
rename from diffcore-pickaxe.c
rename to libgit/diffcore-pickaxe.c
diff --git a/diffcore-rename.c b/libgit/diffcore-rename.c
similarity index 100%
rename from diffcore-rename.c
rename to libgit/diffcore-rename.c
diff --git a/dir.c b/libgit/dir.c
similarity index 100%
rename from dir.c
rename to libgit/dir.c
diff --git a/editor.c b/libgit/editor.c
similarity index 100%
rename from editor.c
rename to libgit/editor.c
diff --git a/entry.c b/libgit/entry.c
similarity index 100%
rename from entry.c
rename to libgit/entry.c
diff --git a/environment.c b/libgit/environment.c
similarity index 100%
rename from environment.c
rename to libgit/environment.c
diff --git a/exec_cmd.c b/libgit/exec_cmd.c
similarity index 100%
rename from exec_cmd.c
rename to libgit/exec_cmd.c
diff --git a/fsck.c b/libgit/fsck.c
similarity index 100%
rename from fsck.c
rename to libgit/fsck.c
diff --git a/graph.c b/libgit/graph.c
similarity index 100%
rename from graph.c
rename to libgit/graph.c
diff --git a/grep.c b/libgit/grep.c
similarity index 100%
rename from grep.c
rename to libgit/grep.c
diff --git a/hash.c b/libgit/hash.c
similarity index 100%
rename from hash.c
rename to libgit/hash.c
diff --git a/help.c b/libgit/help.c
similarity index 100%
rename from help.c
rename to libgit/help.c
diff --git a/hex.c b/libgit/hex.c
similarity index 100%
rename from hex.c
rename to libgit/hex.c
diff --git a/ident.c b/libgit/ident.c
similarity index 100%
rename from ident.c
rename to libgit/ident.c
diff --git a/levenshtein.c b/libgit/levenshtein.c
similarity index 100%
rename from levenshtein.c
rename to libgit/levenshtein.c
diff --git a/list-objects.c b/libgit/list-objects.c
similarity index 100%
rename from list-objects.c
rename to libgit/list-objects.c
diff --git a/ll-merge.c b/libgit/ll-merge.c
similarity index 100%
rename from ll-merge.c
rename to libgit/ll-merge.c
diff --git a/lockfile.c b/libgit/lockfile.c
similarity index 100%
rename from lockfile.c
rename to libgit/lockfile.c
diff --git a/log-tree.c b/libgit/log-tree.c
similarity index 100%
rename from log-tree.c
rename to libgit/log-tree.c
diff --git a/mailmap.c b/libgit/mailmap.c
similarity index 100%
rename from mailmap.c
rename to libgit/mailmap.c
diff --git a/match-trees.c b/libgit/match-trees.c
similarity index 100%
rename from match-trees.c
rename to libgit/match-trees.c
diff --git a/merge-file.c b/libgit/merge-file.c
similarity index 100%
rename from merge-file.c
rename to libgit/merge-file.c
diff --git a/merge-recursive.c b/libgit/merge-recursive.c
similarity index 100%
rename from merge-recursive.c
rename to libgit/merge-recursive.c
diff --git a/name-hash.c b/libgit/name-hash.c
similarity index 100%
rename from name-hash.c
rename to libgit/name-hash.c
diff --git a/notes-cache.c b/libgit/notes-cache.c
similarity index 100%
rename from notes-cache.c
rename to libgit/notes-cache.c
diff --git a/notes-merge.c b/libgit/notes-merge.c
similarity index 100%
rename from notes-merge.c
rename to libgit/notes-merge.c
diff --git a/notes.c b/libgit/notes.c
similarity index 100%
rename from notes.c
rename to libgit/notes.c
diff --git a/object.c b/libgit/object.c
similarity index 100%
rename from object.c
rename to libgit/object.c
diff --git a/pack-check.c b/libgit/pack-check.c
similarity index 100%
rename from pack-check.c
rename to libgit/pack-check.c
diff --git a/pack-refs.c b/libgit/pack-refs.c
similarity index 100%
rename from pack-refs.c
rename to libgit/pack-refs.c
diff --git a/pack-revindex.c b/libgit/pack-revindex.c
similarity index 100%
rename from pack-revindex.c
rename to libgit/pack-revindex.c
diff --git a/pack-write.c b/libgit/pack-write.c
similarity index 100%
rename from pack-write.c
rename to libgit/pack-write.c
diff --git a/pager.c b/libgit/pager.c
similarity index 100%
rename from pager.c
rename to libgit/pager.c
diff --git a/parse-options.c b/libgit/parse-options.c
similarity index 100%
rename from parse-options.c
rename to libgit/parse-options.c
diff --git a/patch-delta.c b/libgit/patch-delta.c
similarity index 100%
rename from patch-delta.c
rename to libgit/patch-delta.c
diff --git a/patch-ids.c b/libgit/patch-ids.c
similarity index 100%
rename from patch-ids.c
rename to libgit/patch-ids.c
diff --git a/path.c b/libgit/path.c
similarity index 100%
rename from path.c
rename to libgit/path.c
diff --git a/pkt-line.c b/libgit/pkt-line.c
similarity index 100%
rename from pkt-line.c
rename to libgit/pkt-line.c
diff --git a/preload-index.c b/libgit/preload-index.c
similarity index 100%
rename from preload-index.c
rename to libgit/preload-index.c
diff --git a/pretty.c b/libgit/pretty.c
similarity index 100%
rename from pretty.c
rename to libgit/pretty.c
diff --git a/progress.c b/libgit/progress.c
similarity index 100%
rename from progress.c
rename to libgit/progress.c
diff --git a/quote.c b/libgit/quote.c
similarity index 100%
rename from quote.c
rename to libgit/quote.c
diff --git a/reachable.c b/libgit/reachable.c
similarity index 100%
rename from reachable.c
rename to libgit/reachable.c
diff --git a/read-cache.c b/libgit/read-cache.c
similarity index 100%
rename from read-cache.c
rename to libgit/read-cache.c
diff --git a/reflog-walk.c b/libgit/reflog-walk.c
similarity index 100%
rename from reflog-walk.c
rename to libgit/reflog-walk.c
diff --git a/refs.c b/libgit/refs.c
similarity index 100%
rename from refs.c
rename to libgit/refs.c
diff --git a/remote.c b/libgit/remote.c
similarity index 100%
rename from remote.c
rename to libgit/remote.c
diff --git a/replace_object.c b/libgit/replace_object.c
similarity index 100%
rename from replace_object.c
rename to libgit/replace_object.c
diff --git a/rerere.c b/libgit/rerere.c
similarity index 100%
rename from rerere.c
rename to libgit/rerere.c
diff --git a/resolve-undo.c b/libgit/resolve-undo.c
similarity index 100%
rename from resolve-undo.c
rename to libgit/resolve-undo.c
diff --git a/revision.c b/libgit/revision.c
similarity index 100%
rename from revision.c
rename to libgit/revision.c
diff --git a/run-command.c b/libgit/run-command.c
similarity index 100%
rename from run-command.c
rename to libgit/run-command.c
diff --git a/server-info.c b/libgit/server-info.c
similarity index 100%
rename from server-info.c
rename to libgit/server-info.c
diff --git a/setup.c b/libgit/setup.c
similarity index 100%
rename from setup.c
rename to libgit/setup.c
diff --git a/sha1-lookup.c b/libgit/sha1-lookup.c
similarity index 100%
rename from sha1-lookup.c
rename to libgit/sha1-lookup.c
diff --git a/sha1_file.c b/libgit/sha1_file.c
similarity index 100%
rename from sha1_file.c
rename to libgit/sha1_file.c
diff --git a/sha1_name.c b/libgit/sha1_name.c
similarity index 100%
rename from sha1_name.c
rename to libgit/sha1_name.c
diff --git a/shallow.c b/libgit/shallow.c
similarity index 100%
rename from shallow.c
rename to libgit/shallow.c
diff --git a/sideband.c b/libgit/sideband.c
similarity index 100%
rename from sideband.c
rename to libgit/sideband.c
diff --git a/sigchain.c b/libgit/sigchain.c
similarity index 100%
rename from sigchain.c
rename to libgit/sigchain.c
diff --git a/strbuf.c b/libgit/strbuf.c
similarity index 100%
rename from strbuf.c
rename to libgit/strbuf.c
diff --git a/string-list.c b/libgit/string-list.c
similarity index 100%
rename from string-list.c
rename to libgit/string-list.c
diff --git a/submodule.c b/libgit/submodule.c
similarity index 100%
rename from submodule.c
rename to libgit/submodule.c
diff --git a/symlinks.c b/libgit/symlinks.c
similarity index 100%
rename from symlinks.c
rename to libgit/symlinks.c
diff --git a/tag.c b/libgit/tag.c
similarity index 100%
rename from tag.c
rename to libgit/tag.c
diff --git a/thread-utils.c b/libgit/thread-utils.c
similarity index 100%
rename from thread-utils.c
rename to libgit/thread-utils.c
diff --git a/trace.c b/libgit/trace.c
similarity index 100%
rename from trace.c
rename to libgit/trace.c
diff --git a/transport-helper.c b/libgit/transport-helper.c
similarity index 100%
rename from transport-helper.c
rename to libgit/transport-helper.c
diff --git a/transport.c b/libgit/transport.c
similarity index 100%
rename from transport.c
rename to libgit/transport.c
diff --git a/tree-diff.c b/libgit/tree-diff.c
similarity index 100%
rename from tree-diff.c
rename to libgit/tree-diff.c
diff --git a/tree-walk.c b/libgit/tree-walk.c
similarity index 100%
rename from tree-walk.c
rename to libgit/tree-walk.c
diff --git a/tree.c b/libgit/tree.c
similarity index 100%
rename from tree.c
rename to libgit/tree.c
diff --git a/unpack-trees.c b/libgit/unpack-trees.c
similarity index 100%
rename from unpack-trees.c
rename to libgit/unpack-trees.c
diff --git a/url.c b/libgit/url.c
similarity index 100%
rename from url.c
rename to libgit/url.c
diff --git a/usage.c b/libgit/usage.c
similarity index 100%
rename from usage.c
rename to libgit/usage.c
diff --git a/userdiff.c b/libgit/userdiff.c
similarity index 100%
rename from userdiff.c
rename to libgit/userdiff.c
diff --git a/utf8.c b/libgit/utf8.c
similarity index 100%
rename from utf8.c
rename to libgit/utf8.c
diff --git a/walker.c b/libgit/walker.c
similarity index 100%
rename from walker.c
rename to libgit/walker.c
diff --git a/wrapper.c b/libgit/wrapper.c
similarity index 100%
rename from wrapper.c
rename to libgit/wrapper.c
diff --git a/write_or_die.c b/libgit/write_or_die.c
similarity index 100%
rename from write_or_die.c
rename to libgit/write_or_die.c
diff --git a/ws.c b/libgit/ws.c
similarity index 100%
rename from ws.c
rename to libgit/ws.c
diff --git a/wt-status.c b/libgit/wt-status.c
similarity index 100%
rename from wt-status.c
rename to libgit/wt-status.c
diff --git a/xdiff-interface.c b/libgit/xdiff-interface.c
similarity index 100%
rename from xdiff-interface.c
rename to libgit/xdiff-interface.c
diff --git a/zlib.c b/libgit/zlib.c
similarity index 100%
rename from zlib.c
rename to libgit/zlib.c
-- 
1.7.4.1
Nguyen Thai Ngoc Duy· Feb 18, 2011, 03:47 UTC · re: Jonathan Nieder · lore

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

2011/2/18 Jonathan Nieder <jrnieder@gmail.com>:
> 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?

> 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.

> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
-- 
Duy
Jonathan Nieder· Feb 18, 2011, 04:14 UTC · re: Nguyen Thai Ngoc Duy · lore

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

Nguyen Thai Ngoc Duy wrote:
> 2011/2/18 Jonathan Nieder <jrnieder@gmail.com>:
Show 6 quoted 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.
> 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.
> 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.

Requested-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 Makefile                |    5 ++++-
 contrib/svn-fe/Makefile |    6 +++---
 2 files changed, 7 insertions(+), 4 deletions(-)
Show changes to 2 files +7 −4

Makefile, contrib/svn-fe/Makefile

diff --git a/Makefile b/Makefile
index b812c1e..3d701d2 100644
--- a/Makefile
+++ b/Makefile
@@ -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)
 
diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
index 360d8da..9dcad63 100644
--- a/contrib/svn-fe/Makefile
+++ b/contrib/svn-fe/Makefile
@@ -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
-- 
1.7.4.1
Jeff King· Feb 18, 2011, 04:18 UTC · re: Jonathan Nieder · lore

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

On Thu, Feb 17, 2011 at 10:14:05PM -0600, Jonathan Nieder wrote:
Show 11 quoted lines
> Nguyen Thai Ngoc Duy wrote:
> > 2011/2/18 Jonathan Nieder <jrnieder@gmail.com>:
> 
> >> 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
Jonathan Nieder· Feb 18, 2011, 05:58 UTC · re: Jeff King · lore

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

Jeff King wrote:
> 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.

Nguyen Thai Ngoc Duy· Feb 18, 2011, 04:31 UTC · re: Jonathan Nieder · lore

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

2011/2/18 Jonathan Nieder <jrnieder@gmail.com>:
> 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.

-- 
Duy
Jonathan Nieder· Feb 18, 2011, 02:33 UTC · re: Jonathan Nieder · lore

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

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.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 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%)
Show changes to 21 files +9 −6

Makefile, test-chmtime.c, test-ctype.c, test-date.c, test-delta.c, test-dump-cache-tree.c, test-genrandom.c, test-index-version.c, test-line-buffer.c, test-match-trees.c, test-mktemp.c, test-obj-pool.c, test-parse-options.c, test-path-utils.c, test-run-command.c, test-sha1.c, test-sigchain.c, test-string-pool.c, test-subprocess.c, test-svn-fe.c, test-treap.c

diff --git a/Makefile b/Makefile
index b812c1e..f458f65 100644
--- a/Makefile
+++ b/Makefile
@@ -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*
diff --git a/test-chmtime.c b/test-programs/test-chmtime.c
similarity index 100%
rename from test-chmtime.c
rename to test-programs/test-chmtime.c
diff --git a/test-ctype.c b/test-programs/test-ctype.c
similarity index 100%
rename from test-ctype.c
rename to test-programs/test-ctype.c
diff --git a/test-date.c b/test-programs/test-date.c
similarity index 100%
rename from test-date.c
rename to test-programs/test-date.c
diff --git a/test-delta.c b/test-programs/test-delta.c
similarity index 100%
rename from test-delta.c
rename to test-programs/test-delta.c
diff --git a/test-dump-cache-tree.c b/test-programs/test-dump-cache-tree.c
similarity index 100%
rename from test-dump-cache-tree.c
rename to test-programs/test-dump-cache-tree.c
diff --git a/test-genrandom.c b/test-programs/test-genrandom.c
similarity index 100%
rename from test-genrandom.c
rename to test-programs/test-genrandom.c
diff --git a/test-index-version.c b/test-programs/test-index-version.c
similarity index 100%
rename from test-index-version.c
rename to test-programs/test-index-version.c
diff --git a/test-line-buffer.c b/test-programs/test-line-buffer.c
similarity index 100%
rename from test-line-buffer.c
rename to test-programs/test-line-buffer.c
diff --git a/test-match-trees.c b/test-programs/test-match-trees.c
similarity index 100%
rename from test-match-trees.c
rename to test-programs/test-match-trees.c
diff --git a/test-mktemp.c b/test-programs/test-mktemp.c
similarity index 100%
rename from test-mktemp.c
rename to test-programs/test-mktemp.c
diff --git a/test-obj-pool.c b/test-programs/test-obj-pool.c
similarity index 100%
rename from test-obj-pool.c
rename to test-programs/test-obj-pool.c
diff --git a/test-parse-options.c b/test-programs/test-parse-options.c
similarity index 100%
rename from test-parse-options.c
rename to test-programs/test-parse-options.c
diff --git a/test-path-utils.c b/test-programs/test-path-utils.c
similarity index 100%
rename from test-path-utils.c
rename to test-programs/test-path-utils.c
diff --git a/test-run-command.c b/test-programs/test-run-command.c
similarity index 100%
rename from test-run-command.c
rename to test-programs/test-run-command.c
diff --git a/test-sha1.c b/test-programs/test-sha1.c
similarity index 100%
rename from test-sha1.c
rename to test-programs/test-sha1.c
diff --git a/test-sigchain.c b/test-programs/test-sigchain.c
similarity index 100%
rename from test-sigchain.c
rename to test-programs/test-sigchain.c
diff --git a/test-string-pool.c b/test-programs/test-string-pool.c
similarity index 100%
rename from test-string-pool.c
rename to test-programs/test-string-pool.c
diff --git a/test-subprocess.c b/test-programs/test-subprocess.c
similarity index 100%
rename from test-subprocess.c
rename to test-programs/test-subprocess.c
diff --git a/test-svn-fe.c b/test-programs/test-svn-fe.c
similarity index 100%
rename from test-svn-fe.c
rename to test-programs/test-svn-fe.c
diff --git a/test-treap.c b/test-programs/test-treap.c
similarity index 100%
rename from test-treap.c
rename to test-programs/test-treap.c
-- 
1.7.4.1
Jonathan Nieder· Feb 18, 2011, 02:37 UTC · re: Jonathan Nieder · lore

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

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.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 Makefile                                       |  146 ++++++++++++------------
 advice.h => include/advice.h                   |    0
 [ etc etc ]
 72 files changed, 73 insertions(+), 73 deletions(-)
Show changes to 72 files +73 −73

Makefile, advice.h, archive.h, attr.h, bisect.h, blob.h, branch.h, builtin.h, bundle.h, cache-tree.h, color.h, commit.h, csum-file.h, decorate.h, delta.h, diff.h, diffcore.h, dir.h, exec_cmd.h, fetch-pack.h, fsck.h, graph.h, grep.h, hash.h, help.h, http.h, levenshtein.h, list-objects.h, ll-merge.h, log-tree.h, mailmap.h, merge-recursive.h, notes-cache.h, notes-merge.h, notes.h, object.h, pack-refs.h, pack-revindex.h, pack.h, parse-options.h, patch-ids.h, pkt-line.h, progress.h, quote.h, reachable.h, reflog-walk.h, refs.h, remote.h, rerere.h, resolve-undo.h, revision.h, run-command.h, send-pack.h, sha1-lookup.h, shortlog.h, sideband.h, sigchain.h, string-list.h, submodule.h, tag.h, tar.h, thread-utils.h, transport.h, tree-walk.h, tree.h, unpack-trees.h, url.h, userdiff.h, utf8.h, walker.h, wt-status.h, xdiff-interface.h

diff --git a/Makefile b/Makefile
index f458f65..1e96504 100644
--- a/Makefile
+++ b/Makefile
@@ -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 \
diff --git a/advice.h b/include/advice.h
similarity index 100%
rename from advice.h
rename to include/advice.h
diff --git a/archive.h b/include/archive.h
similarity index 100%
rename from archive.h
rename to include/archive.h
diff --git a/attr.h b/include/attr.h
similarity index 100%
rename from attr.h
rename to include/attr.h
diff --git a/bisect.h b/include/bisect.h
similarity index 100%
rename from bisect.h
rename to include/bisect.h
diff --git a/blob.h b/include/blob.h
similarity index 100%
rename from blob.h
rename to include/blob.h
diff --git a/branch.h b/include/branch.h
similarity index 100%
rename from branch.h
rename to include/branch.h
diff --git a/builtin.h b/include/builtin.h
similarity index 100%
rename from builtin.h
rename to include/builtin.h
diff --git a/bundle.h b/include/bundle.h
similarity index 100%
rename from bundle.h
rename to include/bundle.h
diff --git a/cache-tree.h b/include/cache-tree.h
similarity index 100%
rename from cache-tree.h
rename to include/cache-tree.h
diff --git a/color.h b/include/color.h
similarity index 100%
rename from color.h
rename to include/color.h
diff --git a/commit.h b/include/commit.h
similarity index 100%
rename from commit.h
rename to include/commit.h
diff --git a/csum-file.h b/include/csum-file.h
similarity index 100%
rename from csum-file.h
rename to include/csum-file.h
diff --git a/decorate.h b/include/decorate.h
similarity index 100%
rename from decorate.h
rename to include/decorate.h
diff --git a/delta.h b/include/delta.h
similarity index 100%
rename from delta.h
rename to include/delta.h
diff --git a/diff.h b/include/diff.h
similarity index 100%
rename from diff.h
rename to include/diff.h
diff --git a/diffcore.h b/include/diffcore.h
similarity index 100%
rename from diffcore.h
rename to include/diffcore.h
diff --git a/dir.h b/include/dir.h
similarity index 100%
rename from dir.h
rename to include/dir.h
diff --git a/exec_cmd.h b/include/exec_cmd.h
similarity index 100%
rename from exec_cmd.h
rename to include/exec_cmd.h
diff --git a/fetch-pack.h b/include/fetch-pack.h
similarity index 100%
rename from fetch-pack.h
rename to include/fetch-pack.h
diff --git a/fsck.h b/include/fsck.h
similarity index 100%
rename from fsck.h
rename to include/fsck.h
diff --git a/graph.h b/include/graph.h
similarity index 100%
rename from graph.h
rename to include/graph.h
diff --git a/grep.h b/include/grep.h
similarity index 100%
rename from grep.h
rename to include/grep.h
diff --git a/hash.h b/include/hash.h
similarity index 100%
rename from hash.h
rename to include/hash.h
diff --git a/help.h b/include/help.h
similarity index 100%
rename from help.h
rename to include/help.h
diff --git a/http.h b/include/http.h
similarity index 100%
rename from http.h
rename to include/http.h
diff --git a/levenshtein.h b/include/levenshtein.h
similarity index 100%
rename from levenshtein.h
rename to include/levenshtein.h
diff --git a/list-objects.h b/include/list-objects.h
similarity index 100%
rename from list-objects.h
rename to include/list-objects.h
diff --git a/ll-merge.h b/include/ll-merge.h
similarity index 100%
rename from ll-merge.h
rename to include/ll-merge.h
diff --git a/log-tree.h b/include/log-tree.h
similarity index 100%
rename from log-tree.h
rename to include/log-tree.h
diff --git a/mailmap.h b/include/mailmap.h
similarity index 100%
rename from mailmap.h
rename to include/mailmap.h
diff --git a/merge-recursive.h b/include/merge-recursive.h
similarity index 100%
rename from merge-recursive.h
rename to include/merge-recursive.h
diff --git a/notes-cache.h b/include/notes-cache.h
similarity index 100%
rename from notes-cache.h
rename to include/notes-cache.h
diff --git a/notes-merge.h b/include/notes-merge.h
similarity index 100%
rename from notes-merge.h
rename to include/notes-merge.h
diff --git a/notes.h b/include/notes.h
similarity index 100%
rename from notes.h
rename to include/notes.h
diff --git a/object.h b/include/object.h
similarity index 100%
rename from object.h
rename to include/object.h
diff --git a/pack-refs.h b/include/pack-refs.h
similarity index 100%
rename from pack-refs.h
rename to include/pack-refs.h
diff --git a/pack-revindex.h b/include/pack-revindex.h
similarity index 100%
rename from pack-revindex.h
rename to include/pack-revindex.h
diff --git a/pack.h b/include/pack.h
similarity index 100%
rename from pack.h
rename to include/pack.h
diff --git a/parse-options.h b/include/parse-options.h
similarity index 100%
rename from parse-options.h
rename to include/parse-options.h
diff --git a/patch-ids.h b/include/patch-ids.h
similarity index 100%
rename from patch-ids.h
rename to include/patch-ids.h
diff --git a/pkt-line.h b/include/pkt-line.h
similarity index 100%
rename from pkt-line.h
rename to include/pkt-line.h
diff --git a/progress.h b/include/progress.h
similarity index 100%
rename from progress.h
rename to include/progress.h
diff --git a/quote.h b/include/quote.h
similarity index 100%
rename from quote.h
rename to include/quote.h
diff --git a/reachable.h b/include/reachable.h
similarity index 100%
rename from reachable.h
rename to include/reachable.h
diff --git a/reflog-walk.h b/include/reflog-walk.h
similarity index 100%
rename from reflog-walk.h
rename to include/reflog-walk.h
diff --git a/refs.h b/include/refs.h
similarity index 100%
rename from refs.h
rename to include/refs.h
diff --git a/remote.h b/include/remote.h
similarity index 100%
rename from remote.h
rename to include/remote.h
diff --git a/rerere.h b/include/rerere.h
similarity index 100%
rename from rerere.h
rename to include/rerere.h
diff --git a/resolve-undo.h b/include/resolve-undo.h
similarity index 100%
rename from resolve-undo.h
rename to include/resolve-undo.h
diff --git a/revision.h b/include/revision.h
similarity index 100%
rename from revision.h
rename to include/revision.h
diff --git a/run-command.h b/include/run-command.h
similarity index 100%
rename from run-command.h
rename to include/run-command.h
diff --git a/send-pack.h b/include/send-pack.h
similarity index 100%
rename from send-pack.h
rename to include/send-pack.h
diff --git a/sha1-lookup.h b/include/sha1-lookup.h
similarity index 100%
rename from sha1-lookup.h
rename to include/sha1-lookup.h
diff --git a/shortlog.h b/include/shortlog.h
similarity index 100%
rename from shortlog.h
rename to include/shortlog.h
diff --git a/sideband.h b/include/sideband.h
similarity index 100%
rename from sideband.h
rename to include/sideband.h
diff --git a/sigchain.h b/include/sigchain.h
similarity index 100%
rename from sigchain.h
rename to include/sigchain.h
diff --git a/string-list.h b/include/string-list.h
similarity index 100%
rename from string-list.h
rename to include/string-list.h
diff --git a/submodule.h b/include/submodule.h
similarity index 100%
rename from submodule.h
rename to include/submodule.h
diff --git a/tag.h b/include/tag.h
similarity index 100%
rename from tag.h
rename to include/tag.h
diff --git a/tar.h b/include/tar.h
similarity index 100%
rename from tar.h
rename to include/tar.h
diff --git a/thread-utils.h b/include/thread-utils.h
similarity index 100%
rename from thread-utils.h
rename to include/thread-utils.h
diff --git a/transport.h b/include/transport.h
similarity index 100%
rename from transport.h
rename to include/transport.h
diff --git a/tree-walk.h b/include/tree-walk.h
similarity index 100%
rename from tree-walk.h
rename to include/tree-walk.h
diff --git a/tree.h b/include/tree.h
similarity index 100%
rename from tree.h
rename to include/tree.h
diff --git a/unpack-trees.h b/include/unpack-trees.h
similarity index 100%
rename from unpack-trees.h
rename to include/unpack-trees.h
diff --git a/url.h b/include/url.h
similarity index 100%
rename from url.h
rename to include/url.h
diff --git a/userdiff.h b/include/userdiff.h
similarity index 100%
rename from userdiff.h
rename to include/userdiff.h
diff --git a/utf8.h b/include/utf8.h
similarity index 100%
rename from utf8.h
rename to include/utf8.h
diff --git a/walker.h b/include/walker.h
similarity index 100%
rename from walker.h
rename to include/walker.h
diff --git a/wt-status.h b/include/wt-status.h
similarity index 100%
rename from wt-status.h
rename to include/wt-status.h
diff --git a/xdiff-interface.h b/include/xdiff-interface.h
similarity index 100%
rename from xdiff-interface.h
rename to include/xdiff-interface.h
-- 
1.7.4.1
Nguyen Thai Ngoc Duy· Feb 18, 2011, 03:52 UTC · re: Jonathan Nieder · lore

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

2011/2/18 Jonathan Nieder <jrnieder@gmail.com>:
Show 9 quoted 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.

> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
-- 
Duy
Jonathan Nieder· Feb 18, 2011, 04:29 UTC · re: Nguyen Thai Ngoc Duy · lore

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

Nguyen Thai Ngoc Duy wrote:
> 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?

> 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%)
-- 
1.7.4.1
Jonathan Nieder· Feb 18, 2011, 04:32 UTC · re: Jonathan Nieder · lore

[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.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 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(-)
Show changes to 24 files +28 −28

compat/basename.c, compat/cygwin.c, compat/fopen.c, compat/inet_ntop.c, compat/inet_pton.c, compat/memmem.c, compat/mingw.c, compat/mkdtemp.c, compat/mmap.c, compat/msvc.c, compat/pread.c, compat/qsort.c, compat/setenv.c, compat/snprintf.c, compat/strcasestr.c, compat/strlcpy.c, compat/strtok_r.c, compat/strtoumax.c, compat/unsetenv.c, compat/win32/dirent.c, compat/win32/pthread.c, compat/win32/syslog.c, compat/win32mmap.c, compat/winansi.c

diff --git a/compat/basename.c b/compat/basename.c
index d8f8a3c..4382378 100644
--- a/compat/basename.c
+++ b/compat/basename.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /* Adapted from libiberty's basename.c.  */
 char *gitbasename (char *path)
diff --git a/compat/cygwin.c b/compat/cygwin.c
index b4a51b9..23c5138 100644
--- a/compat/cygwin.c
+++ b/compat/cygwin.c
@@ -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)
 {
diff --git a/compat/fopen.c b/compat/fopen.c
index b5ca142..e777c44 100644
--- a/compat/fopen.c
+++ b/compat/fopen.c
@@ -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)
 {
diff --git a/compat/inet_ntop.c b/compat/inet_ntop.c
index ea249c6..d2c2b48 100644
--- a/compat/inet_ntop.c
+++ b/compat/inet_ntop.c
@@ -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>
diff --git a/compat/inet_pton.c b/compat/inet_pton.c
index 2ec995e..8ff1d9d 100644
--- a/compat/inet_pton.c
+++ b/compat/inet_pton.c
@@ -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>
diff --git a/compat/memmem.c b/compat/memmem.c
index 56bcb42..2df3e7b 100644
--- a/compat/memmem.c
+++ b/compat/memmem.c
@@ -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)
diff --git a/compat/mingw.c b/compat/mingw.c
index bee6054..e43bba3 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -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)
 {
diff --git a/compat/mkdtemp.c b/compat/mkdtemp.c
index 1136119..4349e15 100644
--- a/compat/mkdtemp.c
+++ b/compat/mkdtemp.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 char *gitmkdtemp(char *template)
 {
diff --git a/compat/mmap.c b/compat/mmap.c
index c9d46d1..a62533e 100644
--- a/compat/mmap.c
+++ b/compat/mmap.c
@@ -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)
 {
diff --git a/compat/msvc.c b/compat/msvc.c
index 71843d7..e55b546 100644
--- a/compat/msvc.c
+++ b/compat/msvc.c
@@ -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"
diff --git a/compat/pread.c b/compat/pread.c
index 978cac4..429f7dd 100644
--- a/compat/pread.c
+++ b/compat/pread.c
@@ -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)
 {
diff --git a/compat/qsort.c b/compat/qsort.c
index d93dce2..a490959 100644
--- a/compat/qsort.c
+++ b/compat/qsort.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /*
  * A merge sort implementation, simplified from the qsort implementation
diff --git a/compat/setenv.c b/compat/setenv.c
index 3a22ea7..bf1016f 100644
--- a/compat/setenv.c
+++ b/compat/setenv.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 int gitsetenv(const char *name, const char *value, int replace)
 {
diff --git a/compat/snprintf.c b/compat/snprintf.c
index e1e0e75..376eeff 100644
--- a/compat/snprintf.c
+++ b/compat/snprintf.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /*
  * The size parameter specifies the available space, i.e. includes
diff --git a/compat/strcasestr.c b/compat/strcasestr.c
index 26896de..d666093 100644
--- a/compat/strcasestr.c
+++ b/compat/strcasestr.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 char *gitstrcasestr(const char *haystack, const char *needle)
 {
diff --git a/compat/strlcpy.c b/compat/strlcpy.c
index 4024c36..780b39f 100644
--- a/compat/strlcpy.c
+++ b/compat/strlcpy.c
@@ -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)
 {
diff --git a/compat/strtok_r.c b/compat/strtok_r.c
index 7b5d568..6eec7f8 100644
--- a/compat/strtok_r.c
+++ b/compat/strtok_r.c
@@ -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
diff --git a/compat/strtoumax.c b/compat/strtoumax.c
index 5541353..50fe26d 100644
--- a/compat/strtoumax.c
+++ b/compat/strtoumax.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 uintmax_t gitstrtoumax (const char *nptr, char **endptr, int base)
 {
diff --git a/compat/unsetenv.c b/compat/unsetenv.c
index eb29f5e..8f38d37 100644
--- a/compat/unsetenv.c
+++ b/compat/unsetenv.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 void gitunsetenv (const char *name)
 {
diff --git a/compat/win32/dirent.c b/compat/win32/dirent.c
index 7a0debe..038188e 100644
--- a/compat/win32/dirent.c
+++ b/compat/win32/dirent.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 #include "dirent.h"
 
 struct DIR {
diff --git a/compat/win32/pthread.c b/compat/win32/pthread.c
index 010e875..3b1f381 100644
--- a/compat/win32/pthread.c
+++ b/compat/win32/pthread.c
@@ -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>
diff --git a/compat/win32/syslog.c b/compat/win32/syslog.c
index 42b95a9..9c4c8e2 100644
--- a/compat/win32/syslog.c
+++ b/compat/win32/syslog.c
@@ -1,5 +1,5 @@
-#include "../../git-compat-util.h"
-#include "../../strbuf.h"
+#include "git-compat-util.h"
+#include "strbuf.h"
 
 static HANDLE ms_eventlog;
 
diff --git a/compat/win32mmap.c b/compat/win32mmap.c
index b58aa69..756fe8a 100644
--- a/compat/win32mmap.c
+++ b/compat/win32mmap.c
@@ -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)
 {
diff --git a/compat/winansi.c b/compat/winansi.c
index dedce21..82a5d9c 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -2,7 +2,7 @@
  * Copyright 2008 Peter Harris <git@peter.is-a-geek.org>
  */
 
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /*
  Functions to be wrapped:
-- 
1.7.4.1
Jonathan Nieder· Feb 18, 2011, 04:34 UTC · re: Jonathan Nieder · lore

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

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.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 block-sha1/sha1.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to block-sha1/sha1.c +1 −1
diff --git a/block-sha1/sha1.c b/block-sha1/sha1.c
index c0054a0..71464fa 100644
--- a/block-sha1/sha1.c
+++ b/block-sha1/sha1.c
@@ -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"
 
-- 
1.7.4.1
Jonathan Nieder· Feb 18, 2011, 04:35 UTC · re: Jonathan Nieder · lore

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

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

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 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%)
Show changes to 4 files +3 −3

Makefile, cache.h, git-compat-util.h, strbuf.h

diff --git a/Makefile b/Makefile
index 1e96504..9ce9ccd 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/cache.h b/include/cache.h
similarity index 100%
rename from cache.h
rename to include/cache.h
diff --git a/git-compat-util.h b/include/git-compat-util.h
similarity index 100%
rename from git-compat-util.h
rename to include/git-compat-util.h
diff --git a/strbuf.h b/include/strbuf.h
similarity index 100%
rename from strbuf.h
rename to include/strbuf.h
-- 
1.7.4.1
Nguyen Thai Ngoc Duy· Feb 18, 2011, 03:56 UTC · re: Jonathan Nieder · lore

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

2011/2/18 Jonathan Nieder <jrnieder@gmail.com>:
Show 13 quoted lines
> Hi,
>
> Nguyễn Thái Ngọc Duy wrote:
>
>>  .gitignore                                         |   19 ------------
>>  Makefile                                           |   30 ++++++++++----------
>>  t/helper/.gitignore                                |   19 ++++++++++++
> [...]
>>  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.
-- 
Duy
Jonathan Nieder· Feb 18, 2011, 04:51 UTC · re: Nguyen Thai Ngoc Duy · lore

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

Nguyen Thai Ngoc Duy wrote:
> 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%)
Jonathan Nieder· Feb 18, 2011, 04:52 UTC · re: Jonathan Nieder · lore

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

Probably it should go in t/ as a new test but I am lazy.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 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%)
Show changes to 2 files +1 −1

Makefile, test-sha1.sh

diff --git a/Makefile b/Makefile
index 9ce9ccd..61981e5 100644
--- a/Makefile
+++ b/Makefile
@@ -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; \
diff --git a/test-sha1.sh b/test-programs/test-sha1.sh
similarity index 100%
rename from test-sha1.sh
rename to test-programs/test-sha1.sh
-- 
1.7.4.1
Jonathan Nieder· Feb 18, 2011, 04:55 UTC · re: Jonathan Nieder · lore

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

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).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
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%)
Show changes to 8 files +11 −11

Makefile, GIT-VERSION-GEN, check_bindir, check-builtins.sh, fixup-builtins, generate-cmdlist.sh, unimplemented.sh, wrap-for-bin.sh

diff --git a/Makefile b/Makefile
index 61981e5..1c10e29 100644
--- a/Makefile
+++ b/Makefile
@@ -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
 #
diff --git a/GIT-VERSION-GEN b/scripts/GIT-VERSION-GEN
similarity index 100%
rename from GIT-VERSION-GEN
rename to scripts/GIT-VERSION-GEN
diff --git a/check_bindir b/scripts/check-bindir.sh
similarity index 100%
rename from check_bindir
rename to scripts/check-bindir.sh
diff --git a/check-builtins.sh b/scripts/check-builtins.sh
similarity index 100%
rename from check-builtins.sh
rename to scripts/check-builtins.sh
diff --git a/fixup-builtins b/scripts/fixup-builtins.sh
similarity index 100%
rename from fixup-builtins
rename to scripts/fixup-builtins.sh
diff --git a/generate-cmdlist.sh b/scripts/generate-cmdlist.sh
similarity index 100%
rename from generate-cmdlist.sh
rename to scripts/generate-cmdlist.sh
diff --git a/unimplemented.sh b/scripts/unimplemented.sh
similarity index 100%
rename from unimplemented.sh
rename to scripts/unimplemented.sh
diff --git a/wrap-for-bin.sh b/scripts/wrap-for-bin.sh
similarity index 100%
rename from wrap-for-bin.sh
rename to scripts/wrap-for-bin.sh
-- 
1.7.4.1
Jonathan Nieder· Feb 18, 2011, 05:04 UTC · re: Jonathan Nieder · lore

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

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.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
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(-)
Show changes to 44 files +70 −67

Makefile, git-add--interactive.perl, git-am.sh, git-archimport.perl, git-bisect.sh, check-racy.c, git-cvsexportcommit.perl, git-cvsimport.perl, git-cvsserver.perl, daemon.c, git-difftool--helper.sh, git-difftool.perl, fast-import.c, git-filter-branch.sh, http-backend.c, http-fetch.c, http-push.c, imap-send.c, git-instaweb.sh, git-lost-found.sh, git-merge-octopus.sh, git-merge-one-file.sh, git-merge-resolve.sh, git-mergetool--lib.sh, git-mergetool.sh, git-parse-remote.sh, git-pull.sh, git-quiltimport.sh, git-rebase--interactive.sh, git-rebase.sh, git-relink.perl, remote-curl.c, git-remote-testgit.py, git-repack.sh, git-request-pull.sh, git-send-email.perl, git-sh-setup.sh, shell.c, show-index.c, git-stash.sh, git-submodule.sh, git-svn.perl, upload-pack.c, git-web--browse.sh

diff --git a/Makefile b/Makefile
index 1c10e29..6f8a11c 100644
--- a/Makefile
+++ b/Makefile
@@ -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) \
-    $@.sh >$@+
+    $< >$@+
 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' \
-	    $@.perl >$@+ && \
+	    $< >$@+ && \
 	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' \
-	    $@.sh > $@+ && \
+	    $< >$@+ && \
 	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' \
-	    $@.py >$@+ && \
+	    $< >$@+ && \
 	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
diff --git a/git-add--interactive.perl b/nonbuiltin/add--interactive.perl
similarity index 100%
rename from git-add--interactive.perl
rename to nonbuiltin/add--interactive.perl
diff --git a/git-am.sh b/nonbuiltin/am.sh
similarity index 100%
rename from git-am.sh
rename to nonbuiltin/am.sh
diff --git a/git-archimport.perl b/nonbuiltin/archimport.perl
similarity index 100%
rename from git-archimport.perl
rename to nonbuiltin/archimport.perl
diff --git a/git-bisect.sh b/nonbuiltin/bisect.sh
similarity index 100%
rename from git-bisect.sh
rename to nonbuiltin/bisect.sh
diff --git a/check-racy.c b/nonbuiltin/check-racy.c
similarity index 100%
rename from check-racy.c
rename to nonbuiltin/check-racy.c
diff --git a/git-cvsexportcommit.perl b/nonbuiltin/cvsexportcommit.perl
similarity index 100%
rename from git-cvsexportcommit.perl
rename to nonbuiltin/cvsexportcommit.perl
diff --git a/git-cvsimport.perl b/nonbuiltin/cvsimport.perl
similarity index 100%
rename from git-cvsimport.perl
rename to nonbuiltin/cvsimport.perl
diff --git a/git-cvsserver.perl b/nonbuiltin/cvsserver.perl
similarity index 100%
rename from git-cvsserver.perl
rename to nonbuiltin/cvsserver.perl
diff --git a/daemon.c b/nonbuiltin/daemon.c
similarity index 100%
rename from daemon.c
rename to nonbuiltin/daemon.c
diff --git a/git-difftool--helper.sh b/nonbuiltin/difftool--helper.sh
similarity index 100%
rename from git-difftool--helper.sh
rename to nonbuiltin/difftool--helper.sh
diff --git a/git-difftool.perl b/nonbuiltin/difftool.perl
similarity index 100%
rename from git-difftool.perl
rename to nonbuiltin/difftool.perl
diff --git a/fast-import.c b/nonbuiltin/fast-import.c
similarity index 100%
rename from fast-import.c
rename to nonbuiltin/fast-import.c
diff --git a/git-filter-branch.sh b/nonbuiltin/filter-branch.sh
similarity index 100%
rename from git-filter-branch.sh
rename to nonbuiltin/filter-branch.sh
diff --git a/http-backend.c b/nonbuiltin/http-backend.c
similarity index 100%
rename from http-backend.c
rename to nonbuiltin/http-backend.c
diff --git a/http-fetch.c b/nonbuiltin/http-fetch.c
similarity index 100%
rename from http-fetch.c
rename to nonbuiltin/http-fetch.c
diff --git a/http-push.c b/nonbuiltin/http-push.c
similarity index 100%
rename from http-push.c
rename to nonbuiltin/http-push.c
diff --git a/imap-send.c b/nonbuiltin/imap-send.c
similarity index 100%
rename from imap-send.c
rename to nonbuiltin/imap-send.c
diff --git a/git-instaweb.sh b/nonbuiltin/instaweb.sh
similarity index 100%
rename from git-instaweb.sh
rename to nonbuiltin/instaweb.sh
diff --git a/git-lost-found.sh b/nonbuiltin/lost-found.sh
similarity index 100%
rename from git-lost-found.sh
rename to nonbuiltin/lost-found.sh
diff --git a/git-merge-octopus.sh b/nonbuiltin/merge-octopus.sh
similarity index 100%
rename from git-merge-octopus.sh
rename to nonbuiltin/merge-octopus.sh
diff --git a/git-merge-one-file.sh b/nonbuiltin/merge-one-file.sh
similarity index 100%
rename from git-merge-one-file.sh
rename to nonbuiltin/merge-one-file.sh
diff --git a/git-merge-resolve.sh b/nonbuiltin/merge-resolve.sh
similarity index 100%
rename from git-merge-resolve.sh
rename to nonbuiltin/merge-resolve.sh
diff --git a/git-mergetool--lib.sh b/nonbuiltin/mergetool--lib.sh
similarity index 100%
rename from git-mergetool--lib.sh
rename to nonbuiltin/mergetool--lib.sh
diff --git a/git-mergetool.sh b/nonbuiltin/mergetool.sh
similarity index 100%
rename from git-mergetool.sh
rename to nonbuiltin/mergetool.sh
diff --git a/git-parse-remote.sh b/nonbuiltin/parse-remote.sh
similarity index 100%
rename from git-parse-remote.sh
rename to nonbuiltin/parse-remote.sh
diff --git a/git-pull.sh b/nonbuiltin/pull.sh
similarity index 100%
rename from git-pull.sh
rename to nonbuiltin/pull.sh
diff --git a/git-quiltimport.sh b/nonbuiltin/quiltimport.sh
similarity index 100%
rename from git-quiltimport.sh
rename to nonbuiltin/quiltimport.sh
diff --git a/git-rebase--interactive.sh b/nonbuiltin/rebase--interactive.sh
similarity index 100%
rename from git-rebase--interactive.sh
rename to nonbuiltin/rebase--interactive.sh
diff --git a/git-rebase.sh b/nonbuiltin/rebase.sh
similarity index 100%
rename from git-rebase.sh
rename to nonbuiltin/rebase.sh
diff --git a/git-relink.perl b/nonbuiltin/relink.perl
similarity index 100%
rename from git-relink.perl
rename to nonbuiltin/relink.perl
diff --git a/remote-curl.c b/nonbuiltin/remote-curl.c
similarity index 100%
rename from remote-curl.c
rename to nonbuiltin/remote-curl.c
diff --git a/git-remote-testgit.py b/nonbuiltin/remote-testgit.py
similarity index 100%
rename from git-remote-testgit.py
rename to nonbuiltin/remote-testgit.py
diff --git a/git-repack.sh b/nonbuiltin/repack.sh
similarity index 100%
rename from git-repack.sh
rename to nonbuiltin/repack.sh
diff --git a/git-request-pull.sh b/nonbuiltin/request-pull.sh
similarity index 100%
rename from git-request-pull.sh
rename to nonbuiltin/request-pull.sh
diff --git a/git-send-email.perl b/nonbuiltin/send-email.perl
similarity index 100%
rename from git-send-email.perl
rename to nonbuiltin/send-email.perl
diff --git a/git-sh-setup.sh b/nonbuiltin/sh-setup.sh
similarity index 100%
rename from git-sh-setup.sh
rename to nonbuiltin/sh-setup.sh
diff --git a/shell.c b/nonbuiltin/shell.c
similarity index 100%
rename from shell.c
rename to nonbuiltin/shell.c
diff --git a/show-index.c b/nonbuiltin/show-index.c
similarity index 100%
rename from show-index.c
rename to nonbuiltin/show-index.c
diff --git a/git-stash.sh b/nonbuiltin/stash.sh
similarity index 100%
rename from git-stash.sh
rename to nonbuiltin/stash.sh
diff --git a/git-submodule.sh b/nonbuiltin/submodule.sh
similarity index 100%
rename from git-submodule.sh
rename to nonbuiltin/submodule.sh
diff --git a/git-svn.perl b/nonbuiltin/svn.perl
similarity index 100%
rename from git-svn.perl
rename to nonbuiltin/svn.perl
diff --git a/upload-pack.c b/nonbuiltin/upload-pack.c
similarity index 100%
rename from upload-pack.c
rename to nonbuiltin/upload-pack.c
diff --git a/git-web--browse.sh b/nonbuiltin/web--browse.sh
similarity index 100%
rename from git-web--browse.sh
rename to nonbuiltin/web--browse.sh
-- 
1.7.4.1
Jonathan Nieder· Feb 18, 2011, 09:25 UTC · re: Nguyen Thai Ngoc Duy · lore

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

Nguyen Thai Ngoc Duy wrote:
> 2011/2/18 Jonathan Nieder <jrnieder@gmail.com>:
Show 5 quoted 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.

Jeff King· Feb 18, 2011, 11:08 UTC · re: Jonathan Nieder · lore

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

On Fri, Feb 18, 2011 at 03:25:18AM -0600, Jonathan Nieder wrote:
> 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&/
> 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.
>  - renamed nonbuiltin/ to commands/.  Names like
>    commands/add--interactive.perl even seem to make a kind of sense.
Definitely a better name.
>  - moved the http support mini-library to http/.
Seems like a weird one-off to me, as it only has two files.
>  - 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.

> 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
Jonathan Nieder· Feb 18, 2011, 12:33 UTC · re: Jeff King · lore

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

Jeff King wrote:
> On Fri, Feb 18, 2011 at 03:25:18AM -0600, Jonathan Nieder wrote:
>>  - 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.
> 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/
		...
>        - 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
 
>        - 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.

>                          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.)

>        - 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".

Nguyen Thai Ngoc Duy· Feb 18, 2011, 12:33 UTC · re: Jonathan Nieder · lore

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

On Fri, Feb 18, 2011 at 4:25 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> 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.
>  - moved the http support mini-library to http/.
Move them to commands/ as well?
>  - 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?

> 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 ;-)
-- 
Duy
Junio C Hamano· Feb 18, 2011, 18:55 UTC · re: Jonathan Nieder · lore

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

Jonathan Nieder <jrnieder@gmail.com> writes:
> 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?
> 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.
>  - 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 ;-).
>  - 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?

>  - 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.
Jonathan Nieder· Feb 19, 2011, 11:11 UTC · re: Junio C Hamano · lore

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

Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
>>  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:
>>  - 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?
Show 6 quoted 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.
Sverre Rabbelier· Feb 19, 2011, 23:05 UTC · re: Jonathan Nieder · lore

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

Heya,
On Sat, Feb 19, 2011 at 12:11, Jonathan Nieder <jrnieder@gmail.com> wrote:
> 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?

-- 
Cheers,

Sverre Rabbelier
Jonathan Nieder· Feb 19, 2011, 23:15 UTC · re: Sverre Rabbelier · lore

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

Sverre Rabbelier wrote:
> On Sat, Feb 19, 2011 at 12:11, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 7 quoted lines
>> 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

Jeff King· Feb 22, 2011, 15:56 UTC · re: Jonathan Nieder · lore

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

On Sat, Feb 19, 2011 at 05:11:03AM -0600, Jonathan Nieder wrote:
>  - 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
Junio C Hamano· Feb 22, 2011, 19:30 UTC · re: Jeff King · lore

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

Jeff King <peff@peff.net> writes:
Show 13 quoted lines
> On Sat, Feb 19, 2011 at 05:11:03AM -0600, Jonathan Nieder wrote:
>
>>  - 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?

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.

> 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.

> 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.

Sverre Rabbelier· Feb 22, 2011, 19:32 UTC · re: Junio C Hamano · lore

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

Heya,
On Tue, Feb 22, 2011 at 20:30, Junio C Hamano <gitster@pobox.com> wrote:
> 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? ;)
-- 
Cheers,

Sverre Rabbelier
Jeff King· Feb 23, 2011, 04:51 UTC · re: Junio C Hamano · lore

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

On Tue, Feb 22, 2011 at 11:30:41AM -0800, Junio C Hamano wrote:
Show 8 quoted 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.

Show 7 quoted 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
Jonathan Nieder· Feb 23, 2011, 08:29 UTC · re: Jeff King · lore

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

Jeff King wrote:
> On Tue, Feb 22, 2011 at 11:30:41AM -0800, Junio C Hamano wrote:
Show 6 quoted lines
>> 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.

>           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

Jeff King· Feb 23, 2011, 08:43 UTC · re: Jonathan Nieder · lore

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

On Wed, Feb 23, 2011 at 02:29:29AM -0600, Jonathan Nieder wrote:
>     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.
>  B. top-level Makefile slurps in Makefiles from subdirs.  Other
>     Makefiles would
I like this better, but...
>      - 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
Jonathan Nieder· Feb 23, 2011, 09:56 UTC · re: Jeff King · lore

Recursive make and variations on the theme

Jeff King wrote:
Show 9 quoted lines
> 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.

Show 5 quoted 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.

> 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.
> 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

Junio C Hamano· Feb 23, 2011, 16:42 UTC · re: Jeff King · lore

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

Jeff King <peff@peff.net> writes:
Show 11 quoted lines
> On Tue, Feb 22, 2011 at 11:30:41AM -0800, Junio C Hamano wrote:
>
>> > 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?

Nicolas Pitre· Feb 23, 2011, 17:18 UTC · re: Junio C Hamano · lore

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

On Wed, 23 Feb 2011, Junio C Hamano wrote:
Show 16 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > On Tue, Feb 22, 2011 at 11:30:41AM -0800, Junio C Hamano wrote:
> >
> >> > 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?

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
Show 5 quoted lines
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
Drew Northup· Feb 23, 2011, 23:09 UTC · re: Nicolas Pitre · lore

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

On Wed, 2011-02-23 at 12:18 -0500, Nicolas Pitre wrote:
Show 24 quoted lines
> On Wed, 23 Feb 2011, Junio C Hamano wrote:
> 
> > Jeff King <peff@peff.net> writes:
> > 
> > > On Tue, Feb 22, 2011 at 11:30:41AM -0800, Junio C Hamano wrote:
> > >
> > >> > 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?
> 
> 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.

-- 
-Drew Northup
________________________________________________
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59
Nicolas Pitre· Feb 24, 2011, 00:14 UTC · re: Drew Northup · lore

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

On Wed, 23 Feb 2011, Drew Northup wrote:
Show 32 quoted lines
> 
> On Wed, 2011-02-23 at 12:18 -0500, Nicolas Pitre wrote:
> > On Wed, 23 Feb 2011, Junio C Hamano wrote:
> > 
> > > Jeff King <peff@peff.net> writes:
> > > 
> > > > On Tue, Feb 22, 2011 at 11:30:41AM -0800, Junio C Hamano wrote:
> > > >
> > > >> > 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?
> > 
> > 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.
Incidentally I know that (guess whom this proposal came from initially).  ;-)
Show 8 quoted 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
Drew Northup· Feb 24, 2011, 17:10 UTC · re: Nicolas Pitre · lore

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

On Wed, 2011-02-23 at 19:14 -0500, Nicolas Pitre wrote:
Show 51 quoted lines
> On Wed, 23 Feb 2011, Drew Northup wrote:
> 
> > 
> > On Wed, 2011-02-23 at 12:18 -0500, Nicolas Pitre wrote:
> > > On Wed, 23 Feb 2011, Junio C Hamano wrote:
> > > 
> > > > Jeff King <peff@peff.net> writes:
> > > > 
> > > > > On Tue, Feb 22, 2011 at 11:30:41AM -0800, Junio C Hamano wrote:
> > > > >
> > > > >> > 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?
> > > 
> > > 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.
> 
> Incidentally I know that (guess whom this proposal came from initially).  ;-)
> 
> > 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.

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.

-- 
-Drew Northup
________________________________________________
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59
Nicolas Pitre· Feb 24, 2011, 18:04 UTC · re: Drew Northup · lore

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

On Thu, 24 Feb 2011, Drew Northup wrote:
Show 19 quoted lines
> 
> On Wed, 2011-02-23 at 19:14 -0500, Nicolas Pitre wrote:
> > On Wed, 23 Feb 2011, Drew Northup wrote:
> > 
> > > 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.
> 
> 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).

Show 5 quoted 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
Jeff King· Feb 24, 2011, 19:08 UTC · re: Nicolas Pitre · lore

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

On Thu, Feb 24, 2011 at 01:04:21PM -0500, Nicolas Pitre wrote:
Show 12 quoted 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.
> 
> 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
Drew Northup· Feb 24, 2011, 19:46 UTC · re: Jeff King · lore

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

On Thu, 2011-02-24 at 14:08 -0500, Jeff King wrote:
Show 27 quoted lines
> On Thu, Feb 24, 2011 at 01:04:21PM -0500, Nicolas Pitre wrote:
> 
> > > 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).
> 
> 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

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.

-- 
-Drew Northup
________________________________________________
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59
Piotr Krukowiecki· Feb 19, 2011, 00:10 UTC · re: Jonathan Nieder · lore

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

W dniu 18.02.2011 10:25, Jonathan Nieder pisze:
> 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.

> 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
-- 
Piotr Krukowiecki
Junio C Hamano· Feb 19, 2011, 00:31 UTC · re: Piotr Krukowiecki · lore

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

Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:
Show 8 quoted lines
> 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.

> - 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.

Jonathan Nieder· Feb 19, 2011, 00:50 UTC · re: Junio C Hamano · lore

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

Junio C Hamano wrote:
> Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:
Show 8 quoted 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.

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.

Piotr Krukowiecki· Feb 19, 2011, 09:27 UTC · re: Jonathan Nieder · lore

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

W dniu 19.02.2011 01:50, Jonathan Nieder pisze:
> 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
> 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? 
-- 
Piotr Krukowiecki
Piotr Krukowiecki· Feb 19, 2011, 09:24 UTC · re: Junio C Hamano · lore

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

On Sat, Feb 19, 2011 at 1:31 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
> Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:
>
>> 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.
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
Show 6 quoted 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) .

-- 
Piotrek
Jonathan Nieder· Feb 19, 2011, 09:41 UTC · re: Piotr Krukowiecki · lore

Advertising the prebuilt htmldocs and manpages

Piotr Krukowiecki wrote:
> On Sat, Feb 19, 2011 at 1:31 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> We are talking about a source tree; there is no end-user
>> documentation.  Only the sources to it.
[...]
>      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.

Junio C Hamano· Feb 20, 2011, 06:52 UTC · re: Jonathan Nieder · lore

Re: Advertising the prebuilt htmldocs and manpages

Jonathan Nieder <jrnieder@gmail.com> writes:
Show 6 quoted lines
> 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?

Jonathan Nieder· Feb 20, 2011, 09:40 UTC · re: Junio C Hamano · lore

Re: Advertising the prebuilt htmldocs and manpages

Junio C Hamano wrote:
> 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.

Show changes to Documentation/Makefile +16 −1
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 36989b7..9217c05 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -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)

← back to recent threads