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

Get commits history only for a file #220

Closed
SaidTayebi opened this issue Sep 5, 2014 · 4 comments
Closed

Get commits history only for a file #220

SaidTayebi opened this issue Sep 5, 2014 · 4 comments

Comments

@SaidTayebi
Copy link

Hi,

how can I get the commits history but only for a particular file, not all the branch ?

thanks !

@SaidTayebi SaidTayebi changed the title Get commits history on for a file Get commits history only for a file Sep 5, 2014
@johnhaley81 johnhaley81 added this to the 0.2.4 milestone Dec 1, 2014
@johnhaley81
Copy link
Collaborator

libgit2/libgit2#1711 might be helpful for this.

@niclashoyer
Copy link

I had a quick look at the log example from libgit2 and it seems to use the git_pathspec_match_tree function to match for a given file. The Pathspec#matchTree method in nodegit seems to be the corresponding one. But that method needs a pathspec and

var pathspec = new nodegit.Pathspec();

results in

Error: A new GitPathspec cannot be instantiated.

Is there any way to construct a new pathspec using nodegit?

@johnhaley81
Copy link
Collaborator

That object will have to be constructed by the libgit2 library. Right now you'd have to be calling something like git_pathspec_new.

Unfortunately we're ignoring that method right now and I think it's because we don't have a good way to pull in an array of strings and pipe that through C++/C to get it into libgit2.

That's something we'll have to figure out. If you have any ideas we'd certainly would love the help :)

@tbranyen
Copy link
Member

Now that git_strarray has landed, we should revisit this.

johnhaley81 pushed a commit that referenced this issue Mar 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants