Tuesday, 15 September 2015

git - Rugged::Repository #status reports a cleared status when using Rugged to add a file to the index -



git - Rugged::Repository #status reports a cleared status when using Rugged to add a file to the index -

i attempting utilize rugged::index #add add together new file index. seems added index associated rugged::repository #status cleared given file.

example irb session showing effort add together file "test_jjv_irb1" >> path = "test_jjv_irb1" => "test_jjv_irb1" >> fileutils.touch("#{local_repo}/#{path}") => ["/var/tmp/d20141015-95025-c5bbxe/test_jjv_irb1"] >> repo.inspect => "#<rugged::repository:70155837868280 {path: \"/private/var/tmp/d20141015-95025-c5bbxe/.git/\"}>"

the newly created file, "test_jjv_irb1", correctly reported rugged::repository #status

>> repo.status(path) => [:worktree_new]

and correctly not included in rugged::index

>> index = repo.index => #<rugged::index [0] 'a_file' [0] 'b_file' [0] 'c_file'

here effort add together new file index.

>> oid = rugged::blob.from_workdir repo, path => "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" >> index.add(:path => path, :oid => oid, :mode => 0100644) => nil >> index.write => nil

the file beingness added, "test_jjv_irb1", correctly included in index.

>> repo.index => #<rugged::index [0] 'a_file' [0] 'b_file' [0] 'c_file' [0] 'test_jjv_irb1'

but it's status reported cleared rugged::repository #status

>> repo.status(path) => []

i expect rugged::repository #status study [:index_new]

oddly issuing git status command line shows new file, "test_jjv_irb1", "changes committed:"

% git status on branch master branch up-to-date 'origin/master'. changes committed: (use "git reset head <file>..." unstage) new file: test_jjv_irb1

rugged confusing.

i did notice similar how can utilize rugged create , commit file command line?

looking @ https://github.com/libgit2/rugged#writing-to-a-repository - looks add has sec parameter titled type. alter things?

git rugged

No comments:

Post a Comment