Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update statusMatrix.js: added two more StatusMatrix example #1886

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

tmpmachine
Copy link
Contributor

@tmpmachine tmpmachine commented Mar 21, 2024

I'm editing the documentation

Affected page: https://isomorphic-git.org/docs/en/statusMatrix

Added two more StatusMatrix examples:

 *   ["j.txt", 1, 2, 0], // deleted, staged, with unstaged-modified changes (new file of the same name)
 *   ["k.txt", 1, 1, 0], // deleted, staged, with unstaged changes (new file of the same name)

This status is for when you delete a file, then create a new one of the same name (still in working directory).

I'm not sure what to edit on the "possible combinations" part where it marked with ??. Maybe something like this?

0	 2	0	 ??       -> U   (Untracked)
1	 1	0	 D + ??   -> DU  (Deleted, Untracked)
1	 2	0	 D + ??   -> DM  (Deleted, Modified)

Canonical Git Scenario

In both scenario, we have a file in HEAD, deleted it, add it to INDEX, then created a new file of the same name. The difference is that the file in scenario 1 has content that identical to HEAD, and scenario 2 has content that differs from HEAD.

  1. StatusMatrix 1,1,0 (Deleted, Untracked)
touch README.md
git add README.md
git commit -m "added readme"
rm README.md
git add README.md
touch README.md
  1. StatusMatrix 1, 2, 0 (Deleted, Modified)
touch README.md
git add README.md
git commit -m "added readme"
rm README.md
git add README.md
touch README.md
echo "Hello, world!" > README.md

@jcubic
Copy link
Contributor

jcubic commented Mar 21, 2024

If you want to add more examples, use canonical git as reference. Maybe some of them can't happen in real word scenario, that's why it's hard to name them.

@tmpmachine
Copy link
Contributor Author

@jcubic done, added canonical git scenario. I'll let others decide the label used in "possible combinations" table.

@jcubic
Copy link
Contributor

jcubic commented Mar 21, 2024

This is just documentation, so I think it's fine.

@jcubic jcubic merged commit d631f8e into isomorphic-git:main Mar 21, 2024
5 checks passed
@isomorphic-git-bot
Copy link
Member

🎉 This PR is included in version 1.25.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants