Skip to content

Commit 42bf77c

Browse files
committed
Merge branch 'vd/scalar-to-main'
Hoist the remainder of "scalar" out of contrib/ to the main part of the codebase. * vd/scalar-to-main: Documentation/technical: include Scalar technical doc t/perf: add 'GIT_PERF_USE_SCALAR' run option t/perf: add Scalar performance tests scalar-clone: add test coverage scalar: add to 'git help -a' command list scalar: implement the `help` subcommand git help: special-case `scalar` scalar: include in standard Git build & installation scalar: fix command documentation section header
2 parents 9d58241 + 9eb7a73 commit 42bf77c

File tree

19 files changed

+264
-207
lines changed

19 files changed

+264
-207
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
/git-whatchanged
186186
/git-worktree
187187
/git-write-tree
188+
/scalar
188189
/git-core-*/?*
189190
/git.res
190191
/gitweb/GITWEB-BUILD-OPTIONS

Documentation/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ MAN1_TXT += $(filter-out \
2121
MAN1_TXT += git.txt
2222
MAN1_TXT += gitk.txt
2323
MAN1_TXT += gitweb.txt
24+
MAN1_TXT += scalar.txt
2425

2526
# man5 / man7 guides (note: new guides should also be added to command-list.txt)
2627
MAN5_TXT += gitattributes.txt
@@ -116,6 +117,7 @@ TECH_DOCS += technical/parallel-checkout
116117
TECH_DOCS += technical/partial-clone
117118
TECH_DOCS += technical/racy-git
118119
TECH_DOCS += technical/reftable
120+
TECH_DOCS += technical/scalar
119121
TECH_DOCS += technical/send-pack-pipeline
120122
TECH_DOCS += technical/shallow
121123
TECH_DOCS += technical/trivial-merge

Documentation/cmd-list.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ sub format_one {
1010
$state = 0;
1111
open I, '<', "$name.txt" or die "No such file $name.txt";
1212
while (<I>) {
13-
if (/^git[a-z0-9-]*\(([0-9])\)$/) {
13+
if (/^(git|scalar)[a-z0-9-]*\(([0-9])\)$/) {
1414
$mansection = $1;
1515
next;
1616
}

contrib/scalar/scalar.txt renamed to Documentation/scalar.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,6 @@ SEE ALSO
161161
--------
162162
linkgit:git-clone[1], linkgit:git-maintenance[1].
163163

164-
Scalar
164+
GIT
165165
---
166-
Associated with the linkgit:git[1] suite
166+
Part of the linkgit:git[1] suite

Documentation/technical/scalar.txt

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -64,64 +64,3 @@ some "global" `git` options (e.g., `-c` and `-C`).
6464
Because `scalar` is not invoked as a Git subcommand (like `git scalar`), it is
6565
built and installed as its own executable in the `bin/` directory, alongside
6666
`git`, `git-gui`, etc.
67-
68-
Roadmap
69-
-------
70-
71-
NOTE: this section will be removed once the remaining tasks outlined in this
72-
roadmap are complete.
73-
74-
Scalar is a large enough project that it is being upstreamed incrementally,
75-
living in `contrib/` until it is feature-complete. So far, the following patch
76-
series have been accepted:
77-
78-
- `scalar-the-beginning`: The initial patch series which sets up
79-
`contrib/scalar/` and populates it with a minimal `scalar` command that
80-
demonstrates the fundamental ideas.
81-
82-
- `scalar-c-and-C`: The `scalar` command learns about two options that can be
83-
specified before the command, `-c <key>=<value>` and `-C <directory>`.
84-
85-
- `scalar-diagnose`: The `scalar` command is taught the `diagnose` subcommand.
86-
87-
- `scalar-generalize-diagnose`: Move the functionality of `scalar diagnose`
88-
into `git diagnose` and `git bugreport --diagnose`.
89-
90-
- 'scalar-add-fsmonitor: Enable the built-in FSMonitor in Scalar
91-
enlistments. At the end of this series, Scalar should be feature-complete
92-
from the perspective of a user.
93-
94-
Roughly speaking (and subject to change), the following series are needed to
95-
"finish" this initial version of Scalar:
96-
97-
- Move Scalar to toplevel: Move Scalar out of `contrib/` and into the root of
98-
`git`. This includes a variety of related updates, including:
99-
- building & installing Scalar in the Git root-level 'make [install]'.
100-
- builing & testing Scalar as part of CI.
101-
- moving and expanding test coverage of Scalar (including perf tests).
102-
- implementing 'scalar help'/'git help scalar' to display scalar
103-
documentation.
104-
105-
Finally, there are two additional patch series that exist in Microsoft's fork of
106-
Git, but there is no current plan to upstream them. There are some interesting
107-
ideas there, but the implementation is too specific to Azure Repos and/or VFS
108-
for Git to be of much help in general.
109-
110-
These still exist mainly because the GVFS protocol is what Azure Repos has
111-
instead of partial clone, while Git is focused on improving partial clone:
112-
113-
- `scalar-with-gvfs`: The primary purpose of this patch series is to support
114-
existing Scalar users whose repositories are hosted in Azure Repos (which does
115-
not support Git's partial clones, but supports its predecessor, the GVFS
116-
protocol, which is used by Scalar to emulate the partial clone).
117-
118-
Since the GVFS protocol will never be supported by core Git, this patch series
119-
will remain in Microsoft's fork of Git.
120-
121-
- `run-scalar-functional-tests`: The Scalar project developed a quite
122-
comprehensive set of integration tests (or, "Functional Tests"). They are the
123-
sole remaining part of the original C#-based Scalar project, and this patch
124-
adds a GitHub workflow that runs them all.
125-
126-
Since the tests partially depend on features that are only provided in the
127-
`scalar-with-gvfs` patch series, this patch cannot be upstreamed.

Makefile

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,9 @@ FUZZ_OBJS =
605605
FUZZ_PROGRAMS =
606606
GIT_OBJS =
607607
LIB_OBJS =
608+
SCALAR_OBJS =
608609
OBJECTS =
610+
OTHER_PROGRAMS =
609611
PROGRAM_OBJS =
610612
PROGRAMS =
611613
EXCLUDED_PROGRAMS =
@@ -819,10 +821,12 @@ BUILT_INS += git-switch$X
819821
BUILT_INS += git-whatchanged$X
820822

821823
# what 'all' will build but not install in gitexecdir
822-
OTHER_PROGRAMS = git$X
824+
OTHER_PROGRAMS += git$X
825+
OTHER_PROGRAMS += scalar$X
823826

824827
# what test wrappers are needed and 'install' will install, in bindir
825828
BINDIR_PROGRAMS_NEED_X += git
829+
BINDIR_PROGRAMS_NEED_X += scalar
826830
BINDIR_PROGRAMS_NEED_X += git-receive-pack
827831
BINDIR_PROGRAMS_NEED_X += git-shell
828832
BINDIR_PROGRAMS_NEED_X += git-upload-archive
@@ -2220,7 +2224,7 @@ profile-fast: profile-clean
22202224

22212225
all:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
22222226
ifneq (,$X)
2223-
$(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) git$X)), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
2227+
$(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) $(OTHER_PROGRAMS))), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
22242228
endif
22252229

22262230
all::
@@ -2543,7 +2547,12 @@ GIT_OBJS += git.o
25432547
.PHONY: git-objs
25442548
git-objs: $(GIT_OBJS)
25452549

2550+
SCALAR_OBJS += scalar.o
2551+
.PHONY: scalar-objs
2552+
scalar-objs: $(SCALAR_OBJS)
2553+
25462554
OBJECTS += $(GIT_OBJS)
2555+
OBJECTS += $(SCALAR_OBJS)
25472556
OBJECTS += $(PROGRAM_OBJS)
25482557
OBJECTS += $(TEST_OBJS)
25492558
OBJECTS += $(XDIFF_OBJS)
@@ -2554,10 +2563,6 @@ ifndef NO_CURL
25542563
OBJECTS += http.o http-walker.o remote-curl.o
25552564
endif
25562565

2557-
SCALAR_SOURCES := contrib/scalar/scalar.c
2558-
SCALAR_OBJECTS := $(SCALAR_SOURCES:c=o)
2559-
OBJECTS += $(SCALAR_OBJECTS)
2560-
25612566
.PHONY: objects
25622567
objects: $(OBJECTS)
25632568

@@ -2683,7 +2688,7 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS
26832688
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
26842689
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
26852690

2686-
contrib/scalar/scalar$X: $(SCALAR_OBJECTS) GIT-LDFLAGS $(GITLIBS)
2691+
scalar$X: scalar.o GIT-LDFLAGS $(GITLIBS)
26872692
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
26882693
$(filter %.o,$^) $(LIBS)
26892694

@@ -2739,8 +2744,7 @@ XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
27392744
XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
27402745
--keyword=__ --keyword=N__ --keyword="__n:1,2"
27412746
MSGMERGE_FLAGS = --add-location --backup=off --update
2742-
LOCALIZED_C = $(sort $(FOUND_C_SOURCES) $(FOUND_H_SOURCES) $(SCALAR_SOURCES) \
2743-
$(GENERATED_H))
2747+
LOCALIZED_C = $(sort $(FOUND_C_SOURCES) $(FOUND_H_SOURCES) $(GENERATED_H))
27442748
LOCALIZED_SH = $(sort $(SCRIPT_SH) git-sh-setup.sh)
27452749
LOCALIZED_PERL = $(sort $(SCRIPT_PERL))
27462750

@@ -3054,7 +3058,7 @@ bin-wrappers/%: wrap-for-bin.sh
30543058
$(call mkdir_p_parent_template)
30553059
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
30563060
-e 's|@@BUILD_DIR@@|$(shell pwd)|' \
3057-
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%$(X),$(@F))$(patsubst git%,$(X),$(filter $(@F),$(BINDIR_PROGRAMS_NEED_X)))|' < $< > $@ && \
3061+
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
30583062
chmod +x $@
30593063

30603064
# GNU make supports exporting all variables by "export" without parameters.
@@ -3268,14 +3272,14 @@ ifndef NO_TCLTK
32683272
$(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
32693273
endif
32703274
ifneq (,$X)
3271-
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) git$X)), test '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p' -ef '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p$X' || $(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)
3275+
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) $(OTHER_PROGRAMS))), test '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p' -ef '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p$X' || $(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)
32723276
endif
32733277

32743278
bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
32753279
execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
32763280
destdir_from_execdir_SQ=$$(echo '$(gitexecdir_relative_SQ)' | sed -e 's|[^/][^/]*|..|g') && \
32773281
{ test "$$bindir/" = "$$execdir/" || \
3278-
for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
3282+
for p in $(OTHER_PROGRAMS) $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
32793283
$(RM) "$$execdir/$$p" && \
32803284
test -n "$(INSTALL_SYMLINKS)" && \
32813285
ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/$$p" "$$execdir/$$p" || \
@@ -3450,7 +3454,7 @@ clean: profile-clean coverage-clean cocciclean
34503454
$(RM) git.res
34513455
$(RM) $(OBJECTS)
34523456
$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
3453-
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
3457+
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS)
34543458
$(RM) $(TEST_PROGRAMS)
34553459
$(RM) $(FUZZ_PROGRAMS)
34563460
$(RM) $(SP_OBJ)
@@ -3501,6 +3505,7 @@ ALL_COMMANDS += git-citool
35013505
ALL_COMMANDS += git-gui
35023506
ALL_COMMANDS += gitk
35033507
ALL_COMMANDS += gitweb
3508+
ALL_COMMANDS += scalar
35043509

35053510
.PHONY: check-docs
35063511
check-docs::

builtin/help.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,8 @@ static const char *cmd_to_page(const char *git_cmd)
440440
return git_cmd;
441441
else if (is_git_command(git_cmd))
442442
return xstrfmt("git-%s", git_cmd);
443+
else if (!strcmp("scalar", git_cmd))
444+
return xstrdup(git_cmd);
443445
else
444446
return xstrfmt("git%s", git_cmd);
445447
}

command-list.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,4 @@ gittutorial guide
235235
gittutorial-2 guide
236236
gitweb ancillaryinterrogators
237237
gitworkflows guide
238+
scalar mainporcelain

contrib/buildsystems/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ unset(CMAKE_REQUIRED_INCLUDES)
610610
#programs
611611
set(PROGRAMS_BUILT
612612
git git-daemon git-http-backend git-sh-i18n--envsubst
613-
git-shell)
613+
git-shell scalar)
614614

615615
if(NOT CURL_FOUND)
616616
list(APPEND excluded_progs git-http-fetch git-http-push)
@@ -757,6 +757,9 @@ target_link_libraries(git-sh-i18n--envsubst common-main)
757757
add_executable(git-shell ${CMAKE_SOURCE_DIR}/shell.c)
758758
target_link_libraries(git-shell common-main)
759759

760+
add_executable(scalar ${CMAKE_SOURCE_DIR}/scalar.c)
761+
target_link_libraries(scalar common-main)
762+
760763
if(CURL_FOUND)
761764
add_library(http_obj OBJECT ${CMAKE_SOURCE_DIR}/http.c)
762765

@@ -903,7 +906,7 @@ list(TRANSFORM git_perl_scripts PREPEND "${CMAKE_BINARY_DIR}/")
903906

904907
#install
905908
foreach(program ${PROGRAMS_BUILT})
906-
if(program STREQUAL "git" OR program STREQUAL "git-shell")
909+
if(program MATCHES "^(git|git-shell|scalar)$")
907910
install(TARGETS ${program}
908911
RUNTIME DESTINATION bin)
909912
else()
@@ -977,7 +980,7 @@ endif()
977980

978981
#wrapper scripts
979982
set(wrapper_scripts
980-
git git-upload-pack git-receive-pack git-upload-archive git-shell git-remote-ext)
983+
git git-upload-pack git-receive-pack git-upload-archive git-shell git-remote-ext scalar)
981984

982985
set(wrapper_test_scripts
983986
test-fake-ssh test-tool)

contrib/scalar/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)