Merged
Conversation
Contributor
|
動作確認済み |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
loadIndexで入手した Index オブジェクトに対し、新しいblobオブジェクトとファイル名を渡してエントリに登録できるappendIndex関数を実装しました。appendIndexはあくまで引数として渡されたGitIndexObjectの変更のみを行い、実際の.git/indexを書き換えるわけではないことに留意してください。これはsaveIndexの管轄です。懸念点
エントリの一部情報は固定値で埋めており、実際のファイルと異なるため、予期せぬエラーを引き起こす可能性があります。
Debug
exampleフォルダを作成し、適当なファイルを追加してコミットしたのち、以下のコマンドを実行してください。テストでは、
loadIndexでインデックスオブジェクトが読み込まれたのち、appendIndexでテストデータが入れられ、saveIndexで更新されています。実行すると、以下のようにエントリ一覧が表示されます。一番下にテストデータと同じエントリが追加されていることを確認してください。
$ nlx tsx ../src/gitIndex.ts [ { ctime: { seconds: 1743051843, nanoseconds: 327102829 }, mtime: { seconds: 1743051843, nanoseconds: 327102829 }, dev: 2080, ino: 199153, mode: 33188, uid: 1000, gid: 1000, fileSize: 2, sha1: '78981922613b2afb6025042ff6bd878ac1994e85', flags: { assumeValid: false, extended: false, stage: 0, nameLength: 5 }, pathName: 'a.txt' }, { ctime: { seconds: 1743052459, nanoseconds: 0 }, mtime: { seconds: 1743052459, nanoseconds: 0 }, dev: 0, ino: 0, mode: 33188, uid: 1000, gid: 1000, fileSize: 5, sha1: '9daeafb9864cf43055ae93beb0afd6c7d144bfa4', flags: { assumeValid: false, extended: false, stage: 0, nameLength: 8 }, pathName: 'hoge.txt' } ]念のため、
git statusで本元のgitから変更が検知できるかを確認します。(テストデータに相当する実ファイルを作成していない場合
deleted変更が追加されますが、気にしなくていいと思います