Small Group Tutorials

Here to help students catch up, keep up, and move ahead. Book a consultation here.

How to Master Git mktree in Punggol Tuition

Canal, playground and seating at Punggol Waterway Park beside Waterway Point

When a learner can reproduce a familiar example but a small variation causes confusion, the problem is usually an incomplete model rather than a lack of effort. The fastest useful response is to expose the hidden state and test one boundary at a time.

Git mktree reads non-recursive git ls-tree-formatted records from standard input, writes a tree object into the object database, and prints the resulting object ID. It normalises entry order, verifies referenced objects by default, accepts NUL-terminated input with -z, can create several trees in one process with –batch, and can relax most existence checks with –missing; gitlink entries are allowed to refer to missing commits even without that option. The command does not create a commit, move a branch, populate the working tree or stage ordinary files for a user. Mastery means understanding tree-entry modes and names, separating object creation from reachability, and using plumbing only inside a disposable repository with explicit verification by cat-file, ls-tree and fsck. This guide begins with that mechanism, then develops it through worked traces, deliberate mistakes, explained practice and transfer decisions.

The aim is independent reasoning. A learner should be able to predict behaviour, locate the earliest wrong assumption, use a safe diagnostic procedure and defend a design choice in a new project.

Punggol families can use the guide in short sessions around homework, CCAs and rest. The activities are proposed learning exercises, not claims about a physical branch, timetable, class size, fee, school relationship or guaranteed result.

Use disposable data and repositories, preserve backups, and check version-sensitive details against the official source. Current documentation settles a technical contract; observation and explanation turn that contract into usable knowledge.

Find your next learning step

Choose the route that matches the present difficulty. Use the complete index for a systematic course.

Build the model

Chapters 1-4 . Begin here, then continue after the learner can predict, verify and explain.

Use the core tools

Chapters 5-8 . Begin here, then continue after the learner can predict, verify and explain.

Handle boundaries

Chapters 9-12 . Begin here, then continue after the learner can predict, verify and explain.

Debug and verify

Chapters 13-16 . Begin here, then continue after the learner can predict, verify and explain.

Transfer with judgment

Chapters 17-20 . Begin here, then continue after the learner can predict, verify and explain.

Open the full chapter index . Jump to capstone practice . Use the How Studying Works hub . Read the official documentation

CHAPTER 1 OF 20 . Build the model

1. mktree builds one tree object from records

Back to contents

git mktree reads non-recursive ls-tree-formatted entries on standard input and prints the ID of the tree it creates. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is expecting it to scan the current directory automatically. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for mktree builds one tree object from records, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the mktree builds one tree object from records chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on expecting it to scan the current directory automatically. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

blob=$(printf 'lesson
' | git hash-object -w --stdin)
printf '100644 blob %s	lesson.txt
' "$blob" | git mktree

Explained result. The command prints a tree object ID for a tree containing lesson.txt. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework repository. Predict the rule using two existing blobs are assembled into a tree without touching the working tree. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “git mktree reads non-recursive ls-tree-formatted entries on standard input and prints the ID of the tree it creates.” Apply this procedure: State the contract for mktree builds one tree object from records, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The command prints a tree object ID for a tree containing lesson.txt. For the homework repository, add one near-miss that exposes expecting it to scan the current directory automatically. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading archive. Contrast the rule using a nested subtree is built bottom-up and inspected by object ID. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “git mktree reads non-recursive ls-tree-formatted entries on standard input and prints the ID of the tree it creates.” Apply this procedure: State the contract for mktree builds one tree object from records, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The command prints a tree object ID for a tree containing lesson.txt. For the reading archive, add one near-miss that exposes expecting it to scan the current directory automatically. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: science project. Stress-test the rule using regular, executable and symbolic-link modes are compared. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “git mktree reads non-recursive ls-tree-formatted entries on standard input and prints the ID of the tree it creates.” Apply this procedure: State the contract for mktree builds one tree object from records, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The command prints a tree object ID for a tree containing lesson.txt. For the science project, add one near-miss that exposes expecting it to scan the current directory automatically. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: CCA website. Explain the rule using NUL records protect names containing tabs or newlines. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “git mktree reads non-recursive ls-tree-formatted entries on standard input and prints the ID of the tree it creates.” Apply this procedure: State the contract for mktree builds one tree object from records, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The command prints a tree object ID for a tree containing lesson.txt. For the CCA website, add one near-miss that exposes expecting it to scan the current directory automatically. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers expecting it to scan the current directory automatically.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for mktree builds one tree object from records, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from mktree builds one tree object from records?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing expecting it to scan the current directory automatically be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny library catalogue with a round trip through ls-tree and mktree verifies canonical object identity. Include one ordinary case, one boundary and one deliberate failure caused by expecting it to scan the current directory automatically. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: git mktree reads non-recursive ls-tree-formatted entries on standard input and prints the ID of the tree it creates. It shows a trace, not only a final value. The ordinary case should demonstrate “The command prints a tree object ID for a tree containing lesson.txt.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for mktree builds one tree object from records, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For mktree builds one tree object from records, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 2 OF 20 . Build the model

2. Input records name a mode type object and path

Back to contents

A conventional text record contains the entry mode, object type, object ID, a tab and the entry name. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is feeding porcelain status output or an arbitrary space-separated list. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Input records name a mode type object and path, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Input records name a mode type object and path chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on feeding porcelain status output or an arbitrary space-separated list. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

printf '100644 blob %s	notes.txt
' "$blob" | git mktree

Explained result. The structured record is accepted because it follows ls-tree output form. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: science project. Contrast the rule using regular, executable and symbolic-link modes are compared. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A conventional text record contains the entry mode, object type, object ID, a tab and the entry name.” Apply this procedure: State the contract for Input records name a mode type object and path, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The structured record is accepted because it follows ls-tree output form. For the science project, add one near-miss that exposes feeding porcelain status output or an arbitrary space-separated list. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: CCA website. Stress-test the rule using NUL records protect names containing tabs or newlines. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A conventional text record contains the entry mode, object type, object ID, a tab and the entry name.” Apply this procedure: State the contract for Input records name a mode type object and path, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The structured record is accepted because it follows ls-tree output form. For the CCA website, add one near-miss that exposes feeding porcelain status output or an arbitrary space-separated list. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: family archive. Explain the rule using batch input produces several independent trees with clear separators. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A conventional text record contains the entry mode, object type, object ID, a tab and the entry name.” Apply this procedure: State the contract for Input records name a mode type object and path, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The structured record is accepted because it follows ls-tree output form. For the family archive, add one near-miss that exposes feeding porcelain status output or an arbitrary space-separated list. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library catalogue. Transfer the rule using a round trip through ls-tree and mktree verifies canonical object identity. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A conventional text record contains the entry mode, object type, object ID, a tab and the entry name.” Apply this procedure: State the contract for Input records name a mode type object and path, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The structured record is accepted because it follows ls-tree output form. For the library catalogue, add one near-miss that exposes feeding porcelain status output or an arbitrary space-separated list. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers feeding porcelain status output or an arbitrary space-separated list.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Input records name a mode type object and path, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from Input records name a mode type object and path?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing feeding porcelain status output or an arbitrary space-separated list be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny test laboratory with missing objects, gitlinks, duplicate names and invalid records expose boundaries. Include one ordinary case, one boundary and one deliberate failure caused by feeding porcelain status output or an arbitrary space-separated list. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: A conventional text record contains the entry mode, object type, object ID, a tab and the entry name. It shows a trace, not only a final value. The ordinary case should demonstrate “The structured record is accepted because it follows ls-tree output form.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Input records name a mode type object and path, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Input records name a mode type object and path, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 3 OF 20 . Build the model

3. Referenced blobs must already exist by default

Back to contents

Without –missing, each ordinary entry object ID is checked against the local object database. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is inventing a hexadecimal ID and assuming the tree stores raw content there. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Referenced blobs must already exist by default, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Referenced blobs must already exist by default chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on inventing a hexadecimal ID and assuming the tree stores raw content there. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

fake=1111111111111111111111111111111111111111
printf '100644 blob %s	missing.txt
' "$fake" | git mktree

Explained result. The absent blob is rejected; create or obtain the object before building an ordinary complete tree. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: family archive. Stress-test the rule using batch input produces several independent trees with clear separators. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Without –missing, each ordinary entry object ID is checked against the local object database.” Apply this procedure: State the contract for Referenced blobs must already exist by default, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The absent blob is rejected; create or obtain the object before building an ordinary complete tree. For the family archive, add one near-miss that exposes inventing a hexadecimal ID and assuming the tree stores raw content there. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library catalogue. Explain the rule using a round trip through ls-tree and mktree verifies canonical object identity. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Without –missing, each ordinary entry object ID is checked against the local object database.” Apply this procedure: State the contract for Referenced blobs must already exist by default, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The absent blob is rejected; create or obtain the object before building an ordinary complete tree. For the library catalogue, add one near-miss that exposes inventing a hexadecimal ID and assuming the tree stores raw content there. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Transfer the rule using missing objects, gitlinks, duplicate names and invalid records expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Without –missing, each ordinary entry object ID is checked against the local object database.” Apply this procedure: State the contract for Referenced blobs must already exist by default, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The absent blob is rejected; create or obtain the object before building an ordinary complete tree. For the test laboratory, add one near-miss that exposes inventing a hexadecimal ID and assuming the tree stores raw content there. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Predict the rule using mktree is compared with add, write-tree, hash-object, commit-tree and update-ref. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Without –missing, each ordinary entry object ID is checked against the local object database.” Apply this procedure: State the contract for Referenced blobs must already exist by default, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The absent blob is rejected; create or obtain the object before building an ordinary complete tree. For the tool decision, add one near-miss that exposes inventing a hexadecimal ID and assuming the tree stores raw content there. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers inventing a hexadecimal ID and assuming the tree stores raw content there.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Referenced blobs must already exist by default, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from Referenced blobs must already exist by default?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing inventing a hexadecimal ID and assuming the tree stores raw content there be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny tool decision with mktree is compared with add, write-tree, hash-object, commit-tree and update-ref. Include one ordinary case, one boundary and one deliberate failure caused by inventing a hexadecimal ID and assuming the tree stores raw content there. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Without –missing, each ordinary entry object ID is checked against the local object database. It shows a trace, not only a final value. The ordinary case should demonstrate “The absent blob is rejected; create or obtain the object before building an ordinary complete tree.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Referenced blobs must already exist by default, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Referenced blobs must already exist by default, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 4 OF 20 . Build the model

4. A tree object is not a commit

Back to contents

mktree records a directory snapshot object; it does not add author, parent or message metadata. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is using the printed tree ID as though it were a branch-ready commit ID. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for A tree object is not a commit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the A tree object is not a commit chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on using the printed tree ID as though it were a branch-ready commit ID. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

tree=$(printf '100644 blob %s	lesson.txt
' "$blob" | git mktree)
git cat-file -t "$tree"

Explained result. cat-file reports tree, not commit. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: test laboratory. Explain the rule using missing objects, gitlinks, duplicate names and invalid records expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “mktree records a directory snapshot object; it does not add author, parent or message metadata.” Apply this procedure: State the contract for A tree object is not a commit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: cat-file reports tree, not commit. For the test laboratory, add one near-miss that exposes using the printed tree ID as though it were a branch-ready commit ID. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Transfer the rule using mktree is compared with add, write-tree, hash-object, commit-tree and update-ref. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “mktree records a directory snapshot object; it does not add author, parent or message metadata.” Apply this procedure: State the contract for A tree object is not a commit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: cat-file reports tree, not commit. For the tool decision, add one near-miss that exposes using the printed tree ID as though it were a branch-ready commit ID. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework repository. Predict the rule using two existing blobs are assembled into a tree without touching the working tree. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “mktree records a directory snapshot object; it does not add author, parent or message metadata.” Apply this procedure: State the contract for A tree object is not a commit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: cat-file reports tree, not commit. For the homework repository, add one near-miss that exposes using the printed tree ID as though it were a branch-ready commit ID. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading archive. Contrast the rule using a nested subtree is built bottom-up and inspected by object ID. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “mktree records a directory snapshot object; it does not add author, parent or message metadata.” Apply this procedure: State the contract for A tree object is not a commit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: cat-file reports tree, not commit. For the reading archive, add one near-miss that exposes using the printed tree ID as though it were a branch-ready commit ID. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers using the printed tree ID as though it were a branch-ready commit ID.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for A tree object is not a commit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from A tree object is not a commit?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using the printed tree ID as though it were a branch-ready commit ID be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny homework repository with two existing blobs are assembled into a tree without touching the working tree. Include one ordinary case, one boundary and one deliberate failure caused by using the printed tree ID as though it were a branch-ready commit ID. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: mktree records a directory snapshot object; it does not add author, parent or message metadata. It shows a trace, not only a final value. The ordinary case should demonstrate “cat-file reports tree, not commit.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for A tree object is not a commit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For A tree object is not a commit, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 5 OF 20 . Use the core tools

5. Creating a tree does not move a reference

Back to contents

The new object is initially reachable only through whatever later object or reference the user creates. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is expecting HEAD or the current branch to advance automatically. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Creating a tree does not move a reference, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Creating a tree does not move a reference chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on expecting HEAD or the current branch to advance automatically. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

before=$(git rev-parse HEAD)
tree=$(printf '100644 blob %s	lesson.txt
' "$blob" | git mktree)
after=$(git rev-parse HEAD)
test "$before" = "$after" && echo unchanged

Explained result. The branch remains unchanged after tree creation. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework repository. Transfer the rule using two existing blobs are assembled into a tree without touching the working tree. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The new object is initially reachable only through whatever later object or reference the user creates.” Apply this procedure: State the contract for Creating a tree does not move a reference, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The branch remains unchanged after tree creation. For the homework repository, add one near-miss that exposes expecting HEAD or the current branch to advance automatically. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading archive. Predict the rule using a nested subtree is built bottom-up and inspected by object ID. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The new object is initially reachable only through whatever later object or reference the user creates.” Apply this procedure: State the contract for Creating a tree does not move a reference, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The branch remains unchanged after tree creation. For the reading archive, add one near-miss that exposes expecting HEAD or the current branch to advance automatically. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: science project. Contrast the rule using regular, executable and symbolic-link modes are compared. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The new object is initially reachable only through whatever later object or reference the user creates.” Apply this procedure: State the contract for Creating a tree does not move a reference, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The branch remains unchanged after tree creation. For the science project, add one near-miss that exposes expecting HEAD or the current branch to advance automatically. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: CCA website. Stress-test the rule using NUL records protect names containing tabs or newlines. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The new object is initially reachable only through whatever later object or reference the user creates.” Apply this procedure: State the contract for Creating a tree does not move a reference, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The branch remains unchanged after tree creation. For the CCA website, add one near-miss that exposes expecting HEAD or the current branch to advance automatically. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers expecting HEAD or the current branch to advance automatically.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Creating a tree does not move a reference, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from Creating a tree does not move a reference?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing expecting HEAD or the current branch to advance automatically be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny reading archive with a nested subtree is built bottom-up and inspected by object ID. Include one ordinary case, one boundary and one deliberate failure caused by expecting HEAD or the current branch to advance automatically. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: The new object is initially reachable only through whatever later object or reference the user creates. It shows a trace, not only a final value. The ordinary case should demonstrate “The branch remains unchanged after tree creation.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Creating a tree does not move a reference, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Creating a tree does not move a reference, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 6 OF 20 . Use the core tools

6. Regular non-executable files use mode 100644

Back to contents

A normal blob entry commonly uses canonical Git mode 100644. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is copying every local permission bit into the tree record. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Regular non-executable files use mode 100644, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Regular non-executable files use mode 100644 chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on copying every local permission bit into the tree record. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

printf '100644 blob %s	answer.txt
' "$blob" | git mktree

Explained result. The resulting tree records a normal non-executable file entry. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: science project. Predict the rule using regular, executable and symbolic-link modes are compared. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A normal blob entry commonly uses canonical Git mode 100644.” Apply this procedure: State the contract for Regular non-executable files use mode 100644, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The resulting tree records a normal non-executable file entry. For the science project, add one near-miss that exposes copying every local permission bit into the tree record. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: CCA website. Contrast the rule using NUL records protect names containing tabs or newlines. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A normal blob entry commonly uses canonical Git mode 100644.” Apply this procedure: State the contract for Regular non-executable files use mode 100644, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The resulting tree records a normal non-executable file entry. For the CCA website, add one near-miss that exposes copying every local permission bit into the tree record. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: family archive. Stress-test the rule using batch input produces several independent trees with clear separators. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A normal blob entry commonly uses canonical Git mode 100644.” Apply this procedure: State the contract for Regular non-executable files use mode 100644, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The resulting tree records a normal non-executable file entry. For the family archive, add one near-miss that exposes copying every local permission bit into the tree record. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library catalogue. Explain the rule using a round trip through ls-tree and mktree verifies canonical object identity. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A normal blob entry commonly uses canonical Git mode 100644.” Apply this procedure: State the contract for Regular non-executable files use mode 100644, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The resulting tree records a normal non-executable file entry. For the library catalogue, add one near-miss that exposes copying every local permission bit into the tree record. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers copying every local permission bit into the tree record.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Regular non-executable files use mode 100644, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from Regular non-executable files use mode 100644?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing copying every local permission bit into the tree record be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny science project with regular, executable and symbolic-link modes are compared. Include one ordinary case, one boundary and one deliberate failure caused by copying every local permission bit into the tree record. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: A normal blob entry commonly uses canonical Git mode 100644. It shows a trace, not only a final value. The ordinary case should demonstrate “The resulting tree records a normal non-executable file entry.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Regular non-executable files use mode 100644, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Regular non-executable files use mode 100644, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 7 OF 20 . Use the core tools

7. Executable files use mode 100755

Back to contents

Git trees distinguish the executable bit for regular files with mode 100755. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is using mode 100777 and expecting Git to preserve all write bits. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Executable files use mode 100755, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Executable files use mode 100755 chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on using mode 100777 and expecting Git to preserve all write bits. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

printf '100755 blob %s	run-study.sh
' "$blob" | git mktree

Explained result. The tree stores an executable regular-file entry using Git’s supported mode. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: family archive. Contrast the rule using batch input produces several independent trees with clear separators. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Git trees distinguish the executable bit for regular files with mode 100755.” Apply this procedure: State the contract for Executable files use mode 100755, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tree stores an executable regular-file entry using Git’s supported mode. For the family archive, add one near-miss that exposes using mode 100777 and expecting Git to preserve all write bits. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library catalogue. Stress-test the rule using a round trip through ls-tree and mktree verifies canonical object identity. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Git trees distinguish the executable bit for regular files with mode 100755.” Apply this procedure: State the contract for Executable files use mode 100755, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tree stores an executable regular-file entry using Git’s supported mode. For the library catalogue, add one near-miss that exposes using mode 100777 and expecting Git to preserve all write bits. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Explain the rule using missing objects, gitlinks, duplicate names and invalid records expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Git trees distinguish the executable bit for regular files with mode 100755.” Apply this procedure: State the contract for Executable files use mode 100755, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tree stores an executable regular-file entry using Git’s supported mode. For the test laboratory, add one near-miss that exposes using mode 100777 and expecting Git to preserve all write bits. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Transfer the rule using mktree is compared with add, write-tree, hash-object, commit-tree and update-ref. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Git trees distinguish the executable bit for regular files with mode 100755.” Apply this procedure: State the contract for Executable files use mode 100755, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tree stores an executable regular-file entry using Git’s supported mode. For the tool decision, add one near-miss that exposes using mode 100777 and expecting Git to preserve all write bits. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers using mode 100777 and expecting Git to preserve all write bits.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Executable files use mode 100755, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from Executable files use mode 100755?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using mode 100777 and expecting Git to preserve all write bits be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny CCA website with NUL records protect names containing tabs or newlines. Include one ordinary case, one boundary and one deliberate failure caused by using mode 100777 and expecting Git to preserve all write bits. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Git trees distinguish the executable bit for regular files with mode 100755. It shows a trace, not only a final value. The ordinary case should demonstrate “The tree stores an executable regular-file entry using Git’s supported mode.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Executable files use mode 100755, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Executable files use mode 100755, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

A symlink entry stores the link target as blob bytes and uses mode 120000. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is pointing the record at the target file’s blob instead of a blob containing the target path text. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Symbolic links use mode 120000 with blob content, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Symbolic links use mode 120000 with blob content chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on pointing the record at the target file’s blob instead of a blob containing the target path text. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

linkblob=$(printf 'lesson.txt' | git hash-object -w --stdin)
printf '120000 blob %s	latest.txt
' "$linkblob" | git mktree

Explained result. The tree stores latest.txt as a symbolic-link entry whose blob content names lesson.txt. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: test laboratory. Stress-test the rule using missing objects, gitlinks, duplicate names and invalid records expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A symlink entry stores the link target as blob bytes and uses mode 120000.” Apply this procedure: State the contract for Symbolic links use mode 120000 with blob content, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tree stores latest.txt as a symbolic-link entry whose blob content names lesson.txt. For the test laboratory, add one near-miss that exposes pointing the record at the target file’s blob instead of a blob containing the target path text. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Explain the rule using mktree is compared with add, write-tree, hash-object, commit-tree and update-ref. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A symlink entry stores the link target as blob bytes and uses mode 120000.” Apply this procedure: State the contract for Symbolic links use mode 120000 with blob content, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tree stores latest.txt as a symbolic-link entry whose blob content names lesson.txt. For the tool decision, add one near-miss that exposes pointing the record at the target file’s blob instead of a blob containing the target path text. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework repository. Transfer the rule using two existing blobs are assembled into a tree without touching the working tree. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A symlink entry stores the link target as blob bytes and uses mode 120000.” Apply this procedure: State the contract for Symbolic links use mode 120000 with blob content, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tree stores latest.txt as a symbolic-link entry whose blob content names lesson.txt. For the homework repository, add one near-miss that exposes pointing the record at the target file’s blob instead of a blob containing the target path text. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading archive. Predict the rule using a nested subtree is built bottom-up and inspected by object ID. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A symlink entry stores the link target as blob bytes and uses mode 120000.” Apply this procedure: State the contract for Symbolic links use mode 120000 with blob content, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tree stores latest.txt as a symbolic-link entry whose blob content names lesson.txt. For the reading archive, add one near-miss that exposes pointing the record at the target file’s blob instead of a blob containing the target path text. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers pointing the record at the target file’s blob instead of a blob containing the target path text.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Symbolic links use mode 120000 with blob content, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from Symbolic links use mode 120000 with blob content?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing pointing the record at the target file’s blob instead of a blob containing the target path text be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny family archive with batch input produces several independent trees with clear separators. Include one ordinary case, one boundary and one deliberate failure caused by pointing the record at the target file’s blob instead of a blob containing the target path text. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: A symlink entry stores the link target as blob bytes and uses mode 120000. It shows a trace, not only a final value. The ordinary case should demonstrate “The tree stores latest.txt as a symbolic-link entry whose blob content names lesson.txt.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Symbolic links use mode 120000 with blob content, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Symbolic links use mode 120000 with blob content, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 9 OF 20 . Handle boundaries

9. Subdirectories use mode 040000 and a tree object

Back to contents

A nested directory entry points to an already-created tree and uses tree mode 040000. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is pointing a directory entry directly at a file blob. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Subdirectories use mode 040000 and a tree object, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Subdirectories use mode 040000 and a tree object chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on pointing a directory entry directly at a file blob. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

child=$(printf '100644 blob %s	page.txt
' "$blob" | git mktree)
printf '040000 tree %s	chapter
' "$child" | git mktree

Explained result. The parent tree contains a chapter entry whose object is the child tree. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework repository. Explain the rule using two existing blobs are assembled into a tree without touching the working tree. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A nested directory entry points to an already-created tree and uses tree mode 040000.” Apply this procedure: State the contract for Subdirectories use mode 040000 and a tree object, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The parent tree contains a chapter entry whose object is the child tree. For the homework repository, add one near-miss that exposes pointing a directory entry directly at a file blob. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading archive. Transfer the rule using a nested subtree is built bottom-up and inspected by object ID. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A nested directory entry points to an already-created tree and uses tree mode 040000.” Apply this procedure: State the contract for Subdirectories use mode 040000 and a tree object, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The parent tree contains a chapter entry whose object is the child tree. For the reading archive, add one near-miss that exposes pointing a directory entry directly at a file blob. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: science project. Predict the rule using regular, executable and symbolic-link modes are compared. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A nested directory entry points to an already-created tree and uses tree mode 040000.” Apply this procedure: State the contract for Subdirectories use mode 040000 and a tree object, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The parent tree contains a chapter entry whose object is the child tree. For the science project, add one near-miss that exposes pointing a directory entry directly at a file blob. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: CCA website. Contrast the rule using NUL records protect names containing tabs or newlines. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A nested directory entry points to an already-created tree and uses tree mode 040000.” Apply this procedure: State the contract for Subdirectories use mode 040000 and a tree object, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The parent tree contains a chapter entry whose object is the child tree. For the CCA website, add one near-miss that exposes pointing a directory entry directly at a file blob. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers pointing a directory entry directly at a file blob.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Subdirectories use mode 040000 and a tree object, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from Subdirectories use mode 040000 and a tree object?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing pointing a directory entry directly at a file blob be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny library catalogue with a round trip through ls-tree and mktree verifies canonical object identity. Include one ordinary case, one boundary and one deliberate failure caused by pointing a directory entry directly at a file blob. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: A nested directory entry points to an already-created tree and uses tree mode 040000. It shows a trace, not only a final value. The ordinary case should demonstrate “The parent tree contains a chapter entry whose object is the child tree.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Subdirectories use mode 040000 and a tree object, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Subdirectories use mode 040000 and a tree object, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 10 OF 20 . Handle boundaries

10. Trees are built bottom-up

Back to contents

Because a parent entry needs the child tree ID, nested structures are normally created from deepest tree to root. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is trying to create a parent before any child object ID exists. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Trees are built bottom-up, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Trees are built bottom-up chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on trying to create a parent before any child object ID exists. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

leaf=$(printf '100644 blob %s	leaf.txt
' "$blob" | git mktree)
root=$(printf '040000 tree %s	chapter
' "$leaf" | git mktree)

Explained result. The child tree exists before the parent records it under the directory name chapter. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: science project. Transfer the rule using regular, executable and symbolic-link modes are compared. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Because a parent entry needs the child tree ID, nested structures are normally created from deepest tree to root.” Apply this procedure: State the contract for Trees are built bottom-up, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The child tree exists before the parent records it under the directory name chapter. For the science project, add one near-miss that exposes trying to create a parent before any child object ID exists. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: CCA website. Predict the rule using NUL records protect names containing tabs or newlines. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Because a parent entry needs the child tree ID, nested structures are normally created from deepest tree to root.” Apply this procedure: State the contract for Trees are built bottom-up, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The child tree exists before the parent records it under the directory name chapter. For the CCA website, add one near-miss that exposes trying to create a parent before any child object ID exists. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: family archive. Contrast the rule using batch input produces several independent trees with clear separators. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Because a parent entry needs the child tree ID, nested structures are normally created from deepest tree to root.” Apply this procedure: State the contract for Trees are built bottom-up, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The child tree exists before the parent records it under the directory name chapter. For the family archive, add one near-miss that exposes trying to create a parent before any child object ID exists. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library catalogue. Stress-test the rule using a round trip through ls-tree and mktree verifies canonical object identity. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Because a parent entry needs the child tree ID, nested structures are normally created from deepest tree to root.” Apply this procedure: State the contract for Trees are built bottom-up, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The child tree exists before the parent records it under the directory name chapter. For the library catalogue, add one near-miss that exposes trying to create a parent before any child object ID exists. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers trying to create a parent before any child object ID exists.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Trees are built bottom-up, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from Trees are built bottom-up?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing trying to create a parent before any child object ID exists be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny test laboratory with missing objects, gitlinks, duplicate names and invalid records expose boundaries. Include one ordinary case, one boundary and one deliberate failure caused by trying to create a parent before any child object ID exists. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Because a parent entry needs the child tree ID, nested structures are normally created from deepest tree to root. It shows a trace, not only a final value. The ordinary case should demonstrate “The child tree exists before the parent records it under the directory name chapter.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Trees are built bottom-up, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Trees are built bottom-up, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 11 OF 20 . Handle boundaries

11. Input order is normalised

Back to contents

The official command normalises tree-entry order, so pre-sorting records is not required for canonical output. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is assuming differently ordered records necessarily produce different tree IDs. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Input order is normalised, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Input order is normalised chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on assuming differently ordered records necessarily produce different tree IDs. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

a=$(git hash-object -w --stdin <<<A); b=$(git hash-object -w --stdin <<<B)
printf '100644 blob %s	b.txt
100644 blob %s	a.txt
' "$b" "$a" | git mktree

Explained result. The resulting tree is stored in Git’s canonical name order despite reversed input order. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: family archive. Predict the rule using batch input produces several independent trees with clear separators. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The official command normalises tree-entry order, so pre-sorting records is not required for canonical output.” Apply this procedure: State the contract for Input order is normalised, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The resulting tree is stored in Git’s canonical name order despite reversed input order. For the family archive, add one near-miss that exposes assuming differently ordered records necessarily produce different tree IDs. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library catalogue. Contrast the rule using a round trip through ls-tree and mktree verifies canonical object identity. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The official command normalises tree-entry order, so pre-sorting records is not required for canonical output.” Apply this procedure: State the contract for Input order is normalised, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The resulting tree is stored in Git’s canonical name order despite reversed input order. For the library catalogue, add one near-miss that exposes assuming differently ordered records necessarily produce different tree IDs. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Stress-test the rule using missing objects, gitlinks, duplicate names and invalid records expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The official command normalises tree-entry order, so pre-sorting records is not required for canonical output.” Apply this procedure: State the contract for Input order is normalised, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The resulting tree is stored in Git’s canonical name order despite reversed input order. For the test laboratory, add one near-miss that exposes assuming differently ordered records necessarily produce different tree IDs. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Explain the rule using mktree is compared with add, write-tree, hash-object, commit-tree and update-ref. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The official command normalises tree-entry order, so pre-sorting records is not required for canonical output.” Apply this procedure: State the contract for Input order is normalised, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The resulting tree is stored in Git’s canonical name order despite reversed input order. For the tool decision, add one near-miss that exposes assuming differently ordered records necessarily produce different tree IDs. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers assuming differently ordered records necessarily produce different tree IDs.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Input order is normalised, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from Input order is normalised?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming differently ordered records necessarily produce different tree IDs be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny tool decision with mktree is compared with add, write-tree, hash-object, commit-tree and update-ref. Include one ordinary case, one boundary and one deliberate failure caused by assuming differently ordered records necessarily produce different tree IDs. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: The official command normalises tree-entry order, so pre-sorting records is not required for canonical output. It shows a trace, not only a final value. The ordinary case should demonstrate “The resulting tree is stored in Git’s canonical name order despite reversed input order.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Input order is normalised, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Input order is normalised, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 12 OF 20 . Handle boundaries

12. A round trip can reproduce a tree ID

Back to contents

Non-recursive git ls-tree output is valid mktree input, so an unchanged tree can be reconstructed with the same object identity. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is using recursive or decorated output that no longer matches the input protocol. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for A round trip can reproduce a tree ID, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the A round trip can reproduce a tree ID chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on using recursive or decorated output that no longer matches the input protocol. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

tree=$(printf '100644 blob %s	lesson.txt
' "$blob" | git mktree)
again=$(git ls-tree "$tree" | git mktree)
test "$tree" = "$again" && echo same

Explained result. The round trip prints same because identical canonical tree content has the same ID. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: test laboratory. Contrast the rule using missing objects, gitlinks, duplicate names and invalid records expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Non-recursive git ls-tree output is valid mktree input, so an unchanged tree can be reconstructed with the same object identity.” Apply this procedure: State the contract for A round trip can reproduce a tree ID, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The round trip prints same because identical canonical tree content has the same ID. For the test laboratory, add one near-miss that exposes using recursive or decorated output that no longer matches the input protocol. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Stress-test the rule using mktree is compared with add, write-tree, hash-object, commit-tree and update-ref. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Non-recursive git ls-tree output is valid mktree input, so an unchanged tree can be reconstructed with the same object identity.” Apply this procedure: State the contract for A round trip can reproduce a tree ID, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The round trip prints same because identical canonical tree content has the same ID. For the tool decision, add one near-miss that exposes using recursive or decorated output that no longer matches the input protocol. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework repository. Explain the rule using two existing blobs are assembled into a tree without touching the working tree. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Non-recursive git ls-tree output is valid mktree input, so an unchanged tree can be reconstructed with the same object identity.” Apply this procedure: State the contract for A round trip can reproduce a tree ID, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The round trip prints same because identical canonical tree content has the same ID. For the homework repository, add one near-miss that exposes using recursive or decorated output that no longer matches the input protocol. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading archive. Transfer the rule using a nested subtree is built bottom-up and inspected by object ID. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Non-recursive git ls-tree output is valid mktree input, so an unchanged tree can be reconstructed with the same object identity.” Apply this procedure: State the contract for A round trip can reproduce a tree ID, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The round trip prints same because identical canonical tree content has the same ID. For the reading archive, add one near-miss that exposes using recursive or decorated output that no longer matches the input protocol. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers using recursive or decorated output that no longer matches the input protocol.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for A round trip can reproduce a tree ID, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from A round trip can reproduce a tree ID?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using recursive or decorated output that no longer matches the input protocol be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny homework repository with two existing blobs are assembled into a tree without touching the working tree. Include one ordinary case, one boundary and one deliberate failure caused by using recursive or decorated output that no longer matches the input protocol. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Non-recursive git ls-tree output is valid mktree input, so an unchanged tree can be reconstructed with the same object identity. It shows a trace, not only a final value. The ordinary case should demonstrate “The round trip prints same because identical canonical tree content has the same ID.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for A round trip can reproduce a tree ID, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For A round trip can reproduce a tree ID, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 13 OF 20 . Debug and verify

13. The -z option makes records NUL-terminated

Back to contents

With -z, mktree reads the NUL-terminated form produced by git ls-tree -z. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is mixing newline and NUL protocols in one pipeline. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for The -z option makes records NUL-terminated, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the The -z option makes records NUL-terminated chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on mixing newline and NUL protocols in one pipeline. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git ls-tree -z "$tree" | git mktree -z

Explained result. The rebuilt tree uses machine-safe NUL record boundaries. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework repository. Stress-test the rule using two existing blobs are assembled into a tree without touching the working tree. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With -z, mktree reads the NUL-terminated form produced by git ls-tree -z.” Apply this procedure: State the contract for The -z option makes records NUL-terminated, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The rebuilt tree uses machine-safe NUL record boundaries. For the homework repository, add one near-miss that exposes mixing newline and NUL protocols in one pipeline. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading archive. Explain the rule using a nested subtree is built bottom-up and inspected by object ID. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With -z, mktree reads the NUL-terminated form produced by git ls-tree -z.” Apply this procedure: State the contract for The -z option makes records NUL-terminated, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The rebuilt tree uses machine-safe NUL record boundaries. For the reading archive, add one near-miss that exposes mixing newline and NUL protocols in one pipeline. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: science project. Transfer the rule using regular, executable and symbolic-link modes are compared. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With -z, mktree reads the NUL-terminated form produced by git ls-tree -z.” Apply this procedure: State the contract for The -z option makes records NUL-terminated, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The rebuilt tree uses machine-safe NUL record boundaries. For the science project, add one near-miss that exposes mixing newline and NUL protocols in one pipeline. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: CCA website. Predict the rule using NUL records protect names containing tabs or newlines. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With -z, mktree reads the NUL-terminated form produced by git ls-tree -z.” Apply this procedure: State the contract for The -z option makes records NUL-terminated, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The rebuilt tree uses machine-safe NUL record boundaries. For the CCA website, add one near-miss that exposes mixing newline and NUL protocols in one pipeline. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers mixing newline and NUL protocols in one pipeline.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for The -z option makes records NUL-terminated, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from The -z option makes records NUL-terminated?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing mixing newline and NUL protocols in one pipeline be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny reading archive with a nested subtree is built bottom-up and inspected by object ID. Include one ordinary case, one boundary and one deliberate failure caused by mixing newline and NUL protocols in one pipeline. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: With -z, mktree reads the NUL-terminated form produced by git ls-tree -z. It shows a trace, not only a final value. The ordinary case should demonstrate “The rebuilt tree uses machine-safe NUL record boundaries.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for The -z option makes records NUL-terminated, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For The -z option makes records NUL-terminated, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 14 OF 20 . Debug and verify

14. NUL input protects unusual path names

Back to contents

The -z protocol avoids relying on quoting and newline record separation for names containing special characters. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is parsing ordinary ls-tree text with read or split and corrupting quoted names. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for NUL input protects unusual path names, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the NUL input protects unusual path names chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on parsing ordinary ls-tree text with read or split and corrupting quoted names. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git ls-tree -z "$tree" | git mktree -z

Explained result. The byte-oriented pipeline preserves valid path names without a human text parser. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: science project. Explain the rule using regular, executable and symbolic-link modes are compared. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The -z protocol avoids relying on quoting and newline record separation for names containing special characters.” Apply this procedure: State the contract for NUL input protects unusual path names, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The byte-oriented pipeline preserves valid path names without a human text parser. For the science project, add one near-miss that exposes parsing ordinary ls-tree text with read or split and corrupting quoted names. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: CCA website. Transfer the rule using NUL records protect names containing tabs or newlines. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The -z protocol avoids relying on quoting and newline record separation for names containing special characters.” Apply this procedure: State the contract for NUL input protects unusual path names, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The byte-oriented pipeline preserves valid path names without a human text parser. For the CCA website, add one near-miss that exposes parsing ordinary ls-tree text with read or split and corrupting quoted names. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: family archive. Predict the rule using batch input produces several independent trees with clear separators. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The -z protocol avoids relying on quoting and newline record separation for names containing special characters.” Apply this procedure: State the contract for NUL input protects unusual path names, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The byte-oriented pipeline preserves valid path names without a human text parser. For the family archive, add one near-miss that exposes parsing ordinary ls-tree text with read or split and corrupting quoted names. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library catalogue. Contrast the rule using a round trip through ls-tree and mktree verifies canonical object identity. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The -z protocol avoids relying on quoting and newline record separation for names containing special characters.” Apply this procedure: State the contract for NUL input protects unusual path names, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The byte-oriented pipeline preserves valid path names without a human text parser. For the library catalogue, add one near-miss that exposes parsing ordinary ls-tree text with read or split and corrupting quoted names. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers parsing ordinary ls-tree text with read or split and corrupting quoted names.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for NUL input protects unusual path names, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from NUL input protects unusual path names?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing parsing ordinary ls-tree text with read or split and corrupting quoted names be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny science project with regular, executable and symbolic-link modes are compared. Include one ordinary case, one boundary and one deliberate failure caused by parsing ordinary ls-tree text with read or split and corrupting quoted names. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: The -z protocol avoids relying on quoting and newline record separation for names containing special characters. It shows a trace, not only a final value. The ordinary case should demonstrate “The byte-oriented pipeline preserves valid path names without a human text parser.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for NUL input protects unusual path names, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For NUL input protects unusual path names, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 15 OF 20 . Debug and verify

15. Batch mode creates more than one tree

Back to contents

With –batch, a blank line separates trees and mktree prints one object ID for each completed input group. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is sending several independent trees without their required separator. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Batch mode creates more than one tree, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Batch mode creates more than one tree chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on sending several independent trees without their required separator. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

printf '100644 blob %s	a.txt

100644 blob %s	b.txt
' "$a" "$b" | git mktree --batch

Explained result. The blank line ends the first tree, so the command prints two output IDs. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: family archive. Transfer the rule using batch input produces several independent trees with clear separators. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With –batch, a blank line separates trees and mktree prints one object ID for each completed input group.” Apply this procedure: State the contract for Batch mode creates more than one tree, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The blank line ends the first tree, so the command prints two output IDs. For the family archive, add one near-miss that exposes sending several independent trees without their required separator. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library catalogue. Predict the rule using a round trip through ls-tree and mktree verifies canonical object identity. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With –batch, a blank line separates trees and mktree prints one object ID for each completed input group.” Apply this procedure: State the contract for Batch mode creates more than one tree, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The blank line ends the first tree, so the command prints two output IDs. For the library catalogue, add one near-miss that exposes sending several independent trees without their required separator. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Contrast the rule using missing objects, gitlinks, duplicate names and invalid records expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With –batch, a blank line separates trees and mktree prints one object ID for each completed input group.” Apply this procedure: State the contract for Batch mode creates more than one tree, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The blank line ends the first tree, so the command prints two output IDs. For the test laboratory, add one near-miss that exposes sending several independent trees without their required separator. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Stress-test the rule using mktree is compared with add, write-tree, hash-object, commit-tree and update-ref. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With –batch, a blank line separates trees and mktree prints one object ID for each completed input group.” Apply this procedure: State the contract for Batch mode creates more than one tree, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The blank line ends the first tree, so the command prints two output IDs. For the tool decision, add one near-miss that exposes sending several independent trees without their required separator. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers sending several independent trees without their required separator.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Batch mode creates more than one tree, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from Batch mode creates more than one tree?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing sending several independent trees without their required separator be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny CCA website with NUL records protect names containing tabs or newlines. Include one ordinary case, one boundary and one deliberate failure caused by sending several independent trees without their required separator. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: With –batch, a blank line separates trees and mktree prints one object ID for each completed input group. It shows a trace, not only a final value. The ordinary case should demonstrate “The blank line ends the first tree, so the command prints two output IDs.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Batch mode creates more than one tree, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Batch mode creates more than one tree, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 16 OF 20 . Debug and verify

16. The final batch newline is optional

Back to contents

The –batch contract allows the final newline to be omitted while still completing the last tree. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is requiring an extra blank group and accidentally requesting an empty tree. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for The final batch newline is optional, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the The final batch newline is optional chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on requiring an extra blank group and accidentally requesting an empty tree. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

printf '100644 blob %s	last.txt' "$blob" | git mktree --batch

Explained result. The final record can complete at end of input without a trailing newline. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: test laboratory. Predict the rule using missing objects, gitlinks, duplicate names and invalid records expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The –batch contract allows the final newline to be omitted while still completing the last tree.” Apply this procedure: State the contract for The final batch newline is optional, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The final record can complete at end of input without a trailing newline. For the test laboratory, add one near-miss that exposes requiring an extra blank group and accidentally requesting an empty tree. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Contrast the rule using mktree is compared with add, write-tree, hash-object, commit-tree and update-ref. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The –batch contract allows the final newline to be omitted while still completing the last tree.” Apply this procedure: State the contract for The final batch newline is optional, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The final record can complete at end of input without a trailing newline. For the tool decision, add one near-miss that exposes requiring an extra blank group and accidentally requesting an empty tree. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework repository. Stress-test the rule using two existing blobs are assembled into a tree without touching the working tree. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The –batch contract allows the final newline to be omitted while still completing the last tree.” Apply this procedure: State the contract for The final batch newline is optional, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The final record can complete at end of input without a trailing newline. For the homework repository, add one near-miss that exposes requiring an extra blank group and accidentally requesting an empty tree. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading archive. Explain the rule using a nested subtree is built bottom-up and inspected by object ID. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The –batch contract allows the final newline to be omitted while still completing the last tree.” Apply this procedure: State the contract for The final batch newline is optional, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The final record can complete at end of input without a trailing newline. For the reading archive, add one near-miss that exposes requiring an extra blank group and accidentally requesting an empty tree. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers requiring an extra blank group and accidentally requesting an empty tree.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for The final batch newline is optional, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from The final batch newline is optional?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing requiring an extra blank group and accidentally requesting an empty tree be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny family archive with batch input produces several independent trees with clear separators. Include one ordinary case, one boundary and one deliberate failure caused by requiring an extra blank group and accidentally requesting an empty tree. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: The –batch contract allows the final newline to be omitted while still completing the last tree. It shows a trace, not only a final value. The ordinary case should demonstrate “The final record can complete at end of input without a trailing newline.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for The final batch newline is optional, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For The final batch newline is optional, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 17 OF 20 . Transfer with judgment

17. –missing relaxes ordinary object-existence checks

Back to contents

The –missing option permits entries that reference objects not present locally, useful only when the caller understands the incomplete graph. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is using it to conceal typographical object IDs in normal work. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for –missing relaxes ordinary object-existence checks, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the –missing relaxes ordinary object-existence checks chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on using it to conceal typographical object IDs in normal work. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

fake=1111111111111111111111111111111111111111
printf '100644 blob %s	missing.txt
' "$fake" | git mktree --missing

Explained result. The tree can be created, but later traversal needs the missing object and repository verification can report the problem. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework repository. Contrast the rule using two existing blobs are assembled into a tree without touching the working tree. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The –missing option permits entries that reference objects not present locally, useful only when the caller understands the incomplete graph.” Apply this procedure: State the contract for –missing relaxes ordinary object-existence checks, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tree can be created, but later traversal needs the missing object and repository verification can report the problem. For the homework repository, add one near-miss that exposes using it to conceal typographical object IDs in normal work. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading archive. Stress-test the rule using a nested subtree is built bottom-up and inspected by object ID. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The –missing option permits entries that reference objects not present locally, useful only when the caller understands the incomplete graph.” Apply this procedure: State the contract for –missing relaxes ordinary object-existence checks, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tree can be created, but later traversal needs the missing object and repository verification can report the problem. For the reading archive, add one near-miss that exposes using it to conceal typographical object IDs in normal work. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: science project. Explain the rule using regular, executable and symbolic-link modes are compared. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The –missing option permits entries that reference objects not present locally, useful only when the caller understands the incomplete graph.” Apply this procedure: State the contract for –missing relaxes ordinary object-existence checks, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tree can be created, but later traversal needs the missing object and repository verification can report the problem. For the science project, add one near-miss that exposes using it to conceal typographical object IDs in normal work. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: CCA website. Transfer the rule using NUL records protect names containing tabs or newlines. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The –missing option permits entries that reference objects not present locally, useful only when the caller understands the incomplete graph.” Apply this procedure: State the contract for –missing relaxes ordinary object-existence checks, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tree can be created, but later traversal needs the missing object and repository verification can report the problem. For the CCA website, add one near-miss that exposes using it to conceal typographical object IDs in normal work. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers using it to conceal typographical object IDs in normal work.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for –missing relaxes ordinary object-existence checks, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from –missing relaxes ordinary object-existence checks?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using it to conceal typographical object IDs in normal work be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny library catalogue with a round trip through ls-tree and mktree verifies canonical object identity. Include one ordinary case, one boundary and one deliberate failure caused by using it to conceal typographical object IDs in normal work. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: The –missing option permits entries that reference objects not present locally, useful only when the caller understands the incomplete graph. It shows a trace, not only a final value. The ordinary case should demonstrate “The tree can be created, but later traversal needs the missing object and repository verification can report the problem.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for –missing relaxes ordinary object-existence checks, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For –missing relaxes ordinary object-existence checks, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

Entries with mode 160000 represent gitlinks, and mktree allows their referenced commit object to be absent locally. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is generalising the gitlink exception to blobs and subtrees. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Gitlinks may be missing even without –missing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Gitlinks may be missing even without –missing chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on generalising the gitlink exception to blobs and subtrees. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

fake=1111111111111111111111111111111111111111
printf '160000 commit %s	vendor
' "$fake" | git mktree

Explained result. The gitlink record is accepted even though that commit is not in the superproject object database. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: science project. Stress-test the rule using regular, executable and symbolic-link modes are compared. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Entries with mode 160000 represent gitlinks, and mktree allows their referenced commit object to be absent locally.” Apply this procedure: State the contract for Gitlinks may be missing even without –missing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The gitlink record is accepted even though that commit is not in the superproject object database. For the science project, add one near-miss that exposes generalising the gitlink exception to blobs and subtrees. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: CCA website. Explain the rule using NUL records protect names containing tabs or newlines. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Entries with mode 160000 represent gitlinks, and mktree allows their referenced commit object to be absent locally.” Apply this procedure: State the contract for Gitlinks may be missing even without –missing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The gitlink record is accepted even though that commit is not in the superproject object database. For the CCA website, add one near-miss that exposes generalising the gitlink exception to blobs and subtrees. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: family archive. Transfer the rule using batch input produces several independent trees with clear separators. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Entries with mode 160000 represent gitlinks, and mktree allows their referenced commit object to be absent locally.” Apply this procedure: State the contract for Gitlinks may be missing even without –missing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The gitlink record is accepted even though that commit is not in the superproject object database. For the family archive, add one near-miss that exposes generalising the gitlink exception to blobs and subtrees. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library catalogue. Predict the rule using a round trip through ls-tree and mktree verifies canonical object identity. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Entries with mode 160000 represent gitlinks, and mktree allows their referenced commit object to be absent locally.” Apply this procedure: State the contract for Gitlinks may be missing even without –missing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The gitlink record is accepted even though that commit is not in the superproject object database. For the library catalogue, add one near-miss that exposes generalising the gitlink exception to blobs and subtrees. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers generalising the gitlink exception to blobs and subtrees.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Gitlinks may be missing even without –missing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from Gitlinks may be missing even without –missing?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing generalising the gitlink exception to blobs and subtrees be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny test laboratory with missing objects, gitlinks, duplicate names and invalid records expose boundaries. Include one ordinary case, one boundary and one deliberate failure caused by generalising the gitlink exception to blobs and subtrees. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Entries with mode 160000 represent gitlinks, and mktree allows their referenced commit object to be absent locally. It shows a trace, not only a final value. The ordinary case should demonstrate “The gitlink record is accepted even though that commit is not in the superproject object database.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Gitlinks may be missing even without –missing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Gitlinks may be missing even without –missing, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 19 OF 20 . Transfer with judgment

19. Duplicate names can create a tree that fsck condemns

Back to contents

mktree can write structurally encoded duplicate-name entries, but git fsck reports duplicateEntries and the object must not be treated as a valid project tree. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is assuming successful object creation proves repository integrity. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Duplicate names can create a tree that fsck condemns, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Duplicate names can create a tree that fsck condemns chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on assuming successful object creation proves repository integrity. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

bad=$(printf '100644 blob %s	same
100644 blob %s	same
' "$a" "$b" | git mktree)
git fsck --full --no-dangling

Explained result. The object ID can be printed, yet fsck reports that the tree contains duplicate file entries. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: family archive. Explain the rule using batch input produces several independent trees with clear separators. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “mktree can write structurally encoded duplicate-name entries, but git fsck reports duplicateEntries and the object must not be treated as a valid project tree.” Apply this procedure: State the contract for Duplicate names can create a tree that fsck condemns, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The object ID can be printed, yet fsck reports that the tree contains duplicate file entries. For the family archive, add one near-miss that exposes assuming successful object creation proves repository integrity. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library catalogue. Transfer the rule using a round trip through ls-tree and mktree verifies canonical object identity. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “mktree can write structurally encoded duplicate-name entries, but git fsck reports duplicateEntries and the object must not be treated as a valid project tree.” Apply this procedure: State the contract for Duplicate names can create a tree that fsck condemns, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The object ID can be printed, yet fsck reports that the tree contains duplicate file entries. For the library catalogue, add one near-miss that exposes assuming successful object creation proves repository integrity. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Predict the rule using missing objects, gitlinks, duplicate names and invalid records expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “mktree can write structurally encoded duplicate-name entries, but git fsck reports duplicateEntries and the object must not be treated as a valid project tree.” Apply this procedure: State the contract for Duplicate names can create a tree that fsck condemns, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The object ID can be printed, yet fsck reports that the tree contains duplicate file entries. For the test laboratory, add one near-miss that exposes assuming successful object creation proves repository integrity. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Contrast the rule using mktree is compared with add, write-tree, hash-object, commit-tree and update-ref. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “mktree can write structurally encoded duplicate-name entries, but git fsck reports duplicateEntries and the object must not be treated as a valid project tree.” Apply this procedure: State the contract for Duplicate names can create a tree that fsck condemns, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The object ID can be printed, yet fsck reports that the tree contains duplicate file entries. For the tool decision, add one near-miss that exposes assuming successful object creation proves repository integrity. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers assuming successful object creation proves repository integrity.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Duplicate names can create a tree that fsck condemns, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from Duplicate names can create a tree that fsck condemns?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming successful object creation proves repository integrity be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny tool decision with mktree is compared with add, write-tree, hash-object, commit-tree and update-ref. Include one ordinary case, one boundary and one deliberate failure caused by assuming successful object creation proves repository integrity. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: mktree can write structurally encoded duplicate-name entries, but git fsck reports duplicateEntries and the object must not be treated as a valid project tree. It shows a trace, not only a final value. The ordinary case should demonstrate “The object ID can be printed, yet fsck reports that the tree contains duplicate file entries.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Duplicate names can create a tree that fsck condemns, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Duplicate names can create a tree that fsck condemns, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 20 OF 20 . Transfer with judgment

20. Choose mktree only when tree-object construction is the job

Back to contents

Use add plus write-tree for an index-driven snapshot, mktree for explicit tree records, commit-tree for a commit object and update-ref for intentional reference movement. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is using low-level plumbing for ordinary staging because it looks more exact. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Choose mktree only when tree-object construction is the job, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Choose mktree only when tree-object construction is the job chapter on Git mktree, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on using low-level plumbing for ordinary staging because it looks more exact. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git add -- lesson.txt
tree=$(git write-tree)
commit=$(printf 'Study snapshot
' | git commit-tree "$tree" -p HEAD)
echo "$commit"

Explained result. Each command has one layer of responsibility; no reference moves until an explicit update-ref or porcelain commit step. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: test laboratory. Transfer the rule using missing objects, gitlinks, duplicate names and invalid records expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use add plus write-tree for an index-driven snapshot, mktree for explicit tree records, commit-tree for a commit object and update-ref for intentional reference movement.” Apply this procedure: State the contract for Choose mktree only when tree-object construction is the job, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Each command has one layer of responsibility; no reference moves until an explicit update-ref or porcelain commit step. For the test laboratory, add one near-miss that exposes using low-level plumbing for ordinary staging because it looks more exact. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Predict the rule using mktree is compared with add, write-tree, hash-object, commit-tree and update-ref. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use add plus write-tree for an index-driven snapshot, mktree for explicit tree records, commit-tree for a commit object and update-ref for intentional reference movement.” Apply this procedure: State the contract for Choose mktree only when tree-object construction is the job, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Each command has one layer of responsibility; no reference moves until an explicit update-ref or porcelain commit step. For the tool decision, add one near-miss that exposes using low-level plumbing for ordinary staging because it looks more exact. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework repository. Contrast the rule using two existing blobs are assembled into a tree without touching the working tree. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use add plus write-tree for an index-driven snapshot, mktree for explicit tree records, commit-tree for a commit object and update-ref for intentional reference movement.” Apply this procedure: State the contract for Choose mktree only when tree-object construction is the job, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Each command has one layer of responsibility; no reference moves until an explicit update-ref or porcelain commit step. For the homework repository, add one near-miss that exposes using low-level plumbing for ordinary staging because it looks more exact. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading archive. Stress-test the rule using a nested subtree is built bottom-up and inspected by object ID. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use add plus write-tree for an index-driven snapshot, mktree for explicit tree records, commit-tree for a commit object and update-ref for intentional reference movement.” Apply this procedure: State the contract for Choose mktree only when tree-object construction is the job, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Each command has one layer of responsibility; no reference moves until an explicit update-ref or porcelain commit step. For the reading archive, add one near-miss that exposes using low-level plumbing for ordinary staging because it looks more exact. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers using low-level plumbing for ordinary staging because it looks more exact.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Choose mktree only when tree-object construction is the job, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git mktree syntax. For this chapter, useful prompts are: “What did you expect from Choose mktree only when tree-object construction is the job?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using low-level plumbing for ordinary staging because it looks more exact be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny homework repository with two existing blobs are assembled into a tree without touching the working tree. Include one ordinary case, one boundary and one deliberate failure caused by using low-level plumbing for ordinary staging because it looks more exact. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Use add plus write-tree for an index-driven snapshot, mktree for explicit tree records, commit-tree for a commit object and update-ref for intentional reference movement. It shows a trace, not only a final value. The ordinary case should demonstrate “Each command has one layer of responsibility; no reference moves until an explicit update-ref or porcelain commit step.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Choose mktree only when tree-object construction is the job, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Choose mktree only when tree-object construction is the job, separate the documented Git mktree mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

Parent guide: choose the next useful step

Start with evidence, not a label such as careless. Ask for one prediction and one trace. If the first transition is wrong, rebuild the model. If the model is sound but syntax fails, practise reference use. If routine cases are correct but boundaries fail, vary ties, defaults, unsupported inputs, ownership or missing paths. If explanations transfer, move to a small project.

Keep a weekly record with four lines: concept, prediction, observed difference and next test. Stop when fatigue replaces reasoning. A smaller case tomorrow is more useful than another hour of copying tonight.

Seek specialist help when cause and effect remain invisible after examples are reduced, when accessibility or data-loss implications are unclear, or when an important repository, database or application state may be at risk. Good support should make the learner’s reasoning more independent.

Capstone practice with explained routes

1. homework repository: model, boundary and recovery

Create a small homework repository using two existing blobs are assembled into a tree without touching the working tree. Combine “mktree builds one tree object from records” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: git mktree reads non-recursive ls-tree-formatted entries on standard input and prints the ID of the tree it creates. Apply: State the contract for mktree builds one tree object from records, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The command prints a tree object ID for a tree containing lesson.txt. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

2. reading archive: model, boundary and recovery

Create a small reading archive using a nested subtree is built bottom-up and inspected by object ID. Combine “A tree object is not a commit” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: mktree records a directory snapshot object; it does not add author, parent or message metadata. Apply: State the contract for A tree object is not a commit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: cat-file reports tree, not commit. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

3. science project: model, boundary and recovery

Create a small science project using regular, executable and symbolic-link modes are compared. Combine “Executable files use mode 100755” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: Git trees distinguish the executable bit for regular files with mode 100755. Apply: State the contract for Executable files use mode 100755, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The tree stores an executable regular-file entry using Git’s supported mode. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

4. CCA website: model, boundary and recovery

Create a small CCA website using NUL records protect names containing tabs or newlines. Combine “Trees are built bottom-up” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: Because a parent entry needs the child tree ID, nested structures are normally created from deepest tree to root. Apply: State the contract for Trees are built bottom-up, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The child tree exists before the parent records it under the directory name chapter. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

5. family archive: model, boundary and recovery

Create a small family archive using batch input produces several independent trees with clear separators. Combine “The -z option makes records NUL-terminated” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: With -z, mktree reads the NUL-terminated form produced by git ls-tree -z. Apply: State the contract for The -z option makes records NUL-terminated, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The rebuilt tree uses machine-safe NUL record boundaries. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

6. library catalogue: model, boundary and recovery

Create a small library catalogue using a round trip through ls-tree and mktree verifies canonical object identity. Combine “The final batch newline is optional” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: The –batch contract allows the final newline to be omitted while still completing the last tree. Apply: State the contract for The final batch newline is optional, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The final record can complete at end of input without a trailing newline. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

7. test laboratory: model, boundary and recovery

Create a small test laboratory using missing objects, gitlinks, duplicate names and invalid records expose boundaries. Combine “Duplicate names can create a tree that fsck condemns” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: mktree can write structurally encoded duplicate-name entries, but git fsck reports duplicateEntries and the object must not be treated as a valid project tree. Apply: State the contract for Duplicate names can create a tree that fsck condemns, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The object ID can be printed, yet fsck reports that the tree contains duplicate file entries. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

8. tool decision: model, boundary and recovery

Create a small tool decision using mktree is compared with add, write-tree, hash-object, commit-tree and update-ref. Combine “Input records name a mode type object and path” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: A conventional text record contains the entry mode, object type, object ID, a tab and the entry name. Apply: State the contract for Input records name a mode type object and path, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The structured record is accepted because it follows ls-tree output form. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

Frequently asked questions

How long should a practice session be?

Use one complete prediction–observation–explanation cycle while attention remains good. Ten to twenty focused minutes can be enough.

Should every option or function be memorised?

No. Memorise the governing distinctions and practise retrieving the official reference. Understanding means predicting and explaining, not reciting a parameter list.

What if the result is correct but the explanation is weak?

Treat it as partial success. Ask for a trace and change one boundary. A reliable model survives controlled variation.

Is the shortest solution the best?

Not automatically. Prefer the solution whose semantics, failure modes and maintenance cost are easiest to justify for the actual project.

When should official documentation be used?

Use it whenever syntax, supported types, SQL dialect behaviour or Git version details matter. Primary documentation settles the current contract.

How can a parent help without technical expertise?

Ask what was predicted, where the first difference appeared, what evidence matters and which smaller example could isolate it.

How do we test transfer?

Change the context, vocabulary and one boundary. Require the learner to identify the invariant before using a tool.

What should be saved after practice?

Keep the corrected rule, one trace, one boundary case and the next question. Avoid storing pages of unexplained output.

Can these exercises replace backups?

No. Use disposable examples and proper backups. Learning should not endanger schoolwork, repositories or personal data.

What counts as mastery?

The learner can predict, verify, diagnose, recover and justify a choice across more than one context, while knowing when to consult the current reference.

Official and supporting references

Return to contents

Continue from here: Start Here · Tuition · Education · Pathways · Parenting 101 · All Site Routes

eduKate Punggol

Contact

83 Punggol Central, Singapore 828761

edu|Kate Bukit Timah

8 Fourth Avenue, Singapore 268674

By Appointment +65 8823 1234
admin@edukatesg.com

Email Us

When a child finally understands, school becomes less frightening and the future opens wider. Email us for the latest schedules and fees.

← 返回

感谢您的回复。 ✨

了解 eduKate Punggol 的更多信息

立即订阅以继续阅读并访问完整档案。

继续阅读