Fossil SCM

Rewrote the "One vs. Many Check-outs per Repository" section in fossil-v-git.wiki to focus more on default modes of operation and their consequences in response to nit-picking on the Lobste.rs thread about this article pointing out that you can make Git work in the Fossil style. Defaults matter.

wyoung 2019-09-13 12:48 trunk
Commit 10a57cece17e70fff787546f565213e43d6123400a5da3530c540910c848635c
1 file changed +52 -35
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -540,45 +540,62 @@
540540
tightly focused and cohesive implementation.
541541
542542
543543
<h3 id="checkouts">2.6 One vs. Many Check-outs per Repository</h3>
544544
545
-A "repository" in Git is a pile-of-files in the <tt>.git</tt>
546
-subdirectory of a single check-out. The working check-out directory and
547
-the <tt>.git</tt> repository subdirectory are normally in the same
548
-directory within the file system.
549
-
550
-With Fossil, a "repository" is a single SQLite database file that can be
551
-stored anywhere. There can be multiple active check-outs from the same
552
-repository, perhaps open on different branches or on different snapshots
553
-of the same branch. It is common in Fossil to switch branches with a
554
-"<tt>cd</tt>" command between two check-out directories rather than
555
-switching to another branch in place within a single working directory.
556
-Long-running tests or builds can be running in one check-out while
557
-changes are being committed in another.
558
-
559
-From the start, Git has allowed symlinks to this <tt>.git</tt> directory
560
-from multiple working directories. The <tt>git init</tt> command offers
561
-the <tt>--separate-git-dir</tt> option to set this up automatically.
562
-Then in version 2.5, Git added the
563
-"[https://git-scm.com/docs/git-worktree|git-worktree]" feature to
564
-provide a higher-level management interface atop this basic mechanism.
565
-Use of this more closely emulates Fossil's decoupling of repository and
566
-working directory, but the fact remains that it is far more common in
567
-Git usage to simply switch a single working directory among branches in
568
-place.
569
-
570
-The main downside of that working style is that it invalidates all build
571
-objects created from files that change in switching between branches.
572
-When you have multiple working directories for a single repository, you
573
-can have a completely independent state in each working directory which
574
-is untouched by the "<tt>cd</tt>" command you use to switch among them.
575
-
576
-There are also practical consequences of the way <tt>.git</tt> links
577
-work that make multiple working directories in Git
578
-[https://duckduckgo.com/?q=git+worktree+problem | not quite
579
-interchangeable], as they are in Fossil.
545
+The default mode of operation in Git is to have a single working
546
+directory with a single <tt>.git</tt> subdirectory holding the actual
547
+local repository contents.
548
+
549
+Fossil doesn't work that way. A Fossil repository is a SQLite database
550
+file which is normally stored outside the working directory. You can
551
+[/help?cmd=open | open] a Fossil repository any number of times into
552
+any number of working directories. A common usage pattern is to have one
553
+working directory per active working branch, so that switching branches
554
+is done with a <tt>cd</tt> command rather than by checking out the
555
+branches successively in a single working directory.
556
+
557
+You can use Git in the Fossil style, either by manually symlinking the
558
+<tt>.git</tt> directory from one working directory to another or by use
559
+of the <tt>[https://git-scm.com/docs/git-worktree|git-worktree]</tt>
560
+feature. Nevertheless, Git's default tie between working directory and
561
+repository means the standard method for working with a Git repo is to
562
+have one working directory only. Most Git tutorials teach this style, so
563
+it is how most people learn to use Git. Because relatively few people
564
+use Git with multiple working directories per repository, there are
565
+[https://duckduckgo.com/?q=git+worktree+problem | several known
566
+problems] in working that way, which don't happen in Fossil because of
567
+the clear separation between repository and working directory.
568
+
569
+Switching branches inside a single working directory loses local context
570
+on each switch.
571
+
572
+For instance, in any software project where the runnable program must be
573
+built from source files, you invalidate build objects on each switch,
574
+artificially increasing the time required to switch versions. This
575
+affects software written in statically-compiled programming languages
576
+such as C, Java, and Haskell, but it can even affect programs written in
577
+dynamic languages like JavaScript. A common
578
+[https://en.wikipedia.org/wiki/Single-page_application | SPA] build
579
+process involves a [http://browserify.org/ | Browserify] pass to convert
580
+[https://nodejs.org/ | Node] packages to run in a web browser,
581
+[https://sass-lang.com | SASS files] to CSS,
582
+[https://www.typescriptlang.org | Typescript] to JavaScript, etc., to
583
+say nothing of [https://github.com/mishoo/UglifyJS | uglification] and
584
+other passes. Once all that processing work is done for a given input
585
+file in a given working directory, why re-do that work just to switch
586
+versions?
587
+
588
+For another example, you might have an active long-running test grinding
589
+away in a working directory, then get a call from a customer requiring
590
+that you switch to a stable branch to answer questions in terms of the
591
+version that customer is running. You don't want to stop the test in
592
+order to switch your lone working directory to the stable branch.
593
+
594
+Disk space is cheap. Having several working directories, each with its
595
+own local state, makes switching versions cheap and fast. Plus,
596
+<tt>cd</tt> is faster to type than <tt>git checkout</tt>.
580597
581598
582599
<h3 id="history">2.7 What you should have done vs. What you actually did</h3>
583600
584601
Git puts a lot of emphasis on maintaining
585602
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -540,45 +540,62 @@
540 tightly focused and cohesive implementation.
541
542
543 <h3 id="checkouts">2.6 One vs. Many Check-outs per Repository</h3>
544
545 A "repository" in Git is a pile-of-files in the <tt>.git</tt>
546 subdirectory of a single check-out. The working check-out directory and
547 the <tt>.git</tt> repository subdirectory are normally in the same
548 directory within the file system.
549
550 With Fossil, a "repository" is a single SQLite database file that can be
551 stored anywhere. There can be multiple active check-outs from the same
552 repository, perhaps open on different branches or on different snapshots
553 of the same branch. It is common in Fossil to switch branches with a
554 "<tt>cd</tt>" command between two check-out directories rather than
555 switching to another branch in place within a single working directory.
556 Long-running tests or builds can be running in one check-out while
557 changes are being committed in another.
558
559 From the start, Git has allowed symlinks to this <tt>.git</tt> directory
560 from multiple working directories. The <tt>git init</tt> command offers
561 the <tt>--separate-git-dir</tt> option to set this up automatically.
562 Then in version 2.5, Git added the
563 "[https://git-scm.com/docs/git-worktree|git-worktree]" feature to
564 provide a higher-level management interface atop this basic mechanism.
565 Use of this more closely emulates Fossil's decoupling of repository and
566 working directory, but the fact remains that it is far more common in
567 Git usage to simply switch a single working directory among branches in
568 place.
569
570 The main downside of that working style is that it invalidates all build
571 objects created from files that change in switching between branches.
572 When you have multiple working directories for a single repository, you
573 can have a completely independent state in each working directory which
574 is untouched by the "<tt>cd</tt>" command you use to switch among them.
575
576 There are also practical consequences of the way <tt>.git</tt> links
577 work that make multiple working directories in Git
578 [https://duckduckgo.com/?q=git+worktree+problem | not quite
579 interchangeable], as they are in Fossil.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
580
581
582 <h3 id="history">2.7 What you should have done vs. What you actually did</h3>
583
584 Git puts a lot of emphasis on maintaining
585
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -540,45 +540,62 @@
540 tightly focused and cohesive implementation.
541
542
543 <h3 id="checkouts">2.6 One vs. Many Check-outs per Repository</h3>
544
545 The default mode of operation in Git is to have a single working
546 directory with a single <tt>.git</tt> subdirectory holding the actual
547 local repository contents.
548
549 Fossil doesn't work that way. A Fossil repository is a SQLite database
550 file which is normally stored outside the working directory. You can
551 [/help?cmd=open | open] a Fossil repository any number of times into
552 any number of working directories. A common usage pattern is to have one
553 working directory per active working branch, so that switching branches
554 is done with a <tt>cd</tt> command rather than by checking out the
555 branches successively in a single working directory.
556
557 You can use Git in the Fossil style, either by manually symlinking the
558 <tt>.git</tt> directory from one working directory to another or by use
559 of the <tt>[https://git-scm.com/docs/git-worktree|git-worktree]</tt>
560 feature. Nevertheless, Git's default tie between working directory and
561 repository means the standard method for working with a Git repo is to
562 have one working directory only. Most Git tutorials teach this style, so
563 it is how most people learn to use Git. Because relatively few people
564 use Git with multiple working directories per repository, there are
565 [https://duckduckgo.com/?q=git+worktree+problem | several known
566 problems] in working that way, which don't happen in Fossil because of
567 the clear separation between repository and working directory.
568
569 Switching branches inside a single working directory loses local context
570 on each switch.
571
572 For instance, in any software project where the runnable program must be
573 built from source files, you invalidate build objects on each switch,
574 artificially increasing the time required to switch versions. This
575 affects software written in statically-compiled programming languages
576 such as C, Java, and Haskell, but it can even affect programs written in
577 dynamic languages like JavaScript. A common
578 [https://en.wikipedia.org/wiki/Single-page_application | SPA] build
579 process involves a [http://browserify.org/ | Browserify] pass to convert
580 [https://nodejs.org/ | Node] packages to run in a web browser,
581 [https://sass-lang.com | SASS files] to CSS,
582 [https://www.typescriptlang.org | Typescript] to JavaScript, etc., to
583 say nothing of [https://github.com/mishoo/UglifyJS | uglification] and
584 other passes. Once all that processing work is done for a given input
585 file in a given working directory, why re-do that work just to switch
586 versions?
587
588 For another example, you might have an active long-running test grinding
589 away in a working directory, then get a call from a customer requiring
590 that you switch to a stable branch to answer questions in terms of the
591 version that customer is running. You don't want to stop the test in
592 order to switch your lone working directory to the stable branch.
593
594 Disk space is cheap. Having several working directories, each with its
595 own local state, makes switching versions cheap and fast. Plus,
596 <tt>cd</tt> is faster to type than <tt>git checkout</tt>.
597
598
599 <h3 id="history">2.7 What you should have done vs. What you actually did</h3>
600
601 Git puts a lot of emphasis on maintaining
602

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button