question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

populateStat is not a function

See original GitHub issue

Please be sure to mention:

  • On Nodejs electron app
  • Using via NPM package

I’ve tried the snippet posted on this issue - https://github.com/isomorphic-git/isomorphic-git/issues/732

Assuming it’s a bit older the only change i could notice was that the snipped used walkBeta1 but the new version (1.21.0) only has walk.

When I tried logging A,B I get this error image

My code version -

 
export const getChangedFiles = async (localGitFolderPath) => {
    try {
        const commits = await log({ fs, dir:localGitFolderPath, depth: 2 })
        const oids = commits.map(commit => commit.oid)
        console.log(oids)

        const A = await TREE({ fs, dir: localGitFolderPath, oid: oids[0] })
        const B = await TREE({ fs, dir: localGitFolderPath, oid: oids[oids.length - 1] })
        console.log(A,B)
        return walk({
            fs,
            dir:localGitFolderPath,
            trees: [
               A,B
            ],
            map: async function ([A, B]) {
             
                // ignore directories
                if (A.fullpath === '.') {
                    return
                }
                await A.populateStat()
                if (A.type === 'tree') {
                    return
                }
                await B.populateStat()
                if (B.type === 'tree') {
                    return
                }
             

                // generate ids
                await A.populateHash()
                await B.populateHash()

                // determine modification type
                let type = 'equal'
                if (A.oid !== B.oid) {
                    type = 'modify'
                }
                if (A.oid === undefined) {
                    type = 'add'
                }
                if (B.oid === undefined) {
                    type = 'remove'
                }
                if (A.oid === undefined && B.oid === undefined) {
                    console.log('Something weird happened:')
                    console.log(A)
                    console.log(B)
                }

                return {
                    path: `/${A.fullpath}`,
                    type: type
                }
            }
        })
    } catch (err) {
        console.log(err)
    }
}

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jcubiccommented, Nov 13, 2022

No, sorry. I have no idea. As I’ve said if it’s not documented you will need to read the source code to understand how walk() works.

0reactions
kotAPIcommented, Nov 14, 2022

Regarding this issue, I think the problem you are facing is that the properties on a tree entry are now async functions. You can see an example in the snippet I shared for how to get the mode. It needs to look something like await entry.oid(), not entry.oid.

Oh I see, this is helpful information, I’m going to try out something and update later. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: booking.populate(...).populate is not a function
execPopulate is not a function. I don't know what happened but this is my code: BookingController.js const Booking = require('.
Read more >
Get list of modified files between two commits #732 - GitHub
I took a look at walkBeta1 and statusMatrix but they do both not seem to be able to satisfy my ... populateStat is...
Read more >
$.plot is not a function - Google Groups
I get the above error message when trying to draw a graph. This message however does not appear all the time which is...
Read more >
1524377 – LMDB.xs need 64-bit arch - Red Hat Bugzilla
LMDB.xs: In function 'populateStat': LMDB.xs:118:2: error: format not a string literal and no format arguments [-Werror=format-security] ...
Read more >
walkBeta1 - isomorphic-git
A powerful recursive tree-walking utility.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found